/* ===== CSS Reset & Variables ===== */
:root {
  /* Brand Colors - 现代渐变色系 */
  --primary: #6366F1;
  --primary-light: #818CF8;
  --primary-lighter: #E0E7FF;
  --primary-dark: #4F46E5;
  --secondary: #EC4899;
  --secondary-light: #F472B6;
  --accent: #F59E0B;
  --accent-light: #FBBF24;

  /* Status Colors */
  --success: #10B981;
  --success-light: #D1FAE5;
  --warning: #F59E0B;
  --warning-light: #FEF3C7;
  --error: #EF4444;
  --error-light: #FEE2E2;
  --info: #3B82F6;
  --info-light: #DBEAFE;

  /* Backgrounds */
  --background: #F9FAFB;
  --background-2: #F3F4F6;
  --surface: #FFFFFF;
  --surface-hover: #FAFAFA;
  --surface-elevated: #FFFFFF;

  /* Text */
  --text-primary: #111827;
  --text-secondary: #4B5563;
  --text-tertiary: #6B7280;
  --text-muted: #9CA3AF;

  /* Borders */
  --border: #E5E7EB;
  --border-light: #F3F4F6;
  --border-dark: #D1D5DB;

  /* Subject Colors */
  --color-chinese: #DC2626;
  --color-chinese-bg: #FEE2E2;
  --color-math: #2563EB;
  --color-math-bg: #DBEAFE;
  --color-english: #7C3AED;
  --color-english-bg: #EDE9FE;
  --color-physics: #0891B2;
  --color-physics-bg: #CFFAFE;
  --color-chemistry: #059669;
  --color-chemistry-bg: #D1FAE5;
  --color-biology: #16A34A;
  --color-biology-bg: #DCFCE7;
  --color-history: #CA8A04;
  --color-history-bg: #FEF9C3;
  --color-geography: #EA580C;
  --color-geography-bg: #FFEDD5;
  --color-politics: #BE185D;
  --color-politics-bg: #FCE7F3;

  /* 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.06);
  --shadow-lg: 0 10px 15px rgba(0,0,0,0.08), 0 4px 6px rgba(0,0,0,0.05);
  --shadow-xl: 0 20px 25px rgba(0,0,0,0.10), 0 10px 10px rgba(0,0,0,0.04);
  --shadow-2xl: 0 25px 50px rgba(0,0,0,0.15);
  --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.3);
  --shadow-color-primary: rgba(99, 102, 241, 0.4);
  --shadow-color-success: rgba(16, 185, 129, 0.4);

  /* Radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --radius-2xl: 28px;
  --radius-full: 9999px;

  /* Transitions */
  --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-bounce: 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);

  /* Gradients */
  --gradient-primary: linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%);
  --gradient-primary-hover: linear-gradient(135deg, #4F46E5 0%, #7C3AED 100%);
  --gradient-secondary: linear-gradient(135deg, #EC4899 0%, #F472B6 100%);
  --gradient-success: linear-gradient(135deg, #10B981 0%, #34D399 100%);
  --gradient-warm: linear-gradient(135deg, #F59E0B 0%, #EF4444 100%);
  --gradient-cool: linear-gradient(135deg, #3B82F6 0%, #06B6D4 100%);
  --gradient-bg: linear-gradient(135deg, #F9FAFB 0%, #F3F4F6 100%);
  --gradient-header: linear-gradient(135deg, #4F46E5 0%, #7C3AED 50%, #EC4899 100%);
  --gradient-mesh: radial-gradient(at 20% 20%, rgba(99, 102, 241, 0.15) 0px, transparent 50%),
                   radial-gradient(at 80% 0%, rgba(236, 72, 153, 0.1) 0px, transparent 50%),
                   radial-gradient(at 0% 50%, rgba(16, 185, 129, 0.08) 0px, transparent 50%),
                   radial-gradient(at 80% 50%, rgba(245, 158, 11, 0.08) 0px, transparent 50%),
                   radial-gradient(at 0% 100%, rgba(59, 130, 246, 0.1) 0px, transparent 50%);
}

/* ===== Dark Theme ===== */
[data-theme="dark"] {
  --primary: #818CF8;
  --primary-light: #A5B4FC;
  --primary-lighter: #312E81;
  --primary-dark: #6366F1;
  --secondary: #F472B6;
  --secondary-light: #F9A8D4;
  --accent: #FBBF24;
  --accent-light: #FCD34D;

  --success: #34D399;
  --success-light: #064E3B;
  --warning: #FBBF24;
  --warning-light: #78350F;
  --error: #F87171;
  --error-light: #7F1D1D;
  --info: #60A5FA;
  --info-light: #1E3A8A;

  --background: #0F172A;
  --background-2: #1E293B;
  --surface: #1E293B;
  --surface-hover: #334155;
  --surface-elevated: #334155;

  --text-primary: #F1F5F9;
  --text-secondary: #CBD5E1;
  --text-tertiary: #94A3B8;
  --text-muted: #64748B;

  --border: #334155;
  --border-light: #1E293B;
  --border-dark: #475569;

  --shadow-xs: 0 1px 2px rgba(0,0,0,0.4);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.5), 0 1px 2px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.5), 0 2px 4px rgba(0,0,0,0.3);
  --shadow-lg: 0 10px 15px rgba(0,0,0,0.6), 0 4px 6px rgba(0,0,0,0.4);
  --shadow-xl: 0 20px 25px rgba(0,0,0,0.7), 0 10px 10px rgba(0,0,0,0.4);
  --shadow-2xl: 0 25px 50px rgba(0,0,0,0.8);

  --gradient-bg: linear-gradient(135deg, #0F172A 0%, #1E293B 100%);
  --gradient-header: linear-gradient(135deg, #312E81 0%, #6D28D9 50%, #831843 100%);
  --gradient-mesh: radial-gradient(at 20% 20%, rgba(129, 140, 248, 0.15) 0px, transparent 50%),
                   radial-gradient(at 80% 0%, rgba(244, 114, 182, 0.1) 0px, transparent 50%),
                   radial-gradient(at 0% 50%, rgba(52, 211, 153, 0.08) 0px, transparent 50%),
                   radial-gradient(at 80% 50%, rgba(251, 191, 36, 0.08) 0px, transparent 50%);

  /* 暗色下键盘活跃卡片更明显的边光 */
  --keyboard-active-glow: 0 0 0 3px var(--primary-light), var(--shadow-lg);
}

/* 暗色滚动条 */
[data-theme="dark"] ::-webkit-scrollbar-track {
  background: var(--background-2);
}
[data-theme="dark"] ::-webkit-scrollbar-thumb {
  background: var(--border-dark);
}
[data-theme="dark"] ::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* 暗色键盘活跃卡片 */
[data-theme="dark"] .question-card.keyboard-active {
  box-shadow: var(--keyboard-active-glow);
  background: var(--surface-elevated);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: "Noto Sans SC", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--gradient-bg);
  background-image: var(--gradient-mesh);
  background-attachment: fixed;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color var(--transition-slow), color var(--transition-slow);
}

/* 顶部光晕装饰 */
body::before {
  content: '';
  position: fixed;
  top: -200px;
  left: 50%;
  transform: translateX(-50%);
  width: 800px;
  height: 400px;
  background: radial-gradient(ellipse at center, rgba(99, 102, 241, 0.15) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border-dark);
  border-radius: var(--radius-full);
  transition: background var(--transition);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ===== Header ===== */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  height: 72px;
  background: var(--gradient-header);
  color: white;
  box-shadow: var(--shadow-lg);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
}

.header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background:
    radial-gradient(circle at 15% 50%, rgba(255,255,255,0.15) 0%, transparent 45%),
    radial-gradient(circle at 85% 50%, rgba(255,255,255,0.1) 0%, transparent 45%),
    radial-gradient(circle at 50% 100%, rgba(236, 72, 153, 0.2) 0%, transparent 60%);
  pointer-events: none;
}

.header::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.3px;
  position: relative;
  z-index: 1;
}

.logo-icon {
  width: 40px;
  height: 40px;
  background: rgba(255,255,255,0.2);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.3);
}

.logo-icon svg {
  width: 24px;
  height: 24px;
  stroke: white;
}

.logo-text {
  background: linear-gradient(135deg, #FFFFFF 0%, #E0E7FF 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.logo-badge {
  font-size: 11px;
  padding: 2px 8px;
  background: rgba(255,255,255,0.2);
  border-radius: var(--radius-full);
  font-weight: 500;
  border: 1px solid rgba(255,255,255,0.3);
}

.nav-tabs {
  display: flex;
  gap: 4px;
  background: rgba(255,255,255,0.1);
  padding: 4px;
  border-radius: var(--radius-lg);
  backdrop-filter: blur(8px);
  position: relative;
  z-index: 1;
}

.nav-tab {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: rgba(255,255,255,0.8);
  transition: var(--transition);
  border: none;
  background: transparent;
}

.nav-tab:hover {
  color: white;
  background: rgba(255,255,255,0.1);
}

.nav-tab.active {
  background: white;
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.nav-tab svg {
  width: 16px;
  height: 16px;
  stroke-width: 2;
}

/* ===== Stats Bar ===== */
.stats-bar {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 0 32px;
  position: relative;
  z-index: 1;
}

.stat-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: rgba(255,255,255,0.15);
  border-radius: var(--radius-full);
  font-size: 13px;
  color: white;
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.2);
}

.stat-value {
  font-weight: 700;
  font-size: 14px;
}

.stat-divider {
  width: 1px;
  height: 20px;
  background: rgba(255,255,255,0.3);
}

/* ===== Theme Toggle ===== */
.theme-toggle {
  position: relative;
  width: 36px;
  height: 36px;
  border: 1px solid rgba(255,255,255,0.2);
  background: rgba(255,255,255,0.1);
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  backdrop-filter: blur(8px);
  transition: var(--transition);
  z-index: 1;
}

.theme-toggle:hover {
  background: rgba(255,255,255,0.2);
  transform: rotate(15deg);
}

.theme-toggle svg {
  width: 18px;
  height: 18px;
  stroke: white;
  stroke-width: 2;
  fill: none;
  transition: var(--transition);
}

.theme-toggle .sun-icon { display: none; }
.theme-toggle .moon-icon { display: block; }

[data-theme="dark"] .theme-toggle .sun-icon { display: block; }
[data-theme="dark"] .theme-toggle .moon-icon { display: none; }

/* ===== Stats Card Grid ===== */
.stats-card-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

@media (max-width: 1024px) {
  .stats-card-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 600px) {
  .stats-card-grid {
    grid-template-columns: 1fr;
  }
}

.stat-card {
  position: relative;
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 20px;
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
  overflow: hidden;
  cursor: pointer;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 80px;
  height: 80px;
  background: var(--gradient-primary);
  opacity: 0.08;
  border-radius: 50%;
  transform: translate(30%, -30%);
  transition: var(--transition);
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--primary-light);
}

.stat-card:hover::before {
  transform: translate(20%, -20%) scale(1.5);
  opacity: 0.15;
}

.stat-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.stat-card-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-card-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary-lighter);
  color: var(--primary);
}

