/* ==========================================================================
   NGT STOREFRONT (DARK MODE) — DESIGN SYSTEM & RESPONSIVE STYLESHEET
   Integrates: Google Fonts (Plus Jakarta Sans / Inter / JetBrains Mono),
   fluid typography (clamp()), and responsive breakpoints (768px / 1024px)
   ========================================================================== */

:root {
  /* ---------- FONT FAMILIES ---------- */
  --font-display: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body:    'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono:    'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  /* ---------- FLUID TYPE SCALE ---------- */
  --text-xs:   0.75rem;
  --text-sm:   0.875rem;
  --text-base: 1rem;
  --text-lg:   clamp(1.0625rem, 1vw + 0.85rem, 1.25rem);
  --text-xl:   clamp(1.25rem, 1.5vw + 0.9rem, 1.5rem);
  --text-2xl:  clamp(1.5rem, 2.5vw + 1rem, 2.125rem);
  --text-hero: clamp(1.875rem, 4vw + 1rem, 3.25rem);

  /* ---------- NGT BRAND / ACCENT TOKENS ---------- */
  --ngt-primary:       #2563EB;
  --ngt-primary-hover: #1D4ED8;
  --ngt-primary-soft:  #EFF6FF;
  --ngt-accent:        #06B6D4;
  --ngt-mpesa:         #10B981;
  --ngt-mpesa-soft:    #ECFDF5;
  --ngt-warning:       #F59E0B;
  --ngt-danger:        #EF4444;

  /* ---------- RADII / LAYOUT / ELEVATION ---------- */
  --container-max: 1320px;
  --radius-sm:   8px;
  --radius-md:   12px;
  --radius-lg:   16px;
  --radius-xl:   20px;
  --radius-full: 9999px;

  --shadow-sm:   0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-md:   0 4px 12px -2px rgba(15, 23, 42, 0.08);
  --shadow-lg:   0 16px 32px -8px rgba(15, 23, 42, 0.14);
  --shadow-glow: 0 0 24px rgba(37, 99, 235, 0.25);

  --transition-fast:   150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-smooth: 250ms cubic-bezier(0.4, 0, 0.2, 1);

  /* ---------- EXISTING STOREFRONT DARK TOKENS (unchanged) ---------- */
  --bg:          #0b1117;
  --bg-2:        #0f172a;
  --bg-3:        #0e1623;
  --bg-4:        #1a2536;
  --border:      #2d3a4f;
  --border-2:    #1e2c3a;
  --cyan:        #38bdf8;
  --cyan-light:  #a5f3fc;
  --cyan-dark:   #0ea5e9;
  --text:        #e0e7ff;
  --text-dim:    #9ab3d8;
  --text-muted:  #8ba0bc;
  --success:     #34d399;
  --danger:      #f87171;
  --warning:     #fbbf24;
  --radius:      16px;
  --radius-lg:   28px;
  --shadow:      0 8px 24px rgba(0,0,0,0.4);
  --transition:  0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

*, *::before, *::after { margin:0; padding:0; box-sizing:border-box; }
html { scroll-behavior:smooth; -webkit-font-smoothing: antialiased; }
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height:1.6;
  min-height:100vh;
  -webkit-font-smoothing:antialiased;
}

h1, h2, h3, h4, .font-display {
  font-family: var(--font-display);
  letter-spacing: -0.02em;
}

