/* ===== CSS Variables - 配色方案 ===== */
:root {
  --bg: #F5F0E8;
  --bg-surface: #FFFEF9;
  --bg-hover: #EDE8DC;
  --primary: #7A9D54;
  --primary-hover: #6B8E47;
  --primary-light: #C8D6B5;
  --primary-lighter: #E6EFDA;
  --text: #3D3D3D;
  --text-secondary: #7D7D7D;
  --text-muted: #A8A8A8;
  --border: #D8D0C0;
  --border-light: #E8E2D4;
  --success: #6B9E5A;
  --success-bg: #E8F3E2;
  --error: #D4766E;
  --error-bg: #FBE8E5;
  --warning: #D4A76E;
  --warning-bg: #FBF0E2;
  --info: #6EA8D4;
  --info-bg: #E2EEF8;
  --shadow: 0 2px 8px rgba(0,0,0,0.06);
  --shadow-lg: 0 4px 16px rgba(0,0,0,0.1);
  --radius: 8px;
  --radius-sm: 4px;
  --radius-lg: 12px;
  --font: 'PingFang SC', 'Microsoft YaHei', 'Hiragino Sans GB', 'Noto Sans SC', sans-serif;
  --font-mono: 'SF Mono', 'Cascadia Code', 'Consolas', monospace;
  --transition: 0.2s ease;
}

/* 暗色模式 */
[data-theme="dark"] {
  --bg: #1E1E20;
  --bg-surface: #28282C;
  --bg-hover: #323236;
  --primary: #8BB86A;
  --primary-hover: #9DC880;
  --primary-light: #3D5A30;
  --primary-lighter: #2A3F22;
  --text: #D0D0D0;
  --text-secondary: #909090;
  --text-muted: #606060;
  --border: #3D3D42;
  --border-light: #323236;
  --success: #7CB868;
  --success-bg: #1E2F18;
  --error: #D4766E;
  --error-bg: #2F1E1C;
  --warning: #D4A76E;
  --warning-bg: #2F2618;
  --info: #6EA8D4;
  --info-bg: #18262F;
  --shadow: 0 2px 8px rgba(0,0,0,0.3);
  --shadow-lg: 0 4px 16px rgba(0,0,0,0.5);
}

/* ===== Reset & Base ===== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  min-height: 100vh;
  transition: background var(--transition), color var(--transition);
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  color: var(--primary-hover);
}

/* ===== Layout ===== */
.app-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px 24px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ===== Header ===== */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0;
  border-bottom: 1px solid var(--border-light);
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}

.app-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--primary);
}

.app-logo .icon {
  width: 36px;
  height: 36px;
  background: var(--primary);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.2rem;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* ===== Theme Toggle ===== */
.theme-toggle {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 6px 14px;
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all var(--transition);
}

.theme-toggle:hover {
  border-color: var(--primary);
  color: var(--primary);
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-family: var(--font);
  cursor: pointer;
  transition: all var(--transition);
  font-weight: 500;
  white-space: nowrap;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-hover);
}

.btn-secondary {
  background: var(--bg-surface);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--bg-hover);
  border-color: var(--primary);
}

.btn-outline {
  background: transparent;
  color: var(--primary);
  border: 1px solid var(--primary);
}

.btn-outline:hover:not(:disabled) {
  background: var(--primary-lighter);
}

.btn-sm {
  padding: 6px 14px;
  font-size: 0.82rem;
}

.btn-lg {
  padding: 14px 28px;
  font-size: 1rem;
}

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 50%;
}

.btn-danger {
  background: var(--error);
  color: #fff;
}

.btn-danger:hover:not(:disabled) {
  opacity: 0.85;
}

/* ===== Cards ===== */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow);
  transition: all var(--transition);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-light);
}

.card-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-body {
  flex: 1;
}

/* ===== Forms ===== */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 6px;
}

.form-input,
.form-textarea,
.form-select {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg-surface);
  transition: border-color var(--transition);
  outline: none;
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-lighter);
}

.form-textarea {
  min-height: 200px;
  resize: vertical;
  line-height: 1.8;
}

.form-select {
  cursor: pointer;
}

.form-hint {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.form-input-group {
  display: flex;
  gap: 8px;
}

.form-input-group .form-input {
  flex: 1;
}

/* ===== File Upload ===== */
.upload-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 40px 24px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  background: var(--bg);
}

.upload-area:hover,
.upload-area.drag-over {
  border-color: var(--primary);
  background: var(--primary-lighter);
}

.upload-icon {
  font-size: 2.5rem;
  color: var(--primary);
  margin-bottom: 12px;
}