.stat-card-icon svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
}

.stat-card-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
  margin-bottom: 4px;
}

.stat-card-trend {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11.5px;
  color: var(--text-muted);
  font-weight: 500;
}

.question-card.success .stat-card-icon { background: var(--success-light); color: var(--success); }
.question-card.warning .stat-card-icon { background: var(--warning-light); color: var(--warning); }
.question-card.danger .stat-card-icon { background: var(--error-light); color: var(--error); }
.question-card.info .stat-card-icon { background: var(--info-light); color: var(--info); }

/* ===== Charts Panel ===== */
.charts-panel {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}

@media (max-width: 768px) {
  .charts-panel {
    grid-template-columns: 1fr;
  }
}

.chart-card {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.chart-card:hover {
  box-shadow: var(--shadow-md);
}

.chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.chart-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.chart-subtitle {
  font-size: 12px;
  color: var(--text-tertiary);
}

.chart-subtitle strong {
  color: var(--primary);
  font-weight: 700;
}

.chart-bars {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chart-bar-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.chart-bar-label {
  width: 60px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.chart-bar-track {
  flex: 1;
  height: 8px;
  background: var(--background-2);
  border-radius: var(--radius-full);
  overflow: hidden;
  position: relative;
}

.chart-bar-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.chart-bar-value {
  width: 32px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-primary);
  text-align: right;
  flex-shrink: 0;
}

.chart-donut-wrapper {
  display: flex;
  align-items: center;
  gap: 20px;
}

.chart-donut {
  width: 120px;
  height: 120px;
  flex-shrink: 0;
}

.chart-donut circle {
  transition: stroke-dasharray 0.6s ease;
}

.chart-donut-legend {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--text-secondary);
}

.legend-item strong {
  margin-left: auto;
  color: var(--text-primary);
  font-weight: 700;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.legend-dot.easy { background: var(--success); }
.legend-dot.medium { background: var(--warning); }
.legend-dot.hard { background: var(--error); }

/* ===== Nav Badge ===== */
.nav-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  background: var(--error);
  color: white;
  border-radius: 9px;
  font-size: 10px;
  font-weight: 700;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--surface);
  box-sizing: content-box;
  z-index: 2;
}

