/* Modern Dark Mode Exam-Style Quiz */
:root {
  --primary: #6366f1;
  --primary-light: #818cf8;
  --success: #10b981;
  --error: #ef4444;
  --warning: #f59e0b;
  --background: #0f172a;
  --surface: #1e293b;
  --surface-elevated: #334155;
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --border: #334155;
  --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.3), 0 2px 4px -2px rgb(0 0 0 / 0.3);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.5),
    0 4px 6px -4px rgb(0 0 0 / 0.5);
  --radius: 12px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter",
    sans-serif;
  background: var(--background);
  color: var(--text-primary);
  line-height: 1.6;
  font-size: 16px;
  min-height: 100vh;
}

/* Custom Scrollbar for Dark Mode */
::-webkit-scrollbar {
  width: 12px;
}

::-webkit-scrollbar-track {
  background: var(--surface);
  border-radius: 10px;
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 10px;
  border: 2px solid var(--surface);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--primary);
}

.app-container {
  max-width: 900px;
  margin: 0 auto;
  padding: 20px;
}

/* Title Bar */
.title-bar {
  text-align: center;
  margin-bottom: 28px;
  padding: 24px 0;
}

.app-title {
  font-size: 42px;
  font-weight: 800;
  color: var(--text-primary);
  margin: 0 0 8px 0;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, var(--primary-light), var(--primary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.app-subtitle {
  font-size: 16px;
  color: var(--text-muted);
  margin: 0;
  font-weight: 500;
}

/* Stats Bar */
.stats-bar {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 24px;
  margin-top: 10px;
  box-shadow: var(--shadow);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 20px;
  border: 1px solid var(--border);
}

.stat {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
}

.mode-selector {
  display: flex;
  gap: 4px;
}

.mode-btn {
  padding: 8px 16px;
  border: 2px solid var(--border);
  background: var(--surface-elevated);
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  color: var(--text-secondary);
}

.mode-btn:hover {
  background: var(--surface-elevated);
  border-color: var(--primary-light);
  color: var(--text-primary);
}

.mode-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

.mode-btn.active:hover {
  background: var(--primary-light);
  border-color: var(--primary-light);
}

/* Quiz Container */
.quiz-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.question-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 32px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
}

.question-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.difficulty,
.category {
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.difficulty {
  background: var(--warning);
  color: white;
}

.category {
  background: var(--primary);
  color: white;
}

.question-text {
  font-size: 28px;
  line-height: 1.5;
  color: var(--text-primary);
  margin-bottom: 32px;
  text-align: center;
  font-weight: 500;
  letter-spacing: -0.02em;
}

/* Answer Options */
.answer-options {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
}

.answer-option {
  position: relative;
  padding: 20px 24px;
  padding-left: 60px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
  transition: var(--transition);
  text-align: left;
  font-weight: 500;
  font-size: 18px;
  min-height: 70px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
}

.answer-option:hover {
  border-color: var(--primary-light);
  background: var(--surface-elevated);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.answer-option.selected {
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.15);
}

.answer-option.correct {
  border-color: var(--success);
  background: rgba(16, 185, 129, 0.15);
}

.answer-option.incorrect {
  border-color: var(--error);
  background: rgba(239, 68, 68, 0.15);
}

.answer-option::before {
  content: attr(data-letter);
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  left: 20px;
  background: var(--primary);
  color: white;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 16px;
}

/* Feedback Section */
.feedback-section {
  margin-top: 20px;
  padding: 20px;
  border-radius: var(--radius);
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  display: none;
}

.feedback-section.show {
  display: block;
}

.correct-answer {
  font-size: 16px;
  font-weight: 600;
  color: var(--success);
  text-align: center;
  margin-bottom: 8px;
}

/* Quiz Controls */
.quiz-controls {
  display: flex;
  justify-content: center;
  gap: 16px;
  padding: 20px;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.control-btn {
  padding: 14px 24px;
  border: 2px solid var(--border);
  background: var(--surface-elevated);
  border-radius: var(--radius);
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  min-width: 100px;
  text-align: center;
  font-size: 15px;
  color: var(--text-primary);
}

.control-btn:hover:not(:disabled) {
  border-color: var(--primary);
  background: var(--primary);
  color: white;
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg);
}

.control-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.control-btn.primary {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

.control-btn.primary:hover:not(:disabled) {
  background: var(--primary-light);
  border-color: var(--primary-light);
}

/* Settings Panel */
.settings-panel {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.setting-group {
  display: flex;
  gap: 12px;
  margin-bottom: 12px;
  align-items: center;
}

.setting-group:last-child {
  margin-bottom: 0;
}

.setting-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}

.setting-item input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
}

.setting-group select {
  padding: 10px 14px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-elevated);
  font-size: 14px;
  min-width: 140px;
  color: var(--text-primary);
  cursor: pointer;
  transition: var(--transition);
}

.setting-group select:hover {
  border-color: var(--primary-light);
}

.setting-group select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* Clear Progress Button */
.clear-btn {
  padding: 10px 20px;
  border: 2px solid var(--error);
  border-radius: var(--radius);
  background: transparent;
  color: var(--error);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  width: 100%;
}

.clear-btn:hover {
  background: var(--error);
  color: white;
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

/* Question Status Badges */
.question-status {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.status-badge.completed {
  background: rgba(16, 185, 129, 0.15);
  color: var(--success);
  border: 1px solid var(--success);
}

.status-badge.incorrect {
  background: rgba(239, 68, 68, 0.15);
  color: var(--error);
  border: 1px solid var(--error);
}

.status-badge.new {
  background: rgba(129, 140, 248, 0.15);
  color: var(--primary-light);
  border: 1px solid var(--primary-light);
}

/* Stats improvements */
.stat-value {
  font-weight: 700;
  color: var(--primary-light);
  font-size: 18px;
}

.stat-label {
  color: var(--text-muted);
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.8px;
  font-weight: 600;
}

/* Responsive Design */
@media (max-width: 768px) {
  .app-container {
    padding: 12px;
  }

  .stats-bar {
    flex-direction: column;
    gap: 12px;
  }

  .stat {
    justify-content: center;
  }

  .question-card {
    padding: 20px;
  }

  .question-text {
    font-size: 22px;
  }

  /* Answer options are now flex column by default */

  .quiz-controls {
    flex-direction: column;
    gap: 8px;
  }

  .control-btn {
    width: 100%;
    max-width: 200px;
  }

  .setting-group {
    flex-direction: column;
    gap: 8px;
  }
}

@media (max-width: 480px) {
  .question-text {
    font-size: 18px;
  }

  .answer-option {
    padding: 16px;
    padding-left: 56px;
    font-size: 16px;
  }

  .stats-bar {
    padding: 16px;
  }
}

/* Loading Animation */
@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

.loading {
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* Focus States for Accessibility */
.answer-option:focus,
.control-btn:focus,
.mode-btn:focus {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* Study Hub Link */
.study-hub-link:hover {
  background: var(--primary) !important;
  color: white !important;
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}
