/* ===================================================================
   Oge Exam Prep — Stylesheet
   =================================================================== */

:root {
  --navy: #1a2332;
  --navy-light: #243447;
  --blue: #3b82f6;
  --blue-light: #60a5fa;
  --green: #22c55e;
  --green-bg: #f0fdf4;
  --red: #ef4444;
  --red-bg: #fef2f2;
  --orange: #f59e0b;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.1), 0 2px 4px rgba(0,0,0,0.06);
}

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

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

/* --- Header --- */
header {
  background: var(--navy);
  color: white;
  padding: 1rem 1.5rem;
  box-shadow: var(--shadow-md);
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-inner {
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  align-items: baseline;
  gap: 1rem;
}
.logo {
  font-size: 1.25rem;
  font-weight: 700;
  color: white;
  text-decoration: none;
}
.subtitle {
  font-size: 0.85rem;
  color: var(--gray-400);
}

/* --- Main --- */
main {
  flex: 1;
  max-width: 900px;
  width: 100%;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

/* --- Footer --- */
footer {
  text-align: center;
  padding: 1.5rem;
  color: var(--gray-400);
  font-size: 0.8rem;
}

/* --- Loading --- */
.loading {
  text-align: center;
  padding: 4rem 0;
  color: var(--gray-400);
  font-size: 1.1rem;
}

/* ===================================================================
   Home — Pack Grid
   =================================================================== */
.page-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}
.page-subtitle {
  color: var(--gray-500);
  margin-bottom: 2rem;
}
.pack-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
}
.pack-card {
  background: white;
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  border: 1px solid var(--gray-200);
  transition: box-shadow 0.2s, transform 0.2s;
}
.pack-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.pack-card h3 {
  font-size: 1.1rem;
  margin-bottom: 0.25rem;
}
.pack-card .pack-meta {
  font-size: 0.85rem;
  color: var(--gray-500);
  margin-bottom: 1rem;
}
.pack-card .pack-type {
  display: inline-block;
  font-size: 0.7rem;
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.5px;
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--gray-100);
  color: var(--gray-600);
  margin-left: 0.5rem;
}
.pack-actions {
  display: flex;
  gap: 0.75rem;
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1.25rem;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: background 0.2s, transform 0.1s;
  text-decoration: none;
}
.btn:active { transform: scale(0.97); }
.btn-primary {
  background: var(--blue);
  color: white;
}
.btn-primary:hover { background: var(--blue-light); }
.btn-secondary {
  background: var(--navy);
  color: white;
}
.btn-secondary:hover { background: var(--navy-light); }
.btn-outline {
  background: transparent;
  border: 2px solid var(--gray-300);
  color: var(--gray-600);
}
.btn-outline:hover { border-color: var(--gray-400); }
.btn-lg {
  padding: 0.75rem 2rem;
  font-size: 1rem;
}
.btn-block {
  width: 100%;
}
.btn-success {
  background: var(--green);
  color: white;
}

/* ===================================================================
   Study Mode
   =================================================================== */
.study-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.study-header h2 { font-size: 1.2rem; }
.study-progress {
  font-size: 0.85rem;
  color: var(--gray-500);
}

.question-card {
  background: white;
  border-radius: var(--radius);
  padding: 2rem;
  box-shadow: var(--shadow);
  border: 1px solid var(--gray-200);
  margin-bottom: 1.5rem;
}
.question-number {
  font-size: 0.8rem;
  color: var(--gray-400);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0.5rem;
}
.question-subject {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--blue);
  background: #eff6ff;
  padding: 2px 8px;
  border-radius: 4px;
  margin-left: 0.75rem;
}
.question-stem {
  font-size: 1.05rem;
  line-height: 1.7;
  margin-bottom: 1.5rem;
}