/* ===== Study Mode ===== */
.study-option {
  transition: all 0.2s ease;
}

.study-option:hover {
  border-color: var(--primary-light) !important;
  background: var(--primary-lighter) !important;
}

.study-option input[type="radio"]:checked + span {
  /* keep visuals consistent */
}

.study-option input[type="radio"]:checked ~ * {
  color: var(--primary-dark);
}

/* ===== Loading Progress ===== */
.global-loading {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--primary), transparent);
  background-size: 200% 100%;
  z-index: 9999;
  animation: loadingBar 1.5s infinite linear;
  opacity: 0;
  transition: opacity 0.2s;
}

.global-loading.show {
  opacity: 1;
}

@keyframes loadingBar {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ===== Activity Log ===== */
.activity-card {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 24px;
}

.activity-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-light);
}

.activity-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 240px;
  overflow-y: auto;
}

.activity-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.activity-item:hover {
  background: var(--background);
}

.activity-icon {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  background: var(--primary-lighter);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.activity-icon[data-type="delete"] { background: var(--error-light); color: var(--error); }
.activity-icon[data-type="edit"] { background: var(--warning-light); color: var(--warning); }
.activity-icon[data-type="favorite"] { background: #FEF3C7; color: #F59E0B; }
.activity-icon[data-type="add_to_exam"] { background: var(--success-light); color: var(--success); }
.activity-icon[data-type="export"] { background: var(--info-light); color: var(--info); }

.activity-icon svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
}

.activity-content {
  flex: 1;
  min-width: 0;
}

.activity-message {
  font-size: 13px;
  color: var(--text-primary);
  margin-bottom: 2px;
  line-height: 1.5;
}

.activity-time {
  font-size: 11px;
  color: var(--text-muted);
}

/* ===== Question Card Checkbox ===== */
.question-card-checkbox {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  user-select: none;
}

.question-card-checkbox input[type="checkbox"] {
  display: none;
}

.checkbox-custom {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border-dark);
  border-radius: 5px;
  background: var(--surface);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  position: relative;
}

.question-card-checkbox input[type="checkbox"]:checked + .checkbox-custom {
  background: var(--primary);
  border-color: var(--primary);
}

.question-card-checkbox input[type="checkbox"]:checked + .checkbox-custom::after {
  content: '';
  width: 5px;
  height: 9px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
  margin-bottom: 2px;
}

.question-card-checkbox:hover .checkbox-custom {
  border-color: var(--primary);
}

.question-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* ===== Batch Action Bar ===== */
.batch-action-bar {
  position: sticky;
  top: 88px;
  z-index: 50;
  background: var(--gradient-primary);
  border-radius: var(--radius-lg);
  padding: 12px 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-lg);
  animation: slideDown 0.3s ease;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.batch-action-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  color: white;
}

