/* ============================================================
   PhishGuard Academy — Global Stylesheet
   Design: modern security dashboard, teal/emerald accent on navy
   Theme: light + dark (data-bs-theme on <html>)
   ============================================================ */

:root {
  --pg-bg: #f1f5f9;
  --pg-surface: #ffffff;
  --pg-border: #e2e8f0;
  --pg-text: #0f172a;
  --pg-muted: #64748b;
  --pg-sidebar: #0b1220;
  --pg-sidebar-muted: #94a3b8;
  --pg-accent: #0d9488;
  --pg-accent-soft: #ccfbf1;
  --pg-danger: #dc2626;
  --pg-danger-soft: #fee2e2;
  --pg-warn: #d97706;
  --pg-warn-soft: #fef3c7;
  --pg-good: #059669;
  --pg-good-soft: #d1fae5;
  --pg-shadow: 0 1px 3px rgba(15, 23, 42, .08), 0 1px 2px rgba(15, 23, 42, .06);
  --pg-shadow-lg: 0 10px 25px -5px rgba(15, 23, 42, .12), 0 4px 10px -6px rgba(15, 23, 42, .1);
  --pg-radius: 12px;
}

html[data-bs-theme="dark"] {
  --pg-bg: #0f172a;
  --pg-surface: #1e293b;
  --pg-border: #334155;
  --pg-text: #e2e8f0;
  --pg-muted: #94a3b8;
  --pg-accent-soft: #134e4a;
  --pg-danger-soft: #450a0a;
  --pg-warn-soft: #451a03;
  --pg-good-soft: #052e16;
  --pg-shadow: 0 1px 3px rgba(0, 0, 0, .4);
  --pg-shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, .5);
}

* { box-sizing: border-box; }

body {
  background: var(--pg-bg);
  color: var(--pg-text);
  font-family: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  margin: 0;
}

a { color: var(--pg-accent); }
a:hover { color: #0f766e; }

/* ---------- App shell ---------- */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 264px;
  flex: 0 0 264px;
  background: linear-gradient(180deg, #0d1b2e 0%, #0b1220 100%);
  color: var(--pg-sidebar-muted);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 1030;
}

.sidebar .brand {
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: 1.25rem 1.25rem 1rem;
  color: #fff;
  text-decoration: none;
}
.sidebar .brand img { width: 40px; height: 40px; }
.sidebar .brand .brand-name {
  font-weight: 700;
  font-size: 1.05rem;
  line-height: 1.1;
  letter-spacing: .2px;
}
.sidebar .brand .brand-sub {
  font-size: .72rem;
  color: var(--pg-sidebar-muted);
  font-weight: 500;
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

.nav-section-label {
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: 1.4px;
  color: #475569;
  padding: 1.1rem 1.5rem .4rem;
  font-weight: 700;
}

.sidebar .nav-link {
  color: var(--pg-sidebar-muted);
  display: flex;
  align-items: center;
  gap: .8rem;
  padding: .65rem 1.5rem;
  font-size: .93rem;
  font-weight: 500;
  border-left: 3px solid transparent;
  border-radius: 0;
  transition: background .15s, color .15s;
}
.sidebar .nav-link:hover {
  color: #fff;
  background: rgba(255, 255, 255, .06);
}
.sidebar .nav-link.active {
  color: #fff;
  background: rgba(20, 184, 166, .14);
  border-left-color: var(--pg-accent);
}
.sidebar .nav-link svg { width: 18px; height: 18px; flex: 0 0 18px; }
.sidebar .nav-link .badge-pill {
  margin-left: auto;
  background: rgba(20, 184, 166, .18);
  color: #5eead4;
  border-radius: 999px;
  font-size: .7rem;
  padding: .15rem .55rem;
  font-weight: 700;
}

.sidebar-footer {
  margin-top: auto;
  padding: 1rem 1.5rem;
  font-size: .78rem;
  color: #475569;
  border-top: 1px solid rgba(255, 255, 255, .06);
}

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  background: var(--pg-surface);
  border-bottom: 1px solid var(--pg-border);
  padding: .75rem 1.75rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 1020;
}
.topbar .page-title { font-size: 1.05rem; font-weight: 700; margin: 0; }
.topbar-spacer { flex: 1; }
.theme-toggle {
  border: 1px solid var(--pg-border);
  background: var(--pg-surface);
  color: var(--pg-text);
  border-radius: 999px;
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background .15s;
}
.theme-toggle:hover { background: var(--pg-bg); }
.theme-toggle svg { width: 18px; height: 18px; }
.icon-moon { display: none; }
html[data-bs-theme="dark"] .icon-sun { display: none; }
html[data-bs-theme="dark"] .icon-moon { display: block; }

.content {
  padding: 2rem 1.75rem 3rem;
  max-width: 1180px;
  width: 100%;
  margin: 0 auto;
}

/* ---------- Mobile nav ---------- */
.sidebar-toggle {
  display: none;
  background: none;
  border: 1px solid var(--pg-border);
  border-radius: 8px;
  padding: .4rem .6rem;
  color: var(--pg-text);
  cursor: pointer;
}
.sidebar-backdrop { display: none; }

@media (max-width: 991.98px) {
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    transform: translateX(-100%);
    transition: transform .25s ease;
    box-shadow: var(--pg-shadow-lg);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-backdrop.show {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .5);
    z-index: 1025;
  }
  .sidebar-toggle { display: inline-flex; }
}