.upload-text {
  font-size: 0.95rem;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.upload-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.upload-area input[type="file"] {
  display: none;
}

/* ===== File List ===== */
.file-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.file-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: var(--primary-lighter);
  border: 1px solid var(--primary-light);
  border-radius: 20px;
  font-size: 0.8rem;
  color: var(--primary);
}

.file-tag .remove-file {
  cursor: pointer;
  font-size: 0.9rem;
  opacity: 0.6;
  transition: opacity var(--transition);
}

.file-tag .remove-file:hover {
  opacity: 1;
  color: var(--error);
}

/* ===== Tabs ===== */
.tabs {
  display: flex;
  border-bottom: 2px solid var(--border-light);
  margin-bottom: 20px;
  gap: 0;
}

.tab-btn {
  padding: 10px 24px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  font-size: 0.9rem;
  font-family: var(--font);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.tab-btn:hover {
  color: var(--text);
}

.tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 600;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* ===== Steps / Progress ===== */
.steps {
  display: flex;
  gap: 0;
  margin-bottom: 24px;
  overflow-x: auto;
}

.step {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  position: relative;
  font-size: 0.85rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.step:first-child {
  border-radius: var(--radius) 0 0 var(--radius);
}

.step:last-child {
  border-radius: 0 var(--radius) var(--radius) 0;
}

.step + .step {
  border-left: none;
}

.step.active {
  background: var(--primary-lighter);
  border-color: var(--primary);
  color: var(--primary);
  font-weight: 600;
}

.step.done {
  background: var(--success-bg);
  border-color: var(--success);
  color: var(--success);
}

.step-num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  flex-shrink: 0;
}

.step.active .step-num {
  background: var(--primary);
  color: #fff;
}

.step.done .step-num {
  background: var(--success);
  color: #fff;
}

/* ===== Preview Area ===== */
.preview-container {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px 40px;
  max-height: 600px;
  overflow-y: auto;
  line-height: 2;
  font-size: 0.95rem;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.05);
}

[data-theme="dark"] .preview-container {
  background: #1A1A1E;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.3);
}

.preview-container h1,
.preview-container h2,
.preview-container h3 {
  color: var(--primary);
  margin-top: 1.2em;
  margin-bottom: 0.5em;
}

.preview-container h1 { font-size: 1.4rem; }
.preview-container h2 { font-size: 1.2rem; border-bottom: 1px solid var(--border-light); padding-bottom: 6px; }
.preview-container h3 { font-size: 1.05rem; }

.preview-container p {
  text-indent: 2em;
  margin-bottom: 0.5em;
}

.preview-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.preview-toolbar label {
  font-size: 0.82rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 4px;
}

.preview-toolbar select {
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-family: var(--font);
  background: var(--bg-surface);
  color: var(--text);
  cursor: pointer;
}

/* ===== Knowledge Points ===== */
.kp-section {
  margin-bottom: 20px;
}

.kp-section-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--primary-light);
  display: flex;
  align-items: center;
  gap: 8px;
}

.kp-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.kp-item {
  background: var(--bg);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 14px 18px;
  transition: all var(--transition);
}

.kp-item:hover {
  border-color: var(--primary-light);
}

.kp-item.class-1 {
  border-left: 4px solid var(--primary);
}

.kp-item.class-2 {
  border-left: 4px solid var(--info);
}

.kp-label {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  margin-bottom: 6px;
}

.kp-label.class-1 {
  background: var(--primary-lighter);
  color: var(--primary);
}

.kp-label.class-2 {
  background: var(--info-bg);
  color: var(--info);
}

.kp-content {
  font-size: 0.9rem;
  line-height: 1.7;
}

.kp-related {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 6px;
}

/* ===== Questions List ===== */
.questions-summary {
  display: flex;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.qs-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  font-size: 0.85rem;
}

.qs-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.qs-dot.single { background: var(--primary); }
.qs-dot.multi { background: var(--info); }
.qs-dot.tf { background: var(--warning); }

/* ===== Two-Column Layout ===== */
.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

@media (max-width: 768px) {
  .two-col {
    grid-template-columns: 1fr;
  }
}

/* ===== Action Bar ===== */
.action-bar {
  display: flex;
  gap: 12px;
  margin-top: 20px;
  flex-wrap: wrap;
  align-items: center;
}

/* ===== Loading ===== */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.loading-box {
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  padding: 32px 48px;
  text-align: center;
  box-shadow: var(--shadow-lg);
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top: 3px solid var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 16px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-text {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.loading-progress {
  margin-top: 12px;
  height: 4px;
  background: var(--border-light);
  border-radius: 2px;
  overflow: hidden;
}

.loading-progress-bar {
  height: 100%;
  background: var(--primary);
  border-radius: 2px;
  transition: width 0.3s ease;
}

/* ===== Toast / Notification ===== */
.toast-container {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 12px 20px;
  border-radius: var(--radius);
  font-size: 0.88rem;
  box-shadow: var(--shadow-lg);
  animation: slideIn 0.3s ease;
  max-width: 360px;
}

.toast.success {
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid var(--success);
}

.toast.error {
  background: var(--error-bg);
  color: var(--error);
  border: 1px solid var(--error);
}

.toast.info {
  background: var(--info-bg);
  color: var(--info);
  border: 1px solid var(--info);
}

@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* ===== Modal ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1500;
}

.modal {
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  padding: 28px;
  max-width: 520px;
  width: 90%;
  box-shadow: var(--shadow-lg);
}

.modal-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 16px;
}

