/* ═══════════════════════════════════════════════
   EduConcours — دليل مشروع البحث التربوي (مباراة التفتيش)
   صفحة مستقلة بلا فصول قابلة للطي: تصميم مخصص.
═══════════════════════════════════════════════ */

.rg-page { padding-block: 5.5rem 4rem; background: var(--clr-bg-alt); }

/* ── Layout: content + sticky sidebar ─────────── */
/* الشريط الجانبي إلى يمين المحتوى (بداية القراءة في وحدة عربية)،
   عبر order + قوالب الأعمدة، مع إبقاء المحتوى أولاً في DOM. */
.rg-layout { display: grid; grid-template-columns: 16rem minmax(0, 1fr); gap: 1.5rem; align-items: start; }
.rg-content { display: grid; gap: 1.5rem; min-width: 0; order: 2; }
/* العمود كله لاصق ومحدود بارتفاع الشاشة؛ بطاقة المباراة بارتفاعها الطبيعي،
   وفهرس الفصول يأخذ ما تبقى من المساحة ويمرَّر داخليًا إن لزم. */
.rg-aside {
  order: 1;
  position: sticky; top: 5.5rem;
  max-height: calc(100vh - 6rem);
  display: flex; flex-direction: column; gap: 1rem;
}
.rg-toc { flex: 1 1 auto; min-height: 0; overflow-y: auto; }
@media (max-width: 900px) {
  .rg-layout { grid-template-columns: 1fr; }
  .rg-content, .rg-aside { order: 0; }
  .rg-aside { position: static; max-height: none; }
}

