/* هوية MSAD على الويب — نفس متغيّرات تطبيق الكاشير ليبقى الشكل واحداً.
 *
 * الوضعان (فاتح/داكن) يُعرَّفان بمتغيّرات فقط: كل مكوّن أدناه يقرأ المتغيّر ولا
 * يكتب لوناً صريحاً، فإضافة وضع ثالث لاحقاً لا تحتاج لمس أي مكوّن.
 *
 * الاتجاه: كل الهوامش والحدود بخصائص منطقية (inline-start/end) لا يمين/يسار،
 * فقلب الصفحة للإنجليزية يقلب التخطيط وحده بلا أي CSS ثانٍ. */

@font-face {
  font-family: 'Cairo'; font-style: normal; font-weight: 300 700; font-display: swap;
  src: url(/fonts/cairo-arabic.woff2) format('woff2');
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF,
    U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC;
}
@font-face {
  font-family: 'Cairo'; font-style: normal; font-weight: 300 700; font-display: swap;
  src: url(/fonts/cairo-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
    U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ═════════════ الوضع الفاتح (الافتراضي) ═════════════ */
:root {
  --bg: #F4F5F2; --surface: #FFFFFF; --surface2: #FAFAF9; --surface3: #F1F2EE;
  --line: #E2E4DF; --line2: #EDEEEA;
  --ink: #14181C; --muted: #6B7280; --faint: #9AA0A6;
  --brand: #0E7C5A; --brand-2: #0A5C43; --brand-3: #52C79E;
  --brand-soft: #D8EFE6; --brand-ink: #FFFFFF;
  --alert: #C2410C; --warn: #B45309; --gold: #B8860B;
  --shadow: 0 1px 2px rgba(20,24,28,0.05);
  --shadow-md: 0 6px 20px rgba(20,24,28,0.08);
  --shadow-lg: 0 18px 48px rgba(20,24,28,0.12);
  --ink-deep: #0E1114;
  --hero-1: #0E1114; --hero-2: #14211C; --hero-ink: #F1F3F0; --hero-muted: #9AA0AA;
  --hero-line: #2A3038;
  --ring: rgba(14,124,90,.18);
}

/* ═════════════ الوضع الداكن ═════════════
   يُطبَّق باختيار صريح (data-theme) أو بتفضيل النظام حين لا يوجد اختيار. */
:root[data-theme="dark"] {
  --bg: #0E1114; --surface: #161B20; --surface2: #1B2126; --surface3: #212830;
  --line: #2A323A; --line2: #232A31;
  --ink: #E9EDEF; --muted: #97A1AA; --faint: #6C767F;
  --brand: #2FA37B; --brand-2: #52C79E; --brand-3: #52C79E;
  --brand-soft: rgba(47,163,123,.16); --brand-ink: #06120D;
  --alert: #F97316; --warn: #D9A441; --gold: #E0A500;
  --shadow: 0 1px 2px rgba(0,0,0,.4);
  --shadow-md: 0 6px 20px rgba(0,0,0,.45);
  --shadow-lg: 0 18px 48px rgba(0,0,0,.55);
  --ink-deep: #06090B;
  --hero-1: #090C0F; --hero-2: #0F1A16; --hero-ink: #F1F3F0; --hero-muted: #9AA0AA;
  --hero-line: #232A31;
  --ring: rgba(82,199,158,.22);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0E1114; --surface: #161B20; --surface2: #1B2126; --surface3: #212830;
    --line: #2A323A; --line2: #232A31;
    --ink: #E9EDEF; --muted: #97A1AA; --faint: #6C767F;
    --brand: #2FA37B; --brand-2: #52C79E; --brand-3: #52C79E;
    --brand-soft: rgba(47,163,123,.16); --brand-ink: #06120D;
    --alert: #F97316; --warn: #D9A441; --gold: #E0A500;
    --shadow: 0 1px 2px rgba(0,0,0,.4);
    --shadow-md: 0 6px 20px rgba(0,0,0,.45);
    --shadow-lg: 0 18px 48px rgba(0,0,0,.55);
    --ink-deep: #06090B;
    --hero-1: #090C0F; --hero-2: #0F1A16; --hero-ink: #F1F3F0; --hero-muted: #9AA0AA;
    --hero-line: #232A31;
    --ring: rgba(82,199,158,.22);
  }
}

/* ═════════════ الأساس ═════════════ */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg); color: var(--ink);
  font-family: 'Cairo', 'Segoe UI', Tahoma, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased; line-height: 1.65;
  transition: background .18s, color .18s;
}
/* الإنجليزية بخط لاتيني أنسب: Cairo يغطّيها لكن حروفه اللاتينية أضيق مما يلزم
   لنصّ إنجليزي طويل، والنتيجة سطر يبدو مزدحماً. */