.modal-body {
  margin-bottom: 20px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ===== Settings Panel ===== */
.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
}

.settings-row label {
  font-size: 0.88rem;
  color: var(--text);
}

.settings-row select,
.settings-row input {
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-family: var(--font);
  background: var(--bg-surface);
  color: var(--text);
}

/* ===== API Key Input ===== */
.api-key-section {
  display: flex;
  align-items: center;
  gap: 8px;
}

.api-key-input {
  width: 260px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-family: var(--font-mono);
  background: var(--bg-surface);
  color: var(--text);
  letter-spacing: 1px;
}

.api-key-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.78rem;
}

.api-key-status.set {
  color: var(--success);
}

.api-key-status.unset {
  color: var(--warning);
}

/* ===== Quiz Layout ===== */
.quiz-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 0;
  flex: 1;
  min-height: calc(100vh - 100px);
}

@media (max-width: 900px) {
  .quiz-layout {
    grid-template-columns: 1fr;
  }
}

/* ===== Quiz Sidebar ===== */
.quiz-sidebar {
  background: var(--bg-surface);
  border-right: 1px solid var(--border-light);
  padding: 20px 16px;
  overflow-y: auto;
  transition: all 0.3s ease;
  position: relative;
}

.quiz-sidebar.collapsed {
  width: 0;
  min-width: 0;
  padding: 0;
  overflow: hidden;
  border-right: none;
}

.sidebar-toggle {
  position: absolute;
  top: 16px;
  right: -16px;
  width: 32px;
  height: 32px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  color: var(--text-secondary);
  z-index: 10;
  transition: all var(--transition);
}

.sidebar-toggle:hover {
  color: var(--primary);
  border-color: var(--primary);
}

.quiz-sidebar.collapsed .sidebar-toggle {
  right: -40px;
}

.sidebar-section {
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-light);
}

.sidebar-section:last-child {
  border-bottom: none;
}

.sidebar-section h3 {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.sidebar-option {
  display: block;
  width: 100%;
  padding: 8px 12px;
  background: none;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-family: var(--font);
  color: var(--text);
  cursor: pointer;
  text-align: left;
  transition: all var(--transition);
  margin-bottom: 2px;
}

.sidebar-option:hover {
  background: var(--bg-hover);
}

.sidebar-option.active {
  background: var(--primary-lighter);
  border-color: var(--primary-light);
  color: var(--primary);
  font-weight: 500;
}

.sidebar-option .badge {
  float: right;
  font-size: 0.75rem;
  padding: 1px 8px;
  border-radius: 10px;
  background: var(--border-light);
  color: var(--text-secondary);
}

/* ===== Quiz Main ===== */
.quiz-main {
  padding: 24px 32px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

/* ===== Dashboard ===== */
.dashboard {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}

@media (max-width: 900px) {
  .dashboard {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 500px) {
  .dashboard {
    grid-template-columns: repeat(2, 1fr);
  }
}

.dash-item {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 14px;
  text-align: center;
}

.dash-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
}

.dash-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.dash-item.accuracy .dash-value { color: var(--success); }
.dash-item.wrong .dash-value { color: var(--error); }

/* ===== Question Area ===== */
.question-container {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.question-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 28px 32px;
  box-shadow: var(--shadow);
  flex: 1;
  display: flex;
  flex-direction: column;
}

.question-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.question-type-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
}

.question-type-badge.single {
  background: var(--primary-lighter);
  color: var(--primary);
}

.question-type-badge.multi {
  background: var(--info-bg);
  color: var(--info);
}

.question-type-badge.tf {
  background: var(--warning-bg);
  color: var(--warning);
}

.question-num {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.question-stem {
  font-size: 1.05rem;
  line-height: 1.8;
  margin-bottom: 24px;
  color: var(--text);
  font-weight: 500;
}

/* ===== Options ===== */
.options-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 24px;
}

.option-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 18px;
  border: 2px solid var(--border-light);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--transition);
  font-size: 0.92rem;
  line-height: 1.6;
}

.option-item:hover {
  border-color: var(--primary-light);
  background: var(--bg);
}

.option-item.selected {
  border-color: var(--primary);
  background: var(--primary-lighter);
}

