/* ==========================================================================
   StudyBuddy Modern Dark Glassmorphism Design System
   ========================================================================== */

:root {
  --bg-dark: #090c19;
  --bg-surface: #10152b;
  --bg-card: rgba(19, 26, 53, 0.72);
  --bg-card-hover: rgba(27, 36, 74, 0.85);
  --border-glass: rgba(255, 255, 255, 0.09);
  --border-glass-bright: rgba(255, 255, 255, 0.18);
  
  --primary: #6366f1;
  --primary-light: #818cf8;
  --primary-glow: rgba(99, 102, 241, 0.45);
  
  --secondary: #8b5cf6;
  --accent-cyan: #06b6d4;
  --accent-glow: rgba(6, 182, 212, 0.35);
  
  --success: #10b981;
  --success-glow: rgba(16, 185, 129, 0.4);
  --warning: #f59e0b;
  --danger: #ef4444;
  --danger-glow: rgba(239, 68, 68, 0.4);

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --font-main: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;

  --shadow-lg: 0 16px 38px rgba(0, 0, 0, 0.45);
  --shadow-glow: 0 0 25px var(--primary-glow);
}

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

body {
  font-family: var(--font-main);
  background-color: var(--bg-dark);
  color: var(--text-main);
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Ambient Background Lights */
.ambient-glow {
  position: fixed;
  border-radius: 50%;
  filter: blur(120px);
  pointer-events: none;
  z-index: 0;
}
.glow-1 {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.22), transparent 70%);
  top: -100px;
  left: -100px;
}
.glow-2 {
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(168, 85, 247, 0.18), transparent 70%);
  bottom: -150px;
  right: -100px;
}
.glow-3 {
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(6, 182, 212, 0.15), transparent 70%);
  top: 40%;
  left: 30%;
}

/* App Layout Wrapper */
.app-layout {
  position: relative;
  z-index: 1;
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px 20px 60px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

/* ==========================================================================
   Header & Top Navigation
   ========================================================================== */
.top-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  flex-wrap: wrap;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}
.brand-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--primary), var(--accent-cyan));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 4px 16px var(--primary-glow);
}
.brand-icon svg {
  width: 24px;
  height: 24px;
}
.brand-text h1 {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #fff 40%, #c7d2fe);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.badge-pill {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--accent-cyan);
  background: rgba(6, 182, 212, 0.12);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  display: inline-block;
}

/* Nav Tabs */
.nav-tabs {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(10, 14, 30, 0.6);
  padding: 6px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-glass);
}
.tab-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-main);
  font-size: 0.9rem;
  font-weight: 500;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.25s ease;
}
.tab-btn svg {
  width: 17px;
  height: 17px;
  transition: transform 0.2s ease;
}
.tab-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.05);
}
.tab-btn.active {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: #fff;
  font-weight: 600;
  box-shadow: 0 4px 18px var(--primary-glow);
}
.tab-btn.active svg {
  transform: scale(1.1);
}

/* Header Actions */
.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}
.icon-action-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-glass);
  color: var(--text-muted);
  padding: 8px 14px;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.25s ease;
}
.icon-action-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-main);
}
.icon-action-btn.active {
  background: rgba(6, 182, 212, 0.18);
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
  box-shadow: 0 0 15px var(--accent-glow);
}
.icon-action-btn svg {
  width: 16px;
  height: 16px;
}
.streak-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.25);
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 600;
  color: #fbbf24;
}

/* ==========================================================================
   Common Glass Card & Button Styles
   ========================================================================== */
