/* ════════════════════════════════════════════════
   ATLAS — Custom Stylesheet
   Palette: Navy #0b1340 | Gold #c9a227 | Dark #070c1e
   ════════════════════════════════════════════════ */

:root {
  --bg:         #070c1e;
  --surface:    #0d1535;
  --surface2:   #111a40;
  --gold:       #c9a227;
  --gold-dim:   rgba(201,162,39,.18);
  --gold-border:rgba(201,162,39,.3);
  --red:        #c0392b;
  --red-dim:    rgba(192,57,43,.18);
  --text:       #e8eaf6;
  --muted:      #8892b0;
  --border:     rgba(255,255,255,.08);
  --radius:     8px;
  --fn-ar:      'Tajawal', sans-serif;
  --fn-serif:   'Libre Baskerville', serif;
  --fn-sans:    'Inter', sans-serif;
  --shadow:     0 8px 32px rgba(0,0,0,.45);
}

/* ── Base ─────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--fn-ar);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}
.ltr-body { font-family: var(--fn-sans); }
main { flex: 1; }

a { color: var(--gold); text-decoration: none; }
a:hover { color: #e6be3a; }

/* ── Typography ──────────────────────────── */
.section-title {
  font-size: 1.8rem;
  font-weight: 900;
  color: #fff;
  position: relative;
  display: inline-block;
  margin-bottom: 1.5rem;
}
.section-title::after {
  content: '';
  display: block;
  width: 48px; height: 3px;
  background: var(--gold);
  margin-top: .4rem;
  border-radius: 2px;
}
.rtl-body .section-title::after { margin-right: 0; }

/* ── Navbar ───────────────────────────────── */
.atlas-nav {
  background: rgba(7,12,30,.95);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  padding: .6rem 0;
}
.atlas-brand {
  display: flex;
  align-items: center;
  gap: .6rem;
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--gold) !important;
  text-decoration: none;
}
.brand-icon {
  width: 34px; height: 34px;
  background: var(--gold-dim);
  border: 1px solid var(--gold-border);
  border-radius: 6px;
  display: grid;
  place-items: center;
  font-size: .9rem;
  color: var(--gold);
  flex-shrink: 0;
}
.atlas-nav .nav-link {
  color: var(--muted);
  font-size: .82rem;
  font-weight: 500;
  padding: .4rem .65rem;
  border-radius: 5px;
  transition: all .2s;
}
.atlas-nav .nav-link:hover,
.atlas-nav .nav-link.active {
  color: var(--gold);
  background: var(--gold-dim);
}
.navbar-toggler { border-color: var(--border); }
.navbar-toggler-icon { filter: invert(1); }

/* ── Buttons ──────────────────────────────── */
.btn-gold {
  background: var(--gold);
  color: #000 !important;
  border: none;
  font-weight: 700;
  border-radius: 5px;
  padding: .4rem 1rem;
  font-size: .82rem;
  transition: all .2s;
}
.btn-gold:hover { background: #e6be3a; transform: translateY(-1px); }

.btn-outline-gold {
  border: 1px solid var(--gold-border);
  color: var(--gold) !important;
  background: transparent;
  border-radius: 5px;
  padding: .4rem 1rem;
  font-size: .82rem;
  transition: all .2s;
}
.btn-outline-gold:hover { background: var(--gold-dim); }

.btn-ghost-red {
  border: 1px solid rgba(192,57,43,.3);
  color: var(--red) !important;
  background: transparent;
  border-radius: 5px;
  padding: .4rem 1rem;
  font-size: .82rem;
  transition: all .2s;
}
.btn-ghost-red:hover { background: var(--red-dim); }

.btn-lang {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 5px;
  font-size: .78rem;
}
.btn-lang:hover { border-color: var(--gold-border); color: var(--gold); }

.lang-menu {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-width: 160px;
}
.lang-menu .dropdown-item {
  color: var(--muted);
  font-size: .82rem;
  padding: .45rem 1rem;
}
.lang-menu .dropdown-item:hover,
.lang-menu .dropdown-item.active {
  background: var(--gold-dim);
  color: var(--gold);
}

/* ── Cards ────────────────────────────────── */
.atlas-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: all .25s;
  overflow: hidden;
}
.atlas-card:hover {
  border-color: var(--gold-border);
  box-shadow: 0 0 0 1px var(--gold-border), var(--shadow);
  transform: translateY(-3px);
}
.atlas-card .card-header-accent {
  background: var(--gold-dim);
  border-bottom: 1px solid var(--gold-border);
  padding: .75rem 1.2rem;
  display: flex;
  align-items: center;
  gap: .6rem;
  color: var(--gold);
  font-weight: 700;
  font-size: .92rem;
}
.atlas-card .card-body { padding: 1.2rem; }
.atlas-card .card-icon {
  width: 42px; height: 42px;
  border-radius: 8px;
  background: var(--gold-dim);
  border: 1px solid var(--gold-border);
  display: grid; place-items: center;
  color: var(--gold);
  font-size: 1rem;
  flex-shrink: 0;
}

