/* غذائيات يا شام — نظام التصميم الزجاجي والألوان الملكية (Zero-Build CSS) */
:root {
  --royal: #263294;
  --royal-deep: #1A2370;
  --cerulean: #0076CE;
  --sky-glow: #0095E8;
  --gold: #F8DF00;
  --gold-warm: #FFD600;
  --bg: #F4F7FC;
  --surface: #FFFFFF;
  --surface-soft: #EEF3FB;
  --text: #0F172A;
  --muted: #64748B;
  --border: rgba(38, 50, 148, 0.13);
  --shadow: 0 10px 26px -12px rgba(15, 21, 53, 0.15);
  --r-xl: 26px;
  --r-lg: 20px;
  --r-md: 14px;
}

html.dark {
  --bg: #0B1028;
  --surface: #131B3E;
  --surface-soft: #0F1535;
  --text: #F1F5F9;
  --muted: #94A3B8;
  --border: rgba(0, 149, 232, 0.24);
  --shadow: 0 14px 32px -12px rgba(0, 0, 0, 0.55);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
body {
  margin: 0;
  font-family: 'Tajawal', 'Cairo', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  padding-bottom: 112px;
  overflow-x: hidden;
  transition: background 240ms ease, color 240ms ease;
}
h1, h2, h3, h4, .font-display { font-family: 'Cairo', 'Tajawal', sans-serif; }
button, input, select, textarea { font-family: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }

.container { width: 100%; max-width: 1040px; margin: 0 auto; padding: 0 16px; }
.hidden { display: none !important; }

/* Top Sticky Frosted Bar */
.topbar {
  position: sticky; top: 0; z-index: 40;
  background: rgba(38, 50, 148, 0.94);
  color: #FFFFFF;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}
html.dark .topbar { background: rgba(11, 16, 40, 0.94); }
.topbar-inner {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 0;
}
.brand-trigger {
  display: flex; align-items: center; gap: 10px; text-align: right; color: #fff; min-width: 0;
}
.brand-trigger img {
  width: 38px; height: 38px; border-radius: 12px; object-fit: cover;
  border: 2px solid var(--gold); flex-shrink: 0;
  transition: transform 140ms ease;
}
.brand-trigger:active img { transform: scale(0.92); }
.brand-title { font-family: 'Cairo', sans-serif; font-weight: 900; font-size: 15px; line-height: 1.2; }
.brand-sub { font-size: 11px; color: #BAE6FD; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.desktop-nav { display: none; align-items: center; gap: 6px; }
@media (min-width: 680px) { .desktop-nav { display: flex; } }
.nav-pill {
  padding: 7px 14px; border-radius: 12px; font-size: 13px; font-weight: 700;
  color: #fff; background: rgba(255, 255, 255, 0.14);
  transition: transform 140ms ease, background 180ms ease;
}
.nav-pill:hover { background: rgba(255, 255, 255, 0.24); }
.nav-pill.is-active { background: var(--gold); color: var(--royal-deep); font-weight: 800; }

.topbar-actions { display: flex; align-items: center; gap: 8px; }
.icon-btn {
  width: 38px; height: 38px; border-radius: 12px; display: inline-flex;
  align-items: center; justify-content: center; position: relative;
  background: rgba(255, 255, 255, 0.15); color: var(--gold);
  transition: transform 140ms ease, background 180ms ease;
}
.icon-btn:active { transform: scale(0.92); }
.icon-btn.gold-btn { background: var(--gold); color: var(--royal-deep); box-shadow: 0 6px 16px -4px rgba(248, 223, 0, 0.5); }
.cart-badge {
  position: absolute; top: -5px; left: -5px; min-width: 19px; height: 19px; padding: 0 4px;
  border-radius: 999px; background: #E11D48; color: #fff; font-size: 10px; font-weight: 900;
  display: inline-flex; align-items: center; justify-content: center;
}

/* Tri-Hero Symmetric Card */
.hero-card {
  margin-top: 16px; border-radius: var(--r-xl); color: #fff; overflow: hidden; position: relative;
  background: radial-gradient(ellipse 76% 68% at 50% 18%, #0095E8 0%, #0076CE 36%, #263294 84%);
  box-shadow: 0 20px 44px -16px rgba(38, 50, 148, 0.44), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}
.hero-body {
  padding: 26px 18px 24px; text-align: center;
  display: flex; flex-direction: column; align-items: center;
}
.hero-emblem {
  width: 92px; height: 92px; border-radius: 26px; overflow: hidden; padding: 0;
  background: var(--royal); animation: emblemBreathe 5s ease-in-out infinite;
}
.hero-emblem img { width: 100%; height: 100%; object-fit: cover; display: block; }
@keyframes emblemBreathe {
  0%, 100% { box-shadow: 0 0 0 4px rgba(248, 223, 0, 0.45), 0 0 28px rgba(0, 149, 232, 0.55); }
  50% { box-shadow: 0 0 0 7px rgba(248, 223, 0, 0.75), 0 0 44px rgba(248, 223, 0, 0.4); }
}
.hero-title { margin: 12px 0 4px; font-size: 26px; font-weight: 900; }
.hero-sub { margin: 0; font-size: 13px; color: #E0F2FE; max-width: 480px; }
.hero-bar {
  margin-top: 16px; width: 100%; max-width: 680px; min-height: 42px;
  border-radius: 14px; padding: 8px 14px;
  background: rgba(255, 255, 255, 0.15); border: 1px solid rgba(255, 255, 255, 0.22);
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px;
  font-size: 12px; font-weight: 700;
}
.gold-chip {
  background: var(--gold); color: var(--royal-deep); padding: 3px 10px;
  border-radius: 999px; font-weight: 900; font-size: 11px;
}
.hero-wave { width: 100%; height: 24px; display: block; margin-bottom: -1px; }
.hero-wave-fill { fill: var(--bg); transition: fill 240ms ease; }

/* Glass Panels & Repeating 60fps Cards (Zero backdrop-filter on repeating cards) */
.glass-panel {
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.97), rgba(244, 247, 252, 0.92));
  border: 1.5px solid var(--border);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.9);
  border-radius: var(--r-lg);
}
html.dark .glass-panel {
  background: linear-gradient(145deg, rgba(19, 27, 62, 0.97), rgba(11, 16, 40, 0.95));
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.finder-bar {
  margin-top: 16px; padding: 12px; display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
}
.input {
  width: 100%; padding: 11px 14px; border-radius: 13px;
  background: var(--surface); border: 1.5px solid var(--border);
  font-size: 14px; outline: none; transition: border-color 180ms ease;
}
.input:focus { border-color: var(--cerulean); }
.finder-input-wrap { flex: 1; min-width: 210px; }

/* Category Rail with Sliding Indicator */
.cat-rail-shell { margin-top: 14px; padding: 6px; }
.cat-rail {
  position: relative; display: flex; align-items: center; gap: 6px;
  overflow-x: auto; padding: 2px; scrollbar-width: none;
}
.cat-rail::-webkit-scrollbar { display: none; }
.cat-slider {
  position: absolute; top: 2px; bottom: 2px; right: 0; border-radius: 12px;
  background: var(--royal); pointer-events: none; z-index: 0;
  transition: transform 320ms cubic-bezier(0.22, 1, 0.36, 1), width 320ms cubic-bezier(0.22, 1, 0.36, 1);
}
html.dark .cat-slider { background: var(--gold); }
.cat-btn {
  position: relative; z-index: 1; padding: 8px 14px; border-radius: 12px;
  font-size: 13px; font-weight: 700; white-space: nowrap; color: var(--muted);
  transition: color 200ms ease;
}
.cat-btn.is-active { color: #FFFFFF; }
html.dark .cat-btn.is-active { color: #0B1028; }

/* Product Grid */
.section-head {
  margin: 18px 2px 12px; display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.section-head h2 { margin: 0; font-size: 19px; font-weight: 900; color: var(--royal); }
html.dark .section-head h2 { color: #FFFFFF; }
.section-head p { margin: 2px 0 0; font-size: 12px; color: var(--muted); }

.prod-grid {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px;
}
@media (min-width: 680px) { .prod-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; } }
@media (min-width: 960px) { .prod-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

.p-card {
  background: var(--surface); border: 1.5px solid var(--border); border-radius: 18px;
  padding: 12px; display: flex; flex-direction: column; justify-content: space-between; gap: 10px;
  transition: transform 220ms cubic-bezier(0.22, 1, 0.36, 1), box-shadow 220ms ease;
  animation: cardFade 260ms cubic-bezier(0.22, 1, 0.36, 1) both;
}
.p-card:hover { transform: translateY(-3px); box-shadow: 0 14px 28px -12px rgba(38, 50, 148, 0.22); }
@keyframes cardFade { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.p-thumb {
  width: 100%; height: 118px; border-radius: 14px; background: var(--surface-soft);
  overflow: hidden; display: flex; align-items: center; justify-content: center; position: relative;
}
.p-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.p-badge {
  position: absolute; top: 8px; right: 8px; background: var(--gold); color: var(--royal-deep);
  font-size: 10px; font-weight: 900; padding: 2px 8px; border-radius: 999px;
}
.p-share-btn {
  position: absolute; top: 8px; left: 8px; width: 28px; height: 28px; border-radius: 9px;
  background: rgba(255, 255, 255, 0.88); color: var(--royal); display: inline-flex;
  align-items: center; justify-content: center; font-size: 13px; font-weight: 800;
}
html.dark .p-share-btn { background: rgba(11, 16, 40, 0.85); color: var(--gold); }

.p-name { margin: 0; font-family: 'Cairo', sans-serif; font-size: 13.5px; font-weight: 800; line-height: 1.35; min-height: 36px; }
.p-meta { display: flex; align-items: center; justify-content: space-between; font-size: 11px; color: var(--muted); }
.p-price-row { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.p-price { font-family: 'Cairo', sans-serif; font-size: 15px; font-weight: 900; color: var(--royal); }
html.dark .p-price { color: var(--gold); }
.p-old { font-size: 11px; color: var(--muted); text-decoration: line-through; }

/* Buttons & Morphing Stepper */
.btn-primary {
  background: var(--royal); color: #fff; font-family: 'Cairo', sans-serif; font-weight: 800;
  padding: 10px 16px; border-radius: 13px; font-size: 13px;
  transition: transform 140ms ease, background 180ms ease;
}
.btn-primary:active { transform: scale(0.95); }
.btn-gold {
  background: var(--gold); color: var(--royal-deep); font-family: 'Cairo', sans-serif; font-weight: 900;
  padding: 10px 16px; border-radius: 13px; font-size: 13px;
  transition: transform 140ms ease;
}
.btn-gold:active { transform: scale(0.95); }
.btn-soft {
  background: var(--surface-soft); color: var(--royal); border: 1px solid var(--border);
  font-family: 'Cairo', sans-serif; font-weight: 800; padding: 9px 12px; border-radius: 12px; font-size: 12.5px;
}
html.dark .btn-soft { color: var(--gold); }
.btn-soft:hover { background: var(--royal); color: #fff; }
html.dark .btn-soft:hover { background: var(--gold); color: var(--royal-deep); }

.stepper {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--royal); color: #fff; border-radius: 12px; padding: 4px;
}
html.dark .stepper { background: var(--gold); color: var(--royal-deep); }
.stepper button {
  width: 28px; height: 28px; border-radius: 9px; background: rgba(255, 255, 255, 0.16);
  color: inherit; font-weight: 900; font-size: 15px;
}
html.dark .stepper button { background: rgba(0, 0, 0, 0.12); }

/* Transparent Tinted Glass Badges */
.glass-tag {
  display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 999px;
  font-size: 11px; font-weight: 800;
  background: rgba(0, 118, 206, 0.13); color: var(--cerulean); border: 1px solid rgba(0, 118, 206, 0.22);
}
html.dark .glass-tag { color: #38BDF8; border-color: rgba(56, 189, 248, 0.3); }

/* Floating Cart Bar */
.floating-cart {
  position: fixed; left: 50%; bottom: 74px; z-index: 35; width: calc(100% - 28px); max-width: 440px;
  transform: translate(-50%, 160%); opacity: 0; pointer-events: none;
  transition: transform 300ms cubic-bezier(0.22, 1, 0.36, 1), opacity 220ms ease;
}
@media (min-width: 680px) { .floating-cart { bottom: 20px; } }
.floating-cart.is-open { transform: translate(-50%, 0); opacity: 1; pointer-events: auto; }
.floating-cart-btn {
  width: 100%; display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; border-radius: 18px; background: var(--royal); color: #fff;
  border: 1.5px solid rgba(248, 223, 0, 0.6); box-shadow: 0 18px 34px -10px rgba(15, 21, 53, 0.55);
}

/* Mobile Bottom Nav */
.mob-nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 38;
  background: rgba(255, 255, 255, 0.94); border-top: 1px solid var(--border);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  display: grid; grid-template-columns: repeat(4, 1fr); padding: 6px 8px;
}
html.dark .mob-nav { background: rgba(19, 27, 62, 0.95); }
@media (min-width: 680px) { .mob-nav { display: none; } }
.mob-tab {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 6px 4px; font-size: 11px; font-weight: 700; color: var(--muted);
}
.mob-tab.is-active { color: var(--royal); font-weight: 900; }
html.dark .mob-tab.is-active { color: var(--gold); }

/* Modals & Bottom Sheets */
.overlay {
  position: fixed; inset: 0; z-index: 60; background: rgba(11, 16, 40, 0.68);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  display: flex; align-items: flex-end; justify-content: center; padding: 0;
}
@media (min-width: 640px) { .overlay { align-items: center; padding: 16px; } }
.sheet {
  width: 100%; max-width: 520px; max-height: 92vh; overflow-y: auto;
  background: var(--surface); border-radius: 26px 26px 0 0; padding: 20px;
  border-top: 1.5px solid var(--border); box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.3);
  animation: sheetUp 260ms cubic-bezier(0.22, 1, 0.36, 1) both;
}
@media (min-width: 640px) { .sheet { border-radius: 26px; border: 1.5px solid var(--border); } }
@keyframes sheetUp { from { transform: translateY(40px); opacity: 0.6; } to { transform: translateY(0); opacity: 1; } }

/* Luminous Glass Toggle Pill (Mostafa standard) */
.toggle-pill {
  width: 50px; height: 28px; border-radius: 999px; position: relative;
  background: rgba(148, 163, 184, 0.3); border: 1.5px solid rgba(148, 163, 184, 0.4);
  transition: background 220ms ease;
}
.toggle-pill.is-on { background: linear-gradient(135deg, #263294, #0095E8); border-color: var(--gold); }
.toggle-knob {
  width: 21px; height: 21px; border-radius: 50%; background: #fff;
  position: absolute; top: 2px; right: 2px; box-shadow: 0 2px 6px rgba(0,0,0,0.25);
  transition: transform 260ms cubic-bezier(0.22, 1.34, 0.36, 1);
}
.toggle-pill.is-on .toggle-knob { transform: translateX(-22px); }

/* Admin Grids & Toast */
.kpi-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 760px) { .kpi-grid { grid-template-columns: repeat(4, 1fr); } }
.kpi-card { background: var(--surface); border: 1.5px solid var(--border); border-radius: 16px; padding: 14px; }
.kpi-val { font-family: 'Cairo', sans-serif; font-size: 20px; font-weight: 900; color: var(--royal); margin-top: 4px; }
html.dark .kpi-val { color: var(--gold); }

.chip-row { display: flex; flex-wrap: wrap; gap: 6px; }
.nb-chip {
  padding: 5px 10px; border-radius: 10px; font-size: 11.5px; font-weight: 700;
  background: var(--surface-soft); border: 1px solid var(--border);
}
.nb-chip.is-active { background: var(--royal); color: #fff; border-color: var(--royal); }
html.dark .nb-chip.is-active { background: var(--gold); color: var(--royal-deep); }

.toast {
  position: fixed; top: 68px; left: 50%; transform: translateX(-50%); z-index: 80;
  background: var(--royal); color: #fff; border: 1.5px solid var(--gold);
  padding: 10px 18px; border-radius: 16px; font-size: 13px; font-weight: 800;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.35);
}
