/* ============================================================
   LOTFI NUTRITION — design tokens
   ============================================================ */
:root {
  /* base palette */
  --bg:        #0A0D13;
  --bg-raised: #10141C;
  --surface:   #141924;
  --surface-2: #1B2230;
  --border:    #232C3D;
  --border-soft: #1B2230;

  /* text */
  --text:      #F3F6FA;
  --text-dim:  #93A0B4;
  --text-faint:#5D6B80;

  /* brand */
  --primary:      #2E5CFF;
  --primary-hi:   #4B74FF;
  --primary-low:  #16265E;
  --neon:         #45FFD0;
  --neon-low:     #0E3A34;
  --danger:       #FF5470;
  --danger-low:   #3A1620;

  /* metrics */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --gap: 16px;
  --header-h: 72px;

  --shadow-card: 0 1px 0 rgba(255,255,255,0.03) inset, 0 12px 24px -16px rgba(0,0,0,0.6);
  --shadow-glow: 0 0 0 1px rgba(69,255,208,0.35), 0 0 24px -4px rgba(69,255,208,0.45);
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Cairo", "Tajawal", ui-sans-serif, system-ui, -apple-system, sans-serif;
  font-weight: 500;
  line-height: 1.6;
  direction: rtl;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }
button { font-family: inherit; }
a { color: inherit; text-decoration: none; }

::selection { background: var(--primary); color: white; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 8px; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

/* ============================================================
   LAYOUT SHELL
   ============================================================ */
.wrap {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ============================================================
   HEADER
   ============================================================ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--header-h);
  display: flex;
  align-items: center;
  background: rgba(10,13,19,0.82);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-soft);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  width: 100%;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: "Cairo", sans-serif;
  font-weight: 900;
  font-size: 21px;
  letter-spacing: 0.2px;
  white-space: nowrap;
}

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(155deg, var(--primary) 0%, #1230A8 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 16px;
  color: white;
  flex-shrink: 0;
  box-shadow: 0 6px 18px -6px rgba(46,92,255,0.65);
}

.brand-name span { color: var(--neon); }

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.icon-btn {
  position: relative;
  width: 42px;
  height: 42px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
}
.icon-btn:hover { border-color: var(--primary); background: var(--surface-2); }
.icon-btn svg { width: 19px; height: 19px; }

.cart-badge {
  position: absolute;
  top: -6px;
  inset-inline-start: -6px;
  min-width: 19px;
  height: 19px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--neon);
  color: #04201C;
  font-size: 11px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--bg);
}

.search-field {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0 12px;
  height: 42px;
  flex: 1;
  max-width: 340px;
}
.search-field svg { width: 17px; height: 17px; color: var(--text-faint); flex-shrink: 0; }
.search-field input {
  border: 0; background: transparent; color: var(--text);
  width: 100%; outline: none; font-family: inherit; font-size: 14px;
}
.search-field input::placeholder { color: var(--text-faint); }

/* ============================================================
   HERO
   ============================================================ */
.hero {
  position: relative;
  overflow: hidden;
  border-bottom: 1px solid var(--border-soft);
  background:
    radial-gradient(560px 320px at 85% -10%, rgba(46,92,255,0.30), transparent 60%),
    radial-gradient(420px 260px at 8% 110%, rgba(69,255,208,0.12), transparent 60%);
}

.hero-inner {
  padding: 56px 0 40px;
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 32px;
  align-items: center;
}

.hero-eyebrow-bar {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 18px;
}
.hero-eyebrow-bar .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--neon);
  box-shadow: 0 0 12px 2px rgba(69,255,208,0.6);
}
.hero-eyebrow-bar span {
  font-size: 13px; color: var(--text-dim); font-weight: 600;
}

.hero h1 {
  font-family: "Cairo", sans-serif;
  font-weight: 900;
  font-size: clamp(30px, 4.4vw, 50px);
  line-height: 1.18;
  margin: 0 0 16px;
  max-width: 15ch;
}

.hero p.lead {
  color: var(--text-dim);
  font-size: 16px;
  max-width: 46ch;
  margin: 0 0 28px;
}

.hero-cta {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 48px;
  padding: 0 22px;
  border-radius: var(--radius-sm);
  font-weight: 800;
  font-size: 15px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform .12s ease, box-shadow .15s ease, background .15s ease, border-color .15s ease;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }

.btn-primary {
  background: linear-gradient(180deg, var(--primary-hi), var(--primary));
  color: white;
  box-shadow: 0 10px 24px -10px rgba(46,92,255,0.75);
}
.btn-primary:hover { box-shadow: 0 12px 28px -8px rgba(46,92,255,0.9); }

.btn-ghost {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
}
.btn-ghost:hover { border-color: var(--primary); }

.btn-neon {
  background: var(--neon);
  color: #05231D;
  box-shadow: var(--shadow-glow);
}
.btn-neon:hover { filter: brightness(1.06); }

.btn-block { width: 100%; }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; box-shadow: none; }

