/* ==========================================================================
   StudyBuddy - Modern, Clean & Simple Styles
   ========================================================================== */

:root {
  /* Default Primary Theme: Indigo */
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-light: #e0e7ff;
  --primary-rgb: 79, 70, 229;

  --accent: #8b5cf6;
  --accent-hover: #7c3aed;

  --success: #10b981;
  --success-light: #d1fae5;
  --warning: #f59e0b;
  --warning-light: #fef3c7;
  --danger: #ef4444;
  --danger-light: #fee2e2;

  /* Surfaces & Neutral Colors */
  --bg-main: #f8fafc;
  --bg-card: #ffffff;
  --bg-subtle: #f1f5f9;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-inverse: #ffffff;
  --border: #e2e8f0;
  --border-focus: #4f46e5;

  /* Shadow & Radii */
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
  --shadow-glow: 0 0 20px rgba(var(--primary-rgb), 0.25);

  --font-sans: 'Plus Jakarta Sans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

/* Color Palettes */
body[data-theme="sunset"] {
  --primary: #ea580c;
  --primary-hover: #c2410c;
  --primary-light: #ffedd5;
  --primary-rgb: 234, 88, 12;
  --border-focus: #ea580c;
}

body[data-theme="emerald"] {
  --primary: #059669;
  --primary-hover: #047857;
  --primary-light: #d1fae5;
  --primary-rgb: 5, 150, 105;
  --border-focus: #059669;
}

body[data-theme="rose"] {
  --primary: #e11d48;
  --primary-hover: #be123c;
  --primary-light: #ffe4e6;
  --primary-rgb: 225, 29, 72;
  --border-focus: #e11d48;
}

body[data-theme="slate"] {
  --primary: #475569;
  --primary-hover: #334155;
  --primary-light: #f1f5f9;
  --primary-rgb: 71, 85, 105;
  --border-focus: #475569;
}

/* Dark Mode Overrides */
body.dark-mode {
  --bg-main: #0b0f19;
  --bg-card: #151d2e;
  --bg-subtle: #1e293b;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --border: #334155;
  --primary-light: rgba(var(--primary-rgb), 0.18);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 20px rgba(0, 0, 0, 0.5);
}

/* ==========================================================================
   Base Styles & Reset
   ========================================================================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-main);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  transition: background-color 0.25s ease, color 0.25s ease;
  line-height: 1.5;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.app-container {
  width: 100%;
  max-width: 860px;
  padding: 1.5rem 1rem 3rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* ==========================================================================
   Header & Study Buddy
   ========================================================================== */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  padding: 0.5rem 0.25rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.brand-avatar {
  width: 48px;
  height: 48px;
  background: var(--primary-light);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  user-select: none;
}

.brand-avatar:hover {
  transform: scale(1.1) rotate(5deg);
}

.brand-title {
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-main);
}

.brand-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
  max-width: 320px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.stats-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  padding: 0.35rem 0.75rem;
  font-size: 0.82rem;
  color: var(--text-main);
  box-shadow: var(--shadow-sm);
}

.stats-badge strong {
  color: var(--primary);
}

.icon-btn {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-main);
  width: 38px;
  height: 38px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.1rem;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
}

.icon-btn:hover {
  background: var(--bg-subtle);
  border-color: var(--primary);
  transform: translateY(-1px);
}

.icon-btn-sm {
  background: none;
  border: none;
  font-size: 1.1rem;
  cursor: pointer;
  color: var(--text-muted);
  padding: 0.2rem 0.4rem;
  border-radius: var(--radius-sm);
}
.icon-btn-sm:hover {
  color: var(--text-main);
  background: var(--bg-subtle);
}

/* ==========================================================================
   Navigation Tabs
   ========================================================================== */
.nav-tabs {
  display: flex;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 0.35rem;
  gap: 0.4rem;
  box-shadow: var(--shadow-sm);
}

.nav-tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.7rem 1rem;
  border-radius: var(--radius-md);
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.nav-tab:hover {
  color: var(--text-main);
  background: var(--bg-subtle);
}

.nav-tab.active {
  background: var(--primary);
  color: var(--text-inverse);
  box-shadow: 0 4px 12px rgba(var(--primary-rgb), 0.3);
}