/* ---------- Cards & headings ---------- */
.card {
  border: 1px solid var(--pg-border);
  border-radius: var(--pg-radius);
  background: var(--pg-surface);
  box-shadow: var(--pg-shadow);
}
.card-header {
  background: transparent;
  border-bottom: 1px solid var(--pg-border);
  font-weight: 700;
  padding: 1rem 1.25rem;
}
.card-body { padding: 1.25rem; }

.section-heading {
  font-weight: 800;
  font-size: 1.6rem;
  margin-bottom: .25rem;
  letter-spacing: -.3px;
}
.section-sub { color: var(--pg-muted); margin-bottom: 1.75rem; }

.eyebrow {
  display: inline-block;
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--pg-accent);
  margin-bottom: .4rem;
}

/* ---------- Stat / hero ---------- */
.hero-card {
  background: linear-gradient(135deg, #0d1b2e 0%, #134e4a 100%);
  color: #e2e8f0;
  border: 0;
  border-radius: 16px;
  box-shadow: var(--pg-shadow-lg);
  overflow: hidden;
  position: relative;
}
.hero-card::after {
  content: "";
  position: absolute;
  right: -80px;
  top: -80px;
  width: 280px;
  height: 280px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(20, 184, 166, .35), transparent 70%);
  pointer-events: none;
}
.hero-card h1 { color: #fff; font-weight: 800; letter-spacing: -.4px; }
.hero-card p { color: #cbd5e1; }
.hero-card .btn { border-radius: 999px; padding: .6rem 1.4rem; font-weight: 600; }

.stat-card { text-align: center; padding: 1.25rem 1rem; }
.stat-card .stat-value {
  font-size: 2.1rem;
  font-weight: 800;
  color: var(--pg-accent);
  line-height: 1.1;
}
.stat-card .stat-label {
  font-size: .8rem;
  color: var(--pg-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .8px;
}
.stat-card .stat-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--pg-accent-soft);
  color: var(--pg-accent);
  margin-bottom: .5rem;
}
.stat-card .stat-icon svg { width: 20px; height: 20px; }

/* ---------- Progress ---------- */
.progress {
  background: var(--pg-border);
  border-radius: 999px;
  height: .6rem;
}
.progress-bar {
  background: linear-gradient(90deg, #14b8a6, #0ea5e9);
  border-radius: 999px;
  font-size: 0;
  transition: width .6s ease;
}

/* ---------- Lesson cards ---------- */
.lesson-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  transition: transform .15s, box-shadow .15s;
}
.lesson-card:hover { transform: translateY(-3px); box-shadow: var(--pg-shadow-lg); }
.lesson-card .card-body { display: flex; flex-direction: column; flex: 1; }
.lesson-card .lesson-icon {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--pg-accent-soft);
  color: var(--pg-accent);
  margin-bottom: .9rem;
}
.lesson-card .lesson-icon svg { width: 24px; height: 24px; }
.lesson-card .lesson-title { font-weight: 700; font-size: 1.02rem; }
.lesson-card .lesson-desc { color: var(--pg-muted); font-size: .88rem; flex: 1; }
.lesson-card .card-footer {
  background: transparent;
  border-top: 1px solid var(--pg-border);
  padding: .9rem 1.25rem;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  font-size: .72rem;
  font-weight: 700;
  padding: .2rem .55rem;
  border-radius: 999px;
}
.status-done { background: var(--pg-good-soft); color: var(--pg-good); }
.status-todo { background: var(--pg-bg); color: var(--pg-muted); }

/* ---------- Lesson content ---------- */
.lesson-content h2 { font-weight: 800; margin-top: 1.75rem; letter-spacing: -.2px; }
.lesson-content h3 { font-weight: 700; margin-top: 1.4rem; }
.lesson-content p, .lesson-content li { color: var(--pg-text); line-height: 1.7; }
.lesson-content .lead-note { color: var(--pg-muted); }