/* ── Section cards on landing ─────────────── */
.section-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 2rem 1.5rem;
  transition: all .25s;
  text-decoration: none !important;
  display: block;
  height: 100%;
}
.section-card:hover {
  border-color: var(--gold-border);
  background: var(--surface2);
  transform: translateY(-4px);
  box-shadow: 0 12px 36px rgba(0,0,0,.4), 0 0 0 1px var(--gold-border);
}
.section-card .sc-icon {
  font-size: 2.2rem;
  color: var(--gold);
  margin-bottom: 1rem;
}
.section-card .sc-title {
  font-size: 1.1rem;
  font-weight: 800;
  color: #fff;
  margin-bottom: .5rem;
}
.section-card .sc-desc {
  font-size: .82rem;
  color: var(--muted);
  line-height: 1.7;
}

/* ── Hero ─────────────────────────────────── */
.atlas-hero {
  background: radial-gradient(ellipse at 50% 0%, rgba(201,162,39,.12) 0%, transparent 65%),
              linear-gradient(180deg, var(--surface) 0%, var(--bg) 100%);
  border-bottom: 1px solid var(--border);
  padding: 5rem 0 4rem;
  text-align: center;
}
.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  background: var(--gold-dim);
  border: 1px solid var(--gold-border);
  color: var(--gold);
  border-radius: 50px;
  padding: .3rem 1rem;
  font-size: .75rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
}
.hero-title {
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 900;
  color: #fff;
  line-height: 1.15;
  margin-bottom: .75rem;
}
.hero-title span { color: var(--gold); }
.hero-sub {
  font-size: 1rem;
  color: var(--muted);
  max-width: 560px;
  margin: 0 auto 2rem;
  line-height: 1.7;
}

/* ── Auth pages ───────────────────────────── */
.auth-wrap {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at 50% 10%, rgba(201,162,39,.1) 0%, transparent 60%), var(--bg);
  padding: 2rem 1rem;
}
.auth-box {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2.5rem 2rem;
  box-shadow: var(--shadow);
}
.auth-logo {
  text-align: center;
  margin-bottom: 1.75rem;
}
.auth-logo .logo-icon {
  width: 52px; height: 52px;
  border-radius: 10px;
  background: var(--gold-dim);
  border: 1px solid var(--gold-border);
  display: grid; place-items: center;
  color: var(--gold);
  font-size: 1.4rem;
  margin: 0 auto .75rem;
}
.auth-logo h2 {
  font-size: 1.3rem;
  font-weight: 800;
  color: #fff;
  margin-bottom: .3rem;
}
.auth-logo p { font-size: .82rem; color: var(--muted); }
.form-label { font-size: .82rem; color: var(--muted); margin-bottom: .35rem; }
.form-control {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  padding: .6rem .9rem;
  font-size: .9rem;
  transition: border-color .2s;
}
.form-control:focus {
  background: var(--surface2);
  border-color: var(--gold-border);
  color: var(--text);
  box-shadow: 0 0 0 3px rgba(201,162,39,.15);
}
.form-control::placeholder { color: rgba(136,146,176,.5); }
.form-select {
  background-color: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  padding: .6rem .9rem;
  font-size: .9rem;
}
.form-select:focus {
  border-color: var(--gold-border);
  box-shadow: 0 0 0 3px rgba(201,162,39,.15);
  background-color: var(--surface2);
  color: var(--text);
}
.form-select option { background: var(--surface2); }