.batch-action-info {
  font-size: 14px;
  font-weight: 500;
}

.batch-action-info strong {
  font-size: 18px;
  margin-right: 4px;
}

.batch-action-buttons {
  display: flex;
  gap: 8px;
}

.batch-action-buttons .btn {
  background: rgba(255, 255, 255, 0.2);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.3);
  backdrop-filter: blur(8px);
}

.batch-action-buttons .btn:hover {
  background: rgba(255, 255, 255, 0.3);
}

.batch-action-buttons .btn-primary {
  background: white;
  color: var(--primary-dark);
  border-color: white;
}

.batch-action-buttons .btn-primary:hover {
  background: rgba(255, 255, 255, 0.95);
  color: var(--primary);
}

.batch-action-buttons .btn-success {
  background: var(--gradient-success);
  color: white;
  border-color: transparent;
}

.batch-action-buttons .btn-success:hover {
  background: linear-gradient(135deg, #059669 0%, #10B981 100%);
}

/* ===== Question Detail Modal ===== */
.question-detail-content {
  font-size: 15px;
  line-height: 1.8;
  color: var(--text-primary);
  margin: 16px 0;
  white-space: pre-wrap;
  padding: 16px;
  background: var(--background);
  border-radius: var(--radius-md);
  border-left: 3px solid var(--primary);
}

.question-detail-options {
  margin: 16px 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.question-detail-option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 14px;
  background: var(--background);
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border-light);
  transition: var(--transition);
}

.question-detail-option:hover {
  border-color: var(--primary-light);
  background: var(--primary-lighter);
}

.question-detail-option .option-letter {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-full);
  background: var(--gradient-primary);
  color: white;
  font-weight: 700;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.question-detail-option.correct {
  background: var(--success-light);
  border-color: var(--success);
}

.question-detail-option.correct .option-letter {
  background: var(--success);
}

.question-detail-section {
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  border-left: 3px solid;
}

.question-detail-answer {
  background: var(--success-light);
  border-left-color: var(--success);
}

.question-detail-answer strong {
  color: var(--success);
  display: block;
  margin-bottom: 4px;
  font-size: 13px;
}

.question-detail-analysis {
  background: var(--info-light);
  border-left-color: var(--info);
}

.question-detail-analysis strong {
  color: var(--info);
  display: block;
  margin-bottom: 4px;
  font-size: 13px;
}

/* ===== Main Layout ===== */
.main-content {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 0;
  min-height: calc(100vh - 72px);
}

/* ===== Sidebar ===== */
.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 20px 0;
  overflow-y: auto;
  max-height: calc(100vh - 72px);
}

.sidebar-section {
  margin-bottom: 24px;
  padding: 0 20px;
}

.sidebar-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: 12px;
  padding: 0 4px;
}

.sidebar-title-actions {
  display: flex;
  gap: 4px;
}

.icon-btn {
  width: 24px;
  height: 24px;
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-tertiary);
  transition: var(--transition);
}

.icon-btn:hover {
  background: var(--background-2);
  color: var(--primary);
}

.icon-btn svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
}

/* ===== Folder Tree ===== */
.folder-tree {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.folder-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 13.5px;
  color: var(--text-secondary);
  transition: var(--transition);
  user-select: none;
  position: relative;
}

.folder-item:hover {
  background: var(--background-2);
  color: var(--text-primary);
}

.folder-item.active {
  background: var(--primary-lighter);
  color: var(--primary-dark);
  font-weight: 600;
}

.folder-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 60%;
  background: var(--primary);
  border-radius: var(--radius-full);
}

.folder-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  stroke-width: 2;
}

.folder-item.active .folder-icon {
  stroke: var(--primary-dark);
}

.folder-name {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.folder-count {
  font-size: 11px;
  padding: 1px 7px;
  background: var(--background-2);
  border-radius: var(--radius-full);
  color: var(--text-tertiary);
  font-weight: 500;
  min-width: 22px;
  text-align: center;
}

.folder-item.active .folder-count {
  background: var(--primary);
  color: white;
}

.folder-actions {
  display: none;
  gap: 2px;
}

.folder-item:hover .folder-actions {
  display: flex;
}

.folder-action-btn {
  width: 22px;
  height: 22px;
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-tertiary);
  transition: var(--transition);
}

.folder-action-btn:hover {
  background: var(--surface);
  color: var(--primary);
}

.folder-action-btn svg {
  width: 12px;
  height: 12px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
}

.folder-children {
  margin-left: 18px;
  border-left: 1px dashed var(--border);
  padding-left: 8px;
  margin-top: 2px;
}

/* ===== Main Content Area ===== */
.content-area {
  padding: 24px 32px 32px;
  overflow-y: auto;
  max-height: calc(100vh - 72px);
}

.view-section {
  display: none;
  animation: fadeIn 0.3s ease;
}

.view-section.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ===== Toolbar ===== */
.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.search-box {
  flex: 1;
  min-width: 240px;
  position: relative;
}

.search-box svg {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  stroke-width: 2;
  fill: none;
  pointer-events: none;
}

.search-input {
  width: 100%;
  padding: 11px 14px 11px 42px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  font-size: 14px;
  background: var(--surface);
  transition: var(--transition);
  font-family: inherit;
  color: var(--text-primary);
}

