/* Tasi3a Maths · فروض مرفقة بإصلاح — com_tasi3abiblio 2.0.0
   Navy header + gold accents (same language as the printed sheets). Built on top of Cassiopeia's Bootstrap 5. */
@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@400;500;700;800;900&display=swap');

.tb-page {
  --tb-navy: #0b3a8c;
  --tb-blue: #1170d1;
  --tb-blue-soft: #e8f1fc;
  --tb-violet: #5b2bc9;
  --tb-violet-deep: #3d1a93;
  --tb-violet-soft: #efe9ff;
  --tb-ink: #0f2547;
  --tb-muted: #5b6b84;
  --tb-line: #dbe6f3;
  --tb-gold: #f6c344;
  --tb-gold-deep: #c98a06;
  --tb-red: #d6283a;
  --tb-green: #178a4c;
  --tb-radius: 22px;
  --tb-accent: var(--tb-blue);
  --tb-accent-deep: var(--tb-navy);
  --tb-accent-soft: var(--tb-blue-soft);
  font-family: "Tajawal", "Segoe UI", Tahoma, sans-serif;
  color: var(--tb-ink);
  max-width: 1180px;
  margin: 0 auto;
  padding: 8px 4px 48px;
  line-height: 1.65;
}
.tb-page.is-synthese { --tb-accent: var(--tb-violet); --tb-accent-deep: var(--tb-violet-deep); --tb-accent-soft: var(--tb-violet-soft); }
.tb-page *, .tb-page *::before, .tb-page *::after { box-sizing: border-box; }
.tb-page h1, .tb-page h2, .tb-page h3, .tb-page p { margin: 0; }
.tb-page a { text-decoration: none; }
.tb-page a:focus-visible, .tb-page button:focus-visible { outline: 3px solid var(--tb-gold); outline-offset: 3px; }

