/* ============================================
   CitizenshipTestPro - Shared App Framework CSS
   Dark cinematic theme inspired by CitizenPass
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

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

:root {
  --bg-primary: #0a1628;
  --bg-secondary: #0d1f3c;
  --bg-card: rgba(13, 31, 60, 0.7);
  --bg-card-hover: rgba(13, 31, 60, 0.9);
  --bg-sidebar: #0b1a30;
  --bg-input: rgba(255, 255, 255, 0.04);
  --border-color: rgba(255, 255, 255, 0.06);
  --border-hover: rgba(0, 217, 255, 0.2);
  --text-primary: #ffffff;
  --text-secondary: rgba(255, 255, 255, 0.6);
  --text-muted: rgba(255, 255, 255, 0.4);
  --accent: #00d9ff;
  --accent-dark: #0099cc;
  --accent-glow: rgba(0, 217, 255, 0.15);
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --purple: #a855f7;
  --sidebar-width: 220px;
  --header-height: 0px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.3);
  --shadow-glow: 0 0 20px rgba(0, 217, 255, 0.1);
  --transition: all 0.25s ease;
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; transition: var(--transition); }
a:hover { color: #33e1ff; }

/* ========== LAYOUT ========== */
.app-layout {
  display: flex;
  min-height: 100vh;
}

.app-main {
  flex: 1;
  margin-left: var(--sidebar-width);
  padding: 2rem 2.5rem;
  min-height: 100vh;
  background: linear-gradient(180deg, var(--bg-primary) 0%, #071222 100%);
}

/* ========== SIDEBAR ========== */
.sidebar {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  z-index: 100;
  overflow-y: auto;
}

.sidebar-logo {
  padding: 1.5rem 1.25rem 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.sidebar-logo .logo-text {
  font-size: 1.25rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--accent), #4dd0e1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.sidebar-logo .logo-subtitle {
  font-size: 0.6rem;
  color: var(--danger);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  display: block;
  margin-top: -2px;
}

.sidebar-logo .logo-flag {
  font-size: 1.1rem;
}

.sidebar-stats {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1.25rem;
  font-size: 0.8rem;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-color);
}

.sidebar-stats .streak { color: #f97316; }
.sidebar-stats .xp { color: var(--accent); }
.sidebar-stats .notif {
  margin-left: auto;
  position: relative;
  cursor: pointer;
}
.sidebar-stats .notif-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  background: var(--danger);
  color: #fff;
  font-size: 0.6rem;
  font-weight: 700;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sidebar-nav {
  flex: 1;
  padding: 0.75rem 0;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 1.25rem;
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  transition: var(--transition);
  border-left: 3px solid transparent;
}

.sidebar-nav a:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.03);
}

.sidebar-nav a.active {
  color: var(--accent);
  background: rgba(0, 217, 255, 0.06);
  border-left-color: var(--accent);
}

.sidebar-nav a .nav-icon {
  width: 20px;
  text-align: center;
  font-size: 1rem;
}

.sidebar-nav a .pro-badge {
  margin-left: auto;
  background: var(--purple);
  color: #fff;
  font-size: 0.6rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
}