.callout {
  border-radius: var(--pg-radius);
  padding: 1rem 1.1rem;
  margin: 1.25rem 0;
  border-left: 4px solid;
}
.callout-danger { background: var(--pg-danger-soft); border-color: var(--pg-danger); }
.callout-warn { background: var(--pg-warn-soft); border-color: var(--pg-warn); }
.callout-good { background: var(--pg-good-soft); border-color: var(--pg-good); }
.callout-info { background: var(--pg-accent-soft); border-color: var(--pg-accent); }
.callout h6 { margin: 0 0 .25rem; font-weight: 700; }

.pill-tag {
  display: inline-block;
  font-size: .72rem;
  font-weight: 700;
  padding: .25rem .6rem;
  border-radius: 999px;
  background: var(--pg-accent-soft);
  color: var(--pg-accent);
  margin: .15rem;
}
.pill-danger { background: var(--pg-danger-soft); color: var(--pg-danger); }
.pill-good { background: var(--pg-good-soft); color: var(--pg-good); }

/* ---------- Email simulation ---------- */
.mail-sim {
  border: 1px solid var(--pg-border);
  border-radius: 10px;
  background: var(--pg-surface);
  overflow: hidden;
  margin: 1rem 0;
}
.mail-sim .mail-head {
  display: flex;
  gap: .9rem;
  padding: 1rem 1.1rem;
  border-bottom: 1px solid var(--pg-border);
  background: var(--pg-bg);
  align-items: center;
}
.mail-sim .avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  color: #fff;
  flex: 0 0 42px;
}
.mail-sim .mail-from { font-weight: 700; font-size: .95rem; }
.mail-sim .mail-subject { font-weight: 600; }
.mail-sim .mail-meta { font-size: .78rem; color: var(--pg-muted); }
.mail-sim .mail-body { padding: 1.1rem; font-size: .93rem; line-height: 1.65; }
.mail-sim .mail-body .mail-link {
  display: inline-block;
  background: var(--pg-accent-soft);
  color: var(--pg-accent);
  font-weight: 700;
  padding: .45rem 1.1rem;
  border-radius: 8px;
  text-decoration: none;
}
.mail-sim .mail-flags { padding: .6rem 1.1rem; border-top: 1px dashed var(--pg-border); }
.flag-item {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: .85rem;
  padding: .25rem 0;
  color: var(--pg-danger);
}
.flag-item svg { width: 16px; height: 16px; flex: 0 0 16px; }

/* ---------- Choice buttons (sims & quizzes) ---------- */
.choice-btn {
  width: 100%;
  text-align: left;
  border: 2px solid var(--pg-border);
  background: var(--pg-surface);
  color: var(--pg-text);
  border-radius: 10px;
  padding: .85rem 1.1rem;
  font-size: .95rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color .15s, background .15s, transform .1s;
  margin-bottom: .7rem;
}
.choice-btn:hover:not(:disabled) {
  border-color: var(--pg-accent);
  background: var(--pg-accent-soft);
}
.choice-btn.correct {
  border-color: var(--pg-good);
  background: var(--pg-good-soft);
  color: var(--pg-good);
}
.choice-btn.wrong {
  border-color: var(--pg-danger);
  background: var(--pg-danger-soft);
  color: var(--pg-danger);
}
.choice-btn:disabled { cursor: not-allowed; opacity: .85; }
.choice-btn .letter {
  display: inline-flex;
  width: 26px;
  height: 26px;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--pg-bg);
  font-weight: 700;
  font-size: .8rem;
  margin-right: .6rem;
  color: var(--pg-muted);
}

.feedback-box {
  border-radius: 10px;
  padding: 1rem 1.1rem;
  margin-top: 1rem;
  display: flex;
  gap: .7rem;
  align-items: flex-start;
}
.feedback-box svg { width: 20px; height: 20px; flex: 0 0 20px; margin-top: .15rem; }
.feedback-good { background: var(--pg-good-soft); color: var(--pg-good); }
.feedback-bad { background: var(--pg-danger-soft); color: var(--pg-danger); }

/* ---------- URL analysis ---------- */
.url-display {
  font-family: ui-monospace, "Cascadia Mono", "Fira Code", Consolas, monospace;
  font-size: 1.02rem;
  background: var(--pg-bg);
  border: 1px solid var(--pg-border);
  border-radius: 10px;
  padding: .9rem 1rem;
  word-break: break-all;
  user-select: all;
}
.part-ok { color: var(--pg-good); font-weight: 700; }
.part-bad { color: var(--pg-danger); font-weight: 700; text-decoration: underline wavy; }
.part-neu { color: var(--pg-warn); font-weight: 700; }
.url-legend span { margin-right: 1rem; font-size: .8rem; }