.search-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-lighter);
}

.search-input::placeholder {
  color: var(--text-muted);
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 16px;
  border: none;
  border-radius: var(--radius-md);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  font-family: inherit;
  position: relative;
  overflow: hidden;
}

.btn::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255,255,255,0.4);
  transform: translate(-50%, -50%);
  transition: width 0.4s, height 0.4s;
}

.btn:active::before {
  width: 200px;
  height: 200px;
}

.btn svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  flex-shrink: 0;
}

.btn-primary {
  background: var(--gradient-primary);
  color: white;
  box-shadow: 0 2px 4px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--surface);
  color: var(--text-secondary);
  border: 1.5px solid var(--border);
}

.btn-secondary:hover {
  background: var(--background-2);
  border-color: var(--border-dark);
  color: var(--text-primary);
}

.btn-success {
  background: var(--gradient-success);
  color: white;
  box-shadow: 0 2px 4px rgba(16, 185, 129, 0.3);
}

.btn-success:hover {
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
  transform: translateY(-1px);
}

.btn-warning {
  background: var(--accent);
  color: white;
}

.btn-warning:hover {
  background: var(--accent-light);
}

.btn-danger {
  background: var(--error);
  color: white;
}

.btn-danger:hover {
  background: #DC2626;
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}

.btn-ghost:hover {
  background: var(--background-2);
  color: var(--text-primary);
}

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: var(--radius-md);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12.5px;
}

.btn-lg {
  padding: 12px 24px;
  font-size: 15px;
}

/* ===== Filter Panel ===== */
.filter-panel {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  background: var(--surface);
  padding: 16px 20px;
  border-radius: var(--radius-lg);
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.filter-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.filter-options {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.filter-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  background: var(--background-2);
  border-radius: var(--radius-full);
  font-size: 12.5px;
  cursor: pointer;
  transition: var(--transition);
  user-select: none;
  border: 1.5px solid transparent;
}

.filter-checkbox:hover {
  background: var(--primary-lighter);
  color: var(--primary-dark);
}

.filter-checkbox input {
  display: none;
}

.filter-checkbox.checked {
  background: var(--primary-lighter);
  color: var(--primary-dark);
  border-color: var(--primary-light);
  font-weight: 500;
}

.filter-checkbox-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ===== Question Grid ===== */
.question-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}

.question-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: relative;
  overflow: hidden;
  cursor: pointer;
}

.question-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--gradient-primary);
  opacity: 0;
  transition: var(--transition);
}

.question-card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--primary-lighter) 0%, transparent 100%);
  opacity: 0;
  transition: var(--transition);
  pointer-events: none;
}

.question-card > * {
  position: relative;
  z-index: 1;
}

.question-card:hover {
  box-shadow: var(--shadow-xl);
  transform: translateY(-4px);
  border-color: var(--primary-light);
}

.question-card.keyboard-active {
  box-shadow: var(--shadow-glow), var(--shadow-lg);
  border-color: var(--primary);
  transform: translateY(-4px) scale(1.005);
}

.question-card.keyboard-active::before {
  opacity: 1;
}

.question-card:hover::before {
  opacity: 1;
}

.question-card:hover::after {
  opacity: 0.4;
}

.question-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.question-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  align-items: center;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.badge-subject {
  color: white;
  font-weight: 600;
}

.badge-difficulty {
  font-weight: 500;
}

.badge-difficulty.easy {
  background: var(--success-light);
  color: var(--success);
}

.badge-difficulty.medium {
  background: var(--warning-light);
  color: var(--warning);
}

.badge-difficulty.hard {
  background: var(--error-light);
  color: var(--error);
}

.badge-type {
  background: var(--info-light);
  color: var(--info);
}

.badge-grade {
  background: var(--background-2);
  color: var(--text-secondary);
}

.badge-score {
  background: var(--accent-light);
  color: #92400E;
  font-weight: 600;
}

.badge-source {
  background: var(--primary-lighter);
  color: var(--primary-dark);
  font-weight: 500;
}

.question-content {
  font-size: 13.5px;
  line-height: 1.7;
  color: var(--text-primary);
  display: -webkit-box;
  -webkit-line-clamp: 4;
  line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
}

.question-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  color: var(--text-muted);
  flex-wrap: wrap;
}

.question-meta-item {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.question-meta-item svg {
  width: 11px;
  height: 11px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
}

.question-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding-top: 10px;
  border-top: 1px dashed var(--border-light);
}

.question-actions-left {
  display: flex;
  gap: 4px;
}

.question-actions-right {
  display: flex;
  gap: 4px;
}

.action-icon-btn {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-tertiary);
  transition: var(--transition);
}

.action-icon-btn:hover {
  background: var(--background-2);
  color: var(--primary);
}

.action-icon-btn.favorited {
  color: #F59E0B;
}

.action-icon-btn.favorited svg {
  fill: #F59E0B;
}

.action-icon-btn svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
}

.action-icon-btn.added {
  color: var(--success);
}

.action-icon-btn.added svg {
  fill: var(--success);
}

/* ===== Empty State ===== */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 20px;
  text-align: center;
  color: var(--text-muted);
}

.empty-state-icon {
  width: 80px;
  height: 80px;
  background: var(--background-2);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
}

