/* QuizPrep — Bootstrap 5.3 theme in HAU colours: maroon #681920, gold #C8842A.
   Gold is used for accents only; text and buttons use maroon for WCAG AA contrast. */
:root {
  --qp-maroon: #681920;
  --qp-maroon-dark: #4f1218;
  --qp-maroon-soft: #f6eced;
  --qp-gold: #c8842a;
  --qp-gold-soft: #fbf3e7;
  --bs-primary: #681920;
  --bs-primary-rgb: 104, 25, 32;
  --bs-link-color: #681920;
  --bs-link-color-rgb: 104, 25, 32;
  --bs-link-hover-color: #4f1218;
  --bs-link-hover-color-rgb: 79, 18, 24;
  --bs-focus-ring-color: rgba(104, 25, 32, .3);
  --bs-body-font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --bs-body-bg: #f7f6f4;
}

.btn-primary {
  --bs-btn-bg: var(--qp-maroon);
  --bs-btn-border-color: var(--qp-maroon);
  --bs-btn-hover-bg: var(--qp-maroon-dark);
  --bs-btn-hover-border-color: var(--qp-maroon-dark);
  --bs-btn-active-bg: #3f0e13;
  --bs-btn-active-border-color: #3f0e13;
  --bs-btn-disabled-bg: var(--qp-maroon);
  --bs-btn-disabled-border-color: var(--qp-maroon);
  --bs-btn-focus-shadow-rgb: 104, 25, 32;
}
.btn-outline-primary {
  --bs-btn-color: var(--qp-maroon);
  --bs-btn-border-color: var(--qp-maroon);
  --bs-btn-hover-bg: var(--qp-maroon);
  --bs-btn-hover-border-color: var(--qp-maroon);
  --bs-btn-active-bg: var(--qp-maroon-dark);
  --bs-btn-active-border-color: var(--qp-maroon-dark);
  --bs-btn-focus-shadow-rgb: 104, 25, 32;
}
.form-control:focus, .form-select:focus, .form-check-input:focus {
  border-color: #a3585f;
  box-shadow: 0 0 0 .25rem rgba(104, 25, 32, .2);
}
.form-check-input:checked { background-color: var(--qp-maroon); border-color: var(--qp-maroon); }

/* Visible keyboard focus everywhere (NFR-10). */
a:focus-visible, button:focus-visible, .btn:focus-visible, .nav-link:focus-visible, .dropdown-item:focus-visible {
  outline: 3px solid var(--qp-gold);
  outline-offset: 2px;
}

.qp-skip {
  position: absolute; left: 1rem; top: .5rem; z-index: 2000;
  background: #fff; color: var(--qp-maroon); padding: .5rem .75rem; border-radius: .375rem;
}