.sidebar-nav a .lock-icon {
  margin-left: auto;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.sidebar-lang {
  padding: 0.75rem 1.25rem;
  border-top: 1px solid var(--border-color);
}

.sidebar-lang a {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.sidebar-premium {
  margin: 0.75rem;
  padding: 1rem;
  background: linear-gradient(135deg, rgba(0, 100, 80, 0.5), rgba(0, 80, 60, 0.4));
  border: 1px solid rgba(0, 217, 255, 0.15);
  border-radius: var(--radius-md);
}

.sidebar-premium .premium-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  font-weight: 700;
  color: #fbbf24;
  margin-bottom: 0.25rem;
}

.sidebar-premium .premium-desc {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

/* ========== PAGE HEADER ========== */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2rem;
}

.page-header h1 {
  font-size: 1.75rem;
  font-weight: 700;
}

.page-header .subtitle {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-top: 0.25rem;
}

.header-badges {
  display: flex;
  gap: 0.75rem;
}

.header-badge {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 50px;
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
  font-weight: 600;
}

.header-badge .badge-icon { font-size: 1rem; }

/* ========== CARDS ========== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  transition: var(--transition);
}

.card:hover {
  border-color: var(--border-hover);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.card-header h2 {
  font-size: 1.1rem;
  font-weight: 700;
}

.card-header h3 {
  font-size: 1rem;
  font-weight: 600;
}

.card-header .card-link {
  font-size: 0.85rem;
  color: var(--accent);
  font-weight: 600;
}

/* ========== READINESS SCORE ========== */
.readiness-card {
  padding: 1.5rem;
}

.readiness-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.readiness-top h2 { font-size: 1.1rem; font-weight: 700; }
.readiness-top .readiness-label { color: var(--text-secondary); font-size: 0.85rem; }

.readiness-bar-container {
  position: relative;
  margin-bottom: 1rem;
}

.readiness-bar {
  height: 8px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 0.25rem;
}

.readiness-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #4dd0e1);
  border-radius: 4px;
  transition: width 0.5s ease;
}

.readiness-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.readiness-labels .pass-mark {
  color: var(--success);
}

.readiness-body {
  display: flex;
  align-items: center;
  gap: 2rem;
}

.readiness-circle {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  border: 4px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.readiness-circle .pct {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--accent);
}

.readiness-circle .label {
  font-size: 0.65rem;
  color: var(--text-secondary);
}

.readiness-stats {
  flex: 1;
}

.readiness-stat {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.readiness-stat .stat-icon { color: var(--accent); }

.readiness-stat strong { color: var(--text-primary); }

.test-date-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(0, 217, 255, 0.05);
  border: 1px solid rgba(0, 217, 255, 0.1);
  border-radius: var(--radius-sm);
  padding: 0.6rem 1rem;
  margin-top: 1rem;
  font-size: 0.85rem;
}

.test-date-banner a {
  color: var(--accent);
  font-weight: 600;
}

.readiness-footer {
  display: flex;
  gap: 1.5rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.readiness-footer span {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

/* ========== STUDY NEXT ========== */
.study-next-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  cursor: pointer;
}

.study-next-card:hover { border-color: var(--accent); background: var(--bg-card-hover); }

.study-next-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--purple), #7c3aed);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  flex-shrink: 0;
}

.study-next-info { flex: 1; }
.study-next-info h3 { font-size: 0.95rem; font-weight: 600; }
.study-next-info p { font-size: 0.8rem; color: var(--text-secondary); }
.study-next-arrow { color: var(--text-muted); font-size: 1.2rem; }

/* ========== DAILY CHALLENGE ========== */
.challenge-card .challenge-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.challenge-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}

.challenge-title h3 { font-size: 1rem; font-weight: 700; }
.challenge-title p { font-size: 0.75rem; color: var(--text-secondary); }

.challenge-question {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

.challenge-options {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.challenge-option {
  padding: 0.75rem 1rem;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  font-size: 0.9rem;
}

.challenge-option:hover {
  border-color: var(--accent);
  background: rgba(0, 217, 255, 0.05);
}

.challenge-option.correct {
  border-color: var(--success);
  background: rgba(34, 197, 94, 0.1);
  color: var(--success);
}

.challenge-option.wrong {
  border-color: var(--danger);
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger);
}

.challenge-option.selected {
  border-color: var(--accent);
  background: rgba(0, 217, 255, 0.08);
}

/* ========== PROGRESS + LEVEL GRID ========== */
.progress-level-grid {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 1.5rem;
}

.study-progress-list {
  margin-top: 0.5rem;
}

.progress-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.85rem;
}

.progress-item:last-child { border-bottom: none; }
.progress-item .count { color: var(--text-secondary); }

.progress-bar-mini {
  width: 100%;
  height: 3px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 2px;
  margin-top: 0.3rem;
}

.progress-bar-mini-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
}

