body {
  font-family: 'Segoe UI', Tahoma, sans-serif;
  margin: 0;
  background-color: #f4f6f8;
}

header {
  background-color: #2c3e50;
  color: white;
  padding: 15px;
  text-align: center;
  font-size: 24px;
  font-weight: bold;
}

.container {
  max-width: 800px;
  margin: 30px auto;
  background: white;
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.question {
  font-size: 20px;
  margin-bottom: 15px;
  font-weight: 500;
}

.options label {
  display: block;
  margin: 8px 0;
  padding: 10px;
  background: #ecf0f1;
  border-radius: 5px;
  cursor: pointer;
  transition: background 0.3s;
}

.options label:hover {
  background: #d0d7de;
}

#navigation {
  margin-top: 20px;
  text-align: center;
}

button {
  padding: 12px 20px;
  margin: 5px;
  border: none;
  border-radius: 5px;
  background-color: #3498db;
  color: white;
  font-size: 16px;
  cursor: pointer;
  transition: background 0.3s;
}

button:hover {
  background-color: #2980b9;
}

#progress {
  margin-bottom: 10px;
  font-weight: bold;
}

#timer {
  margin-bottom: 10px;
  font-weight: bold;
}

.back {
  position: absolute;
  top: 20px;
  left: 20px;
  font-size: 18px;
  color: white;
  text-decoration: none;
  cursor: pointer;
  display: flex;
  align-items: center;
}

.back:hover {
  color: #2980b9;
}

.reviews {
  gap: 10px;
  display: flex;
  flex-direction: row;
  margin-top: 10px;
}

.review-content {
  background: #f9f9f9;
  border: 1px solid #ddd;
  padding: 10px;
  margin-bottom: 15px;
  border-radius: 5px;
  width: 100%;
}

.review-content .question {
  font-weight: semibold;
  font-size: 16px;
  margin: 0;
}

.review-content #explanation {
  font-size: 12px;
  font-style: italic;
  color: #555;
}

.review-content .correct_answer {
  border: 1px solid #007c38;
  border-radius: 10px;
  background-color: #e6f4ea;
  padding: 5px;
}

.exam-selector {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 25px;
}

.exam-option {
  display: flex;
  align-items: center;
  padding: 15px;
  background: #ecf0f1;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s;
  border: 2px solid transparent;
}

.exam-option:hover {
  background: #d0d7de;
}

.exam-option:has(input:checked) {
  background: #e6f4ea;
  border-color: #007c38;
}

.exam-option input[type="radio"] {
  margin-right: 15px;
  transform: scale(1.2);
}

.exam-name {
  font-weight: bold;
  font-size: 16px;
  margin-right: 15px;
}

.exam-desc {
  flex: 1;
  color: #666;
  font-size: 14px;
}

.exam-count {
  background: #2c3e50;
  color: white;
  padding: 5px 10px;
  border-radius: 15px;
  font-size: 12px;
  font-weight: bold;
}

/* Navigation */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

header nav a {
  color: white;
  text-decoration: none;
  margin-left: 15px;
  font-size: 14px;
  font-weight: normal;
}

header nav a:hover {
  text-decoration: underline;
}

/* Auth Forms */
.auth-container {
  max-width: 400px;
  margin: 0 auto;
}

.auth-form label {
  display: block;
  margin-bottom: 5px;
  font-weight: 500;
}

.auth-form input[type="text"],
.auth-form input[type="email"],
.auth-form input[type="password"] {
  width: 100%;
  padding: 10px;
  margin-bottom: 15px;
  border: 1px solid #ddd;
  border-radius: 5px;
  box-sizing: border-box;
}

.auth-form button {
  width: 100%;
  padding: 12px;
  background-color: #27ae60;
}

.auth-form button:hover {
  background-color: #219a52;
}

.auth-link {
  text-align: center;
  margin-top: 15px;
  color: #666;
}

.auth-link a {
  color: #3498db;
  text-decoration: none;
}

.auth-link a:hover {
  text-decoration: underline;
}

.auth-prompt {
  text-align: center;
  margin-top: 20px;
  padding: 15px;
  background: #e8f4fd;
  border-radius: 5px;
  color: #666;
}

.auth-prompt a {
  color: #3498db;
  font-weight: bold;
}

/* Flash Messages */
.flash-messages {
  margin-bottom: 20px;
}