.glass-card {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow-lg);
  transition: border-color 0.3s ease;
}
.glass-card:hover {
  border-color: var(--border-glass-bright);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-main);
  font-size: 0.92rem;
  font-weight: 600;
  padding: 11px 22px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
}
.btn:active {
  transform: scale(0.97);
}
.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: #fff;
  box-shadow: 0 6px 20px var(--primary-glow);
}
.btn-primary:hover {
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  box-shadow: 0 8px 26px rgba(99, 102, 241, 0.6);
  transform: translateY(-1px);
}
.btn-secondary {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--border-glass);
  color: var(--text-main);
}
.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
}
.btn-accent {
  background: linear-gradient(135deg, #06b6d4, #3b82f6);
  color: #fff;
  box-shadow: 0 4px 18px var(--accent-glow);
}
.btn-accent:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}
.btn-success {
  background: rgba(16, 185, 129, 0.15);
  border-color: rgba(16, 185, 129, 0.35);
  color: #34d399;
}
.btn-success:hover {
  background: var(--success);
  color: #fff;
  box-shadow: 0 4px 16px var(--success-glow);
}
.btn-warning {
  background: rgba(245, 158, 11, 0.15);
  border-color: rgba(245, 158, 11, 0.35);
  color: #fbbf24;
}
.btn-warning:hover {
  background: var(--warning);
  color: #1a1a2e;
}
.btn-ghost {
  background: transparent;
  color: var(--text-muted);
}
.btn-ghost:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.05);
}
.btn-large {
  padding: 14px 34px;
  font-size: 1.05rem;
  border-radius: var(--radius-lg);
}
.btn-sm {
  padding: 6px 14px;
  font-size: 0.82rem;
  border-radius: var(--radius-sm);
}

/* View Panels */
.view-panel {
  display: none;
  animation: fadeIn 0.35s ease forwards;
}
.view-panel.active {
  display: block;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   TAB 1: POMODORO CLOCK
   ========================================================================== */
.pomodoro-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 24px;
  align-items: start;
}
@media (max-width: 900px) {
  .pomodoro-grid {
    grid-template-columns: 1fr;
  }
}

.clock-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 36px 30px;
  position: relative;
}

/* Mode Selector */
.timer-mode-selector {
  display: flex;
  background: rgba(10, 14, 30, 0.7);
  padding: 5px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-glass);
  margin-bottom: 20px;
  gap: 4px;
}
.mode-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-main);
  font-weight: 500;
  font-size: 0.85rem;
  padding: 8px 18px;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.25s ease;
}
.mode-btn:hover {
  color: var(--text-main);
}
.mode-btn.active {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

/* Current Focus Task Bar */
.current-task-bar {
  width: 100%;
  max-width: 440px;
  margin-bottom: 24px;
}
.current-task-bar input {
  width: 100%;
  background: rgba(0, 0, 0, 0.25);
  border: 1px dashed rgba(255, 255, 255, 0.18);
  border-radius: var(--radius-md);
  padding: 10px 16px;
  color: var(--text-main);
  font-family: var(--font-main);
  font-size: 0.9rem;
  text-align: center;
  transition: border-color 0.25s ease;
}
.current-task-bar input:focus {
  outline: none;
  border-style: solid;
  border-color: var(--primary-light);
  background: rgba(0, 0, 0, 0.4);
}

/* Circular Timer Progress Ring */
.timer-circle-wrapper {
  position: relative;
  width: 300px;
  height: 300px;
  margin: 10px 0 28px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.progress-ring {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}
.progress-ring-bg {
  fill: none;
  stroke: rgba(255, 255, 255, 0.05);
  stroke-width: 10;
}
.progress-ring-indicator {
  fill: none;
  stroke: var(--primary);
  stroke-width: 12;
  stroke-linecap: round;
  stroke-dasharray: 879.6; /* 2 * PI * 140 */
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 0.8s cubic-bezier(0.4, 0, 0.2, 1), stroke 0.3s ease;
  filter: drop-shadow(0 0 12px var(--primary-glow));
}
body.mode-shortBreak .progress-ring-indicator {
  stroke: var(--accent-cyan);
  filter: drop-shadow(0 0 12px var(--accent-glow));
}
body.mode-longBreak .progress-ring-indicator {
  stroke: var(--success);
  filter: drop-shadow(0 0 12px var(--success-glow));
}

.timer-display-content {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.status-badge {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--primary-light);
  background: rgba(99, 102, 241, 0.15);
  padding: 4px 12px;
  border-radius: var(--radius-full);
  margin-bottom: 8px;
}
.time-string {
  font-family: var(--font-mono);
  font-size: 4.2rem;
  font-weight: 700;
  letter-spacing: -2px;
  color: #fff;
  text-shadow: 0 0 35px rgba(255, 255, 255, 0.2);
  line-height: 1;
  margin-bottom: 8px;
}
.session-round-info {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* Controls */
.timer-controls {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 24px;
}
.timer-controls svg {
  width: 18px;
  height: 18px;
}

/* Quick presets */
.quick-timer-presets {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}
.preset-label {
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-right: 4px;
}
.chip-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-glass);
  color: var(--text-muted);
  font-family: var(--font-main);
  font-size: 0.78rem;
  padding: 5px 12px;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.2s ease;
}
.chip-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.2);
}

