/* ============================================================
   QuizMaster Pro — Global Theme System
   CSS Custom Properties with Light (default), Dark, Blue themes
   ============================================================ */

/* ---- Material Symbols Configuration ---- */
.material-symbols-rounded {
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
  font-size: 20px;
  vertical-align: middle;
  user-select: none;
}

.material-symbols-rounded.filled {
  font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}

/* ============================================================
   LIGHT THEME (Default) — Professional, LeetCode-inspired
   ============================================================ */
:root,
[data-theme="light"] {
  /* Backgrounds */
  --bg-primary: #ffffff;
  --bg-secondary: #f8f9fb;
  --bg-tertiary: #f1f3f5;
  --bg-card: #ffffff;
  --bg-sidebar: #ffffff;
  --bg-input: #f8f9fb;
  --bg-hover: #f1f3f5;
  --bg-active: #eff2ff;
  --bg-overlay: rgba(0, 0, 0, 0.5);
  --bg-code: #f6f8fa;
  --bg-badge: #eef1ff;

  /* Text */
  --text-primary: #1a1d26;
  --text-secondary: #4a5568;
  --text-muted: #8492a6;
  --text-inverse: #ffffff;
  --text-link: #4f6ef7;

  /* Borders */
  --border-color: #e2e8f0;
  --border-subtle: #edf0f4;
  --border-strong: #cbd5e0;
  --border-focus: #4f6ef7;

  /* Accent / Brand */
  --accent-primary: #4f6ef7;
  --accent-primary-hover: #3b5bdb;
  --accent-primary-light: #eff2ff;
  --accent-primary-rgb: 79, 110, 247;
  --accent-secondary: #7c5cfc;
  --accent-gradient: linear-gradient(135deg, #4f6ef7, #7c5cfc);

  /* Status */
  --success: #22c55e;
  --success-light: #f0fdf4;
  --success-border: #bbf7d0;
  --warning: #f59e0b;
  --warning-light: #fffbeb;
  --warning-border: #fde68a;
  --danger: #ef4444;
  --danger-light: #fef2f2;
  --danger-border: #fecaca;
  --info: #3b82f6;
  --info-light: #eff6ff;

  /* Shadows */
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.05), 0 2px 4px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.06), 0 4px 10px rgba(0, 0, 0, 0.04);
  --shadow-xl: 0 20px 40px rgba(0, 0, 0, 0.08);
  --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.04), 0 0 0 1px rgba(0, 0, 0, 0.02);
  --shadow-card-hover: 0 8px 24px rgba(0, 0, 0, 0.08);
  --shadow-sidebar: 1px 0 0 var(--border-subtle);

  /* Misc */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --radius-full: 9999px;
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s ease;
  --transition-slow: 0.4s ease;

  /* Sidebar */
  --sidebar-width: 260px;
  --sidebar-bg: var(--bg-sidebar);
  --sidebar-text: var(--text-secondary);
  --sidebar-active-bg: var(--bg-active);
  --sidebar-active-text: var(--accent-primary);
  --sidebar-hover-bg: var(--bg-hover);

  /* Scrollbar */
  --scrollbar-track: transparent;
  --scrollbar-thumb: #d1d5db;
  --scrollbar-thumb-hover: #9ca3af;
}

/* ============================================================
   DARK THEME — Sleek, modern dark UI
   ============================================================ */