.flash {
  padding: 12px;
  border-radius: 5px;
  margin-bottom: 10px;
}

.flash.error {
  background: #fdecea;
  color: #c0392b;
  border: 1px solid #e74c3c;
}

.flash.success {
  background: #eafaf1;
  color: #27ae60;
  border: 1px solid #2ecc71;
}

.flash.info {
  background: #e8f4fd;
  color: #3498db;
  border: 1px solid #3498db;
}

.flash.warning {
  background: #fef9e7;
  color: #f39c12;
  border: 1px solid #f1c40f;
}

/* Welcome Banner */
.welcome-banner {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 15px 20px;
  border-radius: 8px;
  margin-bottom: 20px;
}

.user-stats {
  margin-left: 15px;
  font-size: 13px;
  opacity: 0.9;
}

/* Quiz Mode Selector */
.mode-selector {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 25px;
}

.mode-option {
  display: flex;
  align-items: center;
  padding: 12px 15px;
  background: #f8f9fa;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s;
  border: 2px solid transparent;
}

.mode-option:hover {
  background: #e9ecef;
}

.mode-option:has(input:checked) {
  background: #e3f2fd;
  border-color: #2196f3;
}

.mode-option input[type="radio"] {
  margin-right: 12px;
  transform: scale(1.1);
}

.mode-name {
  font-weight: bold;
  margin-right: 15px;
}

.mode-desc {
  color: #666;
  font-size: 13px;
}

/* Form Styles */
.form-row {
  display: flex;
  gap: 20px;
  margin: 15px 0;
  align-items: center;
}

.form-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.form-group input {
  width: 80px;
  padding: 8px;
  border: 1px solid #ddd;
  border-radius: 5px;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.btn-primary {
  background-color: #27ae60;
  padding: 14px 30px;
  font-size: 18px;
  width: 100%;
  margin-top: 10px;
}

.btn-primary:hover {
  background-color: #219a52;
}

/* History Table */
.history-table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
}

.history-table th,
.history-table td {
  padding: 12px;
  text-align: left;
  border-bottom: 1px solid #ddd;
}

.history-table th {
  background: #f8f9fa;
  font-weight: 600;
}

.history-table .pass {
  color: #27ae60;
  font-weight: bold;
}

.history-table .fail {
  color: #e74c3c;
}

.empty-state {
  text-align: center;
  padding: 40px;
  color: #666;
}

.empty-state a {
  color: #3498db;
}

/* Analytics Stats */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin: 20px 0;
}

.stat-card {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 25px;
  border-radius: 10px;
  text-align: center;
}

.stat-value {
  font-size: 36px;
  font-weight: bold;
}

.stat-label {
  font-size: 14px;
  opacity: 0.9;
  margin-top: 5px;
}

.exam-scores {
  margin: 20px 0;
}

.exam-score {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-bottom: 15px;
}

.exam-score .exam-name {
  width: 150px;
  font-weight: 500;
}

.score-bar {
  flex: 1;
  height: 20px;
  background: #ecf0f1;
  border-radius: 10px;
  overflow: hidden;
}