/* Sidebar Column */
.sidebar-column {
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.stat-summary-card h3, .session-tasks-card h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 16px;
}
.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.stat-box {
  background: rgba(10, 14, 30, 0.5);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.stat-number {
  font-family: var(--font-mono);
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--accent-cyan);
}
.stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Task Checklist */
.card-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.card-header-row h3 {
  margin-bottom: 0;
}
.subtext {
  font-size: 0.8rem;
  color: var(--text-dim);
}
.inline-input-form {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}
.inline-input-form input {
  flex: 1;
  background: rgba(10, 14, 30, 0.6);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  color: var(--text-main);
  font-family: var(--font-main);
  font-size: 0.85rem;
}
.inline-input-form input:focus {
  outline: none;
  border-color: var(--primary);
}
.tasks-checklist {
  list-style: none;
  max-height: 240px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.task-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.03);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  transition: all 0.2s ease;
}
.task-item:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--border-glass);
}
.task-item.completed span {
  text-decoration: line-through;
  color: var(--text-dim);
}
.task-item-left {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.88rem;
  word-break: break-word;
}
.task-item-left input[type="checkbox"] {
  accent-color: var(--primary);
  width: 16px;
  height: 16px;
  cursor: pointer;
}
.task-del-btn {
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 1.1rem;
  padding: 0 4px;
}
.task-del-btn:hover {
  color: var(--danger);
}

/* ==========================================================================
   TAB 2: FLASHCARDS (3D FLIP STAGE)
   ========================================================================== */
.flashcards-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-width: 820px;
  margin: 0 auto;
}

.flashcard-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  gap: 16px;
  flex-wrap: wrap;
}
.toolbar-left, .toolbar-right, .toolbar-center {
  display: flex;
  align-items: center;
  gap: 12px;
}
.custom-select {
  background: rgba(10, 14, 30, 0.7);
  border: 1px solid var(--border-glass);
  color: var(--text-main);
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  font-family: var(--font-main);
  font-size: 0.88rem;
  cursor: pointer;
  outline: none;
}
.custom-select option {
  background: #13182e;
  color: #fff;
}
.index-badge {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.05);
  padding: 4px 10px;
  border-radius: var(--radius-full);
}
.filter-toggles {
  display: flex;
  background: rgba(10, 14, 30, 0.5);
  padding: 3px;
  border-radius: var(--radius-full);
}
.filter-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.75rem;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.2s;
}
.filter-btn.active {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}

/* Flashcard 3D Stage */
.flashcard-stage {
  perspective: 1200px;
  width: 100%;
  height: 420px;
}
.flashcard-3d {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.65s cubic-bezier(0.34, 1.56, 0.64, 1);
  cursor: pointer;
  outline: none;
}
.flashcard-3d.flipped {
  transform: rotateY(180deg);
}

.card-face {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: var(--radius-lg);
  padding: 36px 40px;
  background: linear-gradient(145deg, rgba(23, 31, 62, 0.85), rgba(16, 21, 44, 0.95));
  border: 1px solid var(--border-glass-bright);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
}

.card-face::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--primary), var(--accent-cyan));
}