/* ── Navigation ─────────────────────────────────────── */
.tb-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 14px; }
.tb-nav a, .tb-nav-current {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 999px;
  font-weight: 700; font-size: 14px;
}
.tb-nav a { background: #eef4fb; color: var(--tb-navy); transition: background .15s ease; }
.tb-nav a:hover { background: #dfeaf8; color: var(--tb-navy); }
.tb-nav-current { background: var(--tb-ink); color: #fff; }

/* ── Hero ───────────────────────────────────────────── */
.tb-hero {
  position: relative; overflow: hidden;
  display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 24px;
  padding: 34px 36px; border-radius: 0 0 40px 40px;
  background: linear-gradient(100deg, var(--tb-accent) 0%, var(--tb-accent-deep) 100%);
  color: #fff; box-shadow: 0 20px 50px -24px rgba(4, 20, 60, .55);
}
.tb-hero::after {
  content: ""; position: absolute; inset: auto -60px -120px auto; width: 300px; height: 300px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,.18), transparent 70%); pointer-events: none;
}
.tb-hero-sub { font-size: 15px; opacity: .88; font-weight: 500; }
.tb-hero h1 { font-size: clamp(28px, 4.4vw, 44px); font-weight: 900; line-height: 1.2; margin: 4px 0 10px; color: #fff; }
.tb-hero-text > p:not(.tb-hero-sub) { max-width: 56ch; font-size: 17px; opacity: .93; }
.tb-hero-pills { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.tb-pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 13px; border-radius: 999px;
  background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.28); font-size: 14px; font-weight: 700; color: #fff;
}
.tb-pill.is-gold { background: var(--tb-gold); border-color: var(--tb-gold); color: #3a2a00; }

.tb-hero-sheet { position: relative; width: 150px; height: 172px; }
.tb-sheet { position: absolute; inset: 0; border-radius: 14px; }
.tb-sheet-back { transform: rotate(-8deg) translate(-14px, 6px); background: rgba(255,255,255,.22); }
.tb-sheet-front {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  background: #fff; color: var(--tb-navy); box-shadow: 0 18px 40px rgba(4, 20, 60, .35);
  border-top: 10px solid var(--tb-gold);
}
.tb-sheet-front i { font-size: 40px; color: var(--tb-red); }
.tb-sheet-front b { font-size: 30px; font-weight: 900; line-height: 1.1; }
.tb-sheet-front small { font-size: 13px; color: var(--tb-muted); font-weight: 700; }

.tb-hero-compact { padding: 28px 32px; }
.tb-hero-num {
  font-size: clamp(72px, 12vw, 128px); font-weight: 900; line-height: 1; letter-spacing: -.04em;
  color: rgba(255,255,255,.22); font-variant-numeric: tabular-nums; user-select: none;
}

/* ── Access banner ──────────────────────────────────── */
.tb-access {
  display: flex; align-items: center; gap: 14px; margin: 18px 0 8px; padding: 14px 20px; border-radius: 16px;
  background: #fff; border: 1px solid var(--tb-line); font-size: 15px;
}
.tb-access i { font-size: 22px; flex: none; width: 44px; height: 44px; display: grid; place-items: center; border-radius: 12px; }
.tb-access.is-open i { background: #e3f6ea; color: var(--tb-green); }
.tb-access.is-view i { background: #fff4d6; color: var(--tb-gold-deep); }

/* ── Sections ───────────────────────────────────────── */
.tb-section { margin-top: 30px; }
.tb-section-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 16px; margin-bottom: 14px; padding-inline-start: 14px; border-inline-start: 5px solid var(--tb-gold); }
.tb-section-head h2 { font-size: 24px; font-weight: 900; color: var(--tb-ink); }
.tb-section-head h2 i { color: var(--tb-accent); margin-inline-end: 4px; }
.tb-section-head p { color: var(--tb-muted); font-size: 15px; }

.tb-grid { display: grid; gap: 18px; }
.tb-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.tb-empty { margin: 40px 0; text-align: center; font-size: 18px; color: var(--tb-muted); }

/* ── Category cards (page 1) ────────────────────────── */
.tb-cat {
  position: relative; overflow: hidden; display: block; min-height: 196px; border-radius: var(--tb-radius);
  background: #fff; color: var(--tb-ink); border: 1px solid var(--tb-line) !important;
  box-shadow: 0 6px 20px -12px rgba(15, 37, 71, .25);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.tb-cat::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 7px;
  background: linear-gradient(90deg, var(--tb-cat-a), var(--tb-cat-b));
}
.tb-cat.is-controle { --tb-cat-a: var(--tb-blue); --tb-cat-b: var(--tb-navy); --tb-cat-soft: var(--tb-blue-soft); }
.tb-cat.is-synthese { --tb-cat-a: var(--tb-violet); --tb-cat-b: var(--tb-violet-deep); --tb-cat-soft: var(--tb-violet-soft); }
.tb-cat:hover { transform: translateY(-5px); box-shadow: 0 22px 44px -18px rgba(15, 37, 71, .4); border-color: var(--tb-cat-a) !important; color: var(--tb-ink); }
.tb-cat .card-body { position: relative; z-index: 1; padding: 24px 22px 20px; height: 100%; }
.tb-cat-watermark {
  position: absolute; left: 10px; bottom: -22px; font-size: 128px; font-weight: 900; line-height: 1;
  color: var(--tb-cat-soft); letter-spacing: -.05em; pointer-events: none; font-variant-numeric: tabular-nums;
  transition: transform .18s ease;
}
.tb-cat:hover .tb-cat-watermark { transform: scale(1.06) translateY(-4px); }
.tb-cat-kind {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px; border-radius: 999px;
  background: var(--tb-cat-soft); color: var(--tb-cat-b); font-size: 13px; font-weight: 800;
}
.tb-cat-count { background: var(--tb-gold); color: #3a2a00; font-size: 13px; font-weight: 800; padding: 6px 11px; display: inline-flex; align-items: center; gap: 5px; }
.tb-cat.is-empty .tb-cat-count { background: #eef1f5; color: var(--tb-muted); }
.tb-cat-title { font-size: 24px; font-weight: 900; margin-top: 14px; line-height: 1.3; }
.tb-cat-desc { color: var(--tb-muted); font-size: 14.5px; margin-top: 4px; }
.tb-cat-cta { display: inline-flex; align-items: center; gap: 8px; margin-top: 18px; font-weight: 800; color: var(--tb-cat-a); font-size: 15px; }
.tb-cat-cta i { transition: transform .18s ease; }
.tb-cat:hover .tb-cat-cta i { transform: translateX(-5px); }
.tb-cat.is-empty { opacity: .78; }

/* ── Devoir cards (page 2) ──────────────────────────── */
.tb-devoirs { margin-top: 22px; }
.tb-dev {
  border-radius: var(--tb-radius); background: #fff; border: 1px solid var(--tb-line) !important;
  box-shadow: 0 6px 20px -12px rgba(15, 37, 71, .25);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.tb-dev:hover { transform: translateY(-4px); box-shadow: 0 22px 44px -18px rgba(15, 37, 71, .38); border-color: var(--tb-accent) !important; }
.tb-dev .card-body { padding: 20px 20px 18px; height: 100%; }
.tb-dev-top { display: flex; align-items: center; justify-content: space-between; }
.tb-dev-icon {
  width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; font-size: 26px;
  background: linear-gradient(135deg, #fff1f2, #ffe0e3); color: var(--tb-red);
}
.tb-dev-index { font-size: 13px; font-weight: 800; color: var(--tb-muted); background: #f1f4f8; padding: 3px 10px; border-radius: 999px; }
.tb-dev-title { font-size: 18.5px; font-weight: 800; line-height: 1.4; margin-top: 14px; min-height: 2.8em; }
.tb-dev-meta { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 10px 0 16px; color: var(--tb-muted); font-size: 13.5px; font-weight: 700; }
.tb-dev-meta i { color: var(--tb-accent); margin-inline-end: 3px; }
.tb-views { font-variant-numeric: tabular-nums; color: var(--tb-ink); }

/* ── Buttons ────────────────────────────────────────── */
.tb-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; width: 100%;
  padding: 11px 16px; border-radius: 14px; font-weight: 800; font-size: 15.5px; border: 2px solid transparent;
  transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
}
.tb-btn:active { transform: scale(.98); }
.tb-btn-dl { background: linear-gradient(100deg, var(--tb-accent), var(--tb-accent-deep)); color: #fff; box-shadow: 0 10px 22px -10px var(--tb-accent-deep); }
.tb-btn-dl:hover { color: #fff; filter: brightness(1.08); box-shadow: 0 14px 28px -10px var(--tb-accent-deep); }
.tb-btn-locked { background: #f4f6f9; color: var(--tb-muted); border-color: var(--tb-line); }
.tb-btn-locked:hover { background: #fff4d6; color: var(--tb-gold-deep); border-color: var(--tb-gold); }
.tb-btn-ghost { background: #fff; color: var(--tb-ink); border-color: var(--tb-line); width: auto; }
.tb-btn-ghost:hover { background: #f1f4f8; }
.tb-modal .tb-btn-dl { width: auto; }

/* ── Sibling strip ──────────────────────────────────── */
.tb-siblings { margin-top: 40px; }
.tb-siblings h2 { font-size: 18px; font-weight: 900; color: var(--tb-muted); margin-bottom: 10px; }
.tb-siblings-strip { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 6px; scrollbar-width: thin; }
.tb-sib {
  flex: none; display: flex; align-items: center; gap: 10px; padding: 8px 14px 8px 10px; border-radius: 14px;
  background: #fff; border: 1px solid var(--tb-line); color: var(--tb-ink); transition: transform .15s ease, border-color .15s ease;
}
.tb-sib:hover { transform: translateY(-2px); color: var(--tb-ink); }
.tb-sib-num { font-size: 22px; font-weight: 900; width: 40px; text-align: center; border-radius: 10px; padding: 2px 0; }
.tb-sib.is-controle .tb-sib-num { background: var(--tb-blue-soft); color: var(--tb-navy); }
.tb-sib.is-synthese .tb-sib-num { background: var(--tb-violet-soft); color: var(--tb-violet-deep); }
.tb-sib.is-controle:hover { border-color: var(--tb-blue); }
.tb-sib.is-synthese:hover { border-color: var(--tb-violet); }
.tb-sib-text { display: flex; flex-direction: column; line-height: 1.2; }
.tb-sib-text small { font-size: 12px; color: var(--tb-muted); font-weight: 700; }
.tb-sib-text b { font-size: 14px; font-weight: 800; }

/* ── Modal ──────────────────────────────────────────── */
.tb-modal { font-family: "Tajawal", "Segoe UI", Tahoma, sans-serif; direction: rtl; }
.tb-modal .modal-content { border: 0; border-radius: 24px; overflow: hidden; }
.tb-modal .modal-body { padding: 34px 28px 28px; }
.tb-modal-icon {
  width: 72px; height: 72px; margin: 0 auto 14px; border-radius: 22px; display: grid; place-items: center;
  background: #fff4d6; color: var(--tb-gold-deep); font-size: 30px;
}
.tb-modal .modal-title { font-size: 22px; font-weight: 900; color: var(--tb-ink); margin-bottom: 8px; }
.tb-modal p { color: var(--tb-muted); font-size: 16px; }
.tb-modal-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 20px; }

/* ── Responsive ─────────────────────────────────────── */
@media (max-width: 991px) {
  .tb-grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 767px) {
  .tb-hero { grid-template-columns: 1fr; padding: 26px 22px; border-radius: 0 0 28px 28px; }
  .tb-hero-sheet { display: none; }
  .tb-hero-num { position: absolute; top: 2px; left: 12px; font-size: 56px; color: rgba(255,255,255,.13); }
}
@media (max-width: 575px) {
  .tb-grid-3 { grid-template-columns: 1fr; }
  .tb-cat { min-height: 0; }
  .tb-access { align-items: flex-start; }
}
@media (prefers-reduced-motion: reduce) {
  .tb-page * { transition: none !important; }
}

/* ── 2.0.2 · Template overrides (specificity shield) ─────────────────
   Some site templates restyle h1, .btn and ul li; these rules win over them. */
.tb-page .tb-hero h1, .tb-page .tb-hero h1 span { background: none !important; box-shadow: none !important; padding: 0 !important; color: #fff !important; }
.tb-page .tb-hero-pills, .tb-page .tb-dev-meta, .tb-page .tb-siblings-strip { list-style: none !important; padding-inline-start: 0 !important; }
.tb-page .tb-dev-meta li, .tb-page .tb-dev-meta li::before, .tb-page .tb-dev-meta li::marker { list-style: none !important; content: none !important; background: none !important; padding: 0 !important; margin: 0 !important; }
.tb-page .tb-dev-meta { display: flex !important; flex-wrap: wrap !important; gap: 6px 14px !important; }
.tb-page .btn.tb-btn { text-transform: none !important; letter-spacing: 0 !important; border-radius: 14px !important; font-size: 15.5px !important; line-height: 1.4 !important; }
.tb-page .btn.tb-btn-dl, .tb-modal .btn.tb-btn-dl { background: linear-gradient(100deg, var(--tb-accent), var(--tb-accent-deep)) !important; color: #fff !important; border-color: transparent !important; }
.tb-page .btn.tb-btn-locked { background: #f4f6f9 !important; color: var(--tb-muted) !important; border: 2px solid var(--tb-line) !important; box-shadow: none !important; }
.tb-page .btn.tb-btn-locked:hover, .tb-page .btn.tb-btn-locked:focus { background: #fff4d6 !important; color: var(--tb-gold-deep) !important; border-color: var(--tb-gold) !important; }
.tb-modal .btn.tb-btn-ghost { background: #fff !important; color: var(--tb-ink) !important; border: 2px solid var(--tb-line) !important; }
.tb-page .tb-cat, .tb-page .tb-cat:hover, .tb-page .tb-sib, .tb-page .tb-nav a { text-decoration: none !important; }

/* ── 2.1.0 : score needed per card + downloads per day ───────────────── */
.tb-score { display: flex; flex-wrap: wrap; align-items: stretch; gap: 0; margin: 18px 0 8px; border-radius: 18px; overflow: hidden; background: #fff; border: 1px solid var(--tb-line); box-shadow: 0 10px 30px -18px rgba(4, 20, 60, .35); }
.tb-score-big { display: grid; place-content: center; justify-items: center; min-width: 120px; padding: 12px 16px; color: #fff; background: linear-gradient(160deg, var(--tb-navy), var(--tb-blue)); }
.tb-score-big small { font-size: 13px; font-weight: 700; color: var(--tb-gold); }
.tb-score-big b { font-size: 44px; font-weight: 900; line-height: 1.05; font-variant-numeric: tabular-nums; }
.tb-score-txt { flex: 1 1 280px; display: grid; gap: 4px; align-content: center; padding: 14px 20px; font-size: 15px; }
.tb-score-txt strong { font-size: 17px; font-weight: 800; }
.tb-score-txt b { color: var(--tb-navy); }
.tb-meter { display: block; height: 10px; max-width: 420px; border-radius: 10px; background: #edf2fb; overflow: hidden; margin-top: 4px; }
.tb-meter i { display: block; height: 100%; min-width: 6px; border-radius: inherit; background: linear-gradient(90deg, var(--tb-gold), #ff9f43); }
.tb-score-day { display: grid; place-content: center; justify-items: center; min-width: 140px; padding: 12px 16px; background: #fff8e1; border-inline-start: 1px dashed #f1d38a; text-align: center; }
.tb-score-day small { font-size: 12px; color: #6b5300; font-weight: 700; }
.tb-score-day b { font-size: 30px; font-weight: 900; line-height: 1.1; color: #3a2a00; font-variant-numeric: tabular-nums; }
.tb-score-day b span { font-size: 16px; color: #8a6d1d; }
.tb-score-day.is-done { background: #eef4fb; border-color: var(--tb-line); }
.tb-score-day.is-done b { font-size: 24px; color: var(--tb-navy); direction: ltr; }
.tb-score-go { align-self: center; margin: 12px 18px; }
.tb-score.is-guest, .tb-score.is-teacher { align-items: center; gap: 14px; padding: 14px 18px; }
.tb-score.is-guest .tb-score-txt, .tb-score.is-teacher .tb-score-txt { padding: 0; }
.tb-score-txt span { color: var(--tb-muted); }
.tb-score-ic { flex: none; width: 46px; height: 46px; display: grid; place-items: center; border-radius: 12px; background: #fff4d6; color: var(--tb-gold-deep); font-size: 20px; }
.tb-score.is-teacher .tb-score-ic { background: #e3f6ea; color: var(--tb-green); }
.tb-score-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.tb-cat-gate { display: inline-flex; align-items: center; gap: 6px; align-self: flex-start; margin: 10px 0 4px; padding: 4px 12px; border-radius: 999px; font-size: 13px; font-weight: 700; }
.tb-cat-gate.is-open { background: #e3f6ea; color: var(--tb-green); }
.tb-cat-gate.is-locked { background: #fff4d6; color: #7a5800; }
.tb-cat-gate small { font-weight: 500; color: #8a6d1d; }
.tb-cat.is-locked { filter: saturate(.75); }

.tb-gate { display: flex; align-items: center; gap: 14px; margin: 8px 0 14px; padding: 14px 18px; border-radius: 16px; background: #fff8e1; border: 1px solid #f1d38a; }
.tb-gate > i { flex: none; width: 44px; height: 44px; display: grid; place-items: center; border-radius: 12px; background: #fff; color: var(--tb-gold-deep); font-size: 20px; }
.tb-gate div { display: grid; gap: 2px; }
.tb-gate span { color: #6b5300; font-size: 14px; }

.tb-dev-note { display: block; margin-top: 6px; text-align: center; font-size: 12px; color: var(--tb-muted); }
.tb-btn-owned { background: var(--tb-green) !important; border-color: var(--tb-green) !important; }
.tb-btn-wait { background: #eef4fb !important; color: var(--tb-navy) !important; border: 1px solid var(--tb-line) !important; cursor: default; }
.tb-btn-wait .tb-clock { direction: ltr; font-variant-numeric: tabular-nums; }
.tb-sib-lock { color: #7a5800; font-weight: 700; }

@media (max-width: 640px) {
  .tb-score-big { min-width: 0; flex: 1 1 40%; }
  .tb-score-day { min-width: 0; flex: 1 1 40%; border-inline-start: 0; }
  .tb-score-txt { order: 3; flex-basis: 100%; }
  .tb-score-go { order: 4; flex: 1 1 100%; margin: 0 16px 14px; }
}