.option-item.correct {
  border-color: var(--success);
  background: var(--success-bg);
}

.option-item.wrong {
  border-color: var(--error);
  background: var(--error-bg);
}

.option-marker {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.85rem;
  flex-shrink: 0;
  background: var(--bg-surface);
  transition: all var(--transition);
}

.option-item.selected .option-marker {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
}

.option-item.correct .option-marker {
  border-color: var(--success);
  background: var(--success);
  color: #fff;
}

.option-item.wrong .option-marker {
  border-color: var(--error);
  background: var(--error);
  color: #fff;
}

.option-text {
  flex: 1;
}

/* ===== Answer Feedback ===== */
.answer-feedback {
  padding: 16px 20px;
  border-radius: var(--radius);
  margin-top: 16px;
  font-size: 0.9rem;
  line-height: 1.7;
}

.answer-feedback.correct {
  background: var(--success-bg);
  border: 1px solid var(--success);
  color: #2E7D32;
}

[data-theme="dark"] .answer-feedback.correct {
  color: var(--success);
}

.answer-feedback.wrong {
  background: var(--error-bg);
  border: 1px solid var(--error);
  color: #C62828;
}

[data-theme="dark"] .answer-feedback.wrong {
  color: var(--error);
}

.feedback-kp {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.feedback-kp strong {
  color: var(--primary);
}

/* ===== Quiz Navigation ===== */
.quiz-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 20px;
  gap: 12px;
}

.quiz-nav-center {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* ===== Empty State ===== */
.empty-state {
  text-align: center;
  padding: 60px 24px;
  color: var(--text-muted);
}

.empty-state-icon {
  font-size: 3rem;
  margin-bottom: 16px;
  opacity: 0.5;
}

.empty-state-text {
  font-size: 0.95rem;
  margin-bottom: 8px;
}

.empty-state-hint {
  font-size: 0.82rem;
}

/* ===== Link Button ===== */
.link-btn {
  background: none;
  border: none;
  color: var(--primary);
  cursor: pointer;
  font-size: 0.85rem;
  font-family: var(--font);
  padding: 4px 0;
  transition: color var(--transition);
}

.link-btn:hover {
  color: var(--primary-hover);
  text-decoration: underline;
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ===== Utility Classes ===== */
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.hidden { display: none !important; }
.w-full { width: 100%; }

.highlight {
  background: linear-gradient(transparent 60%, var(--primary-light) 60%);
  padding: 0 2px;
}

.text-success { color: var(--success); }
.text-error { color: var(--error); }
.text-warning { color: var(--warning); }
.text-primary { color: var(--primary); }
.text-muted { color: var(--text-muted); }

.font-bold { font-weight: 600; }

/* ===== Print Styles (A4) ===== */
@media print {
  body {
    background: #fff;
    color: #000;
    font-size: 12pt;
  }

  .app-header,
  .header-actions,
  .theme-toggle,
  .quiz-sidebar,
  .sidebar-toggle,
  .quiz-nav,
  .dashboard,
  .btn,
  .upload-area,
  .tabs,
  .steps,
  .action-bar,
  .preview-toolbar,
  .toast-container,
  .loading-overlay,
  .no-print {
    display: none !important;
  }

  .app-container {
    max-width: 100%;
    padding: 0;
  }

  .preview-container {
    border: none;
    padding: 0;
    box-shadow: none;
    max-height: none;
    overflow: visible;
    font-size: 11pt;
    line-height: 1.8;
  }

  .question-card {
    break-inside: avoid;
    border: 1px solid #ccc;
    margin-bottom: 12px;
    padding: 16px;
    box-shadow: none;
  }

  .option-item {
    border-color: #ddd;
  }

  .quiz-layout {
    display: block;
  }

  .quiz-main {
    padding: 0;
  }

  @page {
    size: A4;
    margin: 2cm;
  }

  .page-break {
    page-break-before: always;
  }
}

/* ===== Print-specific class ===== */
.print-layout {
  max-width: 210mm;
  margin: 0 auto;
  padding: 20mm;
  background: #fff;
  color: #000;
  font-size: 12pt;
  line-height: 2;
}

.print-layout h1 { font-size: 18pt; }
.print-layout h2 { font-size: 14pt; border-bottom: 1px solid #ccc; }
.print-layout h3 { font-size: 12pt; }

/* ===== Review Mode ===== */
.review-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--warning-bg);
  color: var(--warning);
}

/* ===== Confirm Dialog ===== */
.confirm-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}

.confirm-box {
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  padding: 28px;
  max-width: 420px;
  width: 90%;
  box-shadow: var(--shadow-lg);
  text-align: center;
}

.confirm-box p {
  margin-bottom: 20px;
  font-size: 0.95rem;
}

.confirm-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}