[data-theme="dark"] {
  --bg-primary: #0f1117;
  --bg-secondary: #161922;
  --bg-tertiary: #1c2030;
  --bg-card: #1a1e2e;
  --bg-sidebar: #12141d;
  --bg-input: #1c2030;
  --bg-hover: #232838;
  --bg-active: rgba(79, 110, 247, 0.12);
  --bg-overlay: rgba(0, 0, 0, 0.7);
  --bg-code: #1c2030;
  --bg-badge: rgba(79, 110, 247, 0.15);

  --text-primary: #e8ecf4;
  --text-secondary: #9ca3b8;
  --text-muted: #636b83;
  --text-inverse: #0f1117;
  --text-link: #7c9cff;

  --border-color: rgba(255, 255, 255, 0.08);
  --border-subtle: rgba(255, 255, 255, 0.05);
  --border-strong: rgba(255, 255, 255, 0.15);
  --border-focus: #7c9cff;

  --accent-primary: #6c8cff;
  --accent-primary-hover: #8ba3ff;
  --accent-primary-light: rgba(108, 140, 255, 0.12);
  --accent-primary-rgb: 108, 140, 255;
  --accent-secondary: #a78bfa;
  --accent-gradient: linear-gradient(135deg, #6c8cff, #a78bfa);

  --success: #4ade80;
  --success-light: rgba(74, 222, 128, 0.1);
  --success-border: rgba(74, 222, 128, 0.25);
  --warning: #fbbf24;
  --warning-light: rgba(251, 191, 36, 0.1);
  --warning-border: rgba(251, 191, 36, 0.25);
  --danger: #f87171;
  --danger-light: rgba(248, 113, 113, 0.1);
  --danger-border: rgba(248, 113, 113, 0.25);
  --info: #60a5fa;
  --info-light: rgba(96, 165, 250, 0.1);

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.5);
  --shadow-xl: 0 20px 40px rgba(0, 0, 0, 0.6);
  --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(255, 255, 255, 0.04);
  --shadow-card-hover: 0 8px 24px rgba(0, 0, 0, 0.4);
  --shadow-sidebar: 1px 0 0 rgba(255, 255, 255, 0.06);

  --sidebar-bg: var(--bg-sidebar);

  --scrollbar-track: rgba(255, 255, 255, 0.02);
  --scrollbar-thumb: rgba(255, 255, 255, 0.1);
  --scrollbar-thumb-hover: rgba(255, 255, 255, 0.18);
}

/* ============================================================
   BLUE THEME — Corporate navy/steel blue
   ============================================================ */
[data-theme="blue"] {
  --bg-primary: #0c1929;
  --bg-secondary: #112240;
  --bg-tertiary: #172a4a;
  --bg-card: #15294a;
  --bg-sidebar: #0a1628;
  --bg-input: #172a4a;
  --bg-hover: #1d3461;
  --bg-active: rgba(100, 180, 255, 0.12);
  --bg-overlay: rgba(0, 0, 0, 0.7);
  --bg-code: #172a4a;
  --bg-badge: rgba(100, 180, 255, 0.15);

  --text-primary: #ccd6f6;
  --text-secondary: #8892b0;
  --text-muted: #5a6583;
  --text-inverse: #0c1929;
  --text-link: #64b4ff;

  --border-color: rgba(255, 255, 255, 0.08);
  --border-subtle: rgba(255, 255, 255, 0.04);
  --border-strong: rgba(255, 255, 255, 0.12);
  --border-focus: #64b4ff;

  --accent-primary: #64b4ff;
  --accent-primary-hover: #89c8ff;
  --accent-primary-light: rgba(100, 180, 255, 0.12);
  --accent-primary-rgb: 100, 180, 255;
  --accent-secondary: #00d4aa;
  --accent-gradient: linear-gradient(135deg, #64b4ff, #00d4aa);

  --success: #00d4aa;
  --success-light: rgba(0, 212, 170, 0.1);
  --success-border: rgba(0, 212, 170, 0.25);
  --warning: #ffcc57;
  --warning-light: rgba(255, 204, 87, 0.1);
  --warning-border: rgba(255, 204, 87, 0.25);
  --danger: #ff6b6b;
  --danger-light: rgba(255, 107, 107, 0.1);
  --danger-border: rgba(255, 107, 107, 0.25);
  --info: #64b4ff;
  --info-light: rgba(100, 180, 255, 0.1);

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.5);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.5);
  --shadow-xl: 0 20px 40px rgba(0, 0, 0, 0.6);
  --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.03);
  --shadow-card-hover: 0 8px 24px rgba(0, 0, 0, 0.5);
  --shadow-sidebar: 1px 0 0 rgba(255, 255, 255, 0.05);

  --sidebar-bg: var(--bg-sidebar);

  --scrollbar-track: rgba(255, 255, 255, 0.02);
  --scrollbar-thumb: rgba(255, 255, 255, 0.08);
  --scrollbar-thumb-hover: rgba(255, 255, 255, 0.15);
}

/* ============================================================
   GLOBAL RESETS & BASE STYLES
   ============================================================ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  height: 100%;
  overflow-x: hidden;
  scroll-behavior: smooth;
}

body {
  min-height: 100%;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--bg-secondary);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.6;
  font-size: 14px;
  transition: background var(--transition-normal), color var(--transition-normal);
}

a {
  color: inherit;
  text-decoration: none;
}

a:hover {
  color: var(--accent-primary);
}

img, svg {
  display: block;
  max-width: 100%;
}

input, button, textarea, select {
  font-family: inherit;
  font-size: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
}

ul, ol {
  list-style: none;
}

/* ============================================================
   SCROLLBAR STYLES
   ============================================================ */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: var(--scrollbar-track);
}