/* ---------- Quiz ---------- */
.quiz-timer {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--pg-accent);
  font-variant-numeric: tabular-nums;
}
.quiz-timer.warn { color: var(--pg-danger); animation: pulse 1s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .55; } }

.quiz-option { cursor: pointer; }
.quiz-option input { position: absolute; opacity: 0; }
.quiz-option .q-letter {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  border-radius: 50%;
  background: var(--pg-bg);
  color: var(--pg-muted);
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all .15s;
}
.quiz-option input:focus-visible + .q-letter { outline: 3px solid var(--pg-accent); outline-offset: 2px; }
.quiz-option.selected .q-letter { background: var(--pg-accent); color: #fff; }
.quiz-option.reveal-correct { border-color: var(--pg-good); background: var(--pg-good-soft); }
.quiz-option.reveal-correct .q-letter { background: var(--pg-good); color: #fff; }
.quiz-option.reveal-wrong { border-color: var(--pg-danger); background: var(--pg-danger-soft); }
.quiz-option.reveal-wrong .q-letter { background: var(--pg-danger); color: #fff; }
.quiz-option.reveal-disabled { opacity: .55; }

.score-ring {
  width: 150px;
  height: 150px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: conic-gradient(var(--pg-accent) calc(var(--score) * 1%), var(--pg-border) 0);
  position: relative;
  margin: 1rem auto;
}
.score-ring::after {
  content: "";
  position: absolute;
  inset: 12px;
  border-radius: 50%;
  background: var(--pg-surface);
}
.score-ring .score-value {
  position: relative;
  z-index: 1;
  font-size: 2rem;
  font-weight: 800;
  color: var(--pg-accent);
}

/* ---------- Achievements ---------- */
.achievement {
  border: 1px solid var(--pg-border);
  border-radius: 12px;
  padding: 1rem;
  text-align: center;
  height: 100%;
  background: var(--pg-surface);
}
.achievement .ach-icon {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  margin: 0 auto .6rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  background: var(--pg-bg);
  filter: grayscale(1);
  opacity: .45;
}
.achievement.earned .ach-icon { background: var(--pg-accent-soft); filter: none; opacity: 1; }
.achievement .ach-name { font-weight: 700; font-size: .88rem; }
.achievement .ach-desc { font-size: .75rem; color: var(--pg-muted); }
.achievement.earned { border-color: var(--pg-accent); }

/* ---------- Check list ---------- */
.check-list { list-style: none; padding: 0; margin: 0; }
.check-list li {
  display: flex;
  gap: .7rem;
  padding: .6rem 0;
  border-bottom: 1px dashed var(--pg-border);
  align-items: flex-start;
}
.check-list li:last-child { border-bottom: 0; }
.check-list svg { width: 20px; height: 20px; flex: 0 0 20px; color: var(--pg-good); margin-top: .1rem; }
.check-list .cross { color: var(--pg-danger); }

/* ---------- Misc ---------- */
.avatar-sm {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #14b8a6, #0ea5e9);
  color: #fff;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.avatar-lg {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  background: linear-gradient(135deg, #14b8a6, #0ea5e9);
  color: #fff;
  font-size: 2.2rem;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--pg-shadow-lg);
}
.badge-soft { background: var(--pg-accent-soft); color: var(--pg-accent); font-weight: 600; }
.divider { border-top: 1px solid var(--pg-border); margin: 1.5rem 0; }

footer.site-footer {
  border-top: 1px solid var(--pg-border);
  background: var(--pg-surface);
  padding: 1.25rem 1.75rem;
  color: var(--pg-muted);
  font-size: .85rem;
  text-align: center;
  margin-top: auto;
}

/* Scrollbar */
.sidebar::-webkit-scrollbar { width: 8px; }
.sidebar::-webkit-scrollbar-thumb { background: #334155; border-radius: 8px; }

/* Focus visibility for accessibility */
:focus-visible {
  outline: 3px solid var(--pg-accent);
  outline-offset: 2px;
  border-radius: 4px;
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  z-index: 2000;
  background: var(--pg-accent);
  color: #fff;
  padding: .6rem 1rem;
  border-radius: 0 0 8px 0;
  font-weight: 600;
}
.skip-link:focus { left: 0; color: #fff; }

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* ---------- Print (guide / PDF) ---------- */
#print-guide { display: none; }
