/* ============================================================
   quiz-common.css
   Shared styling for:
   - PPL practice exam pages
   - Index (main menu) page
   ------------------------------------------------------------
   Structure:
   1) Global base styles
   2) Index page layout (logo + menu card)
   3) Exam layout (header, container)
   4) Questions & answers
   5) Pagination / navigation
   6) Generic footer note
   --------------------------------------------------------- */

/* ============================================================
   1) GLOBAL BASE STYLES
   ============================================================ */

body {
  margin: 0;
  padding: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f5f5f5;
  color: #222;
}

/* ============================================================
   2) INDEX PAGE LAYOUT (body class="index-page")
   ============================================================ */

/* Only applied on the index page */
body.index-page {
  background: radial-gradient(circle at top, #e6f0ff 0, #f5f5f5 45%, #f5f5f5 100%);
}

/* Wrapper on the index page that centers logo + card */
body.index-page .wrapper {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

/* Logo block above the card */
body.index-page .logo-wrapper {
  text-align: center;
  margin-bottom: 50px;          /* Adjust vertical gap between logo and card */
}

body.index-page .logo-img {
  max-width: 260px;             /* Adjust logo size here */
  height: auto;
}

/* White card that contains the exam list */
body.index-page .card {
  background: #ffffff;
  padding: 24px 28px 28px;
  border-radius: 12px;
  box-shadow: 0 12px 35px rgba(0,0,0,0.12);
  max-width: 420px;
  width: 90%;
}

body.index-page .card h1 {
  margin: 0 0 20px;
  font-size: 24px;
  text-align: center;
}

/* Vertical list of exam buttons */
body.index-page .tests {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Individual exam button on index page */
body.index-page .test-btn {
  display: block;
  text-decoration: none;
  border-radius: 8px;
  border: 1px solid #d0d7e2;
  padding: 14px 16px;
  background: #f8faff;
  text-align: center;
  font-size: 15px;
  font-weight: 600;
  color: #003366;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.08s;
}

body.index-page .test-btn:hover {
  background: #edf3ff;
  border-color: #003366;
  transform: translateY(-1px);
}

/* Mode toggle – "iPhone-style" segmented control */
body.index-page .mode-toggle {
  margin-bottom: 18px;
  margin-top: 20px;
}

body.index-page .mode-toggle-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 600;
  color: #7a8699;
  margin-bottom: 6px;
}

body.index-page .mode-toggle-options {
  display: flex;
  align-items: center;
  background: #f1f3fb;
  border-radius: 999px;
  padding: 3px;
  gap: 4px;
}

body.index-page .mode-option {
  position: relative;
  flex: 1;
}

body.index-page .mode-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

body.index-page .mode-option span {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  color: #4b5563;
  transition: background 0.16s ease, color 0.16s ease, box-shadow 0.16s ease,
    transform 0.08s ease;
}

body.index-page .mode-option--active span {
  background: #003366;
  color: #ffffff;
  box-shadow: 0 2px 7px rgba(0, 0, 0, 0.25);
  transform: translateY(-1px);
}

/* Small note at the bottom of the index card */
body.index-page .index-footer-note {
  margin-top: 18px;
  font-size: 11px;
  color: #777;
  text-align: center;
}

/* ============================================================
   3) EXAM LAYOUT (HEADER BAR + CONTAINER)
   ============================================================ */

/* Dark blue bar at the top of exam pages */
.header {
  background: #003366;
  color: #ffffff;
  padding: 16px 24px;
}

.header h1 {
  margin: 0;
  font-size: 20px;
}

/* Main white card that wraps exam content */
.container {
  max-width: 900px;
  margin: 16px auto 40px;
  background: #ffffff;
  padding: 20px 24px 32px;
  border-radius: 8px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

/* Sticky exam header that shows timer + score (and optionally buttons) */
.exam-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 8px 0px 20px 0px;
  margin-bottom: 20px;
  font-size: 16px;               /* Base font size for header line */
  color: #333333;
  background: #ffffff;
  border-bottom: 1px solid #dde1e7;
}

/* Timer text (e.g. "Time: 00:00") */
#exam-timer {
  font-variant-numeric: tabular-nums;
  font-size: 16px;               /* Adjust timer size */
  font-weight: 600;
  color: #2b7bc8;
}

/* Score text (e.g. "Correct answers 1 of 2 – 50%") */
#exam-score {
  font-size: 16px;               /* Adjust score size */
  font-weight: 600;
}

/* Optional container for header buttons (Reset, Back to menu, etc.) */
.exam-actions {
  margin-left: auto;
  display: flex;
  gap: 8px;
}

/* Generic header buttons in exam header */
.exam-btn {
  font-size: 14px;               /* Adjust header button text size */
  padding: 7px 14px;             /* Adjust header button height/width */
  border-radius: 999px;
  border: 1px solid #c4ccda;
  background: #f5f7fb;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.08s;
}