.score-fill {
  height: 100%;
  background: linear-gradient(90deg, #3498db, #2ecc71);
  border-radius: 10px;
  transition: width 0.5s ease;
}

.score-value {
  width: 60px;
  text-align: right;
  font-weight: bold;
}

/* Result Banner */
.result-banner {
  padding: 25px;
  border-radius: 10px;
  text-align: center;
  margin-bottom: 25px;
}

.result-banner.pass {
  background: linear-gradient(135deg, #56ab2f 0%, #a8e063 100%);
  color: white;
}

.result-banner.fail {
  background: linear-gradient(135deg, #eb3349 0%, #f45c43 100%);
  color: white;
}

.result-banner h2 {
  margin: 0 0 10px 0;
  font-size: 28px;
}

.result-banner p {
  margin: 0;
  font-size: 18px;
  opacity: 0.95;
}

.btn {
  display: inline-block;
  padding: 12px 25px;
  background-color: #3498db;
  color: white;
  text-decoration: none;
  border-radius: 5px;
  text-align: center;
}

.btn:hover {
  background-color: #2980b9;
}

/* Quiz Info Bar */
.quiz-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 15px;
  background: #f8f9fa;
  border-radius: 8px;
  margin-bottom: 20px;
}

/* Exam Timer */
.exam-timer {
  font-weight: bold;
  font-size: 18px;
}

.exam-timer.time-warning {
  color: #f39c12;
}

.exam-timer.time-critical {
  color: #e74c3c;
  animation: pulse 1s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* Question Meta Tags */
.question-meta {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
}

.tag {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
}

.tag.category {
  background: #e3f2fd;
  color: #1976d2;
}

.tag.difficulty {
  background: #f5f5f5;
  color: #666;
}

.tag.difficulty.easy {
  background: #e8f5e9;
  color: #2e7d32;
}

.tag.difficulty.medium {
  background: #fff3e0;
  color: #ef6c00;
}

.tag.difficulty.hard {
  background: #fce4ec;
  color: #c2185b;
}

/* Answer Reveal */
.answer-reveal {
  display: none;
  margin-top: 15px;
  padding: 15px;
  background: #e8f5e9;
  border-left: 4px solid #2e7d32;
  border-radius: 4px;
}

.btn-show-answer {
  background: #6c757d;
  font-size: 14px;
  padding: 8px 16px;
}

.btn-show-answer:hover {
  background: #5a6268;
}

/* Submit Button */
.btn-submit {
  background: #e74c3c;
}

.btn-submit:hover {
  background: #c0392b;
}

/* Modal */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.modal-content {
  background: white;
  padding: 30px;
  border-radius: 10px;
  max-width: 400px;
  text-align: center;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.modal-content h3 {
  margin-top: 0;
  color: #2c3e50;
}

.modal-content p {
  color: #666;
  margin: 15px 0;
}

.modal-buttons {
  display: flex;
  gap: 15px;
  justify-content: center;
  margin-top: 20px;
}

.modal-buttons button {
  padding: 10px 25px;
}

.modal-buttons .btn-confirm {
  background: #27ae60;
}

.modal-buttons .btn-confirm:hover {
  background: #219a52;
}

/* Hint text */
.hint {
  color: #666;
  font-size: 13px;
  font-style: italic;
}

/* Category Breakdown */
.category-breakdown {
  background: #f8f9fa;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 25px;
}

.category-row {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-bottom: 12px;
}

.category-row:last-child {
  margin-bottom: 0;
}

.category-name {
  width: 150px;
  font-weight: 500;
  color: #333;
}

.category-bar {
  flex: 1;
  height: 24px;
  background: #e9ecef;
  border-radius: 12px;
  overflow: hidden;
}

.category-fill {
  height: 100%;
  border-radius: 12px;
  transition: width 0.5s ease;
}

.category-fill.good {
  background: linear-gradient(90deg, #56ab2f, #a8e063);
}

.category-fill.needs-work {
  background: linear-gradient(90deg, #eb3349, #f45c43);
}

.category-score {
  width: 100px;
  text-align: right;
  font-weight: 500;
  color: #666;
}

/* Areas (Weak/Strong) */
.areas-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 15px;
  margin-bottom: 25px;
}

.area-card {
  background: #f8f9fa;
  border-radius: 8px;
  padding: 15px;
  border-left: 4px solid #ccc;
}

.area-card.weak {
  border-left-color: #e74c3c;
  background: #fef5f5;
}

.area-card.strong {
  border-left-color: #27ae60;
  background: #f5faf5;
}

.area-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.area-name {
  font-weight: 600;
  color: #333;
}

.area-pct {
  font-weight: bold;
  font-size: 18px;
}

.area-card.weak .area-pct {
  color: #e74c3c;
}

.area-card.strong .area-pct {
  color: #27ae60;
}

.area-bar {
  height: 8px;
  background: #e9ecef;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 8px;
}

.area-fill {
  height: 100%;
  border-radius: 4px;
}

.area-fill.weak {
  background: linear-gradient(90deg, #eb3349, #f45c43);
}

.area-fill.strong {
  background: linear-gradient(90deg, #56ab2f, #a8e063);
}

.area-meta {
  font-size: 12px;
  color: #666;
}

/* Time Card */
.time-card {
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%) !important;
}

/* Chart Container */
.chart-container {
  background: white;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 25px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* ===== CSS VARIABLES FOR THEMING ===== */
:root {
  /* Light theme (default) */
  --bg-primary: #f4f6f8;
  --bg-secondary: #ffffff;
  --bg-tertiary: #f7fafc;
  --bg-card: #ffffff;
  --text-primary: #2d3748;
  --text-secondary: #4a5568;
  --text-muted: #718096;
  --border-color: #e2e8f0;
  --border-hover: #cbd5e0;
  --accent-primary: #667eea;
  --accent-secondary: #764ba2;
  --accent-gradient: linear-gradient(135deg, #667eea, #764ba2);
  --success: #48bb78;
  --warning: #ed8936;
  --danger: #e53e3e;
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.1);
  --shadow-md: 0 4px 15px rgba(0,0,0,0.1);
  --shadow-lg: 0 10px 40px rgba(0,0,0,0.15);
  --header-bg: rgba(255, 255, 255, 0.95);
  --input-bg: #ffffff;
  --modal-overlay: rgba(0, 0, 0, 0.5);
}

/* Dark theme */
:root.dark {
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --bg-tertiary: #334155;
  --bg-card: #1e293b;
  --text-primary: #f1f5f9;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --border-color: #334155;
  --border-hover: #475569;
  --accent-primary: #818cf8;
  --accent-secondary: #a78bfa;
  --accent-gradient: linear-gradient(135deg, #818cf8, #a78bfa);
  --success: #4ade80;
  --warning: #fb923c;
  --danger: #f87171;
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 15px rgba(0,0,0,0.4);
  --shadow-lg: 0 10px 40px rgba(0,0,0,0.5);
  --header-bg: rgba(30, 41, 59, 0.95);
  --input-bg: #1e293b;
  --modal-overlay: rgba(0, 0, 0, 0.7);
}

/* Dark mode specific overrides */
:root.dark .main-header,
:root.dark .quiz-header {
  background: var(--header-bg);
}

:root.dark .quiz-setup,
:root.dark .welcome-card,
:root.dark .question-card,
:root.dark .modal-content,
:root.dark .attempt-card,
:root.dark .history-table th,
:root.dark .stat-card,
:root.dark .empty-state-card,
:root.dark .auth-prompt-card {
  background: var(--bg-card);
}

:root.dark .form-section h3,
:root.dark .setup-header h1,
:root.dark .welcome-text h2,
:root.dark .mode-title,
:root.dark .exam-title,
:root.dark .attempt-exam,
:root.dark .stat-number {
  color: var(--text-primary);
}

:root.dark .form-section h3,
:root.dark .setup-header p,
:root.dark .mode-desc,
:root.dark .exam-questions,
:root.dark .stat-label,
:root.dark .welcome-text h2,
:root.dark .quiz-progress span,
:root.dark .quiz-timer {
  color: var(--text-secondary);
}

:root.dark .exam-card,
:root.dark .mode-card,
:root.dark .setting-item,
:root.dark .option-item {
  background: var(--bg-tertiary);
  border-color: var(--border-color);
}

:root.dark .exam-card:hover,
:root.dark .mode-card:hover {
  border-color: var(--accent-primary);
}

:root.dark input,
:root.dark select {
  background: var(--input-bg);
  border-color: var(--border-color);
  color: var(--text-primary);
}

:root.dark .num-btn,
:root.dark .preset-btn,
:root.dark .toggle-btn {
  background: var(--bg-card);
  border-color: var(--border-color);
  color: var(--text-secondary);
}

:root.dark .progress-bar,
:root.dark .category-bar,
:root.dark .area-bar {
  background: var(--bg-tertiary);
}

:root.dark .chart-container {
  background: var(--bg-card);
}

:root.dark .history-table td,
:root.dark .history-table th {
  border-color: var(--border-color);
}

:root.dark .auth-prompt-card,
:root.dark .empty-state-card {
  background: var(--bg-card);
}

/* Apply CSS variables */
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  margin: 0;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  transition: background-color 0.3s, color 0.3s;
}

/* Base reset */
* {
  box-sizing: border-box;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  margin: 0;
  background: var(--bg-primary);
  min-height: 100vh;
}

/* Main Header */
.main-header {
  background: var(--header-bg);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 15px 30px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 22px;
  font-weight: 800;
  color: var(--accent-primary);
}

.logo i {
  font-size: 28px;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 20px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: 8px;
  font-weight: 500;
  transition: all 0.2s;
}

.nav-link:hover, .nav-link.active {
  background: var(--accent-gradient);
  color: white;
}

.user-menu {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  background: var(--bg-tertiary);
  border-radius: 20px;
}

.user-avatar {
  width: 32px;
  height: 32px;
  background: var(--accent-gradient);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 14px;
}

.btn-logout {
  padding: 6px 14px;
  background: var(--bg-secondary);
  color: var(--text-secondary);
  border-radius: 6px;
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
}

.btn-logout:hover {
  background: var(--border-color);
}

.btn-login, .btn-register {
  padding: 10px 20px;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
  transition: all 0.2s;
}

.btn-login {
  color: var(--accent-primary);
}

.btn-register {
  background: var(--accent-gradient);
  color: white;
}

.btn-register:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

/* Theme Toggle Button */
.theme-toggle {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  transition: all 0.3s;
}

.theme-toggle:hover {
  background: var(--accent-primary);
  color: white;
  transform: rotate(15deg);
}

/* Main Content */
.main-content {
  max-width: 1000px;
  margin: 40px auto;
  padding: 0 20px;
}

/* Welcome Card */
.welcome-card {
  background: white;
  border-radius: 16px;
  padding: 30px;
  display: flex;
  align-items: center;
  gap: 25px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.15);
  margin-bottom: 30px;
}

.welcome-icon i {
  font-size: 60px;
  background: linear-gradient(135deg, #667eea, #764ba2);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.welcome-text h2 {
  margin: 0 0 10px 0;
  color: #2d3748;
  font-size: 24px;
}

.quick-stats {
  display: flex;
  gap: 30px;
}

.stat-item {
  display: flex;
  flex-direction: column;
}

.stat-number {
  font-size: 28px;
  font-weight: 800;
  color: #667eea;
}

.stat-label {
  font-size: 13px;
  color: #718096;
}

/* Quiz Setup */
.quiz-setup {
  background: white;
  border-radius: 20px;
  padding: 40px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.15);
}

.setup-header {
  text-align: center;
  margin-bottom: 40px;
}

.setup-header h1 {
  margin: 0 0 10px 0;
  color: #2d3748;
  font-size: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.setup-header h1 i {
  color: #667eea;
}

.setup-header p {
  color: #718096;
  margin: 0;
  font-size: 16px;
}

.form-section {
  margin-bottom: 35px;
}

.form-section h3 {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #2d3748;
  font-size: 18px;
  margin: 0 0 20px 0;
}

.step-number {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
}

/* Exam Grid */
.exam-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 15px;
}

.exam-card {
  position: relative;
  padding: 20px;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.exam-card:hover {
  border-color: #667eea;
  transform: translateY(-2px);
}

.exam-card.selected {
  border-color: #667eea;
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.1), rgba(118, 75, 162, 0.1));
}

.exam-card input {
  display: none;
}

.exam-icon {
  width: 60px;
  height: 60px;
  background: linear-gradient(135deg, #667eea, #764ba2);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
}

.exam-icon i {
  font-size: 28px;
  color: white;
}

.exam-info {
  display: flex;
  flex-direction: column;
}

.exam-title {
  font-weight: 700;
  color: #2d3748;
  font-size: 15px;
}

.exam-questions {
  font-size: 13px;
  color: #718096;
}

.exam-check {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 24px;
  height: 24px;
  background: #667eea;
  border-radius: 50%;
  display: none;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 12px;
}

.exam-card.selected .exam-check {
  display: flex;
}

/* Mode Grid */
.mode-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 15px;
}

.mode-card {
  position: relative;
  padding: 20px;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 15px;
}

.mode-card:hover {
  border-color: #667eea;
}

.mode-card.selected {
  border-color: #667eea;
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.05), rgba(118, 75, 162, 0.05));
}

.mode-card input {
  display: none;
}

.mode-icon {
  width: 50px;
  height: 50px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
}

.mode-icon.practice {
  background: linear-gradient(135deg, #48bb78, #38a169);
  color: white;
}

.mode-icon.exam {
  background: linear-gradient(135deg, #ed8936, #dd6b20);
  color: white;
}

.mode-icon.review {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
}

.mode-info {
  flex: 1;
}

.mode-title {
  display: block;
  font-weight: 700;
  color: #2d3748;
  font-size: 15px;
}

.mode-desc {
  font-size: 12px;
  color: #718096;
}

.mode-check {
  position: absolute;
  top: 10px;
  right: 10px;
  color: #667eea;
  font-size: 18px;
  opacity: 0;
}

.mode-card.selected .mode-check {
  opacity: 1;
}

/* Settings Grid */
.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 25px;
}

.setting-item {
  background: #f7fafc;
  padding: 20px;
  border-radius: 12px;
}

.setting-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  color: #2d3748;
  margin-bottom: 12px;
}

.setting-label i {
  color: #667eea;
}

/* Number Select */
.number-select {
  display: flex;
  align-items: center;
  gap: 8px;
}

.number-select input {
  width: 80px;
  padding: 10px;
  text-align: center;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  font-size: 18px;
  font-weight: 600;
  color: #2d3748;
}

.number-select input:focus {
  outline: none;
  border-color: #667eea;
}

.num-btn {
  padding: 10px 14px;
  border: 2px solid #e2e8f0;
  background: white;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  color: #4a5568;
  transition: all 0.2s;
}

.num-btn:hover {
  border-color: #667eea;
  color: #667eea;
}

/* Quick Presets */
.quick-presets {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.preset-btn {
  padding: 8px 14px;
  border: 2px solid #e2e8f0;
  background: white;
  border-radius: 20px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: #718096;
  transition: all 0.2s;
}

.preset-btn:hover {
  border-color: #667eea;
  color: #667eea;
}

.preset-btn.active {
  background: #667eea;
  border-color: #667eea;
  color: white;
}

/* Toggle Group */
.toggle-group {
  display: flex;
  gap: 10px;
}

.toggle-option input {
  display: none;
}

.toggle-btn {
  padding: 10px 20px;
  border: 2px solid #e2e8f0;
  background: white;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 500;
  color: #718096;
  transition: all 0.2s;
  display: inline-block;
}

.toggle-option input:checked + .toggle-btn {
  background: #667eea;
  border-color: #667eea;
  color: white;
}

/* Time Select */
.time-select {
  width: 100%;
  padding: 12px;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  font-size: 15px;
  color: #2d3748;
  cursor: pointer;
}

/* Start Button */
.btn-start {
  width: 100%;
  padding: 18px;
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 20px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 30px;
}

.btn-start:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 30px rgba(102, 126, 234, 0.4);
}

/* Auth Prompt Card */
.auth-prompt-card {
  background: white;
  border-radius: 16px;
  padding: 30px;
  margin-top: 30px;
  display: flex;
  align-items: center;
  gap: 25px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.15);
}

.auth-prompt-card > i {
  font-size: 50px;
  color: #667eea;
}

.auth-prompt-card > div {
  flex: 1;
}

.auth-prompt-card h4 {
  margin: 0 0 8px 0;
  color: #2d3748;
}

.auth-prompt-card p {
  margin: 0;
  color: #718096;
}

.auth-buttons {
  display: flex;
  gap: 12px;
}

.btn-outline {
  padding: 12px 24px;
  border: 2px solid #667eea;
  color: #667eea;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
}

.btn-solid {
  padding: 12px 24px;
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
}

/* Responsive */
@media (max-width: 768px) {
  .header-content {
    flex-direction: column;
    gap: 15px;
    padding: 15px;
  }
  
  .welcome-card {
    flex-direction: column;
    text-align: center;
  }
  
  .quick-stats {
    justify-content: center;
  }
  
  .quiz-setup {
    padding: 20px;
  }
  
  .exam-grid, .mode-grid, .settings-grid {
    grid-template-columns: 1fr;
  }
  
  .auth-prompt-card {
    flex-direction: column;
    text-align: center;
  }
}

/* ===== QUIZ PAGE STYLES ===== */

/* Quiz Header */
.quiz-header {
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(10px);
  box-shadow: 0 2px 20px rgba(0,0,0,0.1);
  padding: 15px 20px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.quiz-header-content {
  max-width: 1000px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 20px;
}

.quiz-mode-badge {
  padding: 8px 16px;
  border-radius: 20px;
  font-weight: 600;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.quiz-mode-badge.practice {
  background: linear-gradient(135deg, #48bb78, #38a169);
  color: white;
}

.quiz-mode-badge.exam {
  background: linear-gradient(135deg, #ed8936, #dd6b20);
  color: white;
}

.quiz-mode-badge.review {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
}

.quiz-progress {
  flex: 1;
}

.quiz-progress span {
  font-size: 14px;
  font-weight: 600;
  color: #4a5568;
  margin-bottom: 5px;
  display: block;
}

.progress-bar {
  height: 8px;
  background: #e2e8f0;
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #667eea, #764ba2);
  border-radius: 4px;
  transition: width 0.3s ease;
}

.quiz-timer {
  font-size: 24px;
  font-weight: 700;
  color: #2d3748;
  font-family: 'Courier New', monospace;
}

.quiz-timer.time-warning {
  color: #ed8936;
  animation: pulse 1s infinite;
}

.quiz-timer.time-critical {
  color: #e53e3e;
  animation: pulse 0.5s infinite;
}

.btn-exit {
  padding: 10px 20px;
  background: #e2e8f0;
  border: none;
  border-radius: 8px;
  color: #4a5568;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s;
}

.btn-exit:hover {
  background: #cbd5e0;
}

/* Quiz Container */
.quiz-container {
  max-width: 800px;
  margin: 40px auto;
  padding: 0 20px;
}

.question-card {
  background: white;
  border-radius: 16px;
  padding: 30px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.1);
}

.question-text {
  font-size: 20px;
  font-weight: 600;
  color: #2d3748;
  margin-bottom: 25px;
  line-height: 1.5;
}

/* Options */
.options-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.option-item {
  display: flex;
  align-items: center;
  padding: 15px 20px;
  background: #f7fafc;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.option-item:hover {
  border-color: #667eea;
  background: #edf2f7;
}

.option-item.selected,
.option-item:has(input:checked) {
  border-color: #667eea;
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.1), rgba(118, 75, 162, 0.1));
}

.option-item input {
  display: none;
}

.option-letter {
  width: 32px;
  height: 32px;
  background: #e2e8f0;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #4a5568;
  margin-right: 15px;
}

.option-item:has(input:checked) .option-letter {
  background: #667eea;
  color: white;
}

.option-text {
  flex: 1;
  color: #2d3748;
}

/* Quiz Navigation */
.quiz-navigation {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 25px;
  background: white;
  padding: 20px;
  border-radius: 12px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.btn-nav {
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s;
}

.btn-prev {
  background: #e2e8f0;
  color: #4a5568;
}

.btn-prev:hover {
  background: #cbd5e0;
}

.btn-next {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
}

.btn-next:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.question-dots {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.dot {
  width: 12px;
  height: 12px;
  background: #e2e8f0;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.2s;
}

.dot:hover {
  background: #cbd5e0;
}

.dot.active {
  background: #667eea;
  transform: scale(1.2);
}

.dot.answered {
  background: #48bb78;
}

/* Exit Modal */
.exit-options {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 20px;
}

.exit-btn {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 15px 20px;
  border: 2px solid #e2e8f0;
  background: white;
  border-radius: 12px;
  cursor: pointer;
  text-align: left;
  transition: all 0.2s;
}

.exit-btn:hover {
  border-color: #667eea;
}

.exit-btn i {
  font-size: 24px;
  width: 40px;
  text-align: center;
}

.exit-btn span {
  flex: 1;
  font-weight: 600;
  color: #2d3748;
}

.exit-btn small {
  color: #718096;
  font-size: 12px;
}

.exit-btn.save i {
  color: #48bb78;
}

.exit-btn.discard i {
  color: #e53e3e;
}

.exit-btn.continue {
  background: #667eea;
  border-color: #667eea;
}

.exit-btn.continue i,
.exit-btn.continue span,
.exit-btn.continue small {
  color: white;
}

/* Modal Icon */
.modal-icon {
  text-align: center;
  margin-bottom: 15px;
}

.modal-icon i {
  font-size: 60px;
  color: #667eea;
}

/* History Page */
.history-section h3 {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #2d3748;
  margin: 30px 0 20px 0;
}

.history-section h3:first-child {
  margin-top: 0;
}

.attempt-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 15px;
  margin-bottom: 30px;
}

.attempt-card {
  background: white;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.1);
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.attempt-card.incomplete {
  border-left: 4px solid #ed8936;
}

.attempt-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.attempt-exam {
  font-weight: 700;
  color: #2d3748;
}

.attempt-mode {
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

.attempt-mode.practice {
  background: #c6f6d5;
  color: #276749;
}

.attempt-mode.exam {
  background: #feebc8;
  color: #c05621;
}

.attempt-mode.review {
  background: #e9d8fd;
  color: #6b46c1;
}

.attempt-stats {
  display: flex;
  gap: 20px;
  color: #718096;
  font-size: 14px;
}

.attempt-actions {
  margin-top: auto;
}

.btn-resume {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: linear-gradient(135deg, #ed8936, #dd6b20);
  color: white;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
  transition: all 0.2s;
}

.btn-resume:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(237, 137, 54, 0.4);
}

.mode-badge {
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}

.mode-badge.practice {
  background: #c6f6d5;
  color: #276749;
}

.mode-badge.exam {
  background: #feebc8;
  color: #c05621;
}

.mode-badge.review {
  background: #e9d8fd;
  color: #6b46c1;
}

/* Empty State Card */
.empty-state-card {
  background: white;
  border-radius: 16px;
  padding: 60px 30px;
  text-align: center;
  box-shadow: 0 10px 40px rgba(0,0,0,0.1);
}

.empty-state-card i {
  font-size: 80px;
  color: #e2e8f0;
  margin-bottom: 20px;
}

.empty-state-card h3 {
  margin: 0 0 10px 0;
  color: #2d3748;
}

.empty-state-card p {
  color: var(--text-muted);
  margin: 0 0 30px 0;
}

/* Keyboard Shortcuts Help */
.keyboard-help {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-top: 20px;
  padding: 15px;
  background: var(--bg-tertiary);
  border-radius: 10px;
  color: var(--text-muted);
  font-size: 13px;
  flex-wrap: wrap;
}

.kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 24px;
  padding: 0 6px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  font-family: monospace;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  box-shadow: 0 2px 0 var(--border-color);
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .header-content {
    flex-direction: column;
    gap: 15px;
    padding: 15px;
  }
  
  .main-nav {
    flex-wrap: wrap;
    justify-content: center;
  }
  
  .welcome-card {
    flex-direction: column;
    text-align: center;
  }
  
  .quick-stats {
    justify-content: center;
  }
  
  .quiz-setup {
    padding: 20px;
  }
  
  .exam-grid, .mode-grid, .settings-grid {
    grid-template-columns: 1fr;
  }
  
  .auth-prompt-card {
    flex-direction: column;
    text-align: center;
  }
  
  .quiz-header-content {
    flex-wrap: wrap;
    gap: 10px;
  }
  
  .quiz-progress {
    order: 3;
    width: 100%;
  }
  
  .keyboard-help {
    display: none;
  }
  
  .exit-options {
    gap: 10px;
  }
  
  .exit-btn {
    padding: 12px 15px;
  }
  
  .exit-btn small {
    display: none;
  }
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slideIn {
  from { opacity: 0; transform: translateX(-20px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.question-card {
  animation: fadeIn 0.3s ease-out;
}

.welcome-card,
.quiz-setup,
.attempt-card {
  animation: fadeIn 0.4s ease-out;
}

/* Focus styles for accessibility */
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid var(--accent-primary);
  outline-offset: 2px;
}

/* Smooth scrolling */
html {
  scroll-behavior: smooth;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  top: 80px;
  right: 20px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  padding: 16px 24px;
  border-radius: 12px;
  background: var(--bg-card);
  border-left: 4px solid var(--accent-primary);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 12px;
  animation: slideInRight 0.3s ease-out;
  min-width: 300px;
  max-width: 400px;
}

.toast.success {
  border-left-color: var(--success);
}

.toast.error {
  border-left-color: var(--danger);
}

.toast.warning {
  border-left-color: var(--warning);
}

.toast.info {
  border-left-color: var(--accent-primary);
}

.toast-icon {
  font-size: 20px;
}

.toast.success .toast-icon { color: var(--success); }
.toast.error .toast-icon { color: var(--danger); }
.toast.warning .toast-icon { color: var(--warning); }
.toast.info .toast-icon { color: var(--accent-primary); }

.toast-message {
  flex: 1;
  color: var(--text-primary);
}

.toast-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  font-size: 16px;
}

.toast-close:hover {
  color: var(--text-primary);
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(100px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slideOutRight {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(100px);
  }
}