.hero-stats {
  display: flex;
  gap: 26px;
  margin-top: 34px;
  flex-wrap: wrap;
}
.hero-stat b {
  display: block;
  font-family: "Cairo", sans-serif;
  font-size: 24px;
  font-weight: 900;
  color: var(--text);
}
.hero-stat span {
  font-size: 13px;
  color: var(--text-faint);
}

.hero-visual {
  position: relative;
  aspect-ratio: 4/5;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background:
    linear-gradient(160deg, var(--surface-2), var(--bg-raised));
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.hero-visual .glow {
  position: absolute;
  inset: -30%;
  background: conic-gradient(from 180deg, rgba(46,92,255,0.35), rgba(69,255,208,0.25), transparent 60%);
  filter: blur(40px);
  opacity: 0.6;
}
.hero-visual .mark {
  position: relative;
  font-family: "Cairo", sans-serif;
  font-weight: 900;
  font-size: 30px;
  text-align: center;
  color: var(--text-dim);
  padding: 24px;
}
.hero-visual .mark b { display: block; color: var(--text); font-size: 46px; }

@media (max-width: 860px) {
  .hero-inner { grid-template-columns: 1fr; padding-top: 36px; }
  .hero-visual { aspect-ratio: 16/9; order: -1; }
}

/* ============================================================
   FILTER / TOOLBAR
   ============================================================ */
.toolbar {
  position: sticky;
  top: var(--header-h);
  z-index: 30;
  background: rgba(10,13,19,0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-soft);
  padding: 14px 0;
}

.chip-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: none;
}
.chip-row::-webkit-scrollbar { display: none; }

.chip {
  flex-shrink: 0;
  height: 36px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-dim);
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  transition: all .15s ease;
}
.chip:hover { color: var(--text); border-color: var(--primary); }
.chip.active {
  background: var(--primary-low);
  border-color: var(--primary);
  color: #C9D5FF;
}

.toolbar-row2 {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
}

.result-count { font-size: 13px; color: var(--text-faint); }

select.sort-select {
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0 10px;
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
}

/* ============================================================
   PRODUCT GRID
   ============================================================ */
.section-title {
  font-family: "Cairo", sans-serif;
  font-weight: 900;
  font-size: 22px;
  margin: 40px 0 18px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: var(--gap);
  padding-bottom: 60px;
}