.completion-circle-wrap {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.completion-circle {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  border: 4px solid rgba(0, 217, 255, 0.2);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.completion-circle .pct {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--accent);
}

.completion-circle .label {
  font-size: 0.6rem;
  color: var(--text-secondary);
}

/* Level Card */
.level-card {
  text-align: center;
}

.level-icon {
  width: 64px;
  height: 64px;
  margin: 0.5rem auto;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--purple), #6366f1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.level-name {
  font-size: 1.1rem;
  font-weight: 700;
  margin-top: 0.5rem;
}

.level-xp {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 0.75rem;
}

.level-bar {
  height: 6px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 0.5rem;
}

.level-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--purple), #6366f1);
  border-radius: 3px;
}

.level-next {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ========== QUICK ACTIONS ========== */
.quick-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-top: 1.5rem;
}

.quick-action {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
  color: var(--text-primary);
}

.quick-action:hover {
  border-color: var(--accent);
  background: var(--bg-card-hover);
  transform: translateY(-2px);
}

.quick-action .qa-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.quick-action .qa-icon.study { background: linear-gradient(135deg, #3b82f6, #2563eb); }
.quick-action .qa-icon.test { background: linear-gradient(135deg, #22c55e, #16a34a); }
.quick-action .qa-icon.coach { background: linear-gradient(135deg, #ef4444, #dc2626); }

.quick-action h4 { font-size: 0.9rem; font-weight: 600; }
.quick-action p { font-size: 0.75rem; color: var(--text-secondary); }

/* ========== STUDY CHAPTERS ========== */
.study-chapter {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem 1.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  margin-bottom: 0.75rem;
  cursor: pointer;
  transition: var(--transition);
}

.study-chapter:hover {
  border-color: var(--border-hover);
  background: var(--bg-card-hover);
}

.chapter-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}

.chapter-icon.blue { background: linear-gradient(135deg, #3b82f6, #1d4ed8); }
.chapter-icon.purple { background: linear-gradient(135deg, var(--purple), #7c3aed); }
.chapter-icon.teal { background: linear-gradient(135deg, #14b8a6, #0d9488); }
.chapter-icon.orange { background: linear-gradient(135deg, #f97316, #ea580c); }
.chapter-icon.pink { background: linear-gradient(135deg, #ec4899, #db2777); }
.chapter-icon.green { background: linear-gradient(135deg, #22c55e, #16a34a); }
.chapter-icon.red { background: linear-gradient(135deg, #ef4444, #dc2626); }
.chapter-icon.indigo { background: linear-gradient(135deg, #6366f1, #4f46e5); }
.chapter-icon.yellow { background: linear-gradient(135deg, #eab308, #ca8a04); }
.chapter-icon.cyan { background: linear-gradient(135deg, var(--accent), var(--accent-dark)); }

.chapter-info { flex: 1; }
.chapter-info h3 {
  font-size: 0.95rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.chapter-info .pro-badge {
  background: var(--purple);
  color: #fff;
  font-size: 0.55rem;
  font-weight: 700;
  padding: 2px 5px;
  border-radius: 3px;
  text-transform: uppercase;
}

.chapter-info p {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 0.2rem;
}

.chapter-progress {
  width: 100%;
  height: 3px;
  background: rgba(0, 217, 255, 0.1);
  border-radius: 2px;
  margin-top: 0.5rem;
  overflow: hidden;
}

.chapter-progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
}

.chapter-count {
  font-size: 0.8rem;
  color: var(--text-muted);
  white-space: nowrap;
}

/* ========== PRACTICE TESTS ========== */
.test-type-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.test-type-card {
  text-align: center;
  padding: 2rem 1.5rem;
  border: 2px dashed rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: var(--transition);
}

.test-type-card:hover {
  border-color: var(--accent);
  background: rgba(0, 217, 255, 0.03);
}

.test-type-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 1rem;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.test-type-icon.practice { background: linear-gradient(135deg, #3b82f6, #1d4ed8); }
.test-type-icon.mock { background: linear-gradient(135deg, var(--purple), #7c3aed); }

.test-type-card h3 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.test-type-card p {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 1rem;
}

.test-type-card .start-link {
  color: var(--accent);
  font-weight: 600;
  font-size: 0.9rem;
}

/* Chapter test grid */
.chapter-test-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.chapter-test-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
}

.chapter-test-card:hover {
  border-color: var(--accent);
  background: rgba(0, 217, 255, 0.03);
}

.chapter-test-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: rgba(0, 217, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  color: var(--accent);
  flex-shrink: 0;
}

.chapter-test-info h4 { font-size: 0.85rem; font-weight: 600; }
.chapter-test-info p { font-size: 0.75rem; color: var(--text-secondary); }
.chapter-test-arrow { margin-left: auto; color: var(--text-muted); }

/* ========== GLOSSARY ========== */
.glossary-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.glossary-tab {
  padding: 0.5rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: 50px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: var(--transition);
  background: transparent;
  color: var(--text-secondary);
}

.glossary-tab.active, .glossary-tab:hover {
  background: var(--accent);
  color: #000;
  border-color: var(--accent);
  font-weight: 600;
}

.glossary-search {
  position: relative;
  margin-bottom: 1.5rem;
}

.glossary-search input {
  width: 100%;
  padding: 0.75rem 1rem 0.75rem 2.5rem;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.9rem;
  font-family: 'Inter', sans-serif;
  outline: none;
  transition: var(--transition);
}

.glossary-search input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 217, 255, 0.1);
}

.glossary-search .search-icon {
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}

.glossary-item {
  padding: 1rem 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  margin-bottom: 0.5rem;
  cursor: pointer;
  transition: var(--transition);
}

.glossary-item:hover {
  border-color: var(--border-hover);
}

.glossary-item h4 {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.glossary-item h4 .chapter-tag {
  font-size: 0.65rem;
  background: rgba(0, 217, 255, 0.1);
  color: var(--accent);
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 500;
}

.glossary-item p {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.glossary-item .mastery {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.mastery-dots {
  display: flex;
  gap: 3px;
}

.mastery-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
}

.mastery-dot.filled { background: var(--accent); }

.mastery-label {
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* ========== ACHIEVEMENTS ========== */
.achievements-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  margin-bottom: 2rem;
}

.achievements-header .progress-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: linear-gradient(135deg, #f97316, #ea580c);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
}

.achievements-header .progress-info { flex: 1; }
.achievements-header h3 { font-size: 1rem; font-weight: 600; }

.achievements-bar {
  height: 6px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 0.5rem;
}

.achievements-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #f97316, #ea580c);
  border-radius: 3px;
}

.achievements-header .progress-count {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.achievement-category {
  margin-bottom: 2rem;
}

.achievement-category h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.achievement-category h3 .count {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
}

.achievement-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
}

.achievement-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  transition: var(--transition);
}

.achievement-item.unlocked {
  border-color: rgba(0, 217, 255, 0.15);
  background: rgba(0, 217, 255, 0.03);
}

.achievement-item .ach-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
  opacity: 0.4;
}

.achievement-item.unlocked .ach-icon { opacity: 1; }

.achievement-item .ach-info { flex: 1; }
.achievement-item .ach-info h4 { font-size: 0.8rem; font-weight: 600; }
.achievement-item .ach-info p { font-size: 0.7rem; color: var(--text-secondary); }

.achievement-item .ach-xp {
  font-size: 0.75rem;
  color: var(--accent);
  font-weight: 600;
  white-space: nowrap;
}

/* ========== SETTINGS ========== */
.settings-section {
  margin-bottom: 2rem;
}

.settings-section h3 {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.settings-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  margin-bottom: 0.5rem;
  transition: var(--transition);
}

.settings-item:hover { border-color: var(--border-hover); }

.settings-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}

.settings-icon.blue { background: linear-gradient(135deg, #3b82f6, #1d4ed8); }
.settings-icon.green { background: linear-gradient(135deg, #22c55e, #16a34a); }
.settings-icon.orange { background: linear-gradient(135deg, #f97316, #ea580c); }
.settings-icon.purple { background: linear-gradient(135deg, var(--purple), #7c3aed); }
.settings-icon.teal { background: linear-gradient(135deg, #14b8a6, #0d9488); }
.settings-icon.red { background: linear-gradient(135deg, #ef4444, #dc2626); }
.settings-icon.yellow { background: linear-gradient(135deg, #eab308, #ca8a04); }
.settings-icon.pink { background: linear-gradient(135deg, #ec4899, #db2777); }
.settings-icon.cyan { background: linear-gradient(135deg, var(--accent), var(--accent-dark)); }
.settings-icon.indigo { background: linear-gradient(135deg, #6366f1, #4f46e5); }

.settings-info { flex: 1; }
.settings-info h4 { font-size: 0.9rem; font-weight: 600; }
.settings-info p { font-size: 0.75rem; color: var(--text-secondary); }

.settings-control { margin-left: auto; }

.settings-control select {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 0.4rem 0.75rem;
  font-size: 0.8rem;
  font-family: 'Inter', sans-serif;
  outline: none;
}

.settings-control input[type="date"] {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 0.4rem 0.75rem;
  font-size: 0.8rem;
  font-family: 'Inter', sans-serif;
  outline: none;
}

.settings-arrow {
  color: var(--text-muted);
  font-size: 1.1rem;
}

/* Toggle Switch */
.toggle {
  position: relative;
  width: 44px;
  height: 24px;
  cursor: pointer;
}

.toggle input { display: none; }

.toggle-slider {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  transition: var(--transition);
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  top: 3px;
  left: 3px;
  transition: var(--transition);
}

.toggle input:checked + .toggle-slider {
  background: var(--accent);
}

.toggle input:checked + .toggle-slider::before {
  transform: translateX(20px);
}

.settings-item.danger h4 { color: var(--danger); }
.settings-item.danger .settings-icon { background: linear-gradient(135deg, #ef4444, #dc2626); }

/* ========== DISCLAIMER ========== */
.disclaimer-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-md);
  padding: 1.25rem 1.5rem;
}

.disclaimer-card .disclaimer-icon {
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
}

.disclaimer-card p {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.sources-card {
  background: rgba(0, 217, 255, 0.03);
  border: 1px solid rgba(0, 217, 255, 0.1);
}

.sources-card h4 {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--accent);
}

.sources-card a {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  color: var(--accent);
  margin-bottom: 0.3rem;
}

/* ========== AUTH PAGE ========== */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--bg-primary) 0%, #071222 50%, var(--bg-secondary) 100%);
  padding: 2rem;
}

.auth-container {
  width: 100%;
  max-width: 440px;
  text-align: center;
}

.auth-logo {
  margin-bottom: 0.5rem;
}

.auth-logo .logo-text {
  font-size: 2.25rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--accent), #4dd0e1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.auth-logo .logo-flag {
  font-size: 1.5rem;
}

.auth-subtitle {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-bottom: 2rem;
}

.auth-features {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 2rem;
  text-align: left;
}

.auth-feature {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.auth-feature .feat-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  flex-shrink: 0;
}

.auth-feature .feat-icon.blue { background: rgba(59, 130, 246, 0.15); color: #3b82f6; }
.auth-feature .feat-icon.purple { background: rgba(168, 85, 247, 0.15); color: var(--purple); }
.auth-feature .feat-icon.orange { background: rgba(249, 115, 22, 0.15); color: #f97316; }
.auth-feature .feat-icon.cyan { background: rgba(0, 217, 255, 0.15); color: var(--accent); }

.auth-buttons {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.auth-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.85rem 1.25rem;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: var(--transition);
  border: 1px solid var(--border-color);
}

.auth-btn.google {
  background: #fff;
  color: #333;
  border-color: rgba(255, 255, 255, 0.2);
}

.auth-btn.apple {
  background: #000;
  color: #fff;
  border-color: rgba(255, 255, 255, 0.1);
}

.auth-btn.email {
  background: rgba(59, 130, 246, 0.15);
  color: #fff;
  border-color: rgba(59, 130, 246, 0.3);
}

.auth-btn.guest {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--border-color);
}

.auth-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 0.5rem 0;
  color: var(--text-muted);
  font-size: 0.8rem;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-color);
}

.auth-terms {
  margin-top: 1.5rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ========== AI COACH ========== */
.coach-container {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 4rem);
}

.coach-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.coach-avatar {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--purple), #6366f1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}

.coach-header h1 { font-size: 1.5rem; font-weight: 700; }
.coach-header .powered-by { font-size: 0.8rem; color: var(--text-secondary); }

.coach-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.coach-empty .empty-icon {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  background: rgba(0, 217, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  margin-bottom: 1rem;
  color: var(--accent);
}

.coach-empty p {
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
}

.coach-suggestions {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
  max-width: 600px;
}

.coach-suggestion {
  padding: 0.75rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  text-align: left;
}

.coach-suggestion:hover {
  border-color: var(--accent);
  color: var(--text-primary);
}

.coach-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 0;
}

.message {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.message-avatar {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  flex-shrink: 0;
}

.message-avatar.bot { background: linear-gradient(135deg, var(--purple), #6366f1); }
.message-avatar.user { background: linear-gradient(135deg, var(--accent), var(--accent-dark)); }

.message-bubble {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  max-width: 80%;
  font-size: 0.9rem;
  line-height: 1.6;
}

.coach-input {
  display: flex;
  gap: 0.75rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
}

.coach-input input {
  flex: 1;
  padding: 0.85rem 1rem;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.9rem;
  font-family: 'Inter', sans-serif;
  outline: none;
  transition: var(--transition);
}

.coach-input input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 217, 255, 0.1);
}

.coach-input button {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  border: none;
  color: #fff;
  font-size: 1.1rem;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.coach-input button:hover {
  transform: scale(1.05);
}

/* ========== TEST TAKING VIEW ========== */
.test-view {
  max-width: 800px;
  margin: 0 auto;
}

.test-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
}

.test-timer {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent);
}

.test-progress-bar {
  height: 4px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 2px;
  margin-bottom: 2rem;
}

.test-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #4dd0e1);
  border-radius: 2px;
  transition: width 0.3s ease;
}

.test-question-num {
  font-size: 0.85rem;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.test-question-text {
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
  line-height: 1.5;
}

.test-options {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 2rem;
}

.test-option {
  padding: 1rem 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
  font-size: 0.95rem;
}

.test-option:hover { border-color: var(--accent); }
.test-option.selected { border-color: var(--accent); background: rgba(0, 217, 255, 0.08); }
.test-option.correct { border-color: var(--success); background: rgba(34, 197, 94, 0.08); }
.test-option.wrong { border-color: var(--danger); background: rgba(239, 68, 68, 0.08); }

.test-explanation {
  padding: 1rem 1.25rem;
  background: rgba(0, 217, 255, 0.05);
  border: 1px solid rgba(0, 217, 255, 0.1);
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
}

.test-nav {
  display: flex;
  justify-content: space-between;
}

.test-btn {
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  font-family: 'Inter', sans-serif;
  border: none;
}

.test-btn.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  color: #fff;
}

.test-btn.secondary {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
}

.test-btn:hover { transform: translateY(-1px); }

/* ========== RESULTS VIEW ========== */
.results-card {
  text-align: center;
  padding: 2.5rem;
  max-width: 600px;
  margin: 0 auto;
}

.results-icon {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  margin: 0 auto 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
}

.results-icon.pass { background: rgba(34, 197, 94, 0.15); }
.results-icon.fail { background: rgba(239, 68, 68, 0.15); }

.results-title {
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
}

.results-score {
  font-size: 3rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--accent), #4dd0e1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 1rem;
}

.results-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin: 1.5rem 0;
}

.results-stat {
  text-align: center;
}

.results-stat .val {
  font-size: 1.25rem;
  font-weight: 700;
}

.results-stat .label {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

/* ========== LESSON VIEW ========== */
.lesson-container {
  max-width: 800px;
  margin: 0 auto;
}

.lesson-header {
  margin-bottom: 2rem;
}

.lesson-breadcrumb {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.lesson-breadcrumb a { color: var(--accent); }

.lesson-title {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.lesson-meta {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.lesson-content {
  line-height: 1.8;
  color: var(--text-secondary);
}

.lesson-content h2 {
  color: var(--text-primary);
  font-size: 1.3rem;
  margin: 2rem 0 1rem;
}

.lesson-content h3 {
  color: var(--text-primary);
  font-size: 1.1rem;
  margin: 1.5rem 0 0.75rem;
}

.lesson-content p { margin-bottom: 1rem; }

.lesson-content ul, .lesson-content ol {
  margin-bottom: 1rem;
  padding-left: 1.5rem;
}

.lesson-content li { margin-bottom: 0.5rem; }

.lesson-content .highlight-box {
  background: rgba(0, 217, 255, 0.05);
  border-left: 3px solid var(--accent);
  padding: 1rem 1.25rem;
  margin: 1rem 0;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.lesson-content .warning-box {
  background: rgba(239, 68, 68, 0.05);
  border-left: 3px solid var(--danger);
  padding: 1rem 1.25rem;
  margin: 1rem 0;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.lesson-nav {
  display: flex;
  justify-content: space-between;
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-color);
}

/* ========== MOBILE RESPONSIVE ========== */
.mobile-header {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 56px;
  background: var(--bg-sidebar);
  border-bottom: 1px solid var(--border-color);
  z-index: 200;
  align-items: center;
  justify-content: space-between;
  padding: 0 1rem;
}

.mobile-header .logo-text {
  font-size: 1.1rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--accent), #4dd0e1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hamburger {
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.25rem;
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 99;
}

@media (max-width: 1024px) {
  .chapter-test-grid { grid-template-columns: repeat(2, 1fr); }
  .progress-level-grid { grid-template-columns: 1fr; }
  .achievement-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .mobile-header { display: flex; }

  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    z-index: 200;
  }

  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.open { display: block; }

  .app-main {
    margin-left: 0;
    padding: 72px 1rem 2rem;
  }

  .page-header { flex-direction: column; align-items: flex-start; gap: 0.75rem; }
  .header-badges { flex-wrap: wrap; }

  .test-type-grid { grid-template-columns: 1fr; }
  .chapter-test-grid { grid-template-columns: 1fr; }
  .quick-actions { grid-template-columns: 1fr; }
  .progress-level-grid { grid-template-columns: 1fr; }
  .achievement-grid { grid-template-columns: 1fr; }
  .coach-suggestions { grid-template-columns: 1fr; }
  .results-stats { grid-template-columns: 1fr; gap: 0.5rem; }
}

/* Lesson content tables */
.lesson-table { width: 100%; border-collapse: collapse; margin: 1rem 0; }
.lesson-table th, .lesson-table td { padding: 0.6rem 1rem; text-align: left; border-bottom: 1px solid rgba(255,255,255,0.1); }
.lesson-table th { background: rgba(0,217,255,0.1); color: var(--accent); font-weight: 600; }
.lesson-table tr:hover td { background: rgba(255,255,255,0.03); }

/* Lesson content styling */
.lesson-content h3 { color: var(--accent); margin: 1.5rem 0 0.75rem; }
.lesson-content h4 { color: var(--text-primary); margin: 1.2rem 0 0.5rem; }
.lesson-content ul, .lesson-content ol { margin: 0.5rem 0 1rem 1.5rem; }
.lesson-content li { margin-bottom: 0.4rem; line-height: 1.6; }
.lesson-content blockquote { border-left: 3px solid var(--accent); padding: 1rem 1.5rem; margin: 1rem 0; background: rgba(0,217,255,0.05); border-radius: 0 8px 8px 0; font-style: italic; }