.card-back {
  transform: rotateY(180deg);
  background: linear-gradient(145deg, rgba(28, 20, 56, 0.9), rgba(18, 14, 38, 0.95));
}
.card-back::before {
  background: linear-gradient(90deg, var(--secondary), #ec4899);
}

.card-top-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.category-tag {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent-cyan);
  background: rgba(6, 182, 212, 0.12);
  border: 1px solid rgba(6, 182, 212, 0.25);
  padding: 4px 12px;
  border-radius: var(--radius-full);
}
.answer-tag {
  color: #c084fc;
  background: rgba(192, 132, 252, 0.12);
  border-color: rgba(192, 132, 252, 0.25);
}
.icon-star-btn {
  background: transparent;
  border: none;
  font-size: 1.4rem;
  color: var(--text-dim);
  cursor: pointer;
  transition: transform 0.2s, color 0.2s;
  padding: 0 4px;
}
.icon-star-btn:hover {
  transform: scale(1.2);
  color: #facc15;
}
.icon-star-btn.starred {
  color: #facc15;
  text-shadow: 0 0 10px rgba(250, 204, 21, 0.5);
}
.flip-back-indicator {
  font-size: 1.4rem;
  color: var(--text-muted);
}

.card-content {
  text-align: center;
  margin: auto 0;
  padding: 10px 0;
}
.hint-label {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  margin-bottom: 12px;
}
.card-title {
  font-size: 1.65rem;
  font-weight: 600;
  line-height: 1.4;
  color: #fff;
  letter-spacing: -0.01em;
}
.card-hint {
  font-size: 0.95rem;
  color: #fbbf24;
  margin-top: 14px;
  font-style: italic;
  min-height: 24px;
}
.card-answer-body {
  font-size: 1.25rem;
  line-height: 1.6;
  color: #e2e8f0;
  max-width: 90%;
  margin: 0 auto;
}

.card-footer-tip {
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-dim);
}
.card-footer-tip kbd {
  background: rgba(255, 255, 255, 0.1);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

/* Flashcard Navigation Bar */
.flashcard-controls-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
}
.mastery-actions {
  display: flex;
  gap: 12px;
}

/* ==========================================================================
   TAB 3: QUIZ MODE
   ========================================================================== */
.quiz-container {
  max-width: 820px;
  margin: 0 auto;
}

.quiz-setup-card {
  padding: 40px;
  text-align: center;
}
.quiz-badge {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--primary-light);
  background: rgba(99, 102, 241, 0.14);
  padding: 5px 14px;
  border-radius: var(--radius-full);
  margin-bottom: 12px;
}
.quiz-intro-header h2 {
  font-size: 1.85rem;
  font-weight: 700;
  margin-bottom: 10px;
}
.quiz-intro-header p {
  color: var(--text-muted);
  max-width: 540px;
  margin: 0 auto 30px;
}

.quiz-setup-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 34px;
  text-align: left;
}
@media (max-width: 650px) {
  .quiz-setup-grid {
    grid-template-columns: 1fr;
  }
}
.setup-option-card {
  background: rgba(10, 14, 30, 0.5);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 20px;
}
.setup-option-card h3 {
  font-size: 0.98rem;
  margin-bottom: 12px;
  color: var(--text-main);
}
.quiz-meta-info {
  margin-top: 10px;
  font-size: 0.8rem;
  color: var(--text-dim);
}
.setting-checkbox-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  font-size: 0.88rem;
}
.setting-checkbox-row:last-child {
  margin-bottom: 0;
}

.quiz-action-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
}

/* Active Quiz Playing View */
.quiz-play-card {
  padding: 34px;
}
.quiz-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  font-size: 0.9rem;
  color: var(--text-muted);
  font-weight: 500;
}
.quiz-timer-pill {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #f87171;
  padding: 4px 14px;
  border-radius: var(--radius-full);
  font-family: var(--font-mono);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}
.quiz-live-score {
  font-family: var(--font-mono);
  color: var(--accent-cyan);
  font-weight: 600;
}

.quiz-bar-track {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-full);
  margin-bottom: 30px;
  overflow: hidden;
}
.quiz-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent-cyan));
  border-radius: var(--radius-full);
  transition: width 0.35s ease;
}

.quiz-question-box {
  margin-bottom: 28px;
}
.quiz-question-box .category-tag {
  display: inline-block;
  margin-bottom: 12px;
}
.quiz-question-box h2 {
  font-size: 1.45rem;
  font-weight: 600;
  line-height: 1.4;
}