html[lang="en"] body { font-family: 'Segoe UI', system-ui, -apple-system, 'Helvetica Neue', Arial, sans-serif; }

a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-2); }
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }
button:disabled { cursor: not-allowed; opacity: .55; }
h1, h2, h3 { margin: 0; }
img { max-width: 100%; }
::selection { background: var(--brand-soft); color: var(--brand-2); }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 6px; }

/* الأرقام والمعرّفات اللاتينية داخل نصّ عربي: بلا عزل تُعاد ترتيبها فيُقرأ
   الباركود والمبلغ مقلوبَين. */
.num { direction: ltr; unicode-bidi: isolate; font-variant-numeric: tabular-nums; }

.wrap { max-width: 1140px; margin: 0 auto; padding: 0 22px; }
.wrap-sm { max-width: 820px; margin: 0 auto; padding: 0 22px; }

.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 16px; box-shadow: var(--shadow);
}
/* بطاقة تتفاعل: ترتفع قليلاً وتتلوّن حافتها — إشارة أنها قابلة للفتح */
.card-lift { transition: transform .16s, box-shadow .16s, border-color .16s; }
.card-lift:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--brand); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 22px; border-radius: 11px; font-size: 14.5px; font-weight: 500;
  transition: background .14s, border-color .14s, transform .06s, box-shadow .14s; white-space: nowrap;
}
.btn:active { transform: scale(.985); }
.btn-primary { background: var(--brand); color: var(--brand-ink); box-shadow: 0 1px 0 rgba(0,0,0,.04); }
.btn-primary:hover { background: var(--brand-2); color: var(--brand-ink); box-shadow: 0 0 0 4px var(--ring); }
.btn-ghost { background: var(--surface); color: var(--ink); border: 1px solid var(--line); }
.btn-ghost:hover { border-color: var(--brand); color: var(--ink); }
.btn-soft { background: var(--surface2); color: var(--ink); border: 1px solid var(--line); }
.btn-soft:hover { background: var(--surface3); }
.btn-danger { background: rgba(194,65,12,.10); color: var(--alert); border: 1px solid rgba(194,65,12,.28); }
.btn-sm { padding: 7px 13px; font-size: 12.5px; border-radius: 9px; }
.btn-lg { padding: 15px 30px; font-size: 16px; border-radius: 13px; }
/* زر على خلفية البطل الداكنة — لا يرث ألوان الصفحة */
.btn-on-dark { background: transparent; color: var(--hero-ink); border: 1px solid var(--hero-line); }
.btn-on-dark:hover { border-color: var(--brand-3); color: var(--hero-ink); background: rgba(255,255,255,.04); }

input[type=text], input[type=password], input[type=email], input[type=number],
input[type=date], input[type=search], select, textarea {
  width: 100%; background: var(--surface); border: 1px solid var(--line);
  border-radius: 10px; padding: 11px 13px; outline: none; transition: border-color .12s, box-shadow .12s;
}
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--ring); }
label.f { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; color: var(--muted); }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 500;
}
.chip-ok   { background: var(--brand-soft); color: var(--brand-2); }
.chip-warn { background: rgba(180,83,9,.14); color: var(--warn); }
.chip-bad  { background: rgba(194,65,12,.14); color: var(--alert); }
.chip-off  { background: var(--surface2); color: var(--faint); }

