/* =========================================
   SecureScholar — Modules stylesheet
   (Module 1 + shared module styling)
   ========================================= */

/* Theme tokens */
:root {
  --text: #0b1020;
  --muted: #55607a;
  --primary: #2563eb;
  --primary-600: #1e40af;
  --accent: #fbbf24;
  --surface: #ffffff;
  --radius: 14px;
}

/* Base */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  color: var(--text);
  background: linear-gradient(135deg, #f5f7ff, #eef2ff);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  line-height: 1.6;
}

/* Layout */
.container { max-width: 900px; margin: 0 auto; padding: 1.5rem; }

/* Module hero/header */
.module-hero {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;
  text-align: center;
  padding: 2.25rem 0 1.5rem;
}
.module-hero h1 { margin: 0 0 .25rem; }
.module-hero .tagline { opacity: .95; margin: .25rem 0 1rem; }
.badge {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .45rem .7rem; border-radius: 999px; font-size: .9rem;
  background: #fff; color: #111; border: 1px dashed rgba(0,0,0,.15);
}

/* Linear progress bar (hero) */
.progress {
  height: 10px; background: rgba(255,255,255,.65);
  border-radius: 8px; overflow: hidden; margin: .8rem auto 0;
  border: 1px solid rgba(0,0,0,.08);
  max-width: 560px;
}
.progress > div {
  height: 100%; width: 0%; background: var(--accent);
  transition: width .3s ease;
}

/* Circular progress ring */
.ring-wrap { display: flex; justify-content: center; margin: 1rem 0; }
.ring { width: 100px; height: 100px; }
.ring .bg { fill: none; stroke: #e5e7eb; stroke-width: 12; }
.ring .fg {
  fill: none; stroke: #7B61FF; stroke-width: 12; stroke-linecap: round;
  transform: rotate(-90deg); transform-origin: 50% 50%;
  stroke-dasharray: 327; stroke-dashoffset: 327;
  transition: stroke-dashoffset .5s ease;
}
.ring-text { font-size: 20px; fill: #1e3a8a; dominant-baseline: middle; }

/* Sections */
.section { padding: 2.25rem 0; }
.section-title { margin: 0 0 1rem; color: #1e3a8a; }

/* Cards */
.card {
  background: var(--surface);
  border-radius: 16px;
  padding: 1.5rem;
  margin: 1rem 0;
  box-shadow: 0 4px 20px rgba(0,0,0,.05);
  transition: transform .2s ease, box-shadow .2s ease;
}
.card:hover { transform: translateY(-3px); box-shadow: 0 8px 25px rgba(0,0,0,.08); }
.card h3 { margin: 0 0 .5rem; color: #1e3a8a; }
.bullets { margin: .5rem 0 0 1rem; }
.bullets li { margin-bottom: .4rem; }

/* Creator Notes */
.creator-note {
  margin-top: .8rem;
  padding: .7rem 1rem;
  border-left: 4px solid #7B61FF33;
  background: #f8fbff;
  border-radius: 10px;
  font-size: .95rem;
  font-style: italic;
  line-height: 1.6;
}

/* Buttons */
.btn {
  display: inline-block; background: #fff; color: var(--primary);
  border: 1px solid rgba(37,99,235,.3);
  border-radius: 10px; padding: .7rem 1.1rem;
  text-decoration: none; font-weight: 600;
  transition: transform .1s ease, background .2s ease, box-shadow .2s ease;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 5px 16px rgba(37,99,235,.25); }
.btn-primary { background: var(--primary); color: #fff; border-color: transparent; }
.btn-primary:hover { background: var(--primary-600); }
.btn-xl { font-size: 1.15rem; padding: 1.05rem 1.6rem; border-radius: 14px; }

.cta-center { text-align: center; margin-top: 1rem; }

/* Module nav */
.module-nav { display: flex; justify-content: center; gap: .75rem; flex-wrap: wrap; margin: 1.25rem 0 0; }

/* Responsive */
@media (max-width: 600px) {
  .card { padding: 1.2rem; }
  .btn-xl { width: 92%; font-size: 1.05rem; }
  .creator-note { font-size: .9rem; }
}

/* Confetti animation (used by quiz) */
@keyframes confetti-fall {
  0% { opacity: 1; transform: translate(-50%,-50%) translate(0,0) rotate(0deg); }
  100% { opacity: 0; transform: translate(-50%,-50%) translate(var(--dx), var(--dy)) rotate(420deg); }
}

/* Optional dark-mode touches */
@media (prefers-color-scheme: dark) {
  body { background: linear-gradient(135deg, #0f172a, #111827); color: #e5e7eb; }
  .card { background: #0b1220; border: 1px solid rgba(255,255,255,.06); }
  .creator-note { background: #0f1a33; border-left-color: #7B61FF55; }
  .badge { background: #0b1220; color: #e5e7eb; border-color: rgba(255,255,255,.12); }
  .progress { background: rgba(255,255,255,.2); }
  .ring .bg { stroke: #25324a; }
  .ring-text { fill: #c7d2fe; }
}

/* ----- Dark-mode readability tune-up ----- */
@media (prefers-color-scheme: dark) {
  /* Base body text a touch brighter */
  body { color: #e6e8ee; }

  /* Card background + text */
  .card {
    background: #0b1220;
    color: #e6e8ee; /* brighter paragraph text */
    border: 1px solid rgba(255,255,255,0.06);
  }

  /* Section and card headings */
  .section-title,
  .card h3 { color: #c7d2fe; }        /* soft indigo */
  
  /* Creator note box */
  .creator-note {
    background: #0f1a33;              /* deeper navy chip */
    color: #e9eefc;                    /* lighter text */
    border-left-color: #8b5cf6;        /* brighter accent */
  }

  /* Muted helper text */
  .muted { color: #9fb0ca; }

  /* Links in dark mode */
  a, .card a {
    color: #93c5fd;                    /* light blue */
  }
  a:hover, .card a:hover {
    color: #bfdbfe;                    /* brighter on hover */
  }
}

/* ============================
   Achievement Popup Styling Fix
   ============================ */

.achievement-modal {
  background: #ffffff;
  color: #1f2937;
  border-radius: 14px;
  padding: 1.5rem 2rem;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
  text-align: center;
  width: 320px;
  max-width: 90%;
  margin: 2rem auto;
  animation: fadeIn 0.4s ease;
}

.achievement-modal h3 {
  font-size: 1.3rem;
  color: #1e3a8a;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.achievement-modal p {
  color: #334155;
  margin-bottom: 1rem;
  font-size: 1rem;
}

.achievement-modal .emoji {
  font-size: 2rem;
  margin-bottom: 0.5rem;
}

.achievement-modal button {
  background: #2563eb;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 0.6rem 1.2rem;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.2s ease;
}

.achievement-modal button:hover {
  background: #1e40af;
}

/* Dark mode improvement */
@media (prefers-color-scheme: dark) {
  .achievement-modal {
    background: #0b1220;
    color: #e6e8ee;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
  }

  .achievement-modal h3 {
    color: #c7d2fe; /* brighter headline */
  }

  .achievement-modal p {
    color: #e5e7eb; /* higher contrast paragraph */
  }

  .achievement-modal button {
    background: #3b82f6;
  }
  .achievement-modal button:hover {
    background: #2563eb;
  }
}

@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

/* overlay behind modal */
.achv-overlay{
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,.55);
  display: grid;
  place-items: center;
  z-index: 9998;
}

/* modal look (plus dark-mode) — you already pasted the big block */
.achievement-modal { /* ...your styles from earlier... */ }
