/* ============================================================
   موسوعة Dz — نظام التصميم
   الخط: IBM Plex Sans Arabic (مستضاف محليا) — بدون استثناء
   ============================================================ */

@font-face {
  font-family: 'IBM Plex Sans Arabic';
  font-style: normal;
  font-weight: 300;
  font-display: swap;
  src: url('../fonts/ibm-plex-sans-arabic-arabic-300-normal.woff2') format('woff2');
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0898-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FEFF;
}
@font-face {
  font-family: 'IBM Plex Sans Arabic';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/ibm-plex-sans-arabic-arabic-400-normal.woff2') format('woff2');
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0898-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+0691, U+0697, U+FB50-FDFF, U+FE70-FEFF;
}
@font-face {
  font-family: 'IBM Plex Sans Arabic';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('../fonts/ibm-plex-sans-arabic-arabic-500-normal.woff2') format('woff2');
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0898-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+0900-097F, U+FE70-FEFF;
}
@font-face {
  font-family: 'IBM Plex Sans Arabic';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('../fonts/ibm-plex-sans-arabic-arabic-600-normal.woff2') format('woff2');
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0898-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FEFF;
}
@font-face {
  font-family: 'IBM Plex Sans Arabic';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('../fonts/ibm-plex-sans-arabic-arabic-700-normal.woff2') format('woff2');
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0898-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+0691, U+0697, U+FB50-FDFF, U+FE70-FEFF;
}
@font-face {
  font-family: 'IBM Plex Sans Arabic';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/ibm-plex-sans-arabic-latin-400-normal.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+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'IBM Plex Sans Arabic';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('../fonts/ibm-plex-sans-arabic-latin-500-normal.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+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+2074, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'IBM Plex Sans Arabic';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('../fonts/ibm-plex-sans-arabic-latin-700-normal.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+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+2074, U+2191, U+FEFF, U+FFFD;
}

:root {
  --bg: #f4f5fa;
  --surface: #ffffff;
  --surface-2: #f8f9fd;
  --border: #e4e7f0;
  --text: #171a26;
  --muted: #5b6172;
  --primary: #4f46e5;
  --primary-strong: #4338ca;
  --primary-soft: #eef0ff;
  --emerald: #047857;
  --emerald-soft: #e7f6f0;
  --amber: #b45309;
  --amber-soft: #fdf3e3;
  --rose: #be123c;
  --rose-soft: #fdeef2;
  --sky: #0369a1;
  --sky-soft: #e9f5fb;
  --cinq: #ea580c;
  --cinq-soft: #fdefe6;
  --bem: #047857;
  --bem-soft: #e7f6f0;
  --bac: #4f46e5;
  --bac-soft: #eef0ff;
  --radius: 14px;
  --radius-lg: 20px;
  --shadow-sm: 0 1px 2px rgba(23, 26, 38, .05);
  --shadow: 0 1px 2px rgba(23, 26, 38, .06), 0 10px 28px -14px rgba(23, 26, 38, .16);
  --shadow-lg: 0 24px 60px -24px rgba(23, 26, 38, .28);
  --nav-h: 68px;
}
html[data-theme="dark"] {
  --bg: #0e1017;
  --surface: #161927;
  --surface-2: #1c2031;
  --border: #262b3d;
  --text: #eef0f8;
  --muted: #9aa1b7;
  --primary: #7c78ff;
  --primary-strong: #8d89ff;
  --primary-soft: #232647;
  --emerald: #34d399;
  --emerald-soft: #0d2b23;
  --amber: #fbbf24;
  --amber-soft: #2c2410;
  --rose: #fb7185;
  --rose-soft: #2e1219;
  --sky: #38bdf8;
  --sky-soft: #0c2430;
  --cinq: #fb923c;
  --cinq-soft: #2c1a0d;
  --bem: #34d399;
  --bem-soft: #0d2b23;
  --bac: #7c78ff;
  --bac-soft: #232647;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .35);
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 10px 28px -14px rgba(0, 0, 0, .5);
  --shadow-lg: 0 24px 60px -24px rgba(0, 0, 0, .65);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
html, body, button, input, textarea, select { font-family: 'IBM Plex Sans Arabic', 'IBM Plex Sans Arabic', system-ui, -apple-system, 'Segoe UI', Tahoma, Arial, sans-serif; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  line-height: 1.75;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img, svg { display: block; }
::selection { background: var(--primary); color: #fff; }

.container { max-width: 1180px; margin: 0 auto; padding: 0 20px; }

/* ---------- أزرار ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 20px; border-radius: 12px; border: 1px solid transparent;
  font-size: 15px; font-weight: 600; cursor: pointer;
  transition: transform .15s 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(135deg, var(--primary), var(--primary-strong)); color: #fff; box-shadow: 0 6px 18px -8px rgba(79, 70, 229, .55); }
.btn-primary:hover { box-shadow: 0 10px 24px -8px rgba(79, 70, 229, .65); transform: translateY(-1px); }
.btn-ghost { background: var(--surface); border-color: var(--border); color: var(--text); }
.btn-ghost:hover { border-color: var(--primary); color: var(--primary); }
.btn-sm { padding: 7px 14px; font-size: 13.5px; border-radius: 10px; }
.btn-icon { width: 40px; height: 40px; padding: 0; justify-content: center; border-radius: 12px; }

/* ---------- شارات ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px;
  background: var(--surface-2); color: var(--muted); border: 1px solid var(--border);
}
.badge-ok { background: var(--emerald-soft); color: var(--emerald); border-color: transparent; }
.badge-amber { background: var(--amber-soft); color: var(--amber); border-color: transparent; }
.badge-rose { background: var(--rose-soft); color: var(--rose); border-color: transparent; }
.badge-sky { background: var(--sky-soft); color: var(--sky); border-color: transparent; }
.badge-primary { background: var(--primary-soft); color: var(--primary); border-color: transparent; }

/* ---------- شريط التنقل ---------- */
.nav {
  position: sticky; top: 0; z-index: 60;
  height: var(--nav-h);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.nav-inner { display: flex; align-items: center; gap: 14px; height: var(--nav-h); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 19px; }
.brand-logo {
  width: 38px; height: 38px; border-radius: 12px; flex: none;
  background: linear-gradient(135deg, var(--primary), #7c3aed);
  display: flex; align-items: center; justify-content: center; color: #fff;
}
.brand small { display: block; font-size: 11px; font-weight: 500; color: var(--muted); line-height: 1.2; }
.nav-links { display: flex; align-items: center; gap: 4px; margin-inline-start: 8px; }
.nav-links a {
  padding: 8px 14px; border-radius: 10px; font-size: 14.5px; font-weight: 600; color: var(--muted);
  transition: background .15s ease, color .15s ease;
}
.nav-links a:hover, .nav-links a.active { background: var(--primary-soft); color: var(--primary); }
.nav-search { flex: 1; max-width: 340px; margin-inline-start: auto; position: relative; }
.nav-search input {
  width: 100%; padding: 9px 38px 9px 14px; border-radius: 12px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font-size: 14px; outline: none; transition: border-color .15s ease, box-shadow .15s ease;
}
.nav-search input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.nav-search svg { position: absolute; inset-inline-start: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.theme-btn { margin-inline-start: 4px; }
.nav-mobile-btn { display: none; }

/* ---------- الهيرو ---------- */
.hero {
  position: relative; overflow: hidden;
  background:
    radial-gradient(900px 420px at 85% -10%, rgba(124, 58, 237, .35), transparent 60%),
    radial-gradient(700px 380px at 8% 110%, rgba(14, 165, 233, .28), transparent 55%),
    linear-gradient(150deg, #17143b 0%, #251d63 48%, #1e2a63 100%);
  color: #fff;
  padding: 74px 0 96px;
}
html[data-theme="dark"] .hero { background: linear-gradient(150deg, #0c0a24 0%, #17124a 55%, #0e1f45 100%); }
.hero::after {
  content: ""; position: absolute; inset: 0;
  background-image: radial-gradient(rgba(255,255,255,.09) 1px, transparent 1px);
  background-size: 26px 26px; opacity: .5; pointer-events: none;
}
.hero-inner { position: relative; z-index: 1; display: grid; grid-template-columns: 1.25fr .75fr; gap: 48px; align-items: center; }
.hero h1 { font-size: clamp(30px, 4.6vw, 50px); line-height: 1.3; margin: 0 0 14px; font-weight: 700; }
.hero h1 .hl { background: linear-gradient(90deg, #a5b4fc, #67e8f9); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p.sub { color: #c7cbe8; font-size: 17px; max-width: 540px; margin: 0 0 26px; }
.hero-search {
  display: flex; gap: 10px; background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.18); border-radius: 16px; padding: 8px;
  max-width: 560px; backdrop-filter: blur(8px);
}
.hero-search input {
  flex: 1; background: transparent; border: 0; outline: none; color: #fff;
  font-size: 15.5px; padding: 8px 12px;
}
.hero-search input::placeholder { color: #a9aed4; }
.hero-search .btn { background: #fff; color: var(--primary-strong); }
.hero-stats { display: flex; gap: 30px; margin-top: 30px; flex-wrap: wrap; }
.hero-stat b { display: block; font-size: 24px; }
.hero-stat span { color: #b9bedd; font-size: 13px; }

.countdown-card {
  background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.16);
  border-radius: var(--radius-lg); padding: 20px 22px;
  backdrop-filter: blur(10px);
}
.countdown-card + .countdown-card { margin-top: 14px; }
.countdown-card .cd-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.countdown-card h3 { margin: 0; font-size: 17px; font-weight: 700; }
.countdown-card .lvl-tag { font-size: 12px; padding: 3px 10px; border-radius: 999px; font-weight: 700; }
.cd-grid { display: flex; gap: 10px; margin-top: 14px; }
.cd-cell { flex: 1; text-align: center; background: rgba(0,0,0,.22); border-radius: 12px; padding: 10px 4px; }
.cd-cell b { font-size: 22px; display: block; line-height: 1.3; font-variant-numeric: tabular-nums; }
.cd-cell span { font-size: 11.5px; color: #c3c8e6; }
.cd-note { margin-top: 10px; font-size: 11.5px; color: #9aa0c8; }

/* ---------- الأقسام ---------- */
.section { padding: 64px 0; }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 28px; flex-wrap: wrap; }
.section-head h2 { font-size: clamp(22px, 3vw, 30px); margin: 0; font-weight: 700; }
.section-head p { margin: 4px 0 0; color: var(--muted); font-size: 15px; }
.sec-tag {
  display: inline-block; font-size: 13px; font-weight: 700; color: var(--primary);
  background: var(--primary-soft); padding: 4px 12px; border-radius: 999px; margin-bottom: 8px;
}

/* بطاقات المستويات */
.level-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.level-card {
  position: relative; overflow: hidden; cursor: pointer;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 28px; box-shadow: var(--shadow-sm);
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.level-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: transparent; }
.level-card::before {
  content: ""; position: absolute; inset-inline-start: 0; top: 0; bottom: 0; width: 5px;
}
.lvl-cinq::before { background: linear-gradient(180deg, #fb923c, #ea580c); }
.lvl-bem::before { background: linear-gradient(180deg, #34d399, #047857); }
.lvl-bac::before { background: linear-gradient(180deg, #818cf8, #4f46e5); }
.level-card .lvl-icon {
  width: 56px; height: 56px; border-radius: 16px; display: flex; align-items: center; justify-content: center;
  font-size: 27px; margin-bottom: 16px;
}
.lvl-cinq .lvl-icon { background: var(--cinq-soft); }
.lvl-bem .lvl-icon { background: var(--bem-soft); }
.lvl-bac .lvl-icon { background: var(--bac-soft); }
.level-card h3 { margin: 0 0 4px; font-size: 21px; font-weight: 700; }
.level-card .lvl-desc { color: var(--muted); font-size: 14px; margin: 0 0 14px; }
.level-card .chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); color: var(--muted); }
.level-card .go { margin-top: 16px; font-weight: 700; font-size: 14px; display: inline-flex; align-items: center; gap: 6px; }
.lvl-cinq .go { color: var(--cinq); }
.lvl-bem .go { color: var(--bem); }
.lvl-bac .go { color: var(--bac); }

/* شبكة المواد */
.subj-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(235px, 1fr)); gap: 16px; }
.subj-card {
  display: flex; align-items: center; gap: 14px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px; cursor: pointer; box-shadow: var(--shadow-sm);
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}
.subj-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--primary); }
.subj-card .ic {
  width: 46px; height: 46px; border-radius: 13px; background: var(--primary-soft);
  display: flex; align-items: center; justify-content: center; font-size: 22px; flex: none;
}
.subj-card b { font-size: 15.5px; display: block; }
.subj-card span { font-size: 12.5px; color: var(--muted); }

/* بطاقات الملفات والفيديوهات */
.item-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.item-card {
  display: flex; flex-direction: column; gap: 10px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow-sm);
  transition: transform .16s ease, box-shadow .16s ease;
}
.item-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.item-card .t { font-weight: 600; font-size: 15px; line-height: 1.6; flex: 1; }
.item-card .meta { display: flex; flex-wrap: wrap; gap: 6px; }
.item-card .actions { display: flex; gap: 8px; margin-top: 2px; }
.item-card .actions .btn { flex: 1; justify-content: center; }
.src-dz { background: var(--sky-soft); color: var(--sky); }
.src-ency { background: var(--emerald-soft); color: var(--emerald); }
.src-official { background: var(--amber-soft); color: var(--amber); }

.video-card { border-inline-start: 4px solid var(--rose); }
.video-card .vt { font-weight: 600; font-size: 14.5px; line-height: 1.6; flex: 1; }
.video-card .teacher { font-size: 13px; color: var(--muted); }

/* التبويبات والفلاتر */
.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin: 22px 0 14px; }
.tab {
  padding: 8px 18px; border-radius: 999px; font-size: 14px; font-weight: 600; cursor: pointer;
  background: var(--surface); border: 1px solid var(--border); color: var(--muted);
  transition: all .15s ease;
}
.tab:hover { border-color: var(--primary); color: var(--primary); }
.tab.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.filter-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 18px; }

/* شريط التنقل المسار */
.crumbs { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); padding: 20px 0 4px; flex-wrap: wrap; }
.crumbs a { color: var(--primary); font-weight: 600; }
.crumbs a:hover { text-decoration: underline; }

/* رأس صفحة المادة */
.subj-hero {
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 24px 26px; box-shadow: var(--shadow-sm); margin-bottom: 8px;
}
.subj-hero .ic {
  width: 62px; height: 62px; border-radius: 18px; font-size: 30px; flex: none;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--primary-soft), #e0e7ff);
}
.subj-hero h1 { margin: 0; font-size: 24px; }
.subj-hero p { margin: 2px 0 0; color: var(--muted); font-size: 14px; }

/* بطاقات الأساتذة */
.teacher-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.teacher-card {
  display: flex; gap: 14px; align-items: flex-start;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow-sm); transition: transform .16s ease, box-shadow .16s ease;
}
.teacher-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.teacher-card .av {
  width: 48px; height: 48px; border-radius: 999px; flex: none; color: #fff;
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 18px;
  background: linear-gradient(135deg, #f43f5e, #e11d48);
}
.teacher-card b { font-size: 15.5px; display: block; }
.teacher-card span { font-size: 13px; color: var(--muted); }
.teacher-card .row-actions { margin-top: 8px; display: flex; gap: 8px; }

/* صفحة البحث */
.search-empty { text-align: center; padding: 60px 20px; color: var(--muted); }
.search-empty .big { font-size: 42px; }

/* المميزات */
.feat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 18px; }
.feat-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 22px; box-shadow: var(--shadow-sm);
}
.feat-card .fic { width: 46px; height: 46px; border-radius: 13px; display: flex; align-items: center; justify-content: center; margin-bottom: 12px; color: #fff; }
.feat-card b { font-size: 16px; }
.feat-card p { margin: 6px 0 0; color: var(--muted); font-size: 14px; }

/* المصادر */
.src-strip { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.src-pill {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 999px;
  padding: 8px 16px; font-weight: 700; font-size: 14px; box-shadow: var(--shadow-sm);
  transition: transform .15s ease, border-color .15s ease;
}
.src-pill:hover { transform: translateY(-2px); border-color: var(--primary); }
.src-pill .dot { width: 9px; height: 9px; border-radius: 999px; background: var(--emerald); }

/* الفوتر */
footer {
  border-top: 1px solid var(--border); background: var(--surface);
  padding: 44px 0 30px; margin-top: 40px; color: var(--muted); font-size: 14px;
}
footer .cols { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 28px; }
footer h4 { color: var(--text); margin: 0 0 10px; font-size: 15px; }
footer a { display: block; padding: 3px 0; }
footer a:hover { color: var(--primary); }
footer .legal { border-top: 1px solid var(--border); margin-top: 30px; padding-top: 18px; font-size: 12.5px; }

/* ---------- بوت المحادثة ---------- */
.bot-fab {
  position: fixed; bottom: 22px; inset-inline-start: 22px; z-index: 80;
  width: 58px; height: 58px; border-radius: 999px; border: 0; cursor: pointer;
  background: linear-gradient(135deg, #4f46e5, #7c3aed); color: #fff;
  box-shadow: 0 12px 30px -8px rgba(79, 70, 229, .6);
  display: flex; align-items: center; justify-content: center;
  transition: transform .18s ease;
}
.bot-fab:hover { transform: scale(1.07); }
.bot-panel {
  position: fixed; bottom: 94px; inset-inline-start: 22px; z-index: 80;
  width: min(390px, calc(100vw - 44px)); height: min(600px, calc(100vh - 130px));
  background: var(--surface); border: 1px solid var(--border); border-radius: 22px;
  box-shadow: var(--shadow-lg); display: none; flex-direction: column; overflow: hidden;
}
.bot-panel.open { display: flex; animation: pop .22s ease; }
@keyframes pop { from { transform: translateY(14px); opacity: 0; } to { transform: none; opacity: 1; } }
.bot-head {
  background: linear-gradient(135deg, #4f46e5, #7c3aed); color: #fff;
  padding: 16px 18px; display: flex; align-items: center; gap: 12px;
}
.bot-head .bh-ic { width: 40px; height: 40px; border-radius: 12px; background: rgba(255,255,255,.16); display: flex; align-items: center; justify-content: center; }
.bot-head b { font-size: 15.5px; display: block; }
.bot-head span { font-size: 12px; opacity: .85; }
.bot-head .close { margin-inline-start: auto; background: rgba(255,255,255,.14); border: 0; color: #fff; width: 34px; height: 34px; border-radius: 10px; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.bot-msgs { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.bmsg { max-width: 82%; padding: 10px 14px; border-radius: 16px; font-size: 14.5px; line-height: 1.65; white-space: pre-wrap; word-break: break-word; }
.bmsg.user { align-self: flex-end; background: var(--primary); color: #fff; border-end-end-radius: 6px; }
.bmsg.bot { align-self: flex-start; background: var(--surface-2); border: 1px solid var(--border); border-end-start-radius: 6px; }
.bmsg.bot a { color: var(--primary); text-decoration: underline; }
.bmsg.err { background: var(--rose-soft); color: var(--rose); border-color: transparent; }
.bot-typing { display: inline-flex; gap: 5px; align-items: center; }
.bot-typing i { width: 7px; height: 7px; border-radius: 999px; background: var(--muted); animation: blink 1.2s infinite; }
.bot-typing i:nth-child(2) { animation-delay: .2s; }
.bot-typing i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 70%, 100% { opacity: .25; } 35% { opacity: 1; } }
.bot-input { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--border); }
.bot-input input {
  flex: 1; border: 1px solid var(--border); border-radius: 12px; padding: 10px 14px;
  font-size: 14.5px; background: var(--surface-2); color: var(--text); outline: none;
}
.bot-input input:focus { border-color: var(--primary); }
.bot-input button {
  width: 44px; height: 44px; border: 0; border-radius: 12px; cursor: pointer; flex: none;
  background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center;
}
.bot-input button:disabled { opacity: .5; cursor: default; }

/* حالة التحميل العامة */
.loading { text-align: center; padding: 80px 20px; color: var(--muted); font-size: 15px; }
.spinner {
  width: 34px; height: 34px; margin: 0 auto 14px; border-radius: 999px;
  border: 3px solid var(--border); border-top-color: var(--primary);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* التجاوب */
@media (max-width: 980px) {
  .hero-inner { grid-template-columns: 1fr; }
  .nav-links { display: none; }
  .nav-mobile-btn { display: flex; }
  .level-grid { grid-template-columns: 1fr; }
  footer .cols { grid-template-columns: 1fr 1fr; }
}
.mobile-menu {
  display: none; position: fixed; inset: var(--nav-h) 0 auto 0; z-index: 59;
  background: var(--surface); border-bottom: 1px solid var(--border);
  padding: 14px 20px; flex-direction: column; gap: 4px; box-shadow: var(--shadow-lg);
}
.mobile-menu.open { display: flex; }
.mobile-menu a { padding: 12px 14px; border-radius: 12px; font-weight: 600; }
.mobile-menu a:hover { background: var(--primary-soft); color: var(--primary); }
