/* === CSS Variables & Reset === */
:root {
  --primary: #0055a4;
  --primary-light: #e8f0fe;
  --secondary: #d32f2f;
  --success: #2e7d32;
  --warning: #f9a825;
  --bg: #f5f5f5;
  --surface: #ffffff;
  --text: #1a1a1a;
  --text-light: #666666;
  --border: #e0e0e0;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow: 0 2px 8px rgba(0,0,0,0.1);
  --shadow-lg: 0 4px 16px rgba(0,0,0,0.12);
  --max-width: 900px;
  --header-height: 56px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

img { max-width: 100%; height: auto; }
a { color: var(--primary); text-decoration: none; }
button { cursor: pointer; font-family: inherit; }

/* === Header === */
.header {
  background: var(--primary);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}

.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 16px;
  height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  color: #fff;
  font-weight: 700;
  font-size: 1.1rem;
  white-space: nowrap;
}

.nav {
  display: flex;
  gap: 4px;
}

.nav a {
  color: rgba(255,255,255,0.85);
  padding: 6px 12px;
  border-radius: var(--radius);
  font-size: 0.875rem;
  transition: background 0.2s, color 0.2s;
}

.nav a:hover, .nav a.active {
  background: rgba(255,255,255,0.15);
  color: #fff;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.lang-toggle {
  background: rgba(255,255,255,0.2);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.3);
  padding: 4px 10px;
  border-radius: var(--radius);
  font-size: 0.8rem;
  font-weight: 600;
}

.lang-toggle:hover {
  background: rgba(255,255,255,0.3);
}

.menu-toggle {
  display: none;
  background: none;
  border: none;
  color: #fff;
  font-size: 1.4rem;
  padding: 4px;
}

/* === Main Content === */
#app {
  flex: 1;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 20px 16px;
  width: 100%;
}

/* === Footer === */
.footer {
  background: var(--text);
  color: rgba(255,255,255,0.6);
  text-align: center;
  padding: 20px 16px;
  font-size: 0.8rem;
  margin-top: auto;
}

.footer p + p { margin-top: 4px; }

/* === Home Page === */
.hero {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 24px;
}

.hero-img {
  width: 100%;
  height: 240px;
  object-fit: cover;
  display: block;
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.7), rgba(0,0,0,0.2));
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 24px;
  color: #fff;
}

.hero-overlay h1 {
  font-size: 1.6rem;
  margin-bottom: 8px;
}

.hero-overlay p {
  font-size: 0.95rem;
  opacity: 0.9;
}

.stats-bar {
  display: flex;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.stat {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 12px 16px;
  flex: 1;
  min-width: 120px;
  text-align: center;
  box-shadow: var(--shadow);
}

.stat-number {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
}

.stat-label {
  font-size: 0.8rem;
  color: var(--text-light);
}

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

.cta-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 16px;
  transition: transform 0.2s, box-shadow 0.2s;
  cursor: pointer;
  border: none;
  width: 100%;
  text-align: left;
  font-size: 1rem;
  color: var(--text);
}

.cta-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.cta-icon {
  font-size: 2rem;
  flex-shrink: 0;
}

.cta-card h3 {
  font-size: 1rem;
  margin-bottom: 4px;
}

.cta-card p {
  font-size: 0.85rem;
  color: var(--text-light);
}

/* === Exam Page === */
.exam-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 8px;
}

.exam-timer {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--primary);
  background: var(--primary-light);
  padding: 6px 14px;
  border-radius: var(--radius);
}

.exam-timer.warning {
  color: var(--secondary);
  background: #fdecea;
}

.exam-progress {
  width: 100%;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  margin-bottom: 20px;
  overflow: hidden;
}

.exam-progress-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 3px;
  transition: width 0.3s;
}

.question-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}

.question-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  font-size: 0.8rem;
  color: var(--text-light);
}

.question-category {
  background: var(--primary-light);
  color: var(--primary);
  padding: 2px 10px;
  border-radius: 12px;
  font-weight: 600;
}

.question-text {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 16px;
  line-height: 1.5;
}

.question-image {
  margin-bottom: 16px;
  text-align: center;
}

.question-image img {
  max-height: 180px;
  border-radius: var(--radius);
}

.options-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.option-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 16px;
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.95rem;
  text-align: left;
  transition: border-color 0.2s, background 0.2s;
  cursor: pointer;
  color: var(--text);
}

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

.option-btn.selected {
  border-color: var(--primary);
  background: var(--primary-light);
  font-weight: 600;
}

.option-btn.correct {
  border-color: var(--success);
  background: #e8f5e9;
}

.option-btn.incorrect {
  border-color: var(--secondary);
  background: #fdecea;
}

.option-btn.disabled {
  cursor: default;
}

