/* Traffic Law Practice System - Driving Test Theme
   Deep blue primary, green highlights, professional government-exam feel
*/

:root {
  --primary: #0A2E5C;
  --primary-light: #1A4A7A;
  --primary-dark: #061E3D;
  --accent: #1A7D3A;
  --accent-light: #27AE60;
  --accent-warm: #F39C12;
  --danger: #C0392B;
  --danger-light: #E74C3C;
  --bg: #F0F4F8;
  --card-bg: #FFFFFF;
  --text: #2C3E50;
  --text-light: #7F8C8D;
  --text-on-primary: #FFFFFF;
  --border: #D5DDE5;
  --shadow: 0 2px 12px rgba(10,46,92,0.1);
  --radius: 8px;
  --font: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

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

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ===== HEADER ===== */
.header {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  color: var(--text-on-primary);
  padding: 18px 30px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 3px 15px rgba(10,46,92,0.3);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 15px;
}

.header-logo {
  width: 42px;
  height: 42px;
  background: rgba(255,255,255,0.15);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: bold;
  border: 2px solid rgba(255,255,255,0.3);
}

.header-title {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.header-subtitle {
  font-size: 12px;
  opacity: 0.75;
  margin-top: 2px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
}

.header-user {
  background: rgba(255,255,255,0.1);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
}

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 24px;
  border: none;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  font-family: var(--font);
}

.btn-primary {
  background: var(--primary);
  color: white;
  box-shadow: 0 2px 8px rgba(10,46,92,0.25);
}
.btn-primary:hover {
  background: var(--primary-light);
  transform: translateY(-1px);
  box-shadow: 0 4px 15px rgba(10,46,92,0.35);
}

.btn-success {
  background: var(--accent);
  color: white;
}
.btn-success:hover {
  background: #1E8F46;
  transform: translateY(-1px);
}

.btn-outline {
  background: transparent;
  color: var(--primary);
  border: 2px solid var(--primary);
}
.btn-outline:hover {
  background: var(--primary);
  color: white;
}

.btn-danger {
  background: var(--danger);
  color: white;
}
.btn-danger:hover {
  background: #A93226;
}

.btn-lg { padding: 14px 36px; font-size: 16px; border-radius: 10px; }
.btn-sm { padding: 6px 14px; font-size: 12px; }
.btn-block { width: 100%; }

/* ===== CARDS ===== */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.card-header {
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  font-weight: 700;
  font-size: 16px;
  color: var(--primary);
}

.card-body {
  padding: 24px;
}

/* ===== HERO SECTION (Landing Page) ===== */
.hero {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  padding: 60px 30px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle at 30% 50%, rgba(255,255,255,0.05) 0%, transparent 60%);
  pointer-events: none;
}

.hero-icon {
  font-size: 56px;
  margin-bottom: 20px;
  display: inline-block;
  background: rgba(255,255,255,0.1);
  width: 100px;
  height: 100px;
  line-height: 100px;
  border-radius: 50%;
  border: 3px solid rgba(255,255,255,0.2);
}

.hero h1 {
  font-size: 36px;
  font-weight: 800;
  margin-bottom: 12px;
  letter-spacing: 1px;
}

.hero p {
  font-size: 18px;
  opacity: 0.85;
  max-width: 600px;
  margin: 0 auto 30px;
  line-height: 1.6;
}

/* ===== MODULES GRID ===== */
.modules {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  padding: 40px 30px;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

.module-card {
  background: white;
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 30px 24px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s;
  border: 2px solid transparent;
}

.module-card:hover {
  border-color: var(--accent);
  transform: translateY(-3px);
  box-shadow: 0 8px 25px rgba(10,46,92,0.15);
}

.module-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  background: linear-gradient(135deg, var(--primary-light), var(--primary));
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  color: white;
}

.module-card h3 {
  font-size: 18px;
  color: var(--primary);
  margin-bottom: 8px;
}

.module-card p {
  font-size: 13px;
  color: var(--text-light);
  line-height: 1.5;
}