/* Navbar */
.qp-navbar {
  background: var(--qp-maroon);
  border-bottom: 3px solid var(--qp-gold);
}
.qp-navbar .nav-link { color: rgba(255, 255, 255, .85); }
.qp-navbar .nav-link:hover, .qp-navbar .nav-link.active { color: #fff; }
.qp-navbar .nav-link.active { box-shadow: inset 0 -2px 0 var(--qp-gold); }
.qp-role-badge { background: var(--qp-gold); color: #2b1a05; font-weight: 600; }

.qp-logo {
  display: inline-flex; align-items: center; justify-content: center;
  width: 2rem; height: 2rem; border-radius: .5rem;
  background: var(--qp-gold); color: #fff; font-weight: 800; font-size: 1.1rem; line-height: 1;
}
.qp-logo-lg { width: 3rem; height: 3rem; font-size: 1.6rem; border-radius: .75rem; background: var(--qp-maroon); box-shadow: inset 0 -4px 0 var(--qp-gold); }

/* Auth pages */
body.qp-auth { min-height: 100vh; display: flex; flex-direction: column; background:
  radial-gradient(circle at 15% 0%, var(--qp-gold-soft), transparent 45%),
  radial-gradient(circle at 100% 100%, var(--qp-maroon-soft), transparent 50%), #f7f6f4; }
.qp-auth-main { flex: 1; display: flex; align-items: center; justify-content: center; padding: 2rem 1rem; }
.qp-auth-card { width: 100%; max-width: 440px; border: 0; border-top: 4px solid var(--qp-maroon); }

/* Content */
.card { border-color: rgba(0, 0, 0, .08); }
.qp-stat .qp-stat-label { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: #6c6660; font-weight: 600; }
.qp-stat .qp-stat-value { font-size: 1.9rem; font-weight: 700; color: var(--qp-maroon); line-height: 1.2; }
.qp-stat .qp-stat-icon { color: var(--qp-gold); font-size: 1.25rem; }
.qp-count-badge { background: var(--qp-maroon-soft); color: var(--qp-maroon); font-weight: 600; }
.qp-class-card { border-left: 4px solid var(--qp-gold); }
.qp-prose h2 { margin-top: 1.25rem; color: var(--qp-maroon); }
.qp-prose h2:first-child { margin-top: 0; }
.qp-measure { max-width: 36rem; }

.qp-error-code { font-size: 4.5rem; font-weight: 800; color: var(--qp-maroon); line-height: 1; opacity: .9; }

.qp-footer { color: #6c6660; padding: 1.25rem 0; border-top: 1px solid rgba(0, 0, 0, .06); margin-top: 2rem; }
body.qp-auth .qp-footer { border-top: 0; margin-top: 0; }
.qp-footer a { color: inherit; }

/* Small screens (360 px and up, TAKE-02 / NFR-09) */
@media (max-width: 400px) {
  .qp-auth-card .card-body { padding: 1.25rem !important; }
  .qp-stat .qp-stat-value { font-size: 1.5rem; }
}

/* ---- Phase 2: badges, filters, tables ---- */
.qp-badge-pending { background: var(--qp-gold-soft); color: #7a4a0c; border: 1px solid #ecd3ae; }
.qp-badge-info { background: var(--qp-maroon-soft); color: var(--qp-maroon); border: 1px solid #e3c5c8; }
.nav-pills .qp-pill { color: #4a4540; border: 1px solid rgba(0, 0, 0, .1); background: #fff; padding: .35rem .8rem; }
.nav-pills .qp-pill.active { background: var(--qp-maroon); border-color: var(--qp-maroon); color: #fff; }
.nav-pills .qp-pill.active .qp-count-badge { background: rgba(255, 255, 255, .2); color: #fff; }
.qp-filter { width: 15rem; max-width: 100%; }
.qp-check-col { width: 2.5rem; }
a.qp-stat { color: inherit; transition: box-shadow .15s ease; }
a.qp-stat:hover { box-shadow: 0 .25rem .75rem rgba(0, 0, 0, .08); }
.qp-stat-danger { border-color: #f1aeb5; }
.qp-stat-danger .qp-stat-value { color: #b02a37; }
.qp-help-card { background: var(--qp-gold-soft); border-color: #ecd3ae; }
.qp-error-text { max-width: 22rem; }
.min-w-0 { min-width: 0; }
.breadcrumb a { text-decoration: none; }
@media (max-width: 767.98px) {
  #rosterTable td, #rosterTable th { padding-left: .35rem; padding-right: .35rem; }
  #rosterTable .qp-check-col { width: 1.75rem; }
  .qp-actions-btn { padding: .25rem .45rem; }
  #rosterTable .badge { white-space: normal; text-align: left; }
}

/* ---- Phase 3: questions and quizzes ---- */
.qp-q-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.qp-qnum { font-weight: 700; color: var(--qp-maroon); }
.qp-q-options li { display: flex; align-items: baseline; gap: .5rem; padding: .2rem .4rem; border-radius: .375rem; }
.qp-q-options li.qp-correct { background: #e8f5ec; color: #0f5132; font-weight: 600; }
.qp-letter { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 1.4rem; height: 1.4rem;
  border-radius: 50%; background: #efedea; color: #4a4540; font-size: .75rem; font-weight: 700; }
.qp-correct .qp-letter { background: #198754; color: #fff; }
.qp-correct-text { color: #0f5132; }
.qp-accepted { background: #e8f5ec; color: #0f5132; border: 1px solid #b7dfc4; font-weight: 600; }
.qp-clamp { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.qp-letter-cell { background: #fff; }
.qp-preview-banner { background: var(--qp-gold-soft); border: 1px solid #ecd3ae; color: #5c3a0a; }
.qp-checklist li { color: #6c6660; margin-bottom: .25rem; }
.qp-checklist li.ok i { color: #198754; }
.qp-take-q legend { float: none; }
.qp-choice { padding: .55rem .75rem .55rem 2.25rem; border: 1px solid rgba(0, 0, 0, .1); border-radius: .5rem; margin-bottom: .5rem; background: #fff; }
.qp-choice:has(input:checked) { border-color: var(--qp-maroon); background: var(--qp-maroon-soft); }
.qp-choice .form-check-label { width: 100%; cursor: pointer; }
.nav-tabs .nav-link { color: #4a4540; }
.nav-tabs .nav-link.active { color: var(--qp-maroon); font-weight: 600; border-top: 3px solid var(--qp-gold); }

/* ---- Phase 4: taking and reviewing quizzes ---- */
.qp-quiz-card { color: inherit; border-top: 3px solid var(--qp-gold); transition: box-shadow .15s ease, transform .15s ease; }
.qp-quiz-card:hover { box-shadow: 0 .4rem 1rem rgba(0, 0, 0, .08); transform: translateY(-1px); }
.qp-quiz-card-active { border-top-color: var(--qp-maroon); }
.qp-card-cta { background: var(--qp-maroon-soft); color: var(--qp-maroon); font-weight: 600; font-size: .9rem; }
.qp-score-chip { font-weight: 700; font-size: .85rem; padding: .15rem .55rem; border-radius: 999px; background: #efedea; color: #4a4540; }
.qp-score-chip.is-pass { background: #e8f5ec; color: #0f5132; }
.qp-score-chip.is-fail { background: #fbecec; color: #842029; }
.qp-attempt-counter { font-size: 1.15rem; font-weight: 700; color: var(--qp-maroon); }
.qp-bar { display: block; width: 100%; height: 8px; }
.qp-bar-track { fill: #e9e6e2; }
.qp-bar-pass { fill: #198754; }
.qp-bar-fail { fill: var(--qp-gold); }
.qp-bar-mark { fill: #4a4540; opacity: .6; }
.qp-bar-cell { min-width: 8rem; }

.qp-take-bar { position: sticky; top: 0; z-index: 1010; border-top: 3px solid var(--qp-maroon); }
.qp-nav-btn { display: inline-flex; align-items: center; justify-content: center; min-width: 2.1rem; height: 2.1rem; padding: 0 .4rem;
  border: 1px solid rgba(0, 0, 0, .15); border-radius: .4rem; background: #fff; color: #4a4540; text-decoration: none; font-size: .85rem; font-weight: 600; }
.qp-nav-btn.is-answered { background: var(--qp-maroon-soft); border-color: #d9b7ba; color: var(--qp-maroon); }
.qp-nav-btn.is-current { outline: 2px solid var(--qp-gold); outline-offset: 1px; }
.qp-timer { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 1.05rem; padding: .2rem .6rem; border-radius: .4rem; background: #efedea; }
.qp-timer.is-low { background: var(--qp-gold-soft); color: #7a4a0c; }
.qp-timer.is-critical { background: #fbecec; color: #842029; }
.qp-take-q { scroll-margin-top: 9rem; }
.qp-take-q legend:focus { outline: none; }

.qp-result { border-left: 6px solid #198754; }
.qp-result.is-fail { border-left-color: var(--qp-gold); }
.qp-result-pct { font-size: 2.75rem; font-weight: 800; line-height: 1; color: #0f5132; }
.qp-result.is-fail .qp-result-pct { color: #7a4a0c; }
.qp-review-q { border-left: 4px solid #198754; }
.qp-review-q.is-wrong { border-left-color: #dc3545; }
.qp-review-options li { display: flex; flex-wrap: wrap; align-items: center; padding: .4rem .6rem; border-radius: .4rem; margin-bottom: .3rem; background: #faf9f7; }
.qp-review-options li.is-chosen { background: var(--qp-maroon-soft); }
.qp-review-options li.is-key { background: #e8f5ec; }

/* ---- Phase 5: reports and gradebook ---- */
.qp-sort { border: 0; background: none; padding: 0; font: inherit; font-weight: 600; color: inherit; text-align: inherit; white-space: nowrap; }
.qp-gb-quiz .qp-sort { white-space: normal; }
.qp-sort::after { content: " \2195"; opacity: .35; font-size: .8em; }
th[aria-sort="ascending"] .qp-sort::after { content: " \2191"; opacity: .9; }
th[aria-sort="descending"] .qp-sort::after { content: " \2193"; opacity: .9; }
.qp-gradebook { max-height: 75vh; }
.qp-gradebook thead th { position: sticky; top: 0; --bs-table-bg: #fff; z-index: 2; }
.qp-sticky-col { position: sticky; left: 0; --bs-table-bg: #fff; z-index: 1; min-width: 12rem; }
.qp-gradebook thead .qp-sticky-col { z-index: 3; }
.qp-gb-quiz { min-width: 7rem; max-width: 11rem; white-space: normal; }
.qp-gb-pass { --bs-table-bg: #e8f5ec; }
.qp-gb-fail { --bs-table-bg: var(--qp-gold-soft); }
.qp-legend { display: inline-block; padding: 0 .4rem; border-radius: .25rem; }
.qp-legend.is-pass { background: #e8f5ec; }
.qp-legend.is-fail { background: var(--qp-gold-soft); }
.qp-email-preview { width: 100%; min-height: 22rem; border: 0; background: #fff; border-radius: 0 0 .375rem .375rem; }
.qp-audit-details { max-width: 26rem; font-family: var(--bs-font-monospace); font-size: .75rem; }
.qp-navbar .nav-link { white-space: nowrap; }