.quiz-options-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  margin-bottom: 24px;
}
.quiz-option-btn {
  display: flex;
  align-items: center;
  gap: 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-glass);
  padding: 16px 20px;
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-family: var(--font-main);
  font-size: 0.96rem;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  width: 100%;
}
.quiz-option-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(255, 255, 255, 0.25);
  transform: translateX(4px);
}
.option-letter {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  font-weight: 700;
  font-size: 0.85rem;
  flex-shrink: 0;
  color: var(--text-muted);
}
.option-text {
  flex: 1;
}

/* Feedback States */
.quiz-option-btn.correct {
  background: rgba(16, 185, 129, 0.2) !important;
  border-color: var(--success) !important;
  color: #34d399;
  box-shadow: 0 0 20px var(--success-glow);
}
.quiz-option-btn.correct .option-letter {
  background: var(--success);
  color: #fff;
}
.quiz-option-btn.wrong {
  background: rgba(239, 68, 68, 0.2) !important;
  border-color: var(--danger) !important;
  color: #f87171;
  box-shadow: 0 0 20px var(--danger-glow);
  animation: shake 0.4s ease;
}
.quiz-option-btn.wrong .option-letter {
  background: var(--danger);
  color: #fff;
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  50% { transform: translateX(6px); }
  75% { transform: translateX(-3px); }
}

.quiz-feedback-banner {
  background: rgba(10, 14, 30, 0.85);
  border: 1px solid var(--border-glass-bright);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 10px;
}
#quiz-feedback-text {
  font-size: 0.95rem;
  line-height: 1.4;
}

/* Quiz Results Card */
.quiz-result-card {
  padding: 40px;
  text-align: center;
}
.result-celebration {
  margin-bottom: 28px;
}
.result-icon-big {
  font-size: 4rem;
  margin-bottom: 12px;
  animation: bounce 0.6s ease infinite alternate;
}
@keyframes bounce {
  from { transform: translateY(0); }
  to { transform: translateY(-8px); }
}
.result-celebration h2 {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 6px;
}
.result-celebration p {
  color: var(--text-muted);
}

.result-stats-row {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-bottom: 34px;
  flex-wrap: wrap;
}
.stat-pill-result {
  background: rgba(10, 14, 30, 0.6);
  border: 1px solid var(--border-glass);
  padding: 16px 28px;
  border-radius: var(--radius-lg);
  min-width: 140px;
}
.result-number {
  display: block;
  font-family: var(--font-mono);
  font-size: 2rem;
  font-weight: 700;
  color: var(--accent-cyan);
  margin-bottom: 4px;
}
.result-label {
  font-size: 0.78rem;
  color: var(--text-dim);
  text-transform: uppercase;
}

.quiz-review-section {
  text-align: left;
  margin-bottom: 34px;
  background: rgba(10, 14, 30, 0.4);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 20px;
}
.quiz-review-section h3 {
  font-size: 1.05rem;
  margin-bottom: 16px;
  color: var(--text-main);
}
.quiz-review-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 280px;
  overflow-y: auto;
}
.review-item {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.02);
  border-left: 4px solid var(--danger);
  font-size: 0.88rem;
}
.review-item.was-correct {
  border-left-color: var(--success);
}
.review-q-title {
  font-weight: 600;
  margin-bottom: 4px;
}
.review-q-ans {
  color: var(--text-muted);
  font-size: 0.82rem;
}

.result-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
}

/* ==========================================================================
   TAB 4: MANAGE & SETTINGS
   ========================================================================== */
.settings-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
  max-width: 900px;
  margin: 0 auto;
}

.settings-card-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}
.header-icon {
  font-size: 2rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-glass);
  width: 50px;
  height: 50px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.settings-card-header h3 {
  font-size: 1.25rem;
  font-weight: 600;
}
.settings-card-header p {
  font-size: 0.88rem;
  color: var(--text-muted);
}

.settings-form .form-group-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}
.form-field label {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-muted);
}
.form-field input, .form-field textarea, .form-field select {
  background: rgba(10, 14, 30, 0.7);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: var(--text-main);
  font-family: var(--font-main);
  font-size: 0.9rem;
  transition: border-color 0.2s;
}
.form-field input:focus, .form-field textarea:focus {
  outline: none;
  border-color: var(--primary);
  background: rgba(10, 14, 30, 0.95);
}