/* ==========================================================================
   Common Cards & Buttons
   ========================================================================== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-md);
  transition: border-color 0.2s ease;
}

.tab-view {
  display: none;
  flex-direction: column;
  gap: 1.25rem;
  animation: fadeIn 0.25s ease-out;
}

.tab-view.active {
  display: flex;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.hidden {
  display: none !important;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.65rem 1.2rem;
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s ease;
  border: 1px solid transparent;
  text-decoration: none;
  user-select: none;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: var(--primary);
  color: var(--text-inverse);
}
.btn-primary:hover {
  background: var(--primary-hover);
  box-shadow: 0 4px 12px rgba(var(--primary-rgb), 0.3);
}

.btn-secondary {
  background: var(--bg-subtle);
  color: var(--text-main);
  border-color: var(--border);
}
.btn-secondary:hover {
  background: var(--border);
}

.btn-accent {
  background: var(--accent);
  color: var(--text-inverse);
}
.btn-accent:hover {
  background: var(--accent-hover);
}

.btn-success {
  background: var(--success);
  color: var(--text-inverse);
}
.btn-warning {
  background: var(--warning);
  color: #1e293b;
}

.btn-outline {
  background: transparent;
  color: var(--text-main);
  border-color: var(--border);
}
.btn-outline:hover {
  background: var(--bg-subtle);
  border-color: var(--primary);
}

.btn-danger-outline {
  background: transparent;
  color: var(--danger);
  border-color: var(--border);
}
.btn-danger-outline:hover {
  background: var(--danger-light);
  border-color: var(--danger);
}

.btn-sm {
  padding: 0.45rem 0.85rem;
  font-size: 0.82rem;
}
.btn-xs {
  padding: 0.3rem 0.6rem;
  font-size: 0.75rem;
  border-radius: var(--radius-sm);
}
.btn-large {
  padding: 0.85rem 2rem;
  font-size: 1.05rem;
}
.btn-block {
  width: 100%;
}
.icon-only {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-full);
  padding: 0;
  font-size: 1.15rem;
}

.form-control, .form-select {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus, .form-select:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.15);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 0.85rem;
}

.form-group label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
}

/* ==========================================================================
   TAB 1: POMODORO CLOCK
   ========================================================================== */
.timer-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 2.25rem 1.5rem;
}

.mode-pill-group {
  display: flex;
  background: var(--bg-subtle);
  border-radius: var(--radius-full);
  padding: 0.3rem;
  gap: 0.3rem;
  margin-bottom: 1.5rem;
}

.mode-pill {
  padding: 0.45rem 1.25rem;
  border-radius: var(--radius-full);
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.mode-pill:hover {
  color: var(--text-main);
}

.mode-pill.active {
  background: var(--bg-card);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.clock-display-wrap {
  position: relative;
  width: 280px;
  height: 280px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.75rem;
}

.progress-ring {
  transform: rotate(-90deg);
  position: absolute;
  top: 0;
  left: 0;
}

.progress-ring-track {
  fill: transparent;
  stroke: var(--bg-subtle);
  stroke-width: 10;
}

.progress-ring-bar {
  fill: transparent;
  stroke: var(--primary);
  stroke-width: 10;
  stroke-linecap: round;
  stroke-dasharray: 753.98; /* 2 * PI * 120 */
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 0.4s linear, stroke 0.3s ease;
}

.clock-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 1;
}

.time-readout {
  font-family: var(--font-mono);
  font-size: 3.5rem;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.04em;
  line-height: 1;
  margin-bottom: 0.4rem;
}

.mode-status-label {
  font-size: 0.95rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.6rem;
}

.cycle-dots {
  display: flex;
  gap: 0.4rem;
}

.cycle-dots .dot {
  width: 9px;
  height: 9px;
  border-radius: var(--radius-full);
  background: var(--border);
  transition: background-color 0.2s;
}

.cycle-dots .dot.active {
  background: var(--primary);
}

.focus-task-container {
  width: 100%;
  max-width: 440px;
  margin-bottom: 1.5rem;
}

.focus-task-input {
  width: 100%;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-full);
  border: 1px dashed var(--border);
  background: var(--bg-subtle);
  text-align: center;
  color: var(--text-main);
  font-size: 0.92rem;
  outline: none;
  transition: all 0.2s;
}

.focus-task-input:focus {
  border-color: var(--primary);
  background: var(--bg-card);
  box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.15);
}

.timer-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.quick-adjust-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-subtle);
  border-radius: var(--radius-full);
  padding: 0.25rem 0.6rem;
}

.quick-btn {
  background: transparent;
  border: none;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  padding: 0.2rem 0.45rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.quick-btn:hover {
  color: var(--primary);
  background: var(--bg-card);
}

.quick-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
  padding: 0 0.3rem;
}

.buddy-card {
  background: linear-gradient(135deg, var(--bg-card) 0%, var(--bg-subtle) 100%);
}

.buddy-header {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
}

.buddy-avatar-large {
  font-size: 2rem;
}