table.grid { width: 100%; border-collapse: collapse; }
table.grid th {
  text-align: start; font-size: 11.5px; font-weight: 500; color: var(--muted);
  padding: 11px 12px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
table.grid td { padding: 12px; border-bottom: 1px solid var(--line2); font-size: 13.5px; }
table.grid tbody tr:hover { background: var(--surface2); }
table.grid tbody tr:last-child td { border-bottom: none; }

@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.fade { animation: fade .18s ease-out; }

.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }

/* ═════════════ مكوّنات الصفحات العامة ═════════════ */

/* عنوان قسم: عين واحدة تلتقط الترتيب — تسمية صغيرة، عنوان، شرح */
.sec { padding: 72px 0; }
.sec-head { text-align: center; max-width: 640px; margin: 0 auto 38px; }
.sec-tag {
  display: inline-block; font-size: 11px; letter-spacing: .18em; font-weight: 600;
  color: var(--brand); background: var(--brand-soft); padding: 5px 13px; border-radius: 999px;
  margin-bottom: 14px;
}
.sec-title { font-size: clamp(23px, 3.4vw, 33px); font-weight: 700; line-height: 1.35; margin: 0 0 12px; }
.sec-sub { font-size: 15px; color: var(--muted); line-height: 1.95; margin: 0; }

/* بطاقة ميزة: أيقونة في مربّع ملوّن، عنوان، شرح */
.feat { padding: 24px 22px; display: flex; flex-direction: column; gap: 11px; height: 100%; }
.feat-ic {
  width: 42px; height: 42px; border-radius: 12px; display: flex; align-items: center;
  justify-content: center; background: var(--brand-soft); color: var(--brand);
  flex-shrink: 0;
}
.feat-t { font-size: 15.5px; font-weight: 600; }
.feat-b { font-size: 13px; color: var(--muted); line-height: 1.95; margin: 0; }

