/* صفحات /d/ الثابتة — بنفس ألوان التطبيق (lib/core/theme.dart). */
:root {
  --brand: #0047ab;
  --brand-soft: rgba(0, 71, 171, 0.08);
  --gold: #f5a623;
  --success: #2ecc71;
  --ink: #0f172a;
  --muted: #64748b;
  --bg: #f7f8fc;
  --card: #ffffff;
  --border: #e6e9f2;
  --price: #0047ab;
}
@media (prefers-color-scheme: dark) {
  :root {
    --brand-soft: rgba(138, 180, 255, 0.1);
    --ink: #e8ecf6;
    --muted: #94a3b8;
    --bg: #0b1020;
    --card: #141a2e;
    --border: #232b45;
    --price: #8ab4ff;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: 'Cairo', system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.7;
}
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; height: auto; }
h1, h2, h3 { line-height: 1.4; margin: 0; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); font-weight: 600; }
.small { font-size: 13px; }

/* الرأس */
.top {
  position: sticky; top: 0; z-index: 5;
  background: color-mix(in srgb, var(--card) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.top .wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 62px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 900; font-size: 18px; }
.brand img { border-radius: 10px; }
.top nav { display: flex; align-items: center; gap: 14px; font-weight: 800; font-size: 14px; }
@media (max-width: 420px) { .top nav a:not(.btn) { display: none; } .brand { font-size: 16px; } }

/* الأزرار */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--brand); color: #fff; font-weight: 800;
  border-radius: 14px; padding: 10px 18px;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 8px 20px rgba(0, 71, 171, 0.25); }
.btn.small { padding: 7px 14px; border-radius: 12px; font-size: 13px; }
.btn.big { padding: 14px 26px; font-size: 17px; flex: 1; }
.btn.free { background: var(--success); }
.btn.ghost { background: var(--brand-soft); color: var(--price); }

/* الشارات */
.meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 6px 0; font-size: 13px; }
.badge {
  background: var(--brand-soft); color: var(--price);
  border-radius: 999px; padding: 2px 10px; font-weight: 800; font-size: 12px;
}
.badge.gold { background: rgba(245, 166, 35, 0.15); color: #b9770e; }
.badge.free { background: rgba(46, 204, 113, 0.15); color: #1e9e57; }
.badge.paid { background: rgba(255, 193, 7, 0.2); color: #8a6300; }
@media (prefers-color-scheme: dark) {
  .badge.gold { color: var(--gold); }
  .badge.free { color: var(--success); }
  .badge.paid { color: #ffd54f; }
}
.stars { font-weight: 800; }
.star { color: var(--gold); }
.subject { color: var(--gold); font-weight: 800; font-size: 13px; }
.price { color: var(--price); font-weight: 900; font-size: 18px; white-space: nowrap; }
.price.free { color: var(--success); }
.price s { color: var(--muted); font-size: 13px; font-weight: 700; }

/* الفهرس */
.hero { padding: 36px 0 12px; }
.hero h1 { font-size: clamp(26px, 5vw, 38px); font-weight: 900; }
.hero p { color: var(--muted); font-weight: 600; font-size: 16px; margin: 6px 0 14px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips a {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 999px; padding: 6px 16px; font-weight: 800; font-size: 14px;
}
.level { padding: 18px 0; scroll-margin-top: 80px; }
.level h2, .related h2, .desc h2 { font-size: 22px; font-weight: 900; margin-bottom: 14px; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }
@media (max-width: 520px) { .grid { grid-template-columns: repeat(2, 1fr); gap: 12px; } }
.card {
  display: flex; flex-direction: column;
  background: var(--card); border: 1px solid var(--border); border-radius: 20px; overflow: hidden;
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.04);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.card:hover { transform: translateY(-2px); box-shadow: 0 14px 28px rgba(0, 0, 0, 0.08); }
.thumb { aspect-ratio: 1; background: var(--brand-soft); }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.card .info { padding: 12px 14px 14px; display: flex; flex-direction: column; flex: 1; }
.card h3 { font-size: 16px; font-weight: 900; }
.card .short { color: var(--muted); font-size: 13px; font-weight: 600; margin: 4px 0 8px; flex: 1; }
@media (max-width: 520px) {
  .card .info { padding: 10px; }
  .card h3 { font-size: 14px; }
  .card .short { display: none; }
  .card .meta { font-size: 11px; }
  .price { font-size: 16px; }
}

/* صفحة الوثيقة */
.crumbs { padding: 18px 0 10px; font-size: 13px; font-weight: 700; color: var(--muted); }
.crumbs a:hover { color: var(--price); }
.product { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 32px; align-items: start; }
@media (max-width: 820px) { .product { grid-template-columns: 1fr; gap: 18px; } }
.gallery .main {
  width: 100%; aspect-ratio: 1; object-fit: cover;
  border-radius: 22px; border: 1px solid var(--border); background: var(--brand-soft);
}
.thumbs { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-top: 8px; }
.thumbs img { aspect-ratio: 1; object-fit: cover; border-radius: 12px; border: 1px solid var(--border); }
.details h1 { font-size: clamp(22px, 4vw, 32px); font-weight: 900; }
.lead { color: var(--muted); font-weight: 600; font-size: 16px; margin: 8px 0 16px; }
.prices { display: flex; flex-direction: column; gap: 10px; }
.fmt {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--card); border: 1px solid var(--border); border-radius: 16px; padding: 12px 16px;
}
.fmt strong { display: block; font-weight: 900; }
.fmt .muted { font-size: 13px; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 18px 0 8px; }
.unavailable {
  margin-top: 16px; padding: 12px 16px; border-radius: 14px;
  background: rgba(239, 68, 68, 0.1); color: #ef4444; font-weight: 800;
}
.desc {
  background: var(--card); border: 1px solid var(--border); border-radius: 22px;
  padding: 22px; margin: 32px 0 8px;
}
.desc h3 { font-size: 17px; font-weight: 900; margin: 16px 0 4px; }
.desc p { margin: 4px 0; }
.related { padding: 24px 0; }

/* التذييل */
.foot { border-top: 1px solid var(--border); margin-top: 32px; padding: 22px 0 30px; color: var(--muted); font-size: 14px; font-weight: 600; }
.foot strong { color: var(--ink); }
.foot a { color: var(--price); font-weight: 800; }
.foot p { margin: 4px 0; }