/* Monospace (prices, M-Pesa codes, SKUs) */
.price-tag,
.mpesa-code,
.sku-code,
.price-discounted,
.price-regular,
.price-original,
.price-savings,
.discount-timer,
.discount-badge {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

::-webkit-scrollbar { width:8px; height:8px; }
::-webkit-scrollbar-track { background:var(--bg-2); }
::-webkit-scrollbar-thumb { background:var(--border); border-radius:4px; }
::-webkit-scrollbar-thumb:hover { background:var(--cyan-dark); }
.container { max-width:var(--container-max); margin:0 auto; padding:0 1.5rem; }

/* ---------- BUTTONS ---------- */
.btn {
  display:inline-flex; align-items:center; justify-content:center; gap:0.5rem;
  padding:0.7rem 1.4rem; border-radius:40px; font-weight:600;
  font-size:0.88rem; text-decoration:none; cursor:pointer;
  border:1px solid transparent; transition:all var(--transition);
  font-family:inherit; white-space:nowrap; min-height:42px;
}
.btn:disabled { opacity:0.5; cursor:not-allowed; transform:none !important; }
.btn-primary { background:var(--cyan); color:#0b1117; box-shadow:0 6px 18px rgba(56,189,248,0.25); }
.btn-primary:hover:not(:disabled) { background:#7dd3fc; transform:translateY(-2px); box-shadow:0 10px 26px rgba(56,189,248,0.4); }
.btn-outline { border:1.5px solid var(--cyan); color:var(--text); background:transparent; }
.btn-outline:hover:not(:disabled) { background:var(--cyan); color:#0b1117; transform:translateY(-2px); }
.btn-ghost { background:rgba(255,255,255,0.04); border:1px solid var(--border); color:var(--text-dim); }
.btn-ghost:hover:not(:disabled) { border-color:var(--cyan); color:var(--text); }
.btn-sm { padding:0.45rem 0.9rem; font-size:0.78rem; }
.btn-danger  { background:var(--danger);  color:#0b1117; }
.btn-success { background:var(--success); color:#0b1117; }
.btn-block { width:100%; }

/* ---------- FORM ---------- */
.form-group { margin-bottom:1rem; }
.form-group label { display:block; font-size:0.8rem; font-weight:500; color:var(--text-dim); margin-bottom:0.35rem; }
.form-group input,
.form-group select,
.form-group textarea {
  width:100%; padding:0.65rem 0.9rem; border-radius:10px;
  border:1px solid var(--border); background:var(--bg-4);
  color:var(--text); font-size:0.85rem; font-family:inherit;
  outline:none; transition:border var(--transition);
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus { border-color:var(--cyan); }
.form-group textarea { resize:vertical; min-height:70px; }
.form-row { display:grid; grid-template-columns:1fr 1fr; gap:0.75rem; }

/* ---------- BADGES ---------- */
.badge {
  display:inline-block; padding:0.2rem 0.6rem; border-radius:20px;
  font-size:0.68rem; font-weight:600; text-transform:uppercase; letter-spacing:0.5px;
}
.badge-pending   { background:rgba(251,191,36,0.15); color:var(--warning); }
.badge-paid      { background:rgba(52,211,153,0.15); color:var(--success); }
.badge-failed    { background:rgba(248,113,113,0.15); color:var(--danger); }
.badge-shipped   { background:rgba(56,189,248,0.15);  color:var(--cyan); }
.badge-delivered { background:rgba(52,211,153,0.25);  color:var(--success); }
.badge-cancelled { background:rgba(107,114,128,0.2);  color:var(--text-muted); }

/* ---------- MODALS ---------- */
.modal-overlay {
  position:fixed; inset:0; background:rgba(0,0,0,0.75);
  backdrop-filter:blur(6px); -webkit-backdrop-filter:blur(6px);
  z-index:2000; display:none; align-items:flex-start; justify-content:center;
  padding:2rem 1rem; overflow-y:auto;
}
.modal-overlay.active { display:flex; }
.modal {
  background:var(--bg-2); border:1px solid var(--border);
  border-radius:var(--radius-lg); max-width:640px; width:100%;
  box-shadow:0 32px 64px rgba(0,0,0,0.7);
  animation:modalIn 0.3s ease; margin:auto;
}
@keyframes modalIn { from { opacity:0; transform:translateY(30px) scale(0.97); } to { opacity:1; transform:none; } }
.modal-header {
  display:flex; justify-content:space-between; align-items:center;
  padding:1.25rem 1.5rem; border-bottom:1px solid var(--border-2);
}
.modal-header h2 { font-family:var(--font-display); font-size:var(--text-lg); font-weight:700; }
.modal-close { background:none; border:none; color:var(--text-muted); font-size:1.5rem; cursor:pointer; line-height:1; padding:0.25rem; transition:color var(--transition); }
.modal-close:hover { color:var(--danger); }
.modal-body { padding:1.5rem; max-height:70vh; overflow-y:auto; }
.modal-footer { padding:1rem 1.5rem; border-top:1px solid var(--border-2); display:flex; gap:0.75rem; justify-content:flex-end; flex-wrap:wrap; }

/* ---------- TOASTS ---------- */
.toast-container { position:fixed; top:80px; right:1rem; z-index:3000; display:flex; flex-direction:column; gap:0.5rem; max-width:340px; }
.toast {
  background:var(--bg-2); border:1px solid var(--border);
  border-left:4px solid var(--cyan); border-radius:12px;
  padding:0.85rem 1rem; box-shadow:var(--shadow);
  animation:toastIn 0.3s ease; display:flex; gap:0.6rem; align-items:flex-start;
}
.toast.success { border-left-color:var(--success); }
.toast.error   { border-left-color:var(--danger); }
.toast.warning { border-left-color:var(--warning); }
.toast-icon { font-size:1.1rem; flex-shrink:0; }
.toast-msg { font-size:0.82rem; line-height:1.4; }
@keyframes toastIn { from { opacity:0; transform:translateX(40px); } to { opacity:1; transform:none; } }

/* ---------- SPINNER / EMPTY ---------- */
.spinner { width:24px; height:24px; border:3px solid var(--border); border-top-color:var(--cyan); border-radius:50%; animation:spin 0.7s linear infinite; margin:2rem auto; }
@keyframes spin { to { transform:rotate(360deg); } }
.empty-state { text-align:center; padding:3rem 1rem; color:var(--text-muted); }
.empty-state .icon { font-size:3rem; margin-bottom:0.75rem; opacity:0.4; }

/* ---------- HEADER ---------- */
.header {
  background: rgba(15,23,42,0.95); border-bottom:2px solid var(--border-2);
  box-shadow:0 4px 20px rgba(0,180,255,0.08);
  position:sticky; top:0; z-index:1000;
  backdrop-filter:blur(12px); -webkit-backdrop-filter:blur(12px);
}
.header-inner { display:flex; justify-content:space-between; align-items:center; padding:0.85rem 1.5rem; gap:1rem; flex-wrap:wrap; }
.brand { display:flex; flex-direction:column; }
.company-name {
  font-family:var(--font-display);
  font-size:var(--text-xl); font-weight:800; letter-spacing:-0.5px;
  background:linear-gradient(135deg, var(--cyan-light), var(--cyan));
  -webkit-background-clip:text; -webkit-text-fill-color:transparent; background-clip:text;
}
.motto { font-size:0.78rem; color:var(--text-dim); font-style:italic; border-left:3px solid var(--cyan); padding-left:0.6rem; margin-top:0.15rem; }
.header-actions { display:flex; align-items:center; gap:0.75rem; flex-wrap:wrap; }
.cart-btn { position:relative; }
.cart-count {
  position:absolute; top:-8px; right:-8px; background:var(--danger);
  color:#fff; font-size:0.65rem; font-weight:700; min-width:20px;
  height:20px; border-radius:10px; display:flex; align-items:center;
  justify-content:center; padding:0 4px;
}

/* ---------- NAV TABS ---------- */
.nav-tabs { display:flex; gap:0.25rem; padding:0.5rem 1.5rem; background:var(--bg-2); border-bottom:1px solid var(--border-2); overflow-x:auto; scrollbar-width:none; }
.nav-tabs::-webkit-scrollbar { display:none; }
.nav-tab {
  padding:0.6rem 1.1rem; border-radius:10px; font-size:0.85rem;
  font-weight:500; cursor:pointer; border:none; background:transparent;
  color:var(--text-dim); transition:all var(--transition);
  font-family:inherit; white-space:nowrap; display:flex; align-items:center; gap:0.4rem;
}
.nav-tab:hover { background:rgba(56,189,248,0.08); color:var(--text); }
.nav-tab.active { background:rgba(56,189,248,0.15); color:var(--cyan); font-weight:600; }

/* ---------- SEARCH ---------- */
.search-bar { display:flex; gap:0.5rem; padding:1.2rem 1.5rem; flex-wrap:wrap; background:var(--bg-3); border-bottom:1px solid var(--border-2); align-items:center; }
.search-bar input, .search-bar select {
  padding:0.65rem 1rem; border-radius:40px; border:1px solid var(--border);
  background:var(--bg-4); color:var(--text); font-size:0.85rem;
  font-family:inherit; outline:none; transition:border var(--transition);
}
.search-bar input:focus, .search-bar select:focus { border-color:var(--cyan); }
.search-bar input { flex:1; min-width:200px; }
.search-bar select { min-width:160px; }

/* ---------- PRODUCT GRID ---------- */
.section { padding:2rem 1.5rem; }
.section-title { font-family:var(--font-display); font-size:var(--text-2xl); font-weight:700; margin-bottom:0.25rem; background:linear-gradient(135deg,#bae6fd,var(--cyan)); -webkit-background-clip:text; -webkit-text-fill-color:transparent; }
.section-sub { color:var(--text-muted); font-size:0.85rem; margin-bottom:1.5rem; }
.product-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(240px,1fr)); gap:1.25rem; }
.product-card { background:var(--bg-4); border:1px solid var(--border); border-radius:var(--radius); overflow:hidden; transition:all var(--transition); display:flex; flex-direction:column; position:relative; }
.product-card:hover { transform:translateY(-6px); border-color:var(--cyan); box-shadow:0 16px 36px -8px rgba(0,0,0,0.6), 0 0 0 1px rgba(56,189,248,0.25); }
.product-img { width:100%; height:180px; object-fit:cover; background:var(--bg-2); display:block; }
.product-img-placeholder { width:100%; height:180px; background:linear-gradient(135deg,var(--bg-2),var(--bg-4)); display:flex; align-items:center; justify-content:center; font-size:2.5rem; color:var(--border); }
.product-body { padding:1rem; flex:1; display:flex; flex-direction:column; gap:0.4rem; }
.product-cat { font-size:0.68rem; text-transform:uppercase; letter-spacing:1px; color:var(--cyan); font-weight:600; }
.product-name { font-family:var(--font-display); font-size:0.95rem; font-weight:600; line-height:1.35; }
.product-desc { font-size:0.78rem; color:var(--text-muted); line-height:1.45; display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; }
.product-price { font-size:var(--text-lg); font-weight:800; color:var(--cyan-light); margin-top:auto; }
.product-price small { font-size:0.7rem; font-weight:400; color:var(--text-muted); }
.product-stock { font-size:0.72rem; display:flex; align-items:center; gap:0.3rem; }
.stock-in  { color:var(--success); }
.stock-low { color:var(--warning); }
.stock-out { color:var(--danger); }
.product-actions { display:flex; gap:0.5rem; padding:0 1rem 1rem; }
.product-actions .btn { flex:1; }

/* ---------- CART ---------- */
.cart-item { display:flex; gap:0.75rem; padding:0.75rem 0; border-bottom:1px solid var(--border-2); align-items:center; }
.cart-item-img { width:56px; height:56px; border-radius:10px; object-fit:cover; background:var(--bg-4); flex-shrink:0; }
.cart-item-info { flex:1; min-width:0; }
.cart-item-name { font-size:0.85rem; font-weight:600; }
.cart-item-price { font-size:0.78rem; color:var(--text-muted); }
.cart-item-qty { display:flex; align-items:center; gap:0.4rem; }
.cart-item-qty button { width:28px; height:28px; border-radius:8px; border:1px solid var(--border); background:var(--bg-4); color:var(--text); cursor:pointer; font-size:0.85rem; display:flex; align-items:center; justify-content:center; }
.cart-item-qty button:hover { border-color:var(--cyan); }
.cart-item-qty span { min-width:24px; text-align:center; font-weight:600; font-size:0.85rem; }

/* ---------- SUMMARY ---------- */
.summary-row { display:flex; justify-content:space-between; padding:0.4rem 0; font-size:0.85rem; color:var(--text-dim); }
.summary-row.total { border-top:1px solid var(--border); margin-top:0.5rem; padding-top:0.75rem; font-size:var(--text-lg); font-weight:700; color:var(--text); }
.summary-row.total span:last-child { color:var(--cyan-light); font-family:var(--font-mono); }

/* ---------- ORDER CARD ---------- */
.order-card { background:var(--bg-4); border:1px solid var(--border); border-radius:var(--radius); padding:1rem 1.25rem; margin-bottom:0.75rem; }
.order-card-head { display:flex; justify-content:space-between; align-items:center; flex-wrap:wrap; gap:0.5rem; margin-bottom:0.6rem; }
.order-num { font-family:var(--font-mono); font-weight:700; font-size:0.9rem; color:var(--cyan-light); }
.order-meta { font-size:0.75rem; color:var(--text-muted); }
.order-items-list { font-size:0.8rem; color:var(--text-dim); margin-bottom:0.5rem; }

/* ---------- FOOTER ---------- */
.footer { background:var(--bg-2); border-top:1px solid var(--border-2); padding:1.5rem; text-align:center; color:var(--text-muted); font-size:0.8rem; margin-top:3rem; }
.footer a { color:var(--cyan); text-decoration:none; }

/* ==========================================================================
   RESPONSIVE — TABLET (max-width: 768px) / MOBILE (max-width: 420px)
   ========================================================================== */
@media (max-width:768px) {
  .header-inner { flex-direction:column; text-align:center; }
  .motto { border-left:none; border-top:2px solid var(--cyan); padding-top:0.3rem; padding-left:0; }
  .search-bar { flex-direction:column; }
  .search-bar input, .search-bar select { width:100%; min-width:0; }
  .product-grid { grid-template-columns:repeat(auto-fill,minmax(160px,1fr)); gap:0.75rem; }
  .product-img, .product-img-placeholder { height:130px; }
  .product-actions { flex-direction:column; }
  .form-row { grid-template-columns:1fr; }
  .modal { border-radius:20px; }
  .toast-container { left:1rem; right:1rem; max-width:none; }
  .section-title { font-size:var(--text-xl); }
}
@media (max-width:420px) {
  .product-grid { grid-template-columns:1fr 1fr; gap:0.6rem; }
  .product-body { padding:0.75rem; }
  .product-name { font-size:0.82rem; }
  .product-price { font-size:var(--text-base); }
}

/* Desktop 1024px+ refined gutters */
@media (min-width:1024px) {
  .container { padding:0 2rem; }
}