/* --- Options --- */
.options-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}
.option-btn {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  border-radius: 10px;
  border: 2px solid var(--gray-200);
  background: white;
  cursor: pointer;
  text-align: left;
  font-size: 0.95rem;
  line-height: 1.5;
  transition: border-color 0.2s, background 0.2s;
  width: 100%;
}
.option-btn:hover:not(.disabled) {
  border-color: var(--blue);
  background: #f8faff;
}
.option-letter {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--gray-600);
}
.option-btn.selected {
  border-color: var(--blue);
  background: #eff6ff;
}
.option-btn.selected .option-letter {
  background: var(--blue);
  color: white;
}
.option-btn.correct {
  border-color: var(--green);
  background: var(--green-bg);
}
.option-btn.correct .option-letter {
  background: var(--green);
  color: white;
}
.option-btn.wrong {
  border-color: var(--red);
  background: var(--red-bg);
}
.option-btn.wrong .option-letter {
  background: var(--red);
  color: white;
}
.option-btn.disabled {
  cursor: default;
  opacity: 0.7;
}

/* --- Explanation --- */
.explanation {
  background: var(--green-bg);
  border: 1px solid #bbf7d0;
  border-radius: 10px;
  padding: 1.25rem;
  margin-top: 1rem;
}
.explanation.wrong-explanation {
  background: var(--red-bg);
  border-color: #fecaca;
}
.explanation-label {
  font-weight: 700;
  font-size: 0.85rem;
  margin-bottom: 0.5rem;
  color: var(--green);
}
.wrong-explanation .explanation-label {
  color: var(--red);
}
.explanation p {
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--gray-700);
}

/* --- Navigation --- */
.question-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

/* ===================================================================
   Exam Mode
   =================================================================== */
.exam-setup {
  background: white;
  border-radius: var(--radius);
  padding: 2rem;
  box-shadow: var(--shadow);
  border: 1px solid var(--gray-200);
  max-width: 500px;
  margin: 0 auto;
}
.exam-setup h2 { margin-bottom: 1rem; }
.exam-setup p { color: var(--gray-600); margin-bottom: 1.5rem; }
.exam-info {
  background: var(--gray-50);
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
}
.exam-info li {
  list-style: none;
  padding: 0.25rem 0;
  color: var(--gray-600);
}
.exam-info li strong {
  color: var(--gray-800);
}

/* Exam setup form fields */
.exam-limit-wrap {
  margin-bottom: 1rem;
}
.exam-limit-label {
  font-size: 0.9rem;
  color: var(--gray-600);
}
.exam-limit-input {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid var(--gray-300);
  border-radius: 8px;
  margin-top: 0.25rem;
  font-size: 1rem;
}
.exam-cancel-wrap {
  text-align: center;
  margin-top: 1rem;
}

/* Exam top bar */
.exam-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: white;
  border-radius: var(--radius);
  padding: 0.75rem 1.25rem;
  box-shadow: var(--shadow);
  border: 1px solid var(--gray-200);
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.exam-timer {
  font-size: 1.1rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--navy);
}
.exam-timer.warning { color: var(--orange); }
.exam-timer.danger { color: var(--red); }
.exam-count-label {
  font-size: 0.85rem;
  color: var(--gray-500);
}

/* Question dots */
.question-dots {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.q-dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--gray-300);
  background: white;
  font-size: 0;
  cursor: pointer;
  transition: all 0.2s;
}
.q-dot.answered {
  background: var(--blue);
  border-color: var(--blue);
}
.q-dot.current {
  border-color: var(--navy);
  box-shadow: 0 0 0 2px var(--navy);
}

.exam-submit-area {
  text-align: center;
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--gray-200);
}
.unanswered-warning {
  color: var(--orange);
  font-size: 0.85rem;
  margin-bottom: 0.75rem;
}

/* ===================================================================
   Results
   =================================================================== */