.module-card .badge {
  display: inline-block;
  margin-top: 12px;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
}

.badge-green { background: #E8F5E9; color: var(--accent); }
.badge-orange { background: #FFF3E0; color: #E65100; }
.badge-blue { background: #E3F2FD; color: #1565C0; }

/* ===== LOGIN / CARD FORM ===== */
.form-container {
  max-width: 420px;
  margin: 40px auto;
  padding: 0 20px;
}

.form-card {
  background: white;
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 30px;
}

.form-card h2 {
  color: var(--primary);
  font-size: 22px;
  margin-bottom: 6px;
  text-align: center;
}

.form-card .subtitle {
  color: var(--text-light);
  font-size: 13px;
  text-align: center;
  margin-bottom: 24px;
}

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

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

.form-control {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-size: 15px;
  font-family: var(--font);
  transition: border-color 0.2s;
  outline: none;
  box-sizing: border-box;
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(10,46,92,0.1);
}

.form-hint {
  font-size: 12px;
  color: var(--text-light);
  margin-top: 4px;
}

.form-error {
  color: var(--danger);
  font-size: 13px;
  text-align: center;
  margin-bottom: 16px;
  padding: 8px;
  background: #FDEDEC;
  border-radius: 6px;
  display: none;
}

.form-error.show { display: block; }

/* ===== QUESTION DISPLAY ===== */
.question-panel {
  max-width: 800px;
  margin: 20px auto;
  padding: 0 20px;
}

.question-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.question-progress {
  font-size: 14px;
  color: var(--text-light);
  font-weight: 600;
}

.question-type-badge {
  padding: 4px 12px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.badge-single { background: #E3F2FD; color: #1565C0; }
.badge-multiple { background: #FFF3E0; color: #E65100; }
.badge-truefalse { background: #F3E5F5; color: #7B1FA2; }

.question-image {
  margin-bottom: 16px;
  text-align: center;
  background: #F8F9FA;
  border-radius: var(--radius);
  padding: 12px;
  border: 1px solid var(--border);
}

.question-image img {
  max-width: 100%;
  max-height: 400px;
  border-radius: 4px;
}

.question-text {
  font-size: 17px;
  line-height: 1.7;
  margin-bottom: 20px;
  padding: 16px;
  background: #F8F9FA;
  border-radius: var(--radius);
  border-left: 4px solid var(--primary);
}

/* ===== OPTIONS ===== */
.options-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}

.option-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s;
  background: white;
  user-select: none;
}

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

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

.option-item.correct {
  border-color: var(--accent);
  background: #E8F5E9;
}

.option-item.wrong {
  border-color: var(--danger);
  background: #FDEDEC;
}

.option-label {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}

.option-item.correct .option-label { background: var(--accent); }
.option-item.wrong .option-label { background: var(--danger); }

.option-text {
  font-size: 15px;
  line-height: 1.4;
  flex: 1;
}

/* ===== IMAGE OPTIONS (traffic signs) ===== */
.option-item.has-image {
  flex-direction: column;
  align-items: center;
  padding: 16px;
}

.option-image {
  max-width: 120px;
  max-height: 120px;
  margin-bottom: 8px;
}

/* ===== ACTION BAR ===== */
.action-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.action-left {
  display: flex;
  gap: 8px;
}

.action-right {
  display: flex;
  gap: 8px;
}

/* ===== EXPLANATION PANEL ===== */
.explanation-panel {
  margin-top: 16px;
  padding: 20px;
  background: #F0F9F4;
  border-radius: var(--radius);
  border: 1px solid #C8E6C9;
  display: none;
}

.explanation-panel.show {
  display: block;
  animation: slideDown 0.3s ease;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

.explanation-panel h4 {
  color: var(--accent);
  font-size: 14px;
  margin-bottom: 8px;
}

.explanation-panel .exp-text {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
}

.explanation-panel .key-points {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #C8E6C9;
}

.explanation-panel .key-points h4 {
  color: var(--primary);
}

.explanation-panel .key-points ul {
  list-style: none;
  padding: 0;
}

.explanation-panel .key-points li {
  font-size: 13px;
  line-height: 1.6;
  padding: 3px 0 3px 16px;
  position: relative;
}

.explanation-panel .key-points li::before {
  content: '•';
  position: absolute;
  left: 0;
  color: var(--accent);
  font-weight: bold;
}

/* ===== SIMULATION MODE ===== */
.sim-header {
  background: linear-gradient(135deg, #C0392B 0%, #E74C3C 100%);
  color: white;
  padding: 12px 30px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}

.sim-timer {
  font-size: 20px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.sim-timer.warning {
  color: #F1C40F;
  animation: pulse 1s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.sim-progress {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sim-progress-bar {
  width: 200px;
  height: 8px;
  background: rgba(255,255,255,0.3);
  border-radius: 4px;
  overflow: hidden;
}

.sim-progress-fill {
  height: 100%;
  background: white;
  border-radius: 4px;
  transition: width 0.3s;
}

/* ===== RESULT PAGE ===== */
.result-page {
  max-width: 600px;
  margin: 40px auto;
  text-align: center;
  padding: 0 20px;
}

.result-page .card {
  padding: 40px;
}

.result-page .big-score {
  font-size: 72px;
  font-weight: 800;
  color: var(--primary);
}

.result-page .big-score.pass { color: var(--accent); }
.result-page .big-score.fail { color: var(--danger); }

.result-page .score-label {
  font-size: 16px;
  color: var(--text-light);
  margin-top: -8px;
  margin-bottom: 20px;
}

.result-page .verdict {
  font-size: 20px;
  font-weight: 700;
  padding: 10px;
  border-radius: 8px;
  margin-bottom: 20px;
}

.verdict.pass { background: #E8F5E9; color: var(--accent); }
.verdict.fail { background: #FDEDEC; color: var(--danger); }

.result-stats {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
  margin-bottom: 24px;
}

.stat-item {
  background: #F8F9FA;
  padding: 16px;
  border-radius: 8px;
}

.stat-item .num {
  font-size: 24px;
  font-weight: 700;
  color: var(--primary);
}

.stat-item .label {
  font-size: 12px;
  color: var(--text-light);
  margin-top: 4px;
}

/* ===== WRONG BOOK ===== */
.wrong-list {
  max-width: 800px;
  margin: 20px auto;
  padding: 0 20px;
}

.wrong-item {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.2s;
}

.wrong-item:hover {
  background: #F0F7FF;
}

.wrong-item:last-child {
  border-bottom: none;
}

/* ===== STUDY PAGE ===== */
.study-list {
  max-width: 800px;
  margin: 20px auto;
  padding: 0 20px;
}

.study-file {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.study-file:last-child {
  border-bottom: none;
}

.study-file-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.study-file-icon {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.icon-pdf { background: #FDEDEC; color: var(--danger); }
.icon-docx { background: #E3F2FD; color: #1565C0; }

/* ===== FOOTER ===== */
.footer {
  text-align: center;
  padding: 20px;
  color: var(--text-light);
  font-size: 12px;
  border-top: 1px solid var(--border);
  margin-top: auto;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .hero { padding: 40px 20px; }
  .hero h1 { font-size: 26px; }
  .hero p { font-size: 15px; }
  .modules { grid-template-columns: 1fr; padding: 20px 15px; }
  .question-panel { padding: 0 12px; }
  .question-text { font-size: 15px; }
  .sim-header { flex-wrap: wrap; gap: 10px; }
  .sim-progress-bar { width: 120px; }
  .action-bar { flex-direction: column; }
  .action-left, .action-right { width: 100%; }
  .action-left .btn, .action-right .btn { flex: 1; }
  .header-title { font-size: 16px; }
}

@media (max-width: 480px) {
  .option-item { padding: 12px; }
  .option-label { width: 28px; height: 28px; font-size: 12px; }
  .option-text { font-size: 14px; }
  .modules { padding: 12px; }
  .result-stats { grid-template-columns: 1fr; }
}
