/* ============================================================
   مكتبة مدى — نظام التصميم
   هوية مدى التعلم: أزرق سماوي #2B9CD6 · كحلي · ذهبي للتقييم · خط Cairo
   كل المكوّنات هنا — القوالب تستخدم الأصناف، بلا أنماط مضمّنة قدر الإمكان.
   ============================================================ */
:root {
  --brand-50: #eef8fc; --brand-100: #d6eef8; --brand-200: #aaddf0; --brand-300: #74c5e6;
  --brand-400: #51adde; --brand-500: #2b9cd6; --brand-600: #2180bc; --brand-700: #1f6c9c;
  --brand-800: #1d567a; --brand-900: #1b4866;
  --navy-600: #235ea3; --navy-700: #1e4d86; --navy-800: #1a3d6b; --navy-900: #142d50;
  --gold-400: #ffd24d; --gold-500: #fec300; --gold-600: #e0a800;
  --success-50: #ecfdf5; --success-500: #10b981; --success-600: #059669; --success-700: #047857;
  --warning-50: #fffbeb; --warning-600: #d97706; --warning-700: #b45309;
  --danger-50: #fef2f2; --danger-500: #ef4444; --danger-600: #dc2626; --danger-700: #b91c1c;
  --ink-900: #0f2438; --ink-700: #334a5e; --ink-500: #647e94; --ink-400: #93a8ba; --ink-300: #c3d2de;
  --surface: #ffffff; --surface-muted: #f3f8fb; --surface-sunken: #e9f2f8; --line: #dde8f0;
  --radius-sm: .5rem; --radius: .75rem; --radius-lg: 1rem; --radius-xl: 1.25rem; --radius-2xl: 1.75rem;
  --shadow-xs: 0 1px 2px rgb(15 36 56 / .06);
  --shadow-soft: 0 4px 20px -4px rgb(27 72 102 / .12);
  --shadow-card: 0 14px 40px -14px rgb(27 72 102 / .28);
  --shadow-glow: 0 10px 34px -10px rgb(43 156 214 / .55);
  --ease: cubic-bezier(.16, 1, .3, 1);
  --header-h: 72px;
  --font: "Cairo", system-ui, -apple-system, "Segoe UI", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); font-size: 15.5px; line-height: 1.7; color: var(--ink-900);
  background: var(--surface-muted); -webkit-font-smoothing: antialiased; overflow-x: hidden;
}
img { max-width: 100%; display: block; }
a { color: var(--brand-700); text-decoration: none; transition: color .2s; }
a:hover { color: var(--brand-600); }
h1, h2, h3, h4 { line-height: 1.35; margin: 0 0 .5em; color: var(--ink-900); font-weight: 800; }
h1 { font-size: clamp(1.7rem, 3.2vw, 2.5rem); }
h2 { font-size: clamp(1.35rem, 2.3vw, 1.75rem); }
h3 { font-size: 1.15rem; }
p { margin: 0 0 1em; }
:focus-visible { outline: 3px solid var(--brand-300); outline-offset: 2px; border-radius: 6px; }
::selection { background: var(--brand-100); }
.sr-only { position: absolute; inset-inline-start: 0; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.container { width: 100%; max-width: 1240px; margin-inline: auto; padding-inline: 20px; }
.container-narrow { max-width: 880px; }
.container-tight { max-width: 520px; }
.stack > * + * { margin-top: 1rem; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row-between { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.muted { color: var(--ink-500); }
.faint { color: var(--ink-400); }
.small { font-size: .875rem; }
.tiny { font-size: .78rem; }
.bold { font-weight: 700; }
.num { font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate; }
.ltr { direction: ltr; unicode-bidi: isolate; text-align: left; }
.mt-0 { margin-top: 0 } .mt-1 { margin-top: .5rem } .mt-2 { margin-top: 1rem } .mt-3 { margin-top: 1.5rem } .mt-4 { margin-top: 2.5rem }
.mb-0 { margin-bottom: 0 } .mb-1 { margin-bottom: .5rem } .mb-2 { margin-bottom: 1rem } .mb-3 { margin-bottom: 1.5rem }
.text-center { text-align: center; }
.w-full { width: 100%; }

.icon { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-sm { width: 16px; height: 16px; } .icon-lg { width: 26px; height: 26px; }

/* ---------- Buttons ---------- */
.btn {
  --b-bg: var(--surface); --b-fg: var(--ink-900); --b-bd: var(--line);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; padding: 0 20px; border-radius: var(--radius); border: 1px solid var(--b-bd);
  background: var(--b-bg); color: var(--b-fg); font: inherit; font-weight: 700; font-size: .95rem;
  cursor: pointer; white-space: nowrap; text-decoration: none; transition: transform .15s var(--ease), box-shadow .2s, background .2s, border-color .2s;
}
.btn:hover { color: var(--b-fg); border-color: var(--brand-300); }
.btn:active { transform: scale(.98); }
.btn[disabled], .btn.is-disabled { opacity: .55; pointer-events: none; }
.btn-primary { --b-bg: linear-gradient(135deg, var(--brand-500), var(--brand-700)); --b-fg: #fff; --b-bd: transparent; background: var(--b-bg); box-shadow: var(--shadow-glow); }
.btn-primary:hover { --b-fg: #fff; box-shadow: 0 14px 38px -10px rgb(43 156 214 / .7); }
.btn-navy { --b-bg: var(--navy-800); --b-fg: #fff; --b-bd: transparent; }
.btn-navy:hover { --b-bg: var(--navy-900); --b-fg: #fff; }
.btn-gold { --b-bg: var(--gold-500); --b-fg: var(--navy-900); --b-bd: transparent; }
.btn-outline { --b-bg: transparent; --b-fg: var(--brand-700); --b-bd: var(--brand-300); }
.btn-outline:hover { --b-bg: var(--brand-50); }
.btn-ghost { --b-bg: transparent; --b-bd: transparent; --b-fg: var(--ink-700); }
.btn-ghost:hover { --b-bg: var(--surface-sunken); }
.btn-danger { --b-bg: var(--danger-600); --b-fg: #fff; --b-bd: transparent; }
.btn-danger-soft { --b-bg: var(--danger-50); --b-fg: var(--danger-700); --b-bd: transparent; }
.btn-sm { height: 36px; padding: 0 14px; font-size: .85rem; border-radius: var(--radius-sm); }
.btn-lg { height: 54px; padding: 0 28px; font-size: 1.05rem; border-radius: var(--radius-lg); }
.btn-block { width: 100%; }
.btn-icon { width: 44px; padding: 0; }

/* ---------- Cards / surfaces ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-xl); box-shadow: var(--shadow-xs); }
.card-pad { padding: 24px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 24px; border-bottom: 1px solid var(--line); }
.card-head h2, .card-head h3 { margin: 0; font-size: 1.1rem; }
.card-body { padding: 24px; }
.card-foot { padding: 16px 24px; border-top: 1px solid var(--line); background: var(--surface-muted); border-radius: 0 0 var(--radius-xl) var(--radius-xl); }
.divider { height: 1px; background: var(--line); margin: 20px 0; border: 0; }

/* ---------- Badges / chips ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 10px; border-radius: 999px; font-size: .78rem; font-weight: 700; background: var(--surface-sunken); color: var(--ink-700); white-space: nowrap; }
.badge-brand { background: var(--brand-50); color: var(--brand-700); }
.badge-success { background: var(--success-50); color: var(--success-700); }
.badge-warning { background: var(--warning-50); color: var(--warning-700); }
.badge-danger { background: var(--danger-50); color: var(--danger-700); }
.badge-navy { background: var(--navy-800); color: #fff; }
.badge-gold { background: #fff6d6; color: #8a6400; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-700); font-size: .88rem; font-weight: 600; transition: all .2s; }
.chip:hover { border-color: var(--brand-300); color: var(--brand-700); }
.chip.is-active { background: var(--brand-600); border-color: var(--brand-600); color: #fff; }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field + .field { margin-top: 16px; }
.label { font-weight: 700; font-size: .9rem; color: var(--ink-700); }
.label .req { color: var(--danger-600); }
.input, .select, .textarea, .field input:not([type=checkbox]):not([type=radio]):not([type=file]), .field select, .field textarea {
  width: 100%; min-height: 46px; padding: 10px 14px; font: inherit; color: var(--ink-900);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); transition: border-color .2s, box-shadow .2s;
}
.textarea, .field textarea { min-height: 120px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus, .field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--brand-400); box-shadow: 0 0 0 4px var(--brand-50);
}
.field input[type=file] { padding: 10px; border: 1.5px dashed var(--brand-200); border-radius: var(--radius); background: var(--brand-50); width: 100%; font: inherit; }
.help, .helptext { font-size: .8rem; color: var(--ink-500); }
.errorlist { list-style: none; margin: 4px 0 0; padding: 0; color: var(--danger-600); font-size: .85rem; font-weight: 600; }
.field.has-error input, .field.has-error select, .field.has-error textarea { border-color: var(--danger-500); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 20px; }
.form-grid > .field + .field { margin-top: 0; }
.form-grid .span-2 { grid-column: 1 / -1; }
.check { display: flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 600; }
.check input { width: 18px; height: 18px; accent-color: var(--brand-600); }
.form-section { padding-top: 8px; }
.form-section + .form-section { margin-top: 28px; padding-top: 24px; border-top: 1px solid var(--line); }
.form-section h3 { display: flex; align-items: center; gap: 8px; }
@media (max-width: 680px) { .form-grid { grid-template-columns: 1fr; } }

/* ---------- Alerts / messages ---------- */
.alert { display: flex; gap: 12px; align-items: flex-start; padding: 14px 18px; border-radius: var(--radius-lg); border: 1px solid transparent; font-weight: 600; }
.alert-info { background: var(--brand-50); color: var(--brand-800); border-color: var(--brand-100); }
.alert-success { background: var(--success-50); color: var(--success-700); border-color: #c6f3df; }
.alert-warning { background: var(--warning-50); color: var(--warning-700); border-color: #fde7b0; }
.alert-error, .alert-danger { background: var(--danger-50); color: var(--danger-700); border-color: #fecaca; }
.toasts { position: fixed; inset-inline: 0; top: calc(var(--header-h) + 12px); z-index: 80; display: grid; gap: 8px; justify-items: center; pointer-events: none; padding-inline: 16px; }
.toast { pointer-events: auto; max-width: 560px; width: 100%; box-shadow: var(--shadow-card); animation: rise .45s var(--ease) both; }

/* ---------- Header ---------- */
.site-header { position: sticky; top: 0; z-index: 60; background: rgb(255 255 255 / .86); backdrop-filter: saturate(1.4) blur(14px); border-bottom: 1px solid rgb(221 232 240 / .8); }
.site-header .container { height: var(--header-h); display: flex; align-items: center; gap: 20px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink-900); flex: none; }
.brand:hover { color: var(--ink-900); }
.brand-mark { width: 46px; height: 46px; border-radius: 14px; background: var(--brand-50); display: grid; place-items: center; transition: transform .3s var(--ease); }
.brand:hover .brand-mark { transform: rotate(-8deg) scale(1.05); }
.brand-mark img { width: 30px; height: auto; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-text b { font-size: 1.2rem; font-weight: 800; }
.brand-text b span { background: linear-gradient(135deg, var(--brand-500), var(--navy-700)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.brand-text small { font-size: .62rem; font-weight: 700; letter-spacing: .22em; color: var(--ink-400); margin-top: 3px; }
.nav { display: flex; align-items: center; gap: 2px; }
.nav a, .nav button.nav-link { display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 12px; border-radius: 10px; color: var(--ink-700); font-weight: 700; font-size: .93rem; background: none; border: 0; font-family: inherit; cursor: pointer; }
.nav a:hover, .nav button.nav-link:hover, .nav a.is-active { background: var(--brand-50); color: var(--brand-700); }
.header-search { flex: 1; max-width: 420px; position: relative; }
.header-search input { width: 100%; height: 44px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface-muted); padding: 0 46px 0 16px; font: inherit; font-size: .92rem; transition: all .2s; }
.header-search input:focus { outline: none; background: #fff; border-color: var(--brand-300); box-shadow: 0 0 0 4px var(--brand-50); }
.header-search .icon { position: absolute; inset-inline-start: 15px; top: 12px; color: var(--ink-400); }
.header-actions { display: flex; align-items: center; gap: 6px; margin-inline-start: auto; }
.icon-btn { position: relative; width: 44px; height: 44px; display: grid; place-items: center; border-radius: 12px; color: var(--ink-700); background: transparent; border: 0; cursor: pointer; }
.icon-btn:hover { background: var(--brand-50); color: var(--brand-700); }
.icon-btn .count { position: absolute; top: 4px; inset-inline-end: 3px; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 999px; background: var(--gold-500); color: var(--navy-900); font-size: .7rem; font-weight: 800; display: grid; place-items: center; border: 2px solid #fff; }
.dropdown { position: relative; }
.dropdown-menu { position: absolute; top: calc(100% + 8px); inset-inline-end: 0; min-width: 230px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-card); padding: 8px; display: none; z-index: 70; }
.dropdown-menu.align-start { inset-inline-end: auto; inset-inline-start: 0; }
.dropdown.is-open .dropdown-menu { display: block; animation: scaleIn .25s var(--ease) both; }
.dropdown-menu a, .dropdown-menu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 12px; border-radius: 10px; color: var(--ink-700); font: inherit; font-weight: 600; font-size: .92rem; background: none; border: 0; cursor: pointer; text-align: start; }
.dropdown-menu a:hover, .dropdown-menu button:hover { background: var(--brand-50); color: var(--brand-700); }
.dropdown-menu .menu-head { padding: 10px 12px 12px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.dropdown-menu .menu-head b { display: block; }
.mega { display: grid; grid-template-columns: repeat(2, minmax(160px, 1fr)); gap: 2px; min-width: 380px; }
.menu-toggle { display: none; }
@media (max-width: 1080px) {
  .nav { display: none; }
  .menu-toggle { display: grid; }
  .header-search { max-width: none; }
}
@media (max-width: 680px) {
  .header-search { display: none; }
  .brand-text small { display: none; }
}
.mobile-nav { display: none; border-top: 1px solid var(--line); background: #fff; padding: 12px 20px 18px; }
.mobile-nav.is-open { display: block; }
.mobile-nav a { display: block; padding: 10px 6px; font-weight: 700; color: var(--ink-700); border-bottom: 1px solid var(--surface-sunken); }
.mobile-nav form { margin-bottom: 10px; }

/* ---------- Footer ---------- */
.site-footer { margin-top: 80px; background: var(--navy-900); color: #c9d8e6; position: relative; overflow: hidden; }
.site-footer::before { content: ""; position: absolute; inset: 0; background: radial-gradient(600px 300px at 90% -10%, rgb(43 156 214 / .28), transparent 70%), radial-gradient(500px 260px at 0% 120%, rgb(254 195 0 / .10), transparent 70%); pointer-events: none; }
.site-footer .container { position: relative; }
.footer-grid { display: grid; grid-template-columns: 1.6fr repeat(3, 1fr); gap: 36px; padding: 56px 0 36px; }
.site-footer h4 { color: #fff; font-size: 1rem; margin-bottom: 14px; }
.site-footer a { color: #c9d8e6; display: block; padding: 4px 0; font-weight: 600; font-size: .93rem; }
.site-footer a:hover { color: #fff; }
.footer-brand p { color: #9fb5c9; max-width: 340px; margin-top: 14px; }
.footer-brand .brand-text b, .footer-brand .brand { color: #fff; }
.footer-brand .brand-mark { background: rgb(255 255 255 / .08); }
.footer-bottom { border-top: 1px solid rgb(255 255 255 / .08); padding: 18px 0; display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: .85rem; color: #8ea6bc; }
.pay-badges { display: flex; gap: 8px; flex-wrap: wrap; }
.pay-badges span { background: rgb(255 255 255 / .08); padding: 4px 10px; border-radius: 8px; font-size: .78rem; font-weight: 700; color: #dbe7f1; }
@media (max-width: 860px) { .footer-grid { grid-template-columns: 1fr 1fr; } .footer-brand { grid-column: 1 / -1; } }

/* ---------- Page sections ---------- */
main { min-height: 60vh; }
.section { padding-block: 56px; }
.section-sm { padding-block: 32px; }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.section-head h2 { margin: 0; }
.section-head p { margin: 4px 0 0; color: var(--ink-500); }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; color: var(--brand-600); font-weight: 800; font-size: .85rem; letter-spacing: .02em; margin-bottom: 8px; }
.eyebrow::before { content: ""; width: 22px; height: 3px; border-radius: 3px; background: linear-gradient(90deg, var(--brand-500), var(--gold-500)); }
.page-head { padding: 36px 0 28px; background: linear-gradient(180deg, #fff, var(--surface-muted)); border-bottom: 1px solid var(--line); }
.page-head h1 { margin-bottom: 6px; }
.page-head p { color: var(--ink-500); margin: 0; }
.breadcrumbs { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: .85rem; color: var(--ink-500); margin-bottom: 12px; }
.breadcrumbs a { color: var(--ink-500); font-weight: 600; }
.breadcrumbs a:hover { color: var(--brand-600); }
.breadcrumbs .sep { color: var(--ink-300); }

/* ---------- Book card / grid ---------- */
.book-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(178px, 1fr)); gap: 28px 22px; }
.book-row { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(168px, 190px); gap: 22px; overflow-x: auto; padding: 6px 4px 18px; scroll-snap-type: x mandatory; scrollbar-width: thin; }
.book-row > * { scroll-snap-align: start; }
.book-card { position: relative; display: flex; flex-direction: column; gap: 10px; color: var(--ink-900); }
.book-card:hover { color: var(--ink-900); }
.book-cover { position: relative; aspect-ratio: 2 / 3; border-radius: 10px 14px 14px 10px; overflow: hidden; background: linear-gradient(160deg, var(--brand-100), var(--brand-300)); box-shadow: 0 1px 2px rgb(0 0 0 / .08), 0 12px 28px -12px rgb(20 45 80 / .45); transition: transform .35s var(--ease), box-shadow .35s var(--ease); }
.book-cover::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, rgb(0 0 0 / .16) 0, rgb(255 255 255 / .12) 2.5%, transparent 6%); pointer-events: none; }
.book-cover img { width: 100%; height: 100%; object-fit: cover; }
.book-card:hover .book-cover { transform: translateY(-6px) rotate(-.6deg); box-shadow: 0 2px 4px rgb(0 0 0 / .08), 0 22px 40px -14px rgb(20 45 80 / .55); }
.book-cover .cover-badges { position: absolute; top: 8px; inset-inline-start: 8px; display: flex; flex-direction: column; gap: 4px; z-index: 1; }
.cover-badges .badge { height: 22px; font-size: .7rem; box-shadow: var(--shadow-xs); }
.book-meta h3 { font-size: .98rem; font-weight: 800; margin: 0; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.book-meta .by { font-size: .83rem; color: var(--ink-500); font-weight: 600; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.book-meta .bottom { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-top: 6px; }
.formats { display: flex; gap: 4px; }
.formats .fmt { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; background: var(--surface-sunken); color: var(--ink-500); }
.formats .fmt .icon { width: 15px; height: 15px; }
.price { font-weight: 800; color: var(--navy-800); white-space: nowrap; }
.price small { font-size: .72em; font-weight: 700; color: var(--ink-500); margin-inline-start: 2px; }
.price-from { font-size: .75rem; color: var(--ink-400); font-weight: 600; display: block; line-height: 1; }
.stars { display: inline-flex; align-items: center; gap: 4px; color: var(--gold-600); font-weight: 800; font-size: .85rem; }
.stars .icon { fill: var(--gold-500); stroke: var(--gold-500); width: 15px; height: 15px; }
.cover-placeholder { width: 100%; height: 100%; display: grid; place-items: center; padding: 16px; text-align: center; color: #fff; font-weight: 800; background: linear-gradient(160deg, var(--brand-500), var(--navy-800)); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; position: relative; }
.table { width: 100%; border-collapse: collapse; font-size: .93rem; }
.table th { text-align: start; font-weight: 700; color: var(--ink-500); font-size: .8rem; padding: 12px 16px; background: var(--surface-muted); border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 14px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #fafdff; }
.thumb { width: 44px; aspect-ratio: 2/3; border-radius: 6px; object-fit: cover; box-shadow: var(--shadow-xs); background: var(--brand-100); }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tabs a, .tabs button { padding: 12px 16px; font-weight: 700; color: var(--ink-500); border: 0; background: none; font: inherit; font-weight: 700; cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs .is-active { color: var(--brand-700); border-bottom-color: var(--brand-500); }

/* ---------- Stats ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--radius-xl); padding: 20px; display: flex; gap: 14px; align-items: center; }
.stat .stat-icon { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; background: var(--brand-50); color: var(--brand-600); flex: none; }
.stat .stat-icon.gold { background: #fff6d6; color: #a37700; }
.stat .stat-icon.green { background: var(--success-50); color: var(--success-600); }
.stat .stat-icon.navy { background: #e6edf7; color: var(--navy-700); }
.stat b { display: block; font-size: 1.35rem; font-weight: 800; line-height: 1.2; }
.stat span { color: var(--ink-500); font-size: .85rem; font-weight: 600; }

/* ---------- Pagination / empty ---------- */
.pagination { display: flex; gap: 6px; justify-content: center; margin-top: 36px; flex-wrap: wrap; }
.pagination a, .pagination span { min-width: 42px; height: 42px; padding: 0 12px; display: grid; place-items: center; border-radius: 12px; border: 1px solid var(--line); background: #fff; font-weight: 700; color: var(--ink-700); }
.pagination .is-current { background: var(--brand-600); border-color: var(--brand-600); color: #fff; }
.empty { text-align: center; padding: 56px 20px; }
.empty .empty-icon { width: 76px; height: 76px; margin: 0 auto 16px; border-radius: 24px; display: grid; place-items: center; background: var(--brand-50); color: var(--brand-500); }
.empty .empty-icon .icon { width: 34px; height: 34px; }
.empty h3 { margin-bottom: 6px; }
.empty p { color: var(--ink-500); max-width: 420px; margin: 0 auto 18px; }

/* ---------- Layouts ---------- */
.with-sidebar { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 28px; align-items: start; }
.sidebar-sticky { position: sticky; top: calc(var(--header-h) + 20px); }
.side-nav { display: flex; flex-direction: column; gap: 2px; padding: 10px; }
.side-nav a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; color: var(--ink-700); font-weight: 700; font-size: .93rem; }
.side-nav a:hover { background: var(--surface-muted); color: var(--brand-700); }
.side-nav a.is-active { background: var(--brand-50); color: var(--brand-700); }
.split { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 28px; align-items: start; }
@media (max-width: 960px) { .with-sidebar, .split { grid-template-columns: minmax(0, 1fr); } .sidebar-sticky { position: static; } }

.auth-wrap { min-height: calc(100vh - var(--header-h)); display: grid; place-items: center; padding: 40px 16px; background: radial-gradient(700px 380px at 85% 0%, var(--brand-100), transparent 70%), radial-gradient(520px 300px at 0% 100%, #fff3c9, transparent 70%), var(--surface-muted); }
.auth-card { width: 100%; max-width: 460px; padding: 34px; }
.auth-card .brand { justify-content: center; margin-bottom: 18px; }

/* ---------- Motion ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes scaleIn { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: none; } }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
.reveal { animation: rise .7s var(--ease) both; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ---------- Mobile refinements ---------- */
@media (max-width: 560px) {
  .header-actions .btn-ghost { display: none; }
  .header-actions .btn-primary.btn-sm { padding: 0 12px; }
  .site-header .container { gap: 10px; }
  .book-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px 14px; }
}

/* ============================================================
   المحتوى (agent G): النشرة البريدية · تواصل معنا · حقول الفخ · معاينة
   ============================================================ */
.hp-wrap, .hp-field { position: absolute !important; inset-inline-start: -9999px; width: 1px; height: 1px; overflow: hidden; opacity: 0; }
.site-footer form { position: relative; }
.newsletter { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: 24px; align-items: center; margin-top: 44px; padding: 26px 28px; border-radius: var(--radius-2xl); background: linear-gradient(120deg, rgb(43 156 214 / .22), rgb(255 255 255 / .05)); border: 1px solid rgb(255 255 255 / .1); }
.newsletter-text { display: flex; gap: 16px; align-items: center; }
.newsletter-text h4 { margin: 0 0 2px; }
.newsletter-text p { margin: 0; color: #b9cbdb; font-size: .93rem; }
.nl-icon { width: 54px; height: 54px; flex: none; border-radius: 16px; display: grid; place-items: center; background: rgb(254 195 0 / .16); color: var(--gold-400); }
.newsletter-form { display: flex; gap: 10px; flex-wrap: wrap; }
.newsletter-form input[type=email] { flex: 1 1 220px; min-width: 0; height: 50px; padding: 0 16px; border-radius: var(--radius); border: 1px solid rgb(255 255 255 / .18); background: rgb(255 255 255 / .08); color: #fff; font: inherit; }
.newsletter-form input[type=email]::placeholder { color: #9fb5c9; }
.newsletter-form input[type=email]:focus { outline: none; border-color: var(--gold-400); box-shadow: 0 0 0 4px rgb(254 195 0 / .15); }
.newsletter-form .btn { height: 50px; padding: 0 26px; }
.nl-status { flex-basis: 100%; margin: 0; min-height: 1.2em; font-size: .88rem; font-weight: 700; }
.nl-status.is-ok { color: #6ee7b7; } .nl-status.is-err { color: #fca5a5; }
.footer-contact { display: flex; flex-direction: column; gap: 2px; margin: 4px 0 14px; }
.footer-contact a { display: inline-flex !important; align-items: center; gap: 8px; }
@media (max-width: 860px) { .newsletter { grid-template-columns: 1fr; padding: 22px 18px; } }

.contact-layout { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 22px; align-items: start; }
.contact-form-card h2 { font-size: 1.25rem; margin-bottom: 4px; }
.contact-form-card .req { color: var(--danger-600); }
@media (max-width: 860px) { .contact-layout { grid-template-columns: minmax(0, 1fr); } }

.preview-bar { background: var(--warning-50); color: var(--warning-700); border-bottom: 1px solid #fde7b0; text-align: center; padding: 10px 16px; font-weight: 700; }