.option-letter {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.option-btn.selected .option-letter {
  background: var(--primary);
  color: #fff;
}

.option-btn.correct .option-letter {
  background: var(--success);
  color: #fff;
}

.option-btn.incorrect .option-letter {
  background: var(--secondary);
  color: #fff;
}

.explanation {
  background: #e8f5e9;
  border-left: 4px solid var(--success);
  padding: 12px 16px;
  border-radius: 0 var(--radius) var(--radius) 0;
  margin-top: 12px;
  font-size: 0.9rem;
  color: #1b5e20;
}

.explanation.incorrect-explanation {
  background: #fdecea;
  border-left-color: var(--secondary);
  color: #b71c1c;
}

.exam-nav {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
}

.btn {
  padding: 10px 20px;
  border-radius: var(--radius);
  border: none;
  font-size: 0.95rem;
  font-weight: 600;
  transition: background 0.2s, transform 0.1s;
}

.btn:active { transform: scale(0.98); }

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

.btn-primary:hover { background: #004494; }

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

.btn-secondary:hover { background: #d0d0d0; }

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

.btn-danger:hover { background: #b71c1c; }

.btn-hard {
  background: none;
  border: 2px solid var(--warning);
  color: var(--warning);
  padding: 8px 14px;
  font-size: 0.85rem;
}

.btn-hard.active {
  background: var(--warning);
  color: #fff;
}

/* === Results === */
.results-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 32px 24px;
  box-shadow: var(--shadow);
  text-align: center;
  margin-bottom: 24px;
}

.results-score {
  font-size: 3rem;
  font-weight: 700;
  margin: 12px 0;
}

.results-score.pass { color: var(--success); }
.results-score.fail { color: var(--secondary); }

.results-badge {
  display: inline-block;
  padding: 6px 20px;
  border-radius: 20px;
  font-weight: 700;
  font-size: 1.1rem;
  margin-bottom: 16px;
}

.results-badge.pass {
  background: #e8f5e9;
  color: var(--success);
}

.results-badge.fail {
  background: #fdecea;
  color: var(--secondary);
}

.results-details {
  display: flex;
  justify-content: center;
  gap: 24px;
  margin-top: 16px;
  font-size: 0.9rem;
  color: var(--text-light);
}

.results-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

/* === Question Bank === */
.category-pills {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 8px;
  margin-bottom: 20px;
  -webkit-overflow-scrolling: touch;
}

.category-pill {
  padding: 6px 14px;
  border-radius: 20px;
  border: 2px solid var(--border);
  background: var(--surface);
  font-size: 0.85rem;
  white-space: nowrap;
  transition: all 0.2s;
  color: var(--text);
}

.category-pill:hover {
  border-color: var(--primary);
}

.category-pill.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.bank-progress {
  font-size: 0.85rem;
  color: var(--text-light);
  margin-bottom: 16px;
}

/* === Hard Questions === */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-light);
}

.empty-state-icon {
  font-size: 3rem;
  margin-bottom: 12px;
}

.empty-state h2 {
  margin-bottom: 8px;
  color: var(--text);
}

/* === Resources === */
.resource-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.resource-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow);
  display: block;
  transition: transform 0.2s, box-shadow 0.2s;
}

.resource-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.resource-card h3 {
  margin-bottom: 4px;
  color: var(--primary);
}

.resource-card p {
  font-size: 0.9rem;
  color: var(--text-light);
}

.resource-steps {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow);
  margin-top: 24px;
}

.resource-steps h2 {
  margin-bottom: 16px;
}

.resource-steps ol {
  padding-left: 20px;
}

.resource-steps li {
  margin-bottom: 12px;
  line-height: 1.5;
}

/* === Exam Start === */
.exam-start {
  text-align: center;
  padding: 24px;
}

.exam-start h2 {
  margin-bottom: 12px;
}

.exam-info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 20px 0;
  text-align: left;
}

.exam-info-item {
  background: var(--bg);
  padding: 12px;
  border-radius: var(--radius);
}

.exam-info-item strong {
  display: block;
  font-size: 0.8rem;
  color: var(--text-light);
  margin-bottom: 2px;
}

/* === Section Title === */
.section-title {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 16px;
}

/* === Mobile Responsive === */
@media (max-width: 768px) {
  .nav {
    display: none;
    position: absolute;
    top: var(--header-height);
    left: 0;
    right: 0;
    background: var(--primary);
    flex-direction: column;
    padding: 8px;
    box-shadow: var(--shadow-lg);
  }

  .nav.open {
    display: flex;
  }

  .nav a {
    padding: 12px 16px;
  }

  .menu-toggle {
    display: block;
  }

  .hero-overlay h1 {
    font-size: 1.3rem;
  }

  .hero-img {
    height: 200px;
  }

  .exam-info-grid {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 600px) {
  .cta-cards {
    grid-template-columns: repeat(3, 1fr);
  }

  .cta-card {
    flex-direction: column;
    text-align: center;
  }
}

/* === Utility === */
.hidden { display: none !important; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.text-center { text-align: center; }