.results-banner {
  text-align: center;
  background: white;
  border-radius: var(--radius);
  padding: 2.5rem 2rem;
  box-shadow: var(--shadow);
  border: 1px solid var(--gray-200);
  margin-bottom: 2rem;
}
.results-score {
  font-size: 3rem;
  font-weight: 800;
  color: var(--navy);
  line-height: 1.2;
}
.results-percentage {
  font-size: 1.5rem;
  font-weight: 700;
  margin-top: 0.5rem;
}
.results-percentage.pass { color: var(--green); }
.results-percentage.fail { color: var(--red); }
.results-label {
  font-size: 0.9rem;
  color: var(--gray-500);
  margin-top: 0.5rem;
}

.results-breakdown {
  margin-top: 2rem;
}
.results-breakdown h3 {
  font-size: 1.1rem;
  margin-bottom: 1rem;
}
.result-item {
  background: white;
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  box-shadow: var(--shadow);
  border: 1px solid var(--gray-200);
  margin-bottom: 1rem;
}
.result-item.correct { border-left: 4px solid var(--green); }
.result-item.wrong { border-left: 4px solid var(--red); }
.result-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 0.5rem;
}
.result-stem {
  font-size: 0.95rem;
  line-height: 1.5;
  flex: 1;
}
.result-badge {
  flex-shrink: 0;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
  text-transform: uppercase;
}
.result-badge.correct {
  background: var(--green-bg);
  color: var(--green);
}
.result-badge.wrong {
  background: var(--red-bg);
  color: var(--red);
}
.result-answer {
  font-size: 0.85rem;
  color: var(--gray-600);
  margin-bottom: 0.5rem;
}
.result-explanation {
  font-size: 0.85rem;
  color: var(--gray-600);
  line-height: 1.5;
  padding-top: 0.5rem;
  border-top: 1px solid var(--gray-100);
}

.results-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin-top: 2rem;
  flex-wrap: wrap;
}

/* Subject breakdown */
.subject-breakdown {
  background: white;
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  border: 1px solid var(--gray-200);
  margin-bottom: 2rem;
}
.subject-breakdown h3 {
  font-size: 1.1rem;
  margin-bottom: 1rem;
}
.subject-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.subject-table th {
  text-align: left;
  padding: 0.5rem 0.75rem;
  border-bottom: 2px solid var(--gray-200);
  color: var(--gray-500);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.subject-table td {
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--gray-100);
}
.subject-table tr:last-child td {
  border-bottom: none;
}
.subject-pass {
  color: var(--green);
  font-weight: 700;
}
.subject-fail {
  color: var(--red);
  font-weight: 700;
}

/* ===================================================================
   Responsive
   =================================================================== */
@media (max-width: 600px) {
  main { padding: 1rem; }
  .question-card { padding: 1.25rem; }
  .option-btn { padding: 0.75rem 1rem; }
  .results-score { font-size: 2.5rem; }
  .pack-grid { grid-template-columns: 1fr; }
  .exam-bar { flex-direction: column; align-items: stretch; text-align: center; }
  .question-dots { justify-content: center; }
  .header-inner { flex-direction: column; gap: 0.25rem; }
}

/* ===================================================================
   Keyboard Focus Styles
   =================================================================== */

/* Visible focus ring for keyboard navigation */
.option-btn:focus-visible,
.q-dot:focus-visible,
.btn:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

/* Hide focus ring for mouse clicks (browsers that support :focus-visible) */
.option-btn:focus:not(:focus-visible),
.q-dot:focus:not(:focus-visible),
.btn:focus:not(:focus-visible) {
  outline: none;
}

/* Skip-to-content link (hidden until focused) */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Keyboard shortcut hint bar */
.keyboard-hint {
  text-align: center;
  padding: 0.5rem;
  color: var(--gray-400);
  font-size: 0.75rem;
  letter-spacing: 0.02em;
}
.keyboard-hint kbd {
  display: inline-block;
  padding: 0.1rem 0.4rem;
  font-size: 0.7rem;
  font-family: inherit;
  color: var(--gray-500);
  background: var(--gray-100);
  border: 1px solid var(--gray-300);
  border-radius: 4px;
  margin: 0 0.1rem;
}