/* شريط البطل */
.hero {
  background: linear-gradient(165deg, var(--hero-1) 0%, var(--hero-2) 55%, var(--hero-1) 100%);
  color: var(--hero-ink); padding: 88px 0 0; overflow: hidden; position: relative;
}
.hero::after {
  content: ''; position: absolute; inset-inline-start: 50%; top: -160px;
  width: 620px; height: 620px; transform: translateX(-50%);
  background: radial-gradient(circle, rgba(82,199,158,.16), transparent 62%);
  pointer-events: none;
}
.hero .wrap { position: relative; z-index: 1; }
.hero-pill {
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 15px; border-radius: 999px;
  background: rgba(82,199,158,.12); color: var(--brand-3); font-size: 12.5px; margin-bottom: 24px;
}
.hero-pill i { width: 6px; height: 6px; border-radius: 999px; background: var(--brand-3); display: block; }
.hero h1 { font-size: clamp(30px, 5.2vw, 52px); font-weight: 700; line-height: 1.3; margin: 0 0 20px; }
.hero p { font-size: clamp(15px, 2vw, 18px); color: var(--hero-muted); max-width: 640px; margin: 0 auto 34px; line-height: 2; }
.hero-note { font-size: 12.5px; color: var(--hero-muted); margin-top: 16px; }
.hero-shot { margin-top: 54px; margin-bottom: -70px; }
.hero-shot img {
  width: 100%; max-width: 940px; height: auto; border-radius: 14px 14px 0 0;
  border: 1px solid var(--hero-line); border-bottom: none; box-shadow: 0 -20px 60px rgba(0,0,0,.4);
}
.hero-stats { display: flex; gap: 34px; justify-content: center; margin-top: 40px; flex-wrap: wrap; }
.hero-stat-v { font-size: 32px; font-weight: 700; color: var(--brand-3); }
.hero-stat-l { font-size: 12.5px; color: #6E727B; }

/* شريط سعر مضغوط */
.price-tag { display: flex; align-items: baseline; gap: 9px; justify-content: center; }
.price-tag b { font-size: clamp(42px, 7vw, 64px); font-weight: 700; line-height: 1; }
.price-was { text-decoration: line-through; opacity: .55; font-size: 20px; }

/* شارة خصم */
.save {
  display: inline-flex; align-items: center; gap: 7px; padding: 7px 15px; border-radius: 999px;
  background: var(--gold); color: #fff; font-size: 13px; font-weight: 600;
}

/* خطوة مرقّمة */
.step-n {
  width: 32px; height: 32px; border-radius: 10px; background: var(--brand); color: var(--brand-ink);
  display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 700;
  margin-bottom: 13px;
}

/* ═════════════ تنبيهات ═════════════ */
.flash {
  padding: 12px 16px; border-radius: 11px; font-size: 13.5px; line-height: 1.85;
  display: flex; align-items: center; gap: 10px; margin-bottom: 18px;
}
.flash-ok  { background: var(--brand-soft); color: var(--brand-2); border: 1px solid rgba(14,124,90,.2); }
.flash-bad { background: rgba(194,65,12,.09); color: var(--alert); border: 1px solid rgba(194,65,12,.26); }
.flash-warn{ background: rgba(180,83,9,.10); color: var(--warn); border: 1px solid rgba(180,83,9,.25); }

/* ═════════════ الترويسة ═════════════ */
.topbar {
  border-bottom: 1px solid var(--line); background: var(--surface);
  position: sticky; top: 0; z-index: 40; backdrop-filter: saturate(1.4) blur(6px);
}
.topbar .wrap { height: 62px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.navlink {
  padding: 7px 13px; border-radius: 9px; font-size: 13.5px; color: var(--muted); transition: background .12s, color .12s;
}
.navlink:hover { background: var(--surface2); color: var(--ink); }
.navlink.on { background: var(--brand-soft); color: var(--brand-2); font-weight: 600; }

/* مبدّل الوضع واللغة */
.icon-btn {
  width: 34px; height: 34px; border-radius: 9px; display: inline-flex; align-items: center;
  justify-content: center; color: var(--muted); border: 1px solid var(--line); background: var(--surface);
  transition: color .12s, border-color .12s, background .12s;
}
.icon-btn:hover { color: var(--brand); border-color: var(--brand); }
.lang-switch {
  display: inline-flex; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; height: 34px;
}
.lang-switch a {
  padding: 0 11px; display: flex; align-items: center; font-size: 11.5px; letter-spacing: .06em;
  color: var(--muted); font-weight: 600;
}
.lang-switch a.on { background: var(--brand); color: var(--brand-ink); }

/* ═════════════ لوحة التحكم ═════════════ */
.admin-shell { display: flex; min-height: calc(100vh - 62px); align-items: stretch; }
.admin-nav {
  width: 216px; flex-shrink: 0; padding: 22px 8px;
  border-inline-end: 1px solid var(--line); background: var(--surface);
  position: sticky; top: 62px; align-self: flex-start;
  max-height: calc(100vh - 62px); overflow-y: auto;
}
.nav-group { font-size: 10.5px; letter-spacing: .16em; color: var(--faint); padding: 12px 14px 6px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 9px 14px; border-radius: 10px; font-size: 13.5px;
  color: var(--muted); text-align: start; transition: background .12s, color .12s;
}
.nav-item:hover { background: var(--surface2); color: var(--ink); }
.nav-on { background: var(--brand-soft); color: var(--brand-2); font-weight: 600; }
.nav-badge {
  margin-inline-start: auto; font-size: 11px; padding: 1px 7px; border-radius: 999px;
  background: var(--brand); color: var(--brand-ink); font-weight: 600;
}

.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 20px; }
.stat-l { font-size: 12.5px; color: var(--muted); margin-bottom: 7px; }
.stat-v { font-size: 28px; font-weight: 700; line-height: 1.25; }
.stat-s { font-size: 11.5px; color: var(--faint); margin-top: 4px; }

.section-title { font-size: 11.5px; letter-spacing: .15em; color: var(--faint); margin-bottom: 10px; }

/* رسم عمودي بلا مكتبة */
.bars { display: flex; align-items: flex-end; gap: 3px; height: 120px; }
.bars.few { justify-content: center; }
.bar { flex: 1; min-width: 3px; background: var(--brand); border-radius: 4px 4px 2px 2px; }
.bars.few .bar { max-width: 64px; }
.bar-zero { opacity: .18; }
.bars-x { display: flex; justify-content: space-between; font-size: 10.5px; color: var(--faint); margin-top: 7px; }

.split { display: flex; height: 12px; border-radius: 999px; overflow: hidden; background: var(--line2); }

/* لوح جانبي منزلق */
.drawer-bg { position: fixed; inset: 0; background: rgba(10,14,18,.5); z-index: 90; display: flex; }
.drawer {
  width: 920px; max-width: 100%; margin-inline-start: auto; background: var(--surface);
  display: flex; flex-direction: column; box-shadow: var(--shadow-lg); height: 100%;
  animation: slidein .2s ease-out;
}
@keyframes slidein { from { transform: translateX(-24px); opacity: 0; } to { transform: none; opacity: 1; } }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  padding: 9px 14px; font-size: 13.5px; white-space: nowrap; color: var(--muted);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tab-on { color: var(--brand); border-bottom-color: var(--brand); font-weight: 600; }

/* الأسئلة المتكررة */
details summary { position: relative; padding-inline-end: 26px; list-style: none; cursor: pointer; }
details summary::-webkit-details-marker { display: none; }
details summary::after {
  content: '⌄'; position: absolute; inset-inline-end: 2px; top: -2px;
  font-size: 17px; color: var(--muted); transition: transform .18s;
}
details[open] summary::after { transform: rotate(180deg); top: 0; }
details[open] summary { color: var(--brand-2); }

/* معرض اللقطات */
.gallery { display: grid; grid-template-columns: 210px 1fr; gap: 26px; align-items: start; }
.gallery-list { display: flex; flex-direction: column; gap: 4px; position: sticky; top: 84px; }
.gal-item { padding: 10px 14px; border-radius: 10px; font-size: 13.5px; text-align: start; color: var(--muted); width: 100%; }
.gal-item:hover { background: var(--surface2); color: var(--ink); }
.gal-on { background: var(--brand-soft); color: var(--brand-2); font-weight: 600; }
.gal-shot img {
  width: 100%; height: auto; border-radius: 13px; border: 1px solid var(--line); box-shadow: var(--shadow-md);
}

table.compare th:first-child, table.compare td:first-child {
  position: sticky; inset-inline-start: 0; background: var(--surface); z-index: 1;
}

/* ═════════════ الجوال ═════════════ */
@media (max-width: 900px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .hide-sm { display: none !important; }
  .sec { padding: 52px 0; }
  .admin-shell { display: block; }
  .admin-nav {
    position: static; width: 100%; max-height: none; display: flex; gap: 6px;
    overflow-x: auto; padding: 12px; border-inline-end: none; border-bottom: 1px solid var(--line);
  }
  .nav-group { display: none; }
  .nav-item { width: auto; white-space: nowrap; }
  .gallery { grid-template-columns: 1fr; }
  .gallery-list { position: static; flex-direction: row; overflow-x: auto; gap: 6px; padding-bottom: 6px; }
  .gal-item { white-space: nowrap; flex-shrink: 0; width: auto; }
  .hero { padding-top: 62px; }
  .hero-shot { margin-top: 38px; margin-bottom: -40px; }
}

/* من يفضّل حركة أقل: نوقف كل انتقال بدل إضعافه — نصف الحركة يزعج أكثر من كلّها */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
  html { scroll-behavior: auto; }
}
