/* ================================================================
   DealsDaddy – Custom Stylesheet
   Built on top of Bootstrap 5.3
================================================================ */

:root {
  --primary:      #1d4ed8;
  --primary-dark: #1e40af;
  --accent:       #f97316;
  --accent-dark:  #ea6c13;
  --success:      #16a34a;
  --dark:         #0f172a;
  --text:         #1e293b;
  --muted:        #64748b;
  --bg:           #f1f5f9;
  --card-bg:      #ffffff;
  --border:       #e2e8f0;
  --radius:       12px;
  --shadow:       0 1px 4px rgba(0,0,0,.08);
  --shadow-md:    0 4px 16px rgba(0,0,0,.12);
}

* { box-sizing: border-box; }

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Top bar ─────────────────────────────────────────────────── */
.topbar {
  background: var(--dark);
  color: #e2e8f0;
  font-size: 0.8rem;
}
.topbar small, .topbar .text-muted {
  color: #e2e8f0 !important;
}

/* ── Navbar ──────────────────────────────────────────────────── */
#mainNav {
  background: #fff;
  border-bottom: 2px solid var(--primary);
}
.navbar-brand .brand-text { color: var(--primary); font-size: 1.3rem; }
.cart-link { position: relative; }
.cart-badge {
  position: absolute;
  top: -4px; right: -6px;
  min-width: 18px; height: 18px;
  font-size: .65rem;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}

/* ── Hero ────────────────────────────────────────────────────── */
.hero-section {
  background: linear-gradient(135deg, var(--dark) 0%, #1e3a8a 60%, var(--primary) 100%);
  padding: 5rem 0 4rem;
  position: relative;
  overflow: hidden;
}
.hero-section::before {
  content: '';
  position: absolute; inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}
.hero-badge {
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.2);
  color: #fff;
  padding: .35rem .9rem;
  border-radius: 50px;
  font-size: .8rem;
  display: inline-block;
  margin-bottom: 1rem;
}
.hero-section h1 { color: #fff; font-weight: 700; }
.hero-section p  { color: #cbd5e1; }

/* ── Category Pills ──────────────────────────────────────────── */
.category-pill {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .5rem 1rem;
  border-radius: 50px;
  background: #fff;
  border: 2px solid var(--border);
  color: var(--text);
  text-decoration: none;
  font-size: .875rem;
  font-weight: 500;
  transition: all .2s;
}
.category-pill:hover,
.category-pill.active {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
}

/* ── Product Card ─────────────────────────────────────────────- */
.product-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
  transition: transform .2s, box-shadow .2s;
  height: 100%;
  display: flex; flex-direction: column;
}
.product-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}
.product-card .card-img-wrap {
  position: relative;
  overflow: hidden;
  aspect-ratio: 4/3;
  background: #f8fafc;
}
.product-card .card-img-wrap img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform .4s;
}
.product-card:hover .card-img-wrap img { transform: scale(1.05); }
.badge-featured {
  position: absolute; top: 10px; left: 10px;
  background: var(--accent);
  color: #fff; font-size: .7rem;
  padding: .2rem .6rem;
  border-radius: 50px;
}
.badge-sale {
  position: absolute; top: 10px; right: 10px;
  background: #dc2626;
  color: #fff; font-size: .7rem;
  padding: .2rem .6rem;
  border-radius: 50px;
}
.product-card .card-body {
  flex: 1; padding: 1rem;
  display: flex; flex-direction: column;
}
.product-card .card-title {
  font-size: .95rem; font-weight: 600;
  margin-bottom: .4rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.product-card .card-desc {
  font-size: .8rem; color: var(--muted);
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.product-card .price-row {
  margin-top: .75rem;
  display: flex; align-items: center; justify-content: space-between;
}
.price-main  { font-size: 1.15rem; font-weight: 700; color: var(--primary); }
.price-orig  { font-size: .8rem; color: var(--muted); text-decoration: line-through; }

/* ── Buttons ──────────────────────────────────────────────────- */
.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
}
.btn-primary:hover, .btn-primary:focus {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
}
.btn-accent {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.btn-accent:hover { background: var(--accent-dark); border-color: var(--accent-dark); color: #fff; }
.btn-mpesa {
  background: #00aa46;
  border-color: #00aa46;
  color: #fff;
  font-weight: 600;
  font-size: 1rem;
}
.btn-mpesa:hover { background: #008f3a; border-color: #008f3a; color: #fff; }

/* ── Section headings ─────────────────────────────────────────- */
.section-heading {
  font-size: 1.6rem; font-weight: 700;
  position: relative; display: inline-block;
}
.section-heading::after {
  content: ''; display: block;
  width: 40px; height: 3px;
  background: var(--accent);
  border-radius: 2px; margin-top: 6px;
}

/* ── Product Detail Page ─────────────────────────────────────── */
.product-gallery img {
  border-radius: var(--radius);
  width: 100%; object-fit: cover;
  max-height: 420px;
}
.product-gallery .thumb {
  width: 70px; height: 60px;
  object-fit: cover;
  border-radius: 8px;
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color .2s;
}
.product-gallery .thumb.active { border-color: var(--primary); }
.product-price-block { font-size: 2rem; font-weight: 700; color: var(--primary); }

/* ── Cart ─────────────────────────────────────────────────────- */
.cart-table th { font-weight: 600; background: var(--bg); }
.qty-input { width: 70px; text-align: center; }

/* ── Checkout & Payment ───────────────────────────────────────- */
.checkout-card {
  background: #fff;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 1.5rem;
  margin-bottom: 1rem;
}
.mpesa-waiting {
  text-align: center;
  padding: 3rem 1rem;
}
.mpesa-spinner {
  width: 80px; height: 80px;
  border-radius: 50%;
  background: #e8faf0;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 1.5rem;
  animation: pulse 1.4s infinite;
}
@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50%       { transform: scale(1.08); }
}

/* ── Order status ─────────────────────────────────────────────- */
.status-icon-wrap {
  width: 80px; height: 80px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 2.5rem;
  margin: 0 auto 1rem;
}
.status-paid    { background: #dcfce7; color: var(--success); }
.status-pending { background: #fef9c3; color: #92400e; }
.status-failed  { background: #fee2e2; color: #dc2626; }

/* ── Admin-specific styles are in admin/admin.css ─────────────- */

/* ── Footer ───────────────────────────────────────────────────- */
.footer {
  background: var(--dark);
  color: #94a3b8;
  margin-top: auto;
}
.footer-top { color: #94a3b8; }
.footer-links li { margin-bottom: .4rem; }
.footer-links a { color: #94a3b8; text-decoration: none; transition: color .2s; }
.footer-links a:hover { color: #fff; }
.footer-bottom { color: #64748b; }

/* ── Responsive tweaks ────────────────────────────────────────- */
@media (max-width: 576px) {
  .hero-section { padding: 3rem 0 2.5rem; }
  .hero-section h1 { font-size: 1.6rem; }
  .product-grid { --bs-gutter-x: .75rem; --bs-gutter-y: .75rem; }
}

/* ── Utilities ────────────────────────────────────────────────- */
.bg-primary    { background-color: var(--primary) !important; }
.text-primary  { color: var(--primary) !important; }
.border-primary { border-color: var(--primary) !important; }
.card-hover { transition: transform .2s, box-shadow .2s; }
.card-hover:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