.empty-state-icon svg {
  width: 40px;
  height: 40px;
  stroke: var(--text-muted);
  stroke-width: 1.5;
  fill: none;
}

.empty-state-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.empty-state-text {
  font-size: 13.5px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

/* ===== Modal ===== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(17, 24, 39, 0.6);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  transition: opacity 0.2s;
}

.modal-overlay.show {
  display: flex;
  opacity: 1;
  animation: fadeIn 0.2s ease;
}

.modal {
  background: var(--surface);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 640px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-2xl);
  overflow: hidden;
  animation: modalSlideUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modalSlideUp {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal-large {
  max-width: 800px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-light);
  background: var(--background);
}

.modal-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--text-primary);
}

.modal-close {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-tertiary);
  transition: var(--transition);
}

.modal-close:hover {
  background: var(--background-2);
  color: var(--text-primary);
}

.modal-close svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
}

.modal-body {
  padding: 20px 24px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 16px 24px;
  border-top: 1px solid var(--border-light);
  background: var(--background);
}

/* ===== Forms ===== */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-label .required {
  color: var(--error);
  margin-left: 2px;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 14px;
  background: var(--surface);
  transition: var(--transition);
  font-family: inherit;
  color: var(--text-primary);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-lighter);
}

.form-textarea {
  resize: vertical;
  min-height: 80px;
  line-height: 1.6;
}

.form-help {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.form-row-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

@media (max-width: 600px) {
  .form-row, .form-row-3 {
    grid-template-columns: 1fr;
  }
}

/* ===== Toast ===== */
.toast-container {
  position: fixed;
  top: 88px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 12px 18px 12px 14px;
  box-shadow: var(--shadow-xl);
  border-left: 4px solid var(--info);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13.5px;
  font-weight: 500;
  min-width: 240px;
  max-width: 360px;
  pointer-events: auto;
  animation: toastSlideIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.toast.success {
  border-left-color: var(--success);
}

.toast.warning {
  border-left-color: var(--warning);
}

.toast.error {
  border-left-color: var(--error);
}

.toast.info {
  border-left-color: var(--info);
}

.toast-icon {
  width: 22px;
  height: 22px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: var(--info-light);
  color: var(--info);
}

.toast.success .toast-icon {
  background: var(--success-light);
  color: var(--success);
}

.toast.warning .toast-icon {
  background: var(--warning-light);
  color: var(--warning);
}

.toast.error .toast-icon {
  background: var(--error-light);
  color: var(--error);
}

.toast-icon svg {
  width: 12px;
  height: 12px;
  stroke: currentColor;
  stroke-width: 3;
  fill: none;
}

.toast-message {
  flex: 1;
  color: var(--text-primary);
}

@keyframes toastSlideIn {
  from {
    opacity: 0;
    transform: translateX(100%);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes toastSlideOut {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(100%);
  }
}

.toast.hiding {
  animation: toastSlideOut 0.2s ease-in forwards;
}

/* ===== Exam Builder ===== */
.exam-builder {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 24px;
}

@media (max-width: 1024px) {
  .exam-builder {
    grid-template-columns: 1fr;
  }
}

.exam-panel {
  background: var(--surface);
  border-radius: var(--radius-xl);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
}

.exam-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-light);
}

.exam-panel-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.exam-panel-title svg {
  width: 18px;
  height: 18px;
  stroke: var(--primary);
  stroke-width: 2;
  fill: none;
}

.exam-stats {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
}

.exam-stat {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 14px 12px;
  background: var(--background);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
}

.exam-stat-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--primary);
  line-height: 1.2;
}

.exam-stat-label {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 2px;
  font-weight: 500;
}

.exam-options {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 20px;
}

.exam-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--background);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
}

.exam-option-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  color: var(--text-secondary);
}

.switch {
  position: relative;
  display: inline-block;
  width: 38px;
  height: 22px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.switch-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--border-dark);
  border-radius: var(--radius-full);
  transition: var(--transition);
}

.switch-slider::before {
  content: '';
  position: absolute;
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background: white;
  border-radius: 50%;
  transition: var(--transition);
}

.switch input:checked + .switch-slider {
  background: var(--primary);
}

.switch input:checked + .switch-slider::before {
  transform: translateX(16px);
}

.exam-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.exam-actions .btn {
  flex: 1;
  min-width: 100px;
}

/* ===== Assistant ===== */
.assistant-panel {
  background: linear-gradient(135deg, var(--primary-lighter) 0%, #FCE7F3 100%);
  border: 1px solid var(--primary-light);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 20px;
}

.assistant-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 600;
  color: var(--primary-dark);
  margin-bottom: 16px;
}

.assistant-title-icon {
  width: 32px;
  height: 32px;
  background: var(--gradient-primary);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
}

.assistant-title-icon svg {
  width: 16px;
  height: 16px;
  stroke: white;
  stroke-width: 2;
  fill: none;
}

