/* ==================== CORE VARIABLES & RESET ==================== */
:root {
  --bg: #fff;
  --text: #0b1220;
  --muted: #556070;
  --stroke: #e3e7ef;
  --card: #f6f7fb;
  --shadow: 0 10px 24px rgba(0,0,0,.1);
  --shadow-lg: 0 16px 36px rgba(0,0,0,.15);
  --radius: 8px;
}

html[data-theme="dark"] {
  --bg: #0b1220;
  --text: #e6eaf2;
  --muted: #8f9bb1;
  --stroke: #243251;
  --card: #121a2b;
  --shadow: 0 10px 24px rgba(0,0,0,.55);
  --shadow-lg: 0 16px 36px rgba(0,0,0,.65);
}

/* ===== Manual Dark Mode (theme switcher) ===== */
html[data-theme="dark"], :root[data-theme="dark"] {
  --bg:#161b22;
  --text:#e8eef7;
  --muted:#a9b4c8;
  --stroke:#29313b;
  --card:#0f141a;
  --shadow:0 10px 24px rgba(0,0,0,.55);
  --shadow-lg:0 16px 36px rgba(0,0,0,.65);
}

* { box-sizing: border-box; }
html, body { height: 100%; 
max-width: 100%;
    overflow-x: hidden;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img, svg { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }

.wrap { max-width: 1180px; margin: 0 auto; padding: 0 20px; }
.section { padding: 48px 0 24px; }
.section-title { font-size: 32px; line-height: 1.2; margin: 0 0 18px; color:var(--text)}

/* ==================== NAVIGATION ==================== */
.navbar {
  background: linear-gradient(90deg, #0a1931 0%, #102a55 100%);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 2000; /* Priority from latest.css */
  box-shadow: 0 2px 10px rgba(0,0,0,.25);
  transition: background .3s ease;
  min-height: 56px;
}

@media (max-width:768px){
  .navbar{position:relative}
}

.brand, .site-title {
  font-weight: 800;
  font-size: 22px;
  letter-spacing: .2px;
  color: #fff;
  font-family: Segoe UI, sans-serif;
  text-shadow: 0 2px 6px rgba(0,0,0,.35), 0 0 8px rgba(255,255,255,.15);
  transition: all .3s ease;
}

.nav-menu { display: flex; gap: 24px; }

.nav-link {
  color: #e4ebfa;
  font-weight: 600;
  transition: color .25s ease;
}

.nav-link:hover, .nav-link:focus {
  color: #fff;
  outline: 2px solid rgba(255,255,255,0.5);
}

.nav-toggle {
  display: none;
  width: 44px;
  height: 36px;
  border: 0;
  background: 0 0;
  cursor: pointer;
}

.nav-toggle .bar {
  display: block;
  width: 26px;
  height: 2px;
  background: #fff;
  margin: 5px auto;
  border-radius: 2px;
}

/* ==================== HERO SECTION ==================== */
.hero {
  padding: 56px 0 24px;
  display: grid;
  place-items: center;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(300px, 520px);
  gap: 1.5rem;
  align-items: center;
}

.hero-copy h1 { font-size: 42px; line-height: 1.1; margin: 0 0 12px; }

.hero-lead {
  color: var(--muted);
  font-size: 18px;
  margin: 0 0 18px;
  line-height: 1.5;
  text-wrap: balance;
}

.eyebrow {
  display: inline-block;
  background: #e8f0ff;
  color: #1d6ef2;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .4px;
  text-transform: uppercase;
}

html[data-theme="dark"] .eyebrow {
  background: #1b2a4a;
  color: #cfe0ff;
  border: 1px solid #2a3a5a;
  box-shadow: 0 1px 0 rgba(0,0,0,.35), inset 0 1px 0 rgba(255,255,255,.05);
}

.hero-media {
  justify-self: end;
  inline-size: min(520px, 40vw);
  aspect-ratio: 2/1;
}

.hero-media img { width: 80%; height: 100%; object-fit: contain; }

/* ==================== BUTTONS ==================== */
.btn-modern {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  padding: .85rem 1.15rem;
  border-radius: 12px;
  font-weight: 700;
  font-size: 16px;
  border: 1px solid transparent;
  transition: transform .06s ease, box-shadow .2s ease, background .2s ease;
  line-height: 1;
  min-height: 44px;
  white-space: nowrap;
  min-inline-size: 9ch;
}

.btn-modern:active { transform: translateY(1px); }

.btn-primary {
  background-color: #2d7cff;
  color: #fff;
  padding: 12px 20px;
  font-size: 16px;
  font-weight: 500;
  border-radius: 8px;
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-ghost {
  background: #fff;
  color: #1d6ef2;
  border-color: #d9e1f0;
}

.btn-ghost:hover { border-color: #1d6ef2; }

.btn-brand {
  background-color: #1d6ef2!important;
  border-color: #1d6ef2!important;
  color: #fff!important;
}

.btn-large-center {
  display: block;
  margin: 40px auto;
  width: 50%;
  max-width: 360px;
  font-size: 1.2rem;
  padding: 18px 0;
  text-align: center;
}

.hero-cta { display: flex; gap: 12px; flex-wrap: wrap; }

/* ==================== TOPICS GRID ==================== */
.topics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 24px;
  padding: 20px 0;
}

.topic-card {
  background: linear-gradient(135deg, #ffffff 0%, #f8faff 100%);
  border: 1px solid #e8edff;
  border-radius: 20px;
  padding: 24px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(45, 124, 255, 0.08);
}

.topic-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, #2d7cff, #6c8eff);
  transform: scaleX(0);
  transition: transform 0.3s ease;
}

.topic-card:hover {
  transform: translateY(-6px);
  border-color: #2d7cff;
  box-shadow: 0 12px 32px rgba(45, 124, 255, 0.15);
}

.topic-card:hover::before { transform: scaleX(1); }

.topic-icon {
  width: 60px; height: 60px;
  border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #2d7cff 0%, #6c8eff 100%);
  color: white; font-size: 24px; flex-shrink: 0;
}

.topic-title { font-size: 18px; font-weight: 600; color: #1a2b4c; margin-bottom: 4px; color:var(--text)}
.topic-description { font-size: 14px; color: #64748b; line-height: 1.5; }

/* Meta & Stats (from old.css) */
.topic-meta {
  display: flex; align-items: center; gap: 16px;
  margin-top: 16px; padding-top: 16px; border-top: 1px solid #f1f5f9;
}
.topic-stat { display: flex; align-items: center; gap: 6px; font-size: 13px; color: #64748b; }

/* ==================== EXAM & QUIZ STYLES ==================== */
.page-quiz .card {
  border-radius: 16px;
  border: 1px solid var(--stroke);
  background: var(--card);
  box-shadow: var(--shadow);
  margin: 0 auto;
  max-width: 1200px;
  padding: 1.5rem;
}

.exam-header {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 1.5rem;
  padding: 1.25rem 1.5rem;
  background: var(--card);
  border-bottom: 2px solid var(--stroke);
  margin-bottom: 1.5rem;
}

#quiz-wrapper {
  background-color: var(--card) !important;
  border-radius: 12px;
  padding: 30px !important; 
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
  margin-bottom: 2rem;
}

.option-box {
  background: var(--card);
  border: 2px solid var(--stroke);
  border-radius: 12px;
  cursor: pointer !important;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  padding: 1rem;
  margin-bottom: 1rem;
  user-select: none;
  touch-action: manipulation;
  gap: 7px;
}

.option-box * { pointer-events: none; } /* Prevents child clicks from breaking logic */

.option-box:hover { border-color: #2d7cff; transform: translateY(-2px); }

.option-box.selected {
  background: rgba(45, 124, 255, 0.1) !important;
  border-color: #2d7cff !important;
}

.option-box.correct {
  background: #d1e7dd !important;
  border-color: #0f5132 !important;
  color: #0f5132 !important;
}

.option-box.incorrect {
  background: #f8d7da !important;
  border-color: #842029 !important;
  color: #842029 !important;
}

.option-letter {
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--stroke);
  border-radius: 50%;
  font-weight: 700;
  
  margin-right: 3px;
}

.option-box.selected .option-letter {
  background: #2d7cff; border-color: #2d7cff; color: white;
}

/* Quick Nav */
#question-nav { display: grid; grid-template-columns: repeat(10, 1fr); gap: 0.5rem; }
.question-nav-item {
  width: 42px; height: 42px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 10px; font-weight: 600; cursor: pointer;
}
.question-nav-item.current { background: #2d7cff; color: white; }
.question-nav-item.answered { background: #10b981; color: white; }
.question-nav-item.flagged { background: #f59e0b; color: white; }

/* ==================== MISC COMPONENTS (BLOG/PAGES) ==================== */
.blog-card {
  max-width: 100%; margin: 2rem auto; padding: 2rem;
  border-radius: 1rem; box-shadow: 0 0 25px rgba(0,0,0,.05);
}

.video-container {
  position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden;
  border-radius: 12px;
}

.video-container iframe { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }

.category-icon {
  font-size: 1.6rem; width: 3.2rem; height: 3.2rem;
  border-radius: 0.75rem; display: flex; align-items: center; justify-content: center;
  margin: 0 auto 1rem; color: white;
}

/* Legal/Policy Pages */
.pp-container, .tos-container { max-width: 900px; }
.pp-section h2, .tos-section h2 { font-size: 1.25rem; margin-top: 1.5rem; }

/* ==================== DARK MODE OVERRIDES ==================== */
html[data-theme="dark"] .topic-card {
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  border-color: #334155;
}

html[data-theme="dark"] .option-box { background: #1e293b; border-color: #334155; }

html[data-theme="dark"] .option-box.correct {
  background: #103024 !important; border-color: #198754 !important; color: #d1e7dd !important;
}

html[data-theme="dark"] .option-box.incorrect {
  background: #2a1719 !important; border-color: #dc3545 !important; color: #f8d7da !important;
}

/* ==================== RESPONSIVE DESIGN ==================== */
@media (max-width: 800px) {
  .nav-toggle { display: block; }
  .nav-menu {
    position: fixed; top: 64px; left: 0; right: 0; bottom: 0;
    background: #0a1931; display: none; flex-direction: column; padding: 20px;
  }
  .nav-menu.open { display: flex; }
}

@media (max-width: 768px) {
  .hero-grid { grid-template-columns: 1fr; }
  .hero-media { display: none !important; }
  .topics-grid { grid-template-columns: 1fr; gap: 16px; }
  
  .btn-primary, .btn-large-center { width: 100%; }
  
  #quiz-wrapper { padding: 20px !important; }
  
  .option-box:active { transform: scale(0.98); background: rgba(45, 124, 255, 0.05); }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: .001ms !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
}

/* Fix for study.php navigation overflow */
@media (max-width: 768px) {
    .page-study .d-flex.justify-content-between.align-items-center.mb-3 {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 15px;
    }

    .page-study .btn-group {
        display: flex !important;
        flex-wrap: wrap; /* Allows buttons to drop to next line */
        width: 100%;
    }

    .page-study .btn-group .btn {
        flex: 1 1 auto; /* Allows buttons to grow and fill space */
        font-size: 0.85rem;
        padding: 8px 4px;
    }
}

/* ==================== DARK MODE SPECIFICS ==================== */
html[data-theme="dark"] .option-box.selected {
  background: rgba(45, 124, 255, 0.2) !important;
  border-color: #3b82f6 !important;
}

html[data-theme="dark"] .option-box.correct {
  background: #103024 !important;
  border-color: #198754 !important;
  color: #d1e7dd !important;
}

html[data-theme="dark"] .option-box.incorrect {
  background: #2a1719 !important;
  border-color: #dc3545 !important;
  color: #f8d7da !important;
}

html[data-theme="dark"] #quiz-wrapper {
	color: #f1f1f1fc;
}
	
	
html[data-theme="dark"] #explanation {
	color: #f1f1f1fc;
	background: #3f3c3c;
}

.ad-header {
    min-height: 90px;
    margin: 16px 0;
    display: flex;
    justify-content: center;
    align-items: center;
}

.ad-header ins.adsbygoogle {
    display: block !important;
    width: 100% !important;
    max-width: 970px;   /* optional but recommended */
}

@media (max-width: 768px) {
    .ad-header {
        min-height: 60px;
    }
}


/* === Quiz Footer Horizontal Ad (Mobile-Safe) === */
.quiz-footer-ad {
    width: 100%;
    max-width: 100%;
    margin: 20px auto;
    padding: 8px 0;
    text-align: center;

    /* Prevent overflow */
    overflow: hidden;

    /* Reserve space (CLS-safe) */
    min-height: 90px;

    border-top: 1px solid rgba(0, 0, 0, 0.06);
}

/* AdSense container fix */
.quiz-footer-ad ins.adsbygoogle {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;   /* 🔑 CRITICAL FIX */
    margin: 0 auto;
}

/* Mobile */
@media (max-width: 768px) {
    .quiz-footer-ad {
        min-height: 60px;
        padding: 6px 0;
    }
}


/* Centers the CTA container and adds margin for Ads */
.hero-cta {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 40px 0; /* Creates 40px space above and below the button for Ads */
    width: 100%;
}

/* Makes the button Big and Bold */
.hero-cta .btn-lg {
    padding: 18px 45px;
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    border-radius: 12px;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.hero-cta .btn-lg:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}



.question-video video, 
.question-video iframe {
    width: 100%;
    border-radius: 16px;
    background: #000;
}

/* Subtle pulse effect for video questions to grab attention */
.question-video {
    position: relative;
    padding: 4px;
    background: linear-gradient(45deg, #2d7cff, #6c8eff);
    border-radius: 20px;
    margin-bottom: 20px;
}