.card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color .15s ease, transform .15s ease;
}
.card:hover { border-color: #33405A; transform: translateY(-2px); }
.card.out-of-stock { opacity: 0.55; }

.card-media {
  position: relative;
  aspect-ratio: 1/1;
  background: var(--bg-raised);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.card-media img { width: 100%; height: 100%; object-fit: cover; }
.card-media .ph { color: var(--text-faint); font-size: 12px; }

.badge {
  position: absolute;
  top: 10px;
  inset-inline-start: 10px;
  font-size: 11px;
  font-weight: 800;
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--danger-low);
  color: #FFB4C2;
  border: 1px solid rgba(255,84,112,0.35);
}
.badge.sale {
  background: var(--neon-low);
  color: var(--neon);
  border-color: rgba(69,255,208,0.35);
  inset-inline-start: auto;
  inset-inline-end: 10px;
}

.card-body {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.card-cat { font-size: 11.5px; color: var(--text-faint); font-weight: 700; }
.card-name {
  font-size: 14.5px;
  font-weight: 800;
  color: var(--text);
  min-height: 40px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.price-row { display: flex; align-items: baseline; gap: 8px; margin-top: auto; }
.price { font-weight: 900; font-size: 16.5px; color: var(--text); font-family: "Cairo", sans-serif; }
.price-old { font-size: 12.5px; color: var(--text-faint); text-decoration: line-through; }

.add-btn {
  margin-top: 6px;
  height: 40px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-weight: 800;
  font-size: 13.5px;
  cursor: pointer;
  transition: all .15s ease;
}
.add-btn:hover { background: var(--primary); border-color: var(--primary); color: white; }
.add-btn[disabled] { cursor: not-allowed; opacity: 0.5; }

.empty-state {
  padding: 70px 20px;
  text-align: center;
  color: var(--text-dim);
}
.empty-state b { display: block; color: var(--text); font-size: 17px; margin-bottom: 6px; }

/* ============================================================
   CART DRAWER
   ============================================================ */
.overlay {
  position: fixed; inset: 0;
  background: rgba(4,6,10,0.6);
  backdrop-filter: blur(2px);
  z-index: 60;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
}
.overlay.open { opacity: 1; pointer-events: auto; }

.drawer {
  position: fixed;
  top: 0; bottom: 0;
  inset-inline-end: 0;
  width: min(420px, 100vw);
  background: var(--bg-raised);
  border-inline-start: 1px solid var(--border);
  z-index: 70;
  display: flex;
  flex-direction: column;
  transform: translateX(105%);
  transition: transform .25s ease;
}
[dir="rtl"] .drawer, .drawer { transform: translateX(105%); }
.drawer.open { transform: translateX(0); }

.drawer-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px; border-bottom: 1px solid var(--border-soft);
}
.drawer-head h3 { margin: 0; font-family: "Cairo", sans-serif; font-weight: 900; font-size: 17px; }
.close-btn {
  width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text-dim); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.close-btn:hover { color: var(--text); }

.drawer-body { flex: 1; overflow-y: auto; padding: 14px 20px; }

.cart-item {
  display: grid;
  grid-template-columns: 56px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-soft);
}
.cart-item img, .cart-item .ph {
  width: 56px; height: 56px; border-radius: 8px; object-fit: cover;
  background: var(--surface); border: 1px solid var(--border);
}
.cart-item .name { font-size: 13.5px; font-weight: 700; margin-bottom: 4px; }
.cart-item .unit { font-size: 12px; color: var(--text-faint); }

.qty-ctrl {
  display: flex; align-items: center; gap: 6px;
  border: 1px solid var(--border); border-radius: 8px; overflow: hidden;
}
.qty-ctrl button {
  width: 26px; height: 26px; border: 0; background: var(--surface);
  color: var(--text); cursor: pointer; font-size: 14px;
}
.qty-ctrl span { min-width: 18px; text-align: center; font-size: 13px; font-weight: 700; }

.cart-item-remove {
  grid-column: 3; justify-self: start;
  background: none; border: 0; color: var(--text-faint);
  font-size: 12px; cursor: pointer; margin-top: 4px;
}
.cart-item-remove:hover { color: var(--danger); }

.drawer-foot {
  border-top: 1px solid var(--border-soft);
  padding: 16px 20px 20px;
}
.total-row {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 14px; font-family: "Cairo", sans-serif;
}
.total-row span { color: var(--text-dim); font-size: 14px; }
.total-row b { font-size: 19px; font-weight: 900; }

.empty-cart { text-align: center; padding: 50px 10px; color: var(--text-dim); }

/* ============================================================
   CHECKOUT MODAL
   ============================================================ */
.modal-overlay {
  position: fixed; inset: 0; z-index: 80;
  background: rgba(4,6,10,0.7);
  display: flex; align-items: flex-end; justify-content: center;
  opacity: 0; pointer-events: none; transition: opacity .2s ease;
}
.modal-overlay.open { opacity: 1; pointer-events: auto; }

.modal {
  width: 100%; max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 20px 20px 0 0;
  padding: 22px 22px 26px;
  transform: translateY(30px);
  transition: transform .22s ease;
}
.modal-overlay.open .modal { transform: translateY(0); }

@media (min-width: 620px) {
  .modal-overlay { align-items: center; }
  .modal { border-radius: 18px; }
}

.modal h3 {
  font-family: "Cairo", sans-serif; font-weight: 900; font-size: 19px;
  margin: 0 0 4px;
}
.modal .sub { color: var(--text-dim); font-size: 13px; margin: 0 0 18px; }

.field { margin-bottom: 14px; }
.field label {
  display: block; font-size: 13px; font-weight: 700; color: var(--text-dim);
  margin-bottom: 6px;
}
.field input, .field select, .field textarea {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 11px 12px;
  font-family: inherit;
  font-size: 14px;
  outline: none;
  transition: border-color .15s ease;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--primary); }
.field textarea { resize: vertical; min-height: 64px; }
.field-error { color: var(--danger); font-size: 12px; margin-top: 5px; display: none; }
.field.invalid input, .field.invalid select { border-color: var(--danger); }
.field.invalid .field-error { display: block; }

.order-summary {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-bottom: 16px;
  font-size: 13px;
  color: var(--text-dim);
}
.order-summary .row { display: flex; justify-content: space-between; padding: 3px 0; }
.order-summary .row b { color: var(--text); font-weight: 800; }
.order-summary hr { border: none; border-top: 1px solid var(--border-soft); margin: 8px 0; }

/* ============================================================
   FOOTER
   ============================================================ */
.site-footer {
  border-top: 1px solid var(--border-soft);
  padding: 40px 0 30px;
  margin-top: 40px;
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.3fr 1fr 1fr;
  gap: 24px;
}
.footer-grid h4 {
  font-family: "Cairo", sans-serif; font-size: 14px; font-weight: 800;
  margin: 0 0 12px; color: var(--text);
}
.footer-grid p, .footer-grid a {
  font-size: 13.5px; color: var(--text-dim); display: block; margin-bottom: 8px;
}
.footer-grid a:hover { color: var(--neon); }
.footer-bottom {
  margin-top: 28px; padding-top: 18px; border-top: 1px solid var(--border-soft);
  font-size: 12.5px; color: var(--text-faint); text-align: center;
}
@media (max-width: 700px) {
  .footer-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   TOAST
   ============================================================ */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  inset-inline-end: 24px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 12px 18px;
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 700;
  z-index: 100;
  box-shadow: 0 14px 30px -10px rgba(0,0,0,0.6);
  opacity: 0;
  transform: translateY(10px);
  transition: all .2s ease;
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translateY(0); }