.buddy-tip-text {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* ==========================================================================
   TAB 2: FLASHCARDS
   ========================================================================== */
.flashcards-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.deck-selector-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.deck-selector-wrap label {
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--text-muted);
}

.flashcards-actions {
  display: flex;
  gap: 0.5rem;
}

.study-card-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
}

.study-meta {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.88rem;
  color: var(--text-muted);
}

.card-counter {
  font-weight: 700;
  color: var(--text-main);
}

.deck-mastery-stats {
  display: flex;
  gap: 0.5rem;
}

.badge {
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
}

.mastered-badge {
  background: var(--success-light);
  color: var(--success);
}

.learning-badge {
  background: var(--warning-light);
  color: #b45309;
}

/* 3D Flip Card Effect */
.flip-card-wrapper {
  width: 100%;
  max-width: 580px;
  height: 320px;
  perspective: 1200px;
  cursor: pointer;
  outline: none;
}

.flip-card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  text-align: center;
  transition: transform 0.55s cubic-bezier(0.4, 0.2, 0.2, 1);
  transform-style: preserve-3d;
  border-radius: var(--radius-lg);
}

.flip-card-wrapper.flipped .flip-card-inner {
  transform: rotateY(180deg);
}

.flip-card-face {
  position: absolute;
  width: 100%;
  height: 100%;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  border-radius: var(--radius-lg);
  border: 2px solid var(--border);
  padding: 2rem 1.75rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  box-shadow: var(--shadow-lg);
}

.flip-card-front {
  background: var(--bg-card);
}

.flip-card-back {
  background: linear-gradient(145deg, var(--bg-card) 0%, var(--primary-light) 100%);
  transform: rotateY(180deg);
  border-color: var(--primary);
}

.face-tag {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
  color: var(--primary);
  background: var(--bg-subtle);
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-sm);
}

.card-text {
  font-size: 1.35rem;
  font-weight: 600;
  line-height: 1.45;
  color: var(--text-main);
  max-height: 180px;
  overflow-y: auto;
  padding: 0.5rem;
  word-break: break-word;
}

.flip-hint {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.card-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 0.5rem;
}

.deck-sub-controls {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: center;
}

/* Deck Management Table */
.deck-manager-card {
  margin-top: 1rem;
}

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

.cards-table-wrapper {
  max-height: 320px;
  overflow-y: auto;
}

.cards-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.cards-table th {
  text-align: left;
  padding: 0.6rem;
  border-bottom: 2px solid var(--border);
  color: var(--text-muted);
}

.cards-table td {
  padding: 0.6rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

/* ==========================================================================
   TAB 3: QUIZ ARENA
   ========================================================================== */
.quiz-hero {
  text-align: center;
  padding: 1rem 0 1.5rem 0;
}

.quiz-hero-icon {
  font-size: 3rem;
  margin-bottom: 0.5rem;
}

.quiz-hero h2 {
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 0.4rem;
}

.quiz-hero p {
  color: var(--text-muted);
  font-size: 0.92rem;
  max-width: 520px;
  margin: 0 auto;
}

.quiz-options-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
  margin-top: 1rem;
}

.quiz-option-card {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 1rem;
}

.quiz-option-card .option-icon {
  font-size: 2rem;
}

.quiz-option-card h3 {
  font-size: 1.15rem;
  font-weight: 700;
}

.quiz-option-card p {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.custom-quiz-btns {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.button-row {
  display: flex;
  gap: 0.4rem;
}

/* Quiz Runner */
.quiz-runner-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.quiz-title-badge {
  font-size: 0.8rem;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--primary);
  background: var(--primary-light);
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
  display: inline-block;
  margin-bottom: 0.2rem;
}

.quiz-progress-label {
  font-size: 1.05rem;
  font-weight: 700;
}

.quiz-timer-badge {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  font-weight: 600;
  background: var(--bg-subtle);
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-full);
}

.quiz-progress-bar-container {
  width: 100%;
  height: 8px;
  background: var(--bg-subtle);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-bottom: 1.5rem;
}

.quiz-progress-bar-fill {
  height: 100%;
  background: var(--primary);
  width: 0%;
  transition: width 0.3s ease;
}

.quiz-question-card {
  padding: 1rem 0;
}

.quiz-question-title {
  font-size: 1.3rem;
  font-weight: 700;
  line-height: 1.4;
  margin-bottom: 1.25rem;
}