.assistant-config {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

@media (max-width: 600px) {
  .assistant-config {
    grid-template-columns: 1fr;
  }
}

.assistant-config .form-group {
  margin-bottom: 0;
}

.assistant-config .form-label {
  color: var(--primary-dark);
  font-size: 12px;
  font-weight: 600;
}

.assistant-config .form-input,
.assistant-config .form-select {
  background: white;
  font-size: 13px;
}

.difficulty-distribution {
  background: white;
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 16px;
}

.distribution-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.distribution-value {
  font-size: 12px;
  color: var(--primary);
  font-weight: 700;
}

.distribution-sliders {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.distribution-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.distribution-label {
  width: 60px;
  font-size: 12.5px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
}

.distribution-label .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.distribution-label.easy .dot { background: var(--success); }
.distribution-label.medium .dot { background: var(--warning); }
.distribution-label.hard .dot { background: var(--error); }

.distribution-slider {
  flex: 1;
  height: 6px;
  border-radius: var(--radius-full);
  background: var(--background-2);
  -webkit-appearance: none;
  appearance: none;
  outline: none;
  cursor: pointer;
}

.distribution-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  background: var(--primary);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(99, 102, 241, 0.3);
  transition: var(--transition);
}

.distribution-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

.distribution-slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  background: var(--primary);
  border-radius: 50%;
  cursor: pointer;
  border: none;
  box-shadow: 0 2px 4px rgba(99, 102, 241, 0.3);
}

.distribution-row-value {
  width: 40px;
  text-align: right;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-primary);
}

/* ===== Exam List ===== */
.exam-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.exam-question-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px;
  background: var(--surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
  transition: var(--transition);
  margin-bottom: 8px;
  cursor: grab;
}

.exam-question-item:hover {
  border-color: var(--primary-light);
  box-shadow: var(--shadow-sm);
}

.exam-question-item.dragging {
  opacity: 0.5;
  cursor: grabbing;
}

.exam-question-item.drag-over-target {
  border-top: 3px solid var(--primary);
}

.exam-question-drag-handle {
  cursor: grab;
  color: var(--text-tertiary);
  flex-shrink: 0;
  padding: 2px 0;
}

.exam-question-drag-handle svg {
  width: 16px;
  height: 16px;
}

.exam-question-drag-handle:hover {
  color: var(--primary);
}

.exam-question-item:hover {
  border-color: var(--primary-light);
  box-shadow: var(--shadow-sm);
}

.exam-question-num {
  width: 28px;
  height: 28px;
  background: var(--gradient-primary);
  color: white;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 12px;
  flex-shrink: 0;
}

.exam-question-content {
  flex: 1;
  min-width: 0;
}

.exam-question-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 6px;
}

.exam-question-text {
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--text-primary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.exam-question-actions {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex-shrink: 0;
}

.exam-question-move,
.exam-question-remove {
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-tertiary);
  transition: var(--transition);
  flex-shrink: 0;
  padding: 0;
}

.exam-question-move:hover {
  background: var(--primary-lighter);
  color: var(--primary);
}

.exam-question-move:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.exam-question-move:disabled:hover {
  background: transparent;
  color: var(--text-tertiary);
}

.exam-question-remove:hover {
  background: var(--error-light);
  color: var(--error);
}

.exam-question-move svg,
.exam-question-remove svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
}

/* ===== Badge Grade ===== */
.badge-grade {
  background: var(--background-2);
  color: var(--text-secondary);
  font-weight: 500;
}

/* ===== Responsive ===== */
@media (max-width: 1024px) {
  .main-content {
    grid-template-columns: 240px 1fr;
  }

  .stats-bar {
    padding: 0 16px;
  }
}

@media (max-width: 768px) {
  .header {
    padding: 0 16px;
    height: 64px;
  }

  .main-content {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: -320px;
    width: 280px;
    height: 100vh;
    z-index: 200;
    background: var(--surface);
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-2xl);
    overflow-y: auto;
    padding: 24px 16px;
    margin: 0 !important;
  }

  .sidebar.show {
    left: 0;
  }

  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 199;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
  }

  .sidebar-backdrop.show {
    opacity: 1;
    pointer-events: auto;
  }

  .mobile-sidebar-toggle {
    display: inline-flex !important;
  }

  .content-area {
    padding: 16px;
  }

  .nav-tab span {
    display: none;
  }

  .logo-text {
    font-size: 16px;
  }

  .question-grid {
    grid-template-columns: 1fr;
  }
}

/* Mobile sidebar toggle button (hidden on desktop) */
.mobile-sidebar-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-primary);
  margin-right: 8px;
}

.mobile-sidebar-toggle:hover {
  background: var(--primary-lighter);
  border-color: var(--primary-light);
  color: var(--primary);
}

.mobile-sidebar-toggle svg {
  width: 20px;
  height: 20px;
}

/* ===== Animations ===== */
.question-card {
  animation: cardFadeIn 0.3s ease backwards;
}

@keyframes cardFadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.question-card:nth-child(1) { animation-delay: 0.02s; }
.question-card:nth-child(2) { animation-delay: 0.04s; }
.question-card:nth-child(3) { animation-delay: 0.06s; }
.question-card:nth-child(4) { animation-delay: 0.08s; }
.question-card:nth-child(5) { animation-delay: 0.10s; }
.question-card:nth-child(6) { animation-delay: 0.12s; }

/* ===== Upload Zone ===== */
.upload-zone {
  border: 2px dashed var(--border-dark);
  border-radius: var(--radius-xl);
  padding: 36px 24px;
  text-align: center;
  background: var(--surface);
  margin-bottom: 20px;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.upload-zone::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--primary-lighter) 0%, transparent 100%);
  opacity: 0;
  transition: var(--transition);
  pointer-events: none;
}