/* ── Dashboard ────────────────────────────── */
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.2rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}
.stat-icon {
  width: 48px; height: 48px;
  border-radius: 8px;
  background: var(--gold-dim);
  border: 1px solid var(--gold-border);
  display: grid; place-items: center;
  color: var(--gold);
  font-size: 1.2rem;
  flex-shrink: 0;
}
.stat-value { font-size: 1.6rem; font-weight: 900; color: #fff; line-height: 1; }
.stat-label { font-size: .75rem; color: var(--muted); margin-top: .2rem; }

/* ── Page header strip ────────────────────── */
.page-strip {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 2rem 0;
}
.page-strip h1 { font-size: 1.6rem; font-weight: 900; color: #fff; }
.page-strip p  { color: var(--muted); font-size: .88rem; margin-top: .3rem; }

/* ── Accordion (lessons) ──────────────────── */
.accordion-item {
  background: var(--surface);
  border: 1px solid var(--border) !important;
  border-radius: var(--radius) !important;
  margin-bottom: .75rem;
  overflow: hidden;
}
.accordion-header .accordion-button {
  background: var(--surface);
  color: var(--text);
  font-weight: 700;
  font-size: .95rem;
  border: none;
  gap: .75rem;
  padding: 1rem 1.25rem;
}
.accordion-button::after { filter: invert(1); }
.accordion-button:not(.collapsed) {
  background: var(--gold-dim);
  color: var(--gold);
  box-shadow: none;
}
.accordion-body { background: var(--bg); padding: 1.25rem; }

.subject-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1rem;
  margin-bottom: .75rem;
  cursor: pointer;
  transition: all .2s;
}
.subject-card:hover { border-color: var(--gold-border); background: var(--surface2); }
.subject-card.active-subject { border-color: var(--gold); background: var(--gold-dim); }

/* ── Tables ───────────────────────────────── */
.atlas-table { width: 100%; }
.atlas-table th {
  background: var(--surface2);
  color: var(--gold);
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .06em;
  padding: .75rem 1rem;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
}
.atlas-table td {
  padding: .8rem 1rem;
  border-bottom: 1px solid var(--border);
  font-size: .88rem;
  color: var(--text);
  vertical-align: middle;
}
.atlas-table tr:last-child td { border-bottom: none; }
.atlas-table tr:hover td { background: var(--surface); }

/* ── Badges ───────────────────────────────── */
.badge-gold { background: var(--gold-dim); color: var(--gold); border: 1px solid var(--gold-border); border-radius: 4px; padding: .15rem .55rem; font-size: .68rem; font-weight: 600; }
.badge-red  { background: var(--red-dim);  color: var(--red);  border: 1px solid rgba(192,57,43,.3); border-radius: 4px; padding: .15rem .55rem; font-size: .68rem; }
.badge-blue { background: rgba(74,144,217,.15); color: #4a90d9; border: 1px solid rgba(74,144,217,.3); border-radius: 4px; padding: .15rem .55rem; font-size: .68rem; }

/* ── Quiz ─────────────────────────────────── */
.quiz-wrap { max-width: 720px; margin: 0 auto; }
.quiz-option {
  display: block;
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: .9rem 1.2rem;
  color: var(--text);
  text-align: inherit;
  cursor: pointer;
  transition: all .2s;
  font-size: .92rem;
  margin-bottom: .6rem;
}
.quiz-option:hover  { border-color: var(--gold-border); background: var(--gold-dim); color: var(--gold); }
.quiz-option.correct{ border-color: #27ae60; background: rgba(39,174,96,.15); color: #27ae60; pointer-events: none; }
.quiz-option.wrong  { border-color: var(--red); background: var(--red-dim); color: var(--red); pointer-events: none; }
.quiz-option.disabled{ opacity: .5; pointer-events: none; }
.quiz-progress { height: 4px; background: var(--border); border-radius: 2px; overflow: hidden; margin-bottom: 1.5rem; }
.quiz-progress-bar { height: 100%; background: var(--gold); border-radius: 2px; transition: width .4s ease; }
.quiz-score-circle {
  width: 140px; height: 140px;
  border-radius: 50%;
  border: 4px solid var(--gold);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  margin: 0 auto 2rem;
  font-size: 2.4rem;
  font-weight: 900;
  color: var(--gold);
}
.quiz-score-circle small { font-size: .75rem; font-weight: 400; color: var(--muted); display: block; margin-top: .2rem; }

/* ── Conflict zones info card ─────────────── */
.conflict-card {
  position: fixed;
  top: 50%; right: 1.5rem;
  transform: translateY(-50%) translateX(110%);
  z-index: 30;
  width: 320px;
  background: rgba(4,9,24,.94);
  border: 1px solid rgba(192,57,43,.3);
  border-radius: 4px;
  backdrop-filter: blur(24px);
  box-shadow: 0 0 40px rgba(192,57,43,.12), 0 24px 48px rgba(0,0,0,.7);
  transition: transform .65s cubic-bezier(.16,1,.3,1);
  overflow: hidden;
}
.conflict-card.visible { transform: translateY(-50%) translateX(0); }
[dir="rtl"] .conflict-card { right: auto; left: 1.5rem; transform: translateY(-50%) translateX(-110%); }
[dir="rtl"] .conflict-card.visible { transform: translateY(-50%) translateX(0); }

/* ── Alerts ───────────────────────────────── */
.alert-atlas {
  border-radius: 6px;
  border: 1px solid;
  padding: .75rem 1rem;
  font-size: .88rem;
  margin-bottom: 1rem;
}
.alert-danger  { background: var(--red-dim);  border-color: rgba(192,57,43,.3); color: #e74c3c; }
.alert-success { background: rgba(39,174,96,.1); border-color: rgba(39,174,96,.3); color: #27ae60; }
.alert-info    { background: rgba(74,144,217,.1); border-color: rgba(74,144,217,.3); color: #4a90d9; }

/* ── Footer ───────────────────────────────── */
.atlas-footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  margin-top: auto;
}
.footer-brand { color: var(--gold); font-weight: 800; font-size: 1rem; }
.footer-copy  { font-size: .75rem; color: var(--muted); }
.footer-links { display: flex; flex-wrap: wrap; gap: 1rem; justify-content: flex-end; }
.footer-links a { font-size: .78rem; color: var(--muted); }
.footer-links a:hover { color: var(--gold); }
[dir="rtl"] .footer-links { justify-content: flex-start; }

/* ── Utility ──────────────────────────────── */
.text-gold  { color: var(--gold) !important; }
.text-muted-atlas { color: var(--muted) !important; }
.bg-surface { background: var(--surface) !important; }
.border-gold{ border-color: var(--gold-border) !important; }
.divider { border-top: 1px solid var(--border); margin: 1.25rem 0; }
.mono { font-family: 'Courier New', monospace; font-size: .8em; }

/* Search input */
.search-input {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: .6rem 1rem;
  color: var(--text);
  font-size: .88rem;
  width: 100%;
  transition: border-color .2s;
}
.search-input:focus { outline: none; border-color: var(--gold-border); }
.search-input::placeholder { color: rgba(136,146,176,.5); }

/* Thread indicator dot */
.threat-fill { height: 4px; background: linear-gradient(90deg,#e67e22,#c0392b); border-radius: 2px; transition: width 1.2s ease .3s; }
.threat-track { height: 4px; background: var(--border); border-radius: 2px; overflow: hidden; }

/* Page spinner */
.page-loader { position: fixed; inset: 0; background: var(--bg); display: grid; place-items: center; z-index: 9999; transition: opacity .4s; }
.page-loader.hidden { opacity: 0; pointer-events: none; }

/* Responsive tweaks */
@media (max-width: 768px) {
  .atlas-hero { padding: 3rem 0 2.5rem; }
  .hero-title { font-size: 1.8rem; }
  .section-card { padding: 1.5rem 1.2rem; }
  .conflict-card { width: calc(100vw - 2rem); right: 1rem; left: 1rem; }
  [dir="rtl"] .conflict-card { right: 1rem; left: 1rem; }
}