/* ── Hero ─────────────────────────────────────── */
.rg-hero {
  position: relative;
  overflow: hidden;
  padding: clamp(1.5rem, 4vw, 3rem);
  background: linear-gradient(135deg, #0f172a 0%, #1e40af 60%, #2563eb 100%);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
  margin-bottom: 1.5rem;
}
.rg-hero::before {
  content: '';
  position: absolute; inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.04'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}
.rg-hero__inner { position: relative; z-index: 1; }
.rg-hero__top { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .75rem; margin-bottom: 1rem; }
.rg-hero__top .breadcrumb { margin-bottom: 0; }
.rg-hero .breadcrumb { color: rgba(255,255,255,.75); }
.rg-hero .breadcrumb a { color: #fff !important; }
.rg-hero .breadcrumb__sep { color: rgba(255,255,255,.4); }
/* هوية الموقع (شعار assets/logo-icon.svg + الاسم) — نفس مكوّن
   .portal-brand-hero في الصفحة الرئيسية، بمقاس أصغر يلائم صف الهيرو هنا. */
.rg-hero__brand {
  display: inline-flex; align-items: center; gap: .6rem;
  flex-shrink: 0;
  padding: .35rem .55rem .35rem .8rem;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(255,255,255,.12), rgba(96,165,250,.08));
  border: 1px solid rgba(191,219,254,.22);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  text-decoration: none; opacity: .95;
}
.rg-hero__brand:hover { opacity: 1; }
.rg-hero__brand-mark {
  width: 32px; height: 32px; flex: 0 0 auto;
  background: url("../assets/logo-icon.svg") center/contain no-repeat;
  filter: drop-shadow(0 6px 14px rgba(37,99,235,.35));
}
.rg-hero__brand-copy { display: flex; flex-direction: column; gap: .05rem; }
.rg-hero__brand-copy strong { color: #f8fafc; font-size: .9rem; font-weight: 800; line-height: 1; }
.rg-hero__brand-copy span { color: #bfdbfe; font-size: .62rem; font-weight: 700; white-space: nowrap; }
.rg-hero__eyebrow {
  display: inline-flex; align-items: center; gap: .4rem;
  font-size: .75rem; font-weight: 700; letter-spacing: .04em;
  color: #bfdbfe; background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.25);
  border-radius: 99px; padding: .3rem .85rem; margin-bottom: 1rem;
}
.rg-hero h1 {
  font-family: var(--ff-display);
  font-size: clamp(1.6rem, 3.4vw, 2.4rem);
  line-height: 1.35;
  color: #fff;
  margin: 0 0 .9rem;
  max-width: 46rem;
}
.rg-hero__lead { color: rgba(255,255,255,.85); line-height: 1.9; max-width: 46rem; margin: 0 0 1.5rem; font-size: 1.02rem; }
.rg-hero__meta { display: flex; flex-wrap: wrap; gap: .6rem; }
.rg-hero__meta span {
  display: inline-flex; align-items: center; gap: .4rem;
  font-size: .8rem; font-weight: 600; color: #fff;
  background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.22);
  border-radius: 99px; padding: .4rem .9rem;
}

/* ── Regulatory alert ─────────────────────────── */
.rg-alert {
  display: flex; gap: .8rem;
  background: var(--clr-bg);
  border: 1px solid var(--clr-border);
  border-inline-start: 4px solid #d97706;
  border-radius: var(--radius-md);
  padding: 1.1rem 1.25rem;
  margin-bottom: 1.5rem;
  line-height: 1.85;
}
.rg-alert__icon { flex-shrink: 0; font-size: 1.3rem; color: #d97706; }
.rg-alert strong { color: var(--clr-heading); }
.rg-alert p { margin: 0 0 .5rem; color: var(--clr-text); }
.rg-alert p:last-child { margin-bottom: 0; }

/* ── Quick nav (TOC) — sidebar card ───────────── */
.rg-toc {
  background: var(--clr-bg);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-lg);
  padding: 1.1rem 1.15rem;
}
.rg-toc h2 { font-size: .85rem; font-weight: 800; color: var(--clr-heading); margin: 0 0 .7rem; }
.rg-toc__grid { display: grid; gap: .15rem; }
.rg-toc a {
  display: flex; align-items: center; gap: .5rem;
  font-size: .76rem; font-weight: 600; color: var(--clr-text);
  text-decoration: none; padding: .35rem .5rem;
  border-radius: var(--radius-sm);
  transition: background .15s, color .15s;
}
.rg-toc a:hover { background: var(--clr-primary-lt); color: var(--clr-primary); }
.rg-toc a span.rg-toc__n {
  display: inline-flex; align-items: center; justify-content: center;
  width: 1.3rem; height: 1.3rem; flex-shrink: 0;
  border-radius: 50%; background: var(--clr-primary-lt); color: var(--clr-primary);
  font-size: .64rem; font-weight: 800;
}
/* ── Core principle banner ────────────────────── */
.rg-principle {
  background: linear-gradient(135deg, #eff6ff, #dbeafe);
  border: 1px solid #bfdbfe;
  border-radius: var(--radius-lg);
  padding: 1.5rem clamp(1.25rem, 3vw, 2rem);
  margin-bottom: 2rem;
}
html[data-theme="dark"] .rg-principle { background: linear-gradient(135deg,#0f1f3d,#132a52); border-color: #1e3a6a; }
.rg-principle h2 { font-size: 1.05rem; font-weight: 800; color: var(--clr-heading); margin: 0 0 1rem; }
.rg-principle__chain {
  display: flex; flex-wrap: wrap; align-items: center; gap: .4rem;
  margin-bottom: 1.25rem;
}
.rg-principle__chain span {
  font-size: .82rem; font-weight: 700; color: var(--clr-primary);
  background: var(--clr-bg); border: 1px solid var(--clr-border);
  border-radius: 99px; padding: .35rem .8rem;
}
.rg-principle__chain i { color: var(--clr-muted); font-style: normal; }
.rg-principle__list {
  display: flex; flex-wrap: wrap; gap: .5rem; margin: 0; padding: 0; list-style: none;
}
.rg-principle__list li {
  font-size: .78rem; font-weight: 700; color: var(--clr-heading);
  background: var(--clr-bg); border: 1px solid var(--clr-border);
  border-radius: var(--radius-sm); padding: .35rem .7rem;
}

/* ── Section ──────────────────────────────────── */
.rg-section {
  background: var(--clr-bg);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-lg);
  padding: clamp(1.25rem, 3vw, 2rem);
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-sm);
  scroll-margin-top: 5.5rem;
}
.rg-section__head { display: flex; align-items: center; gap: .85rem; margin-bottom: 1rem; }
.rg-section__num {
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; width: 2.4rem; height: 2.4rem;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg,#1e40af,#2563eb);
  color: #fff; font-weight: 800; font-size: 1.05rem;
}
.rg-section h2 { font-size: 1.2rem; font-weight: 800; color: var(--clr-heading); margin: 0; }
.rg-section__key { font-size: .95rem; color: var(--clr-muted); line-height: 1.8; margin: 0 0 1rem; }
.rg-section h3 { font-size: .95rem; font-weight: 800; color: var(--clr-heading); margin: 1.25rem 0 .6rem; }
.rg-section h3:first-of-type { margin-top: 0; }
.rg-section p { color: var(--clr-text); line-height: 1.9; margin: 0 0 .8rem; }
.rg-section ul.rg-list { margin: 0 0 .8rem; padding-inline-start: 1.3rem; line-height: 1.85; color: var(--clr-text); }
.rg-section ul.rg-list li { margin-bottom: .4rem; }

/* ── Boxes / frames ───────────────────────────── */
.rg-box {
  border-radius: var(--radius-md);
  padding: 1rem 1.15rem;
  margin: 0 0 1rem;
  line-height: 1.85;
  border: 1px solid var(--clr-border);
  background: var(--clr-bg-alt);
}
.rg-box__label { display: block; font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; margin-bottom: .4rem; }
.rg-box p:last-child { margin-bottom: 0; }
.rg-box--bad { background: #fef2f2; border-color: #fecaca; }
.rg-box--bad .rg-box__label { color: #b91c1c; }
html[data-theme="dark"] .rg-box--bad { background: #2a1414; border-color: #7f1d1d; }
.rg-box--good { background: #f0fdf4; border-color: #bbf7d0; }
.rg-box--good .rg-box__label { color: #15803d; }
html[data-theme="dark"] .rg-box--good { background: #0f2417; border-color: #166534; }
.rg-box--tip { background: #eff6ff; border-color: #bfdbfe; }
.rg-box--tip .rg-box__label { color: #1d4ed8; }
html[data-theme="dark"] .rg-box--tip { background: #0f1f3d; border-color: #1e3a6a; }
.rg-box--rule { background: #fffbeb; border-color: #fde68a; }
.rg-box--rule .rg-box__label { color: #b45309; }
html[data-theme="dark"] .rg-box--rule { background: #2a2107; border-color: #78350f; }

/* ── Example card (weak → strong walkthrough) ─── */
.rg-example { border: 1px solid var(--clr-border); border-radius: var(--radius-md); overflow: hidden; margin-bottom: 1rem; }
.rg-example__row { display: grid; grid-template-columns: 9rem 1fr; gap: .5rem; padding: .7rem 1rem; border-top: 1px solid var(--clr-border); }
.rg-example__row:first-child { border-top: none; background: var(--clr-primary-lt); }
.rg-example__row dt { font-size: .78rem; font-weight: 800; color: var(--clr-muted); }
.rg-example__row dd { margin: 0; font-size: .88rem; color: var(--clr-text); line-height: 1.8; }

/* ── Tables ───────────────────────────────────── */
.rg-table-wrap { overflow-x: auto; margin: 0 0 1rem; }
table.rg-table { width: 100%; border-collapse: collapse; font-size: .86rem; }
table.rg-table th {
  background: var(--clr-primary-lt); color: var(--clr-heading);
  font-weight: 800; text-align: start; padding: .6rem .8rem;
  border: 1px solid var(--clr-border);
}
table.rg-table td { padding: .6rem .8rem; border: 1px solid var(--clr-border); color: var(--clr-text); line-height: 1.7; vertical-align: top; }
table.rg-table tr:nth-child(even) td { background: var(--clr-bg-alt); }

/* ── Compare (weak vs strong) ─────────────────── */
.rg-compare { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; margin-bottom: .6rem; }
@media (max-width: 640px) { .rg-compare { grid-template-columns: 1fr; } }
.rg-compare > div { border-radius: var(--radius-sm); padding: .7rem .9rem; font-size: .85rem; line-height: 1.75; }
.rg-compare__weak { background: #fef2f2; color: #7f1d1d; border: 1px solid #fecaca; }
.rg-compare__strong { background: #f0fdf4; color: #14532d; border: 1px solid #bbf7d0; }
html[data-theme="dark"] .rg-compare__weak { background: #2a1414; border-color: #7f1d1d; color: #fca5a5; }
html[data-theme="dark"] .rg-compare__strong { background: #0f2417; border-color: #166534; color: #86efac; }
.rg-compare__tag { display: block; font-size: .68rem; font-weight: 800; text-transform: uppercase; margin-bottom: .3rem; opacity: .8; }

/* ── Applied model panel ──────────────────────── */
.rg-applied {
  background: linear-gradient(135deg, #0f172a, #1e293b);
  color: #fff;
  border-radius: var(--radius-lg);
  padding: clamp(1.25rem, 3vw, 2rem);
  margin-bottom: 2rem;
}
.rg-applied__eyebrow { font-size: .75rem; font-weight: 800; letter-spacing: .05em; color: #93c5fd; text-transform: uppercase; margin-bottom: .5rem; display: block; }
.rg-applied h2 { color: #fff; font-size: 1.15rem; line-height: 1.6; margin: 0 0 1.25rem; }
.rg-applied h4 { color: #bfdbfe; font-size: .82rem; font-weight: 800; margin: 1.1rem 0 .5rem; text-transform: uppercase; letter-spacing: .03em; }
.rg-applied h4:first-of-type { margin-top: 0; }
.rg-applied p { color: rgba(255,255,255,.88); line-height: 1.85; margin: 0 0 .7rem; }
.rg-applied ul { margin: 0 0 .7rem; padding-inline-start: 1.3rem; color: rgba(255,255,255,.88); line-height: 1.8; }
.rg-applied ul li { margin-bottom: .3rem; }
.rg-applied__grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
@media (max-width: 700px) { .rg-applied__grid { grid-template-columns: 1fr; } }

/* ── Oral exam pitch + Q&A ─────────────────────── */
.rg-pitch {
  background: var(--clr-primary-lt);
  border: 1px dashed var(--clr-primary);
  border-radius: var(--radius-md);
  padding: 1.1rem 1.25rem;
  font-size: .92rem; line-height: 2;
  color: var(--clr-heading);
  margin-bottom: 1.25rem;
}
.rg-qa { display: grid; gap: .6rem; }
.rg-qa__item {
  display: flex; gap: .9rem; align-items: flex-start;
  border: 1px solid var(--clr-border); border-radius: var(--radius-sm);
  padding: .75rem .9rem;
}
.rg-qa__q { flex: 1; font-weight: 700; color: var(--clr-heading); font-size: .88rem; }
.rg-qa__tests {
  flex-shrink: 0; font-size: .72rem; font-weight: 700; color: var(--clr-primary);
  background: var(--clr-bg-alt); border-radius: 99px; padding: .3rem .7rem;
  white-space: nowrap;
}

/* ── Checklist ─────────────────────────────────── */
.rg-checklist { list-style: none; margin: 0; padding: 0; display: grid; gap: .55rem; }
.rg-checklist li {
  display: flex; align-items: flex-start; gap: .6rem;
  font-size: .9rem; color: var(--clr-text); line-height: 1.7;
}
.rg-checklist li::before {
  content: '☐'; flex-shrink: 0; color: var(--clr-primary); font-size: 1.1rem; line-height: 1.4;
}

/* ── Final formula ─────────────────────────────── */
.rg-formula {
  background: linear-gradient(135deg,#1e3a8a,#2563eb);
  color: #fff;
  border-radius: var(--radius-lg);
  padding: clamp(1.5rem, 4vw, 2.5rem);
  text-align: center;
  margin-bottom: 2rem;
}
.rg-formula__eq { font-size: .95rem; font-weight: 700; line-height: 2; color: #dbeafe; max-width: 48rem; margin: 0 auto 1.25rem; }
.rg-formula__msg { font-size: 1.05rem; font-weight: 700; line-height: 1.9; max-width: 42rem; margin: 0 auto; }

/* ── Motivation letter: worked sample ──────────── */
.rg-letter {
  background: var(--clr-bg-alt);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-md);
  padding: 1.25rem 1.5rem;
  line-height: 2.1;
  font-size: .92rem;
  color: var(--clr-text);
  margin-bottom: 1rem;
}
.rg-letter p { margin: 0 0 1.1rem; }
.rg-letter p:last-child { margin-bottom: 0; }
.rg-letter__tag {
  display: inline-block;
  font-size: .66rem; font-weight: 800;
  color: var(--clr-primary); background: var(--clr-primary-lt);
  border-radius: 99px; padding: .15rem .65rem;
  margin-inline-end: .5rem; vertical-align: middle;
  white-space: nowrap;
}

/* ── References ────────────────────────────────── */
.rg-refs { background: var(--clr-bg); border: 1px solid var(--clr-border); border-radius: var(--radius-lg); padding: 1.5rem; }
.rg-refs h2 { font-size: 1rem; font-weight: 800; color: var(--clr-heading); margin: 0 0 1rem; }
.rg-refs ol { margin: 0; padding-inline-start: 1.4rem; }
.rg-refs li { font-size: .85rem; color: var(--clr-text); line-height: 1.9; margin-bottom: .4rem; }
.rg-refs a { color: var(--clr-primary); font-weight: 700; }
.rg-refs__note { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--clr-border); font-size: .76rem; color: var(--clr-muted); line-height: 1.8; }

/* ── Also read: related modules ────────────────── */
.rg-also__head {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: .6rem;
  margin-bottom: 1rem;
}
.rg-also__head h2 { font-size: 1.05rem; font-weight: 800; color: var(--clr-heading); margin: 0; }
.rg-also__all { font-size: .82rem; font-weight: 700; color: var(--clr-primary); text-decoration: none; flex-shrink: 0; }
.rg-also__all:hover { text-decoration: underline; }
.rg-also__grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
@media (max-width: 700px) { .rg-also__grid { grid-template-columns: 1fr; } }
.rg-also__card {
  display: flex; flex-direction: column; gap: .4rem;
  background: var(--clr-bg); border: 1px solid var(--clr-border); border-radius: var(--radius-lg);
  padding: 1.1rem 1.15rem;
  text-decoration: none;
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.rg-also__card:hover { border-color: var(--clr-primary); box-shadow: var(--shadow-sm); transform: translateY(-2px); }
.rg-also__icon { font-size: 1.4rem; }
.rg-also__title { font-size: .92rem; font-weight: 800; color: var(--clr-heading); line-height: 1.5; }
.rg-also__desc { font-size: .78rem; color: var(--clr-muted); line-height: 1.7; }