.upload-zone:hover, .upload-zone.dragover {
  border-color: var(--primary);
  background: var(--primary-lighter);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.upload-zone:hover::before, .upload-zone.dragover::before {
  opacity: 0.5;
}

.upload-content {
  position: relative;
  z-index: 1;
}

.upload-icon {
  width: 60px;
  height: 60px;
  border-radius: var(--radius-full);
  background: var(--gradient-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 14px;
  box-shadow: 0 8px 20px rgba(99, 102, 241, 0.3);
}

.upload-icon svg {
  width: 28px;
  height: 28px;
  stroke: white;
  stroke-width: 2;
}

.upload-text {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.upload-hint {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 14px;
}

.upload-formats {
  display: flex;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
}

.format-tag {
  font-size: 11px;
  padding: 2px 8px;
  background: var(--background-2);
  color: var(--text-secondary);
  border-radius: var(--radius-full);
  font-weight: 600;
  letter-spacing: 0.5px;
}

/* ===== Upload Progress ===== */
.upload-progress {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}

.upload-progress[hidden] {
  display: none;
}

.progress-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 13px;
}

.progress-title {
  color: var(--text-secondary);
  font-weight: 500;
}

.progress-percent {
  color: var(--primary);
  font-weight: 700;
}

.progress-bar {
  position: relative;
  height: 8px;
  background: var(--background-2);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-fill {
  position: absolute;
  inset: 0;
  background: var(--gradient-primary);
  border-radius: var(--radius-full);
  width: 0%;
  transition: width 0.3s ease;
  background-size: 200% 100%;
  animation: progressShimmer 2s linear infinite;
}

@keyframes progressShimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ===== Floating Action Button ===== */
.fab {
  position: fixed;
  bottom: 32px;
  right: 32px;
  width: 56px;
  height: 56px;
  border-radius: var(--radius-full);
  background: var(--gradient-primary);
  border: none;
  color: white;
  cursor: pointer;
  box-shadow: var(--shadow-xl);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  z-index: 99;
}

.fab:hover {
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 12px 28px rgba(99, 102, 241, 0.4);
}

.fab svg {
  width: 24px;
  height: 24px;
  stroke: white;
  stroke-width: 2.5;
}

/* ===== Difficulty Slider Visual ===== */
input[type="radio"]:checked + .badge {
  box-shadow: 0 0 0 2px var(--primary) !important;
  transform: scale(1.1);
}

/* ===== Question Modal Detail ===== */
.question-detail {
  font-size: 14px;
  line-height: 1.8;
  color: var(--text-primary);
}

.question-detail-options {
  margin: 16px 0;
  padding: 12px 16px;
  background: var(--background);
  border-radius: var(--radius-md);
  font-family: 'Courier New', monospace;
}

.question-detail-answer {
  margin-top: 16px;
  padding: 12px 16px;
  background: var(--success-light);
  border-left: 3px solid var(--success);
  border-radius: var(--radius-md);
  color: var(--text-primary);
}

.question-detail-answer strong {
  color: var(--success);
}

.question-detail-analysis {
  margin-top: 12px;
  padding: 12px 16px;
  background: var(--info-light);
  border-left: 3px solid var(--info);
  border-radius: var(--radius-md);
  color: var(--text-primary);
}

/* ===== Question Type Icons ===== */
.type-icon {
  width: 14px;
  height: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 700;
  color: white;
  margin-right: 4px;
}

.type-icon.choice { background: var(--info); }
.type-icon.fill { background: var(--secondary); }
.type-icon.essay { background: var(--accent); }

/* ===== Subject Color Dot ===== */
.subject-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 4px;
  vertical-align: middle;
}

/* ===== Shimmer Loading ===== */
.shimmer {
  background: linear-gradient(90deg, var(--background-2) 0%, var(--border-light) 50%, var(--background-2) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

@keyframes print {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ===== Exam Preview Content ===== */
.exam-preview-content {
  font-family: "Noto Sans SC", serif;
  line-height: 1.8;
  padding: 24px;
  background: var(--surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}

.exam-preview-content > div:first-child {
  font-family: "SimSun", "Noto Serif SC", serif;
}

/* ===== Stats Card ===== */
.stats-card {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: var(--shadow-sm);
}

.stats-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  font-size: 13px;
  color: var(--text-secondary);
  border-bottom: 1px dashed var(--border-light);
}

.stats-row:last-child {
  border-bottom: none;
}

.stats-row span:last-child {
  font-weight: 700;
  color: var(--primary);
}

/* ===== Tag Filter ===== */
.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 4px 0;
}

.tag-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  background: var(--info-light);
  color: var(--info);
  border-radius: var(--radius-full);
  font-size: 11.5px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}

.tag-pill:hover {
  background: var(--info);
  color: white;
}

.tag-pill .remove {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: rgba(255,255,255,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

/* ===== Question Detail Modal ===== */
.question-detail-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
}

.question-detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 12px 0;
  padding: 12px 16px;
  background: var(--background);
  border-radius: var(--radius-md);
  font-size: 12.5px;
  color: var(--text-secondary);
}

.question-detail-meta-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.question-detail-meta-item strong {
  color: var(--text-primary);
  font-weight: 600;
}

/* ===== Print Styles ===== */
@media print {
  .header, .sidebar, .toolbar, .question-actions, .modal-header, .modal-footer {
    display: none !important;
  }

  .question-card {
    break-inside: avoid;
    box-shadow: none;
    border: 1px solid #ccc;
  }
}