.exam-btn:hover {
  background: #e4ebfa;
  border-color: #9fb1d9;
  transform: translateY(-0.5px);
}

/* You can target specific header buttons if you like */
.exam-btn-reset { /* Reset button */ }
.exam-btn-back  {
  /* Back to menu button uses a stronger color */
  background: #003366;
  color: #ffffff;
  border-color: #003366;
}

/* ============================================================
   4) QUESTIONS & ANSWERS
   ============================================================ */

/* Each "page" holds up to 10 questions and only one page is visible at a time */
.page {
  display: none;
}

.page.active {
  display: block;
}

/* Single question block */
.question {
  padding: 12px 10px;
  border-bottom: 1px solid #e3e6ec;
}

.question:last-child {
  border-bottom: none;
}

/* Question title line, e.g. "Q1. ..." */
.question-title {
  font-weight: 600;
  margin-bottom: 10px;
  text-indent: -40px;     /* moves first line left */
  padding-left: 45px;     /* pushes all lines right */
  display: block;
}

/* Optional additional text between question title and answers */
.question-text {
  font-size: 14px;
  margin-bottom: 6px;
}

/* Optional image for "See figure / See annex" questions */
.figure-image {
  margin: 8px 0 4px;
  text-align: center;
}

.figure-image img {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
  border: 1px solid #cccccc;
}

/* Container for all answer options */
.answers {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 6px;
}

/* Single answer option */
.answer-option {
  border: 1px solid #d4d9e3;
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 14px;
  background: #fafbff;
  cursor: pointer;
  display: flex;
  align-items: flex-start;
  gap: 6px;
  transition: background 0.12s, border-color 0.12s;
  user-select: none;
}

/* Letter label "A.", "B.", etc. */
.answer-label {
  font-weight: 600;
  min-width: 18px;
}

/* Hover state before answered */
.answer-option:hover {
  background: #f2f4ff;
}

/* Correct answer highlight */
.answer-option.correct {
  background: #e4f7e9;
  border-color: #3ca25b;
}

/* Incorrect answer highlight */
.answer-option.incorrect {
  background: #ffecec;
  border-color: #e57373;
}

/* After answering, everything becomes less clickable */
.answer-option.disabled {
  cursor: default;
  opacity: 0.85;
}

/* Feedback line under each question (e.g. Correct / Incorrect) */
.feedback {
  margin-top: 4px;
  font-size: 13px;
}

.feedback.correct {
  color: #2e8b57;
}

.feedback.incorrect {
  color: #cc0000;
}

/* ============================================================
   5) PAGINATION / NAVIGATION (BOTTOM OF EXAM PAGES)
   ============================================================ */

/* Wrapper around Previous/Next + numeric page buttons */
.page-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 24px;
  padding-top: 12px;
  border-top: 1px solid #dde1e7;
  gap: 12px;
}

/* In single-question mode we already have the question's bottom border,
   so we remove the extra separator line from the navigation bar. */
body.single-question-mode .page-nav {
  border-top: none;
  padding-top: 0;
}

/* Previous / Next buttons container */
.nav-main {
  display: flex;
  gap: 8px;
}

/* Previous / Next buttons themselves */
.nav-main button {
  min-width: 80px;              /* Adjust width of Prev/Next buttons */
  padding: 8px 14px;            /* Adjust size of Prev/Next buttons */
  border-radius: 4px;
  border: 1px solid #cccccc;
  background: #eeeeee;
  cursor: pointer;
  font-size: 14px;              /* Adjust Prev/Next text size */
  transition: background 0.12s, border-color 0.12s;
}

.nav-main button:hover:not(:disabled) {
  background: #e0e6f5;
  border-color: #b4bed6;
}

.nav-main button:disabled {
  opacity: 0.5;
  cursor: default;
}

/* Numeric page buttons "1 2 3 ..." */
.page-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-left: auto;
}

.page-buttons button {
  min-width: 32px;             /* Adjust width of page number buttons */
  padding: 6px 10px;           /* Adjust size of numeric buttons */
  border-radius: 4px;
  border: 1px solid #d4d9e3;
  background: #f5f7fb;
  cursor: pointer;
  font-size: 13px;             /* Adjust numeric button text size */
  transition: background 0.12s, border-color 0.12s;
}

.page-buttons button:hover {
  background: #e4ebfa;
  border-color: #9fb1d9;
}

/* Active/current page number */
.page-buttons button.active {
  background: #003366;
  color: #ffffff;
  border-color: #003366;
}

/* ============================================================
   6) GENERIC FOOTER NOTE (IF USED)
   ============================================================ */

.footer-note {
  font-size: 11px;
  color: #666666;
  margin-top: 12px;
}
