:root {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --success: #16a34a;
  --danger: #dc2626;
  --warning: #d97706;
  --bg: #f1f5f9;
  --card-bg: #ffffff;
  --text: #1e293b;
  --text-muted: #64748b;
  --border: #cbd5e1;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

.container {
  max-width: 850px;
  margin: 0 auto;
  padding: 0 16px;
}

.app-header {
  background-color: var(--primary);
  color: white;
  padding: 24px 0;
  text-align: center;
  margin-bottom: 24px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.app-header h1 {
  font-size: 1.5rem;
  letter-spacing: 0.5px;
}

.app-header p {
  font-size: 0.95rem;
  opacity: 0.9;
}

.card {
  background: var(--card-bg);
  border-radius: 10px;
  padding: 24px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.08);
  margin-bottom: 30px;
}

.hidden {
  display: none !important;
}

h2 {
  font-size: 1.25rem;
  margin-bottom: 18px;
  color: var(--primary);
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
}

.req {
  color: var(--danger);
}

select, input[type="text"], input[type="date"] {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 1rem;
  background: #fff;
}

select:focus, input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

/* Mode Selector */
.mode-selector {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.mode-option {
  cursor: pointer;
}

.mode-option input {
  display: none;
}

.mode-box {
  position: relative;
  border: 2px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
  height: 100%;
  background: #ffffff;
  transition: all 0.2s ease;
}

.mode-option:hover .mode-box {
  border-color: var(--primary);
  background: #f8fafc;
  transform: translateY(-1px);
}

.mode-box strong {
  display: block;
  font-size: 1.05rem;
  margin-bottom: 4px;
}

.mode-box span {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.mode-option input:checked + .mode-box {
  border-color: var(--primary);
  background-color: #eff6ff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.16), 0 4px 10px rgba(37, 99, 235, 0.12);
}

.mode-option input:checked + .mode-box strong {
  color: var(--primary);
}

.mode-option input:checked + .mode-box::after {
  content: "✓";
  position: absolute;
  top: 12px;
  right: 14px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--primary);
  color: #ffffff;
  font-size: 0.8rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Student Info Box */
.student-box {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 20px;
}

.student-box h3 {
  font-size: 1rem;
  margin-bottom: 12px;
  color: var(--text);
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 10px 18px;
  border: none;
  border-radius: 6px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

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

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); }

.btn-secondary { background: #e2e8f0; color: var(--text); }
.btn-secondary:hover:not(:disabled) { background: #cbd5e1; }

.btn-success { background: var(--success); color: white; }
.btn-success:hover:not(:disabled) { background: #15803d; }

.btn-large {
  width: 100%;
  padding: 12px;
  font-size: 1.05rem;
}

/* Quiz Screen */
.quiz-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}

.badge {
  background: #dbeafe;
  color: var(--primary);
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: 700;
  margin-right: 8px;
}

.question-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px dashed var(--border);
}

.nav-btn {
  width: 34px;
  height: 34px;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.85rem;
}

.nav-btn.answered {
  background: #dbeafe;
  border-color: var(--primary);
  color: var(--primary);
}

.nav-btn.current {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.q-code {
  font-size: 0.8rem;
  color: var(--text-muted);
  background: #f1f5f9;
  padding: 2px 6px;
  border-radius: 4px;
}

.question-text {
  font-size: 1.1rem;
  font-weight: 500;
  margin: 12px 0 18px 0;
}

.options-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.option-item {
  display: flex;
  align-items: flex-start;
  padding: 12px 16px;
  border: 2px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
  cursor: pointer;
  transition: all 0.15s ease;
}

.option-item:hover {
  border-color: var(--primary);
  background: #f8fafc;
}

.option-prefix {
  font-weight: 700;
  margin-right: 12px;
  color: var(--primary);
  min-width: 22px;
}

/* Trạng thái lựa chọn */
.option-item.selected {
  border-color: var(--primary);
  background: #eff6ff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
  font-weight: 600;
}

.option-item.selected .option-prefix {
  background: var(--primary);
  color: #ffffff;
  border-radius: 4px;
  text-align: center;
  padding: 0 4px;
}

.option-item.correct {
  border-color: var(--success);
  background: #dcfce7;
  color: #14532d;
  box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.14);
  font-weight: 600;
}

.option-item.correct .option-prefix {
  color: #15803d;
}

.option-item.wrong {
  border-color: var(--danger);
  background: #fee2e2;
  color: #7f1d1d;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.14);
}

.option-item.wrong .option-prefix {
  color: #b91c1c;
}

.feedback-box {
  margin-top: 16px;
  padding: 14px;
  border-radius: 8px;
  font-size: 0.95rem;
}

.feedback-box.error {
  background: #fef2f2;
  border-left: 4px solid var(--danger);
  color: #991b1b;
}

.feedback-box.success {
  background: #f0fdf4;
  border-left: 4px solid var(--success);
  color: #166534;
}

.quiz-footer {
  display: flex;
  justify-content: space-between;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

/* Result Screen */
.result-summary {
  text-align: center;
}

.student-summary {
  margin-bottom: 16px;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.score-circle {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: #eff6ff;
  border: 4px solid var(--primary);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  margin: 0 auto 16px auto;
}

.score-circle span {
  font-size: 2rem;
  font-weight: 800;
  color: var(--primary);
  line-height: 1;
}

.save-status {
  margin: 12px 0;
  font-size: 0.9rem;
  font-weight: 600;
}

.review-section {
  margin-top: 24px;
}

.review-section hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin-bottom: 20px;
}

.review-item {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 14px;
}

.review-item.is-correct { border-left: 5px solid var(--success); }
.review-item.is-wrong { border-left: 5px solid var(--danger); }

.review-note {
  margin-top: 8px;
  padding: 8px 12px;
  background: #f8fafc;
  border-radius: 6px;
  font-size: 0.9rem;
  color: #334155;
}

.loader {
  text-align: center;
  padding: 20px;
  color: var(--text-muted);
  font-style: italic;
}

@media (max-width: 600px) {
  .mode-selector, .grid-2 {
    grid-template-columns: 1fr;
  }
}

/* Giao diện Footer màu xám nhẹ */
.app-footer {
  margin-top: 48px;
  padding: 24px 0;
  background-color: #e2e8f0; /* Màu xám trung tính nhẹ, dễ phân biệt với nền trắng/xám nhạt */
  border-top: 2px solid #cbd5e1; /* Đường viền phân cách rõ nét */
  color: #334155;
  font-size: 12px;
  line-height: 1.6;
}

.app-footer strong {
  color: #0f172a;
}

.app-footer .copyright {
  margin-top: 6px !important;
  font-size: 11px;
  color: #64748b;
}