.form-switches-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: rgba(10, 14, 30, 0.4);
  padding: 16px;
  border-radius: var(--radius-md);
  margin-bottom: 24px;
  border: 1px solid var(--border-glass);
}
.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.88rem;
  cursor: pointer;
}
.switch-row input[type="checkbox"] {
  accent-color: var(--primary);
  width: 18px;
  height: 18px;
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

/* Sub-tabs for content manager */
.sub-tabs {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--border-glass);
  padding-bottom: 12px;
  margin-bottom: 20px;
}
.subtab-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-main);
  font-size: 0.9rem;
  font-weight: 500;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
}
.subtab-btn:hover {
  color: var(--text-main);
}
.subtab-btn.active {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-weight: 600;
}

.panel-actions-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.file-upload-label {
  cursor: pointer;
}

/* Tables */
.items-table-wrapper {
  max-height: 380px;
  overflow-y: auto;
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  background: rgba(10, 14, 30, 0.5);
  margin-bottom: 20px;
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.86rem;
}
.data-table th {
  background: rgba(19, 26, 53, 0.9);
  padding: 12px 16px;
  color: var(--text-muted);
  font-weight: 600;
  position: sticky;
  top: 0;
  border-bottom: 1px solid var(--border-glass);
  z-index: 1;
}
.data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  vertical-align: middle;
}
.data-table tr:hover {
  background: rgba(255, 255, 255, 0.02);
}
.text-right {
  text-align: right;
}
.action-icon-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  color: var(--text-muted);
  font-size: 0.88rem;
  transition: color 0.2s;
}
.action-icon-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}
.action-icon-btn.delete-btn:hover {
  color: var(--danger);
  background: rgba(239, 68, 68, 0.15);
}

.danger-zone {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: rgba(239, 68, 68, 0.06);
  border: 1px solid rgba(239, 68, 68, 0.18);
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  color: var(--text-muted);
}
.danger-text {
  color: #f87171 !important;
}
.danger-text:hover {
  background: rgba(239, 68, 68, 0.15) !important;
}

/* ==========================================================================
   Modals
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: modalFadeIn 0.25s ease;
}
@keyframes modalFadeIn {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}
.modal-dialog {
  width: 100%;
  max-width: 540px;
  max-height: 90vh;
  overflow-y: auto;
  border: 1px solid var(--border-glass-bright);
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-glass);
}
.modal-header h3 {
  font-size: 1.2rem;
  font-weight: 600;
}
.modal-close-btn {
  background: transparent;
  border: none;
  font-size: 1.6rem;
  color: var(--text-dim);
  cursor: pointer;
  line-height: 1;
}
.modal-close-btn:hover {
  color: #fff;
}
.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 24px;
}

.options-input-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.option-input-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.option-input-row input[type="radio"] {
  accent-color: var(--primary);
  width: 18px;
  height: 18px;
  cursor: pointer;
}
.option-input-row .opt-text {
  flex: 1;
  padding: 8px 12px;
  background: rgba(10, 14, 30, 0.7);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-family: var(--font-main);
  font-size: 0.88rem;
}

/* Toggle Switches */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
  flex-shrink: 0;
}
.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: rgba(255, 255, 255, 0.15);
  transition: .3s;
  border-radius: 22px;
}
.slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
}
.toggle-switch input:checked + .slider {
  background-color: var(--primary);
}
.toggle-switch input:checked + .slider:before {
  transform: translateX(18px);
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}
.toast {
  background: rgba(19, 26, 53, 0.95);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-glass-bright);
  padding: 12px 20px;
  border-radius: var(--radius-md);
  color: #fff;
  font-size: 0.9rem;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
  animation: slideToast 0.3s ease forwards;
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}
@keyframes slideToast {
  from { opacity: 0; transform: translateX(50px); }
  to { opacity: 1; transform: translateX(0); }
}

/* Confetti Canvas */
.confetti-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 9999;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.28);
}