::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: 3px;
}

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

/* Firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}

::selection {
  background: rgba(var(--accent-primary-rgb), 0.2);
  color: var(--text-primary);
}

/* ============================================================
   UTILITY CLASSES
   ============================================================ */

/* Status badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

.badge-primary {
  background: var(--accent-primary-light);
  color: var(--accent-primary);
}

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

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

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

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 600;
  transition: all var(--transition-fast);
  border: 1px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  font-family: inherit;
}

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

.btn-primary {
  background: var(--accent-gradient);
  color: #fff;
  box-shadow: 0 2px 8px rgba(var(--accent-primary-rgb), 0.25);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(var(--accent-primary-rgb), 0.35);
  color: #fff;
}

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

.btn-outline:hover:not(:disabled) {
  background: var(--bg-hover);
  border-color: var(--border-strong);
  color: var(--text-primary);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-danger:hover:not(:disabled) {
  background: #dc2626;
  transform: translateY(-1px);
  color: #fff;
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  padding: 8px 12px;
}

.btn-ghost:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.btn-sm {
  padding: 6px 14px;
  font-size: 13px;
  border-radius: var(--radius-sm);
}

.btn-lg {
  padding: 14px 28px;
  font-size: 15px;
  border-radius: var(--radius-lg);
}

/* Cards */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  transition: box-shadow var(--transition-normal), border-color var(--transition-normal), transform var(--transition-normal);
}

.card-hover:hover {
  box-shadow: var(--shadow-card-hover);
  border-color: var(--border-strong);
  transform: translateY(-2px);
}

.card-padding {
  padding: 24px;
}

/* Form inputs */
.form-input {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
}

.form-input::placeholder {
  color: var(--text-muted);
}

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

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-select {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
  background-position: right 10px center;
  background-repeat: no-repeat;
  background-size: 20px;
  padding-right: 36px;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

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

/* Alerts */
.alert {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 500;
}

.alert-error {
  background: var(--danger-light);
  color: var(--danger);
  border: 1px solid var(--danger-border);
}

.alert-success {
  background: var(--success-light);
  color: var(--success);
  border: 1px solid var(--success-border);
}

.alert-warning {
  background: var(--warning-light);
  color: var(--warning);
  border: 1px solid var(--warning-border);
}

/* Loading */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-color);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

.spinner-lg {
  width: 40px;
  height: 40px;
  border-width: 3px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Tables */
.table-container {
  overflow-x: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
}

table {
  width: 100%;
  border-collapse: collapse;
}

thead {
  background: var(--bg-tertiary);
}

th {
  padding: 12px 16px;
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border-color);
}

td {
  padding: 14px 16px;
  font-size: 14px;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-subtle);
}

tr:last-child td {
  border-bottom: none;
}

tbody tr {
  transition: background var(--transition-fast);
}

tbody tr:hover {
  background: var(--bg-hover);
}

/* Empty states */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
}

.empty-state .material-symbols-rounded {
  font-size: 48px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.empty-state h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.empty-state p {
  font-size: 14px;
  color: var(--text-muted);
}

/* ============================================================
   ANIMATIONS
   ============================================================ */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

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

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

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.animate-fade-in { animation: fadeIn 0.3s ease forwards; }
.animate-slide-up { animation: slideUp 0.4s ease forwards; }
.animate-scale-in { animation: scaleIn 0.25s ease forwards; }

/* Staggered children animation */
.stagger-children > * {
  opacity: 0;
  animation: fadeIn 0.3s ease forwards;
}
.stagger-children > *:nth-child(1) { animation-delay: 0.05s; }
.stagger-children > *:nth-child(2) { animation-delay: 0.10s; }
.stagger-children > *:nth-child(3) { animation-delay: 0.15s; }
.stagger-children > *:nth-child(4) { animation-delay: 0.20s; }
.stagger-children > *:nth-child(5) { animation-delay: 0.25s; }
.stagger-children > *:nth-child(6) { animation-delay: 0.30s; }

/* ============================================================
   RESPONSIVE UTILITIES
   ============================================================ */
@media (max-width: 768px) {
  :root {
    --sidebar-width: 0px;
  }
}