.quiz-options-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.quiz-option-btn {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  width: 100%;
  text-align: left;
  padding: 1rem 1.2rem;
  border-radius: var(--radius-md);
  border: 2px solid var(--border);
  background: var(--bg-card);
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.quiz-option-btn:hover:not(:disabled) {
  border-color: var(--primary);
  background: var(--bg-subtle);
}

.quiz-option-btn .letter-indicator {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-full);
  background: var(--bg-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.quiz-option-btn.correct {
  border-color: var(--success) !important;
  background: var(--success-light) !important;
  color: #065f46 !important;
}

.quiz-option-btn.wrong {
  border-color: var(--danger) !important;
  background: var(--danger-light) !important;
  color: #991b1b !important;
}

.quiz-explanation {
  margin-top: 1.25rem;
  padding: 0.85rem 1rem;
  border-radius: var(--radius-md);
  background: var(--bg-subtle);
  border-left: 4px solid var(--primary);
  font-size: 0.9rem;
  line-height: 1.45;
}

.quiz-runner-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1.5rem;
}

.quiz-feedback-text {
  font-weight: 700;
  font-size: 1rem;
}

/* Quiz Results Screen */
.result-header {
  text-align: center;
  padding: 1rem 0;
}

.result-trophy {
  font-size: 3.5rem;
  margin-bottom: 0.5rem;
}

.score-circle-container {
  display: flex;
  justify-content: center;
  margin: 1.25rem 0;
}

.score-display {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 160px;
  height: 160px;
  border-radius: var(--radius-full);
  border: 6px solid var(--primary);
  background: var(--bg-subtle);
}

.score-percent {
  font-size: 2.25rem;
  font-weight: 800;
  color: var(--primary);
}

.score-fraction {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 600;
}

.result-breakdown {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-height: 280px;
  overflow-y: auto;
  margin: 1rem 0;
  padding: 0.5rem;
}

.review-item {
  padding: 0.85rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  font-size: 0.88rem;
  background: var(--bg-card);
}

.review-item.review-correct {
  border-left: 4px solid var(--success);
}

.review-item.review-wrong {
  border-left: 4px solid var(--danger);
}

.review-q-text {
  font-weight: 700;
  margin-bottom: 0.35rem;
}

.result-actions {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 1.5rem;
}

/* ==========================================================================
   Modals & Dialogs
   ========================================================================== */
.modal-dialog {
  margin: auto;
  border: none;
  border-radius: var(--radius-lg);
  padding: 0;
  max-width: 500px;
  width: 90%;
  background: var(--bg-card);
  color: var(--text-main);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.modal-dialog-lg {
  max-width: 620px;
}

.modal-dialog::backdrop {
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(4px);
}

.modal-content {
  padding: 1.75rem;
}

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

.modal-header h3 {
  font-size: 1.2rem;
  font-weight: 800;
}

.modal-close-btn {
  background: none;
  border: none;
  font-size: 1.25rem;
  cursor: pointer;
  color: var(--text-muted);
}
.modal-close-btn:hover {
  color: var(--text-main);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
  margin-top: 1.25rem;
}

.option-input-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.5rem;
}

/* Settings Form Details */
.settings-body h4 {
  font-size: 0.95rem;
  font-weight: 700;
  margin: 1.25rem 0 0.65rem 0;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.35rem;
}
.settings-body h4:first-of-type {
  margin-top: 0;
}

.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.form-check-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.9rem;
  cursor: pointer;
}

.theme-picker-group {
  display: flex;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.theme-pick-btn {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  border: 3px solid transparent;
  cursor: pointer;
  transition: transform 0.2s, border-color 0.2s;
}

.theme-pick-btn.active {
  border-color: var(--text-main);
  transform: scale(1.15);
}

.data-actions-row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.5rem;
}

.file-upload-label {
  cursor: pointer;
}

/* ==========================================================================
   Footer
   ========================================================================== */
.app-footer {
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: auto;
  padding: 1rem 0;
}

/* ==========================================================================
   Responsive Adaptations
   ========================================================================== */
@media (max-width: 600px) {
  .app-container {
    padding: 1rem 0.5rem;
  }
  .app-header {
    flex-direction: column;
    align-items: flex-start;
  }
  .header-actions {
    width: 100%;
    justify-content: space-between;
  }
  .nav-tab .tab-text {
    font-size: 0.85rem;
  }
  .time-readout {
    font-size: 2.8rem;
  }
  .clock-display-wrap {
    width: 240px;
    height: 240px;
  }
  .progress-ring {
    width: 240px;
    height: 240px;
  }
  .progress-ring circle {
    cx: 120px;
    cy: 120px;
    r: 100px;
  }
  .progress-ring-bar {
    stroke-dasharray: 628.32; /* 2 * PI * 100 */
  }
  .flip-card-wrapper {
    height: 270px;
  }
  .card-text {
    font-size: 1.15rem;
  }
  .settings-grid {
    grid-template-columns: 1fr;
  }
}
