/* =========================================================
   Online Exam & Scholarship Portal - Theme
   Light, soft, multi-tone palette (not a single flat blue) --
   inspired by friendly edtech/fintech dashboards.
   ========================================================= */

:root {
  --brand-indigo: #4f5fed;
  --brand-indigo-dark: #3d4ad1;
  --brand-teal: #14b8a6;
  --brand-amber: #f59e0b;
  --brand-rose: #f43f5e;
  --brand-violet: #8b5cf6;
  --brand-cyan: #06b6d4;
  --brand-pink: #ec4899;

  --bg-page: #f8f9fd;
  --bg-soft-indigo: #eef0ff;
  --bg-soft-teal: #e6fbf8;
  --bg-soft-amber: #fff7e6;
  --bg-soft-rose: #ffeef0;
  --bg-soft-green: #eafbf0;
  --bg-soft-blue: #eaf4ff;
  --bg-soft-violet: #f3eeff;
  --bg-soft-cyan: #e6fbff;
  --bg-soft-pink: #fff0f7;

  --text-main: #1f2440;
  --text-muted: #767b95;
  --radius-lg: 16px;
  --radius-md: 12px;
  --shadow-soft: 0 6px 24px rgba(31, 36, 64, 0.06);
}

/* Scaling the root font-size down is the single most effective way to shrink
   every rem-based Bootstrap component at once (buttons, badges, form
   controls, spacing utilities...) without re-overriding each one. */
html { font-size: 14px; }

body {
  background: var(--bg-page);
  color: var(--text-main);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: .95rem;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Poppins', 'Inter', sans-serif;
  font-weight: 600;
  color: var(--text-main);
}
/* A compact, app-like heading scale instead of Bootstrap's blog-sized defaults */
h1 { font-size: 1.65rem; }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.12rem; }
h5 { font-size: 1rem; }
h6 { font-size: .92rem; }

small, .small { font-size: .85em; }

/* ---------- Navbars: gradient instead of flat bg-primary/bg-dark ---------- */
.navbar.bg-primary {
  background: linear-gradient(135deg, var(--brand-indigo) 0%, var(--brand-violet) 100%) !important;
  box-shadow: 0 4px 18px rgba(79, 95, 237, 0.25);
}
.navbar.bg-dark {
  background: linear-gradient(135deg, #20243d 0%, #383f6b 100%) !important;
  box-shadow: 0 4px 18px rgba(20, 23, 40, 0.25);
}
.navbar-brand { font-family: 'Poppins', sans-serif; font-weight: 700; letter-spacing: .2px; }

/* ---------- Cards ---------- */
.card {
  border-radius: var(--radius-lg);
  border: 1px solid rgba(31,36,64,0.06);
  box-shadow: var(--shadow-soft);
  transition: box-shadow .2s ease, transform .2s ease;
}
.card-header { border-radius: var(--radius-lg) var(--radius-lg) 0 0 !important; font-weight: 600; }

/* Cards that act like clickable summary tiles (dashboard/report stat cards)
   get a gentle lift on hover - purely cosmetic, never applied to form cards */
.stat-card:hover, .stat-tile:hover { box-shadow: 0 10px 28px rgba(31,36,64,0.10); transform: translateY(-2px); }

/* ---------- Buttons: soften the default Bootstrap solid blocks ---------- */
.btn { border-radius: 10px; font-weight: 500; transition: transform .12s ease, box-shadow .12s ease; }
.btn:active { transform: scale(.97); }
.btn-primary {
  background: linear-gradient(135deg, var(--brand-indigo) 0%, var(--brand-indigo-dark) 100%);
  border: none;
}
.btn-primary:hover { background: linear-gradient(135deg, var(--brand-indigo-dark) 0%, var(--brand-indigo) 100%); }
.btn-success { background: linear-gradient(135deg, #16c79a 0%, #0fae84 100%); border: none; }
.btn-danger  { background: linear-gradient(135deg, #f4596b 0%, #e0334a 100%); border: none; }
.btn-dark    { background: linear-gradient(135deg, #2c2f48 0%, #1c1e30 100%); border: none; }

/* "Soft" button variants used across the new admin/result UI - light tinted
   background instead of one saturated color everywhere */
.btn-soft-primary   { background: var(--bg-soft-indigo); color: var(--brand-indigo-dark); border: 1px solid #d8dcff; }
.btn-soft-secondary { background: #eef0f4; color: #555a72; border: 1px solid #e1e3ea; }
.btn-soft-success   { background: var(--bg-soft-green); color: #128a57; border: 1px solid #c9f1da; }
.btn-soft-info      { background: var(--bg-soft-blue); color: #1c6fbf; border: 1px solid #cfe6fb; }
.btn-soft-warning   { background: var(--bg-soft-amber); color: #a86a00; border: 1px solid #ffe6ab; }
.btn-soft-violet     { background: var(--bg-soft-violet); color: #6d3fc9; border: 1px solid #ddd0fb; }
.btn-soft-danger     { background: var(--bg-soft-rose); color: #c2273b; border: 1px solid #ffd7dc; }
.btn-soft-primary:hover, .btn-soft-secondary:hover, .btn-soft-success:hover,
.btn-soft-info:hover, .btn-soft-warning:hover, .btn-soft-violet:hover, .btn-soft-danger:hover { filter: brightness(0.97); }

/* ---------- Soft alerts (replace harsh solid alert-danger/success blocks) ---------- */
.alert { border-radius: var(--radius-md); border: none; }
.alert-soft-success { background: var(--bg-soft-green); color: #0f7a52; }
.alert-soft-danger  { background: var(--bg-soft-rose);  color: #c2273b; }
.alert-soft-warning { background: var(--bg-soft-amber); color: #92660a; }
.alert-soft-info    { background: var(--bg-soft-blue);  color: #1a5fa3; }

/* ---------- Dashboard / report stat tiles ---------- */
.stat-card { border-left: 4px solid var(--brand-indigo); }
.stat-tile {
  background: #fff; border-radius: var(--radius-md); padding: 16px 14px; text-align: center;
  box-shadow: var(--shadow-soft); border: 1px solid rgba(31,36,64,0.05);
}
.stat-tile .stat-label { font-size: .78rem; color: var(--text-muted); margin-bottom: 4px; }
.stat-tile .stat-value { font-size: 1.5rem; font-weight: 700; color: var(--text-main); }
.stat-tile-danger .stat-value { color: var(--brand-rose); }

/* Rotating light pastel tints so a row of tiles feels lively instead of a
   wall of identical white boxes - cycles through 6 soft colors. Targets the
   column wrapper (the actual sibling under .row) since each .stat-tile's
   immediate parent is unique to it. */
.row.g-3 > div:nth-of-type(6n+1) .stat-tile { background: var(--bg-soft-indigo); }
.row.g-3 > div:nth-of-type(6n+2) .stat-tile { background: var(--bg-soft-teal); }
.row.g-3 > div:nth-of-type(6n+3) .stat-tile { background: var(--bg-soft-amber); }
.row.g-3 > div:nth-of-type(6n+4) .stat-tile { background: var(--bg-soft-rose); }
.row.g-3 > div:nth-of-type(6n+5) .stat-tile { background: var(--bg-soft-violet); }
.row.g-3 > div:nth-of-type(6n+6) .stat-tile { background: var(--bg-soft-cyan); }
.row.g-3 .stat-tile-danger { background: var(--bg-soft-rose) !important; }

/* Result page score tiles */
.score-tile {
  background: var(--bg-soft-indigo); border-radius: var(--radius-md); padding: 18px 10px;
}
.score-tile-success { background: var(--bg-soft-green); }
.score-tile-danger { background: var(--bg-soft-rose); }
.score-tile-violet { background: var(--bg-soft-violet); }
.score-tile-cyan { background: var(--bg-soft-cyan); }
.score-label { font-size: .78rem; color: var(--text-muted); }
.score-value { font-size: 1.6rem; font-weight: 700; margin-top: 4px; }

.pending-result-card { color: var(--text-muted); }
.pending-icon { font-size: 3rem; line-height: 1; }

/* ---------- Live / status badges ---------- */
.badge-live {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--bg-soft-green); color: #0f9d63; font-weight: 600;
  padding: 4px 10px; border-radius: 20px; font-size: .78rem;
}
.rank-badge { background: #eef0f4; padding: 3px 10px; border-radius: 20px; font-weight: 600; }
.rank-badge.rank-gold   { background: linear-gradient(135deg,#ffe9a8,#ffd166); color: #7a4e00; }
.rank-badge.rank-silver { background: linear-gradient(135deg,#e7eaf3,#c9cedd); color: #44485c; }
.rank-badge.rank-bronze { background: linear-gradient(135deg,#f0c9a4,#dba36c); color: #5c3514; }
.rank-badge.rank-top { background: linear-gradient(135deg,#ffe9a8,#ffd166); color: #7a4e00; } /* fallback alias */
.row-highlight { background: var(--bg-soft-indigo) !important; }

/* ---------- Forms ---------- */
.form-control, .form-select {
  border-radius: 10px; border: 1px solid #e1e3ea; padding: .55rem .8rem;
}
.form-control:focus, .form-select:focus {
  border-color: var(--brand-indigo); box-shadow: 0 0 0 3px rgba(79,95,237,0.15);
}
.form-label { font-weight: 500; font-size: .9rem; color: #4b4f66; }

/* ---------- Tables ---------- */
.table { --bs-table-bg: transparent; font-size: .88rem; }
.table thead th { font-size: .72rem; text-transform: uppercase; letter-spacing: .03em; color: var(--text-muted); border-bottom-width: 1px; white-space: nowrap; }
.table > :not(caption) > * > * { padding: .7rem .8rem; }
.table-responsive { border-radius: 0 0 var(--radius-lg) var(--radius-lg); }

/* ---------- Report charts ---------- */
.chart-card-body { padding: 14px 18px 6px; }
.chart-container { position: relative; width: 100%; height: 260px; }
.chart-container-sm { position: relative; width: 100%; height: 200px; }
.insight-pill {
  display: inline-flex; align-items: center; gap: 6px; background: var(--bg-soft-indigo);
  color: var(--brand-indigo-dark); border-radius: 20px; padding: 5px 12px; font-size: .8rem; font-weight: 600;
}

/* ---------- Exam-taking screen ---------- */
.option-label {
  display:block; padding:12px 16px; border:1px solid #e1e3ea; border-radius: 12px;
  margin-bottom:10px; cursor:pointer; transition: all .15s ease; background: #fff;
}
.option-label:hover { background: var(--bg-soft-indigo); border-color:#c7ccff; }
.option-label.selected {
  background: linear-gradient(135deg, var(--brand-indigo) 0%, var(--brand-indigo-dark) 100%);
  color:#fff; border-color: var(--brand-indigo);
}
#exam-timer {
  font-size:1.5rem; font-weight:700; font-family:'Poppins',sans-serif;
  background: var(--bg-soft-indigo); color: var(--brand-indigo-dark);
  padding: 6px 16px; border-radius: 10px; display:inline-block;
}
#exam-timer.warning { background: var(--bg-soft-rose); color: var(--brand-rose); animation: pulse 1s infinite; }
@keyframes pulse { 0%,100% { opacity:1; } 50% { opacity:.55; } }

#question-timer {
  font-size:1.05rem; font-weight:700; font-family:'Poppins',sans-serif;
  background: var(--bg-soft-amber, #fff3cd); color: var(--brand-amber, #8a6d1a);
  padding: 3px 12px; border-radius: 8px; display:inline-block;
}
#question-timer.warning { background: var(--bg-soft-rose); color: var(--brand-rose); animation: pulse 1s infinite; }
.question-palette button[disabled] { opacity: .55; cursor: not-allowed; }

.question-palette button {
  width:42px; height:42px; margin:3px; border-radius: 10px; border: 1px solid #e1e3ea; font-weight: 600;
}
.q-answered { background: linear-gradient(135deg,#16c79a,#0fae84) !important; color:#fff !important; border:none !important; }
.q-unanswered { background:#f1f2f6; color: var(--text-muted); }
.q-current { outline: 2px solid var(--brand-indigo); outline-offset: 1px; }

#proctor-warning-overlay {
  position:fixed; inset:0; z-index:9999; display:none; align-items:center; justify-content:center;
  text-align:center; padding:40px;
  background: radial-gradient(circle at center, rgba(244,63,94,.97), rgba(193,30,60,.98));
  color:#fff; font-size:1.3rem;
}

@media (max-width: 767.98px) {
  .exam-topbar {
    position: sticky; top: 0; z-index: 1020; background: var(--bg-page);
    padding-top: 10px; padding-bottom: 10px; margin-bottom: 10px !important;
    box-shadow: 0 4px 12px rgba(31,36,64,0.06);
  }
  .exam-topbar h5 { font-size: .95rem; }
}

/* ---------- Info pills (instructions page, multicolor variants) ---------- */
.info-pill {
  display: flex; align-items: center; gap: 10px; border-radius: var(--radius-md);
  padding: 12px 14px; height: 100%;
}
.info-pill i { font-size: 1.3rem; opacity: .85; }
.info-pill-label { font-size: .72rem; text-transform: uppercase; letter-spacing: .03em; opacity: .75; }
.info-pill-value { font-weight: 700; font-size: .92rem; }
.info-pill-indigo { background: var(--bg-soft-indigo); color: var(--brand-indigo-dark); }
.info-pill-teal   { background: var(--bg-soft-teal); color: #0f7a6e; }
.info-pill-amber  { background: var(--bg-soft-amber); color: #92660a; }
.info-pill-violet { background: var(--bg-soft-violet); color: #6d3fc9; }
.info-pill-rose   { background: var(--bg-soft-rose); color: #c2273b; }
.info-pill-cyan   { background: var(--bg-soft-cyan); color: #0e7490; }

/* ---------- Profile page ---------- */
.profile-header-card { background: linear-gradient(135deg, #fff 0%, var(--bg-soft-indigo) 100%); }
.profile-avatar {
  width: 64px; height: 64px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, var(--brand-indigo) 0%, var(--brand-violet) 100%);
  color: #fff; font-family: 'Poppins', sans-serif; font-weight: 700; font-size: 1.6rem;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 6px 18px rgba(79,95,237,0.35);
}
.profile-field {
  display: flex; justify-content: space-between; padding: 10px 0;
  border-bottom: 1px solid rgba(31,36,64,0.06);
}
.profile-field:last-child { border-bottom: none; }
.profile-field-label { color: var(--text-muted); font-size: .85rem; }
.profile-field-value { font-weight: 600; font-size: .9rem; text-align: right; }

/* ---------- Misc ---------- */
.footer-note { color: var(--text-muted); }
.recent-txn-row { border-bottom: 1px solid rgba(31,36,64,0.06); }
.recent-txn-row:last-child { border-bottom: none; }

/* ---------- Question management (manage_questions.php / edit_question.php) ---------- */
.question-row { padding: 16px 20px; border-bottom: 1px solid rgba(31,36,64,0.06); }
.question-row:last-child { border-bottom: none; }
.question-row:hover { background: var(--bg-page); }
.option-chip {
  display: inline-flex; align-items: center; gap: 4px; padding: 5px 10px; border-radius: 8px;
  background: #f4f5f9; width: 100%;
}
.option-chip-correct { background: var(--bg-soft-green); color: #0f7a52; font-weight: 600; }
.option-chip-wrong { background: var(--bg-soft-rose); color: #c2273b; font-weight: 600; }
.option-chip-your-pick-neutral { background: var(--bg-soft-indigo); color: var(--brand-indigo-dark); font-weight: 600; }
.option-chip-your-pick { font-size: .68rem; background: rgba(0,0,0,0.08); border-radius: 8px; padding: 1px 6px; margin-left: 6px; font-weight: 600; }

.answer-key-tag { padding: 1px 8px; border-radius: 6px; font-weight: 600; }
.answer-key-correct { background: var(--bg-soft-green); color: #0f7a52; }
.answer-key-wrong { background: var(--bg-soft-rose); color: #c2273b; }

.answer-status-badge { font-size: .75rem; font-weight: 600; padding: 3px 10px; border-radius: 20px; white-space: nowrap; }
.answer-status-correct { background: var(--bg-soft-green); color: #0f7a52; }
.answer-status-wrong { background: var(--bg-soft-rose); color: #c2273b; }
.answer-status-skipped { background: #eef0f4; color: #767b95; }
.answer-status-neutral { background: var(--bg-soft-indigo); color: var(--brand-indigo-dark); }

/* =========================================================
   Animations - subtle, purposeful motion (not decoration for its own sake)
   ========================================================= */

/* Page content fades + lifts in on load, once, so navigating feels alive
   without being distracting on repeat views */
@keyframes page-fade-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.container, .container-fluid { animation: page-fade-in .35s ease both; }

/* Cards animate in with a slight stagger when several appear in a row/grid */
@keyframes card-rise {
  from { opacity: 0; transform: translateY(10px) scale(.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.card { animation: card-rise .4s cubic-bezier(.22,.61,.36,1) both; }
.row > [class*="col-"]:nth-child(1) .card { animation-delay: .02s; }
.row > [class*="col-"]:nth-child(2) .card { animation-delay: .06s; }
.row > [class*="col-"]:nth-child(3) .card { animation-delay: .10s; }
.row > [class*="col-"]:nth-child(4) .card { animation-delay: .14s; }
.row > [class*="col-"]:nth-child(5) .card { animation-delay: .18s; }
.row > [class*="col-"]:nth-child(6) .card { animation-delay: .22s; }

/* Table rows: gentle highlight sweep on hover instead of an abrupt color snap */
.table tbody tr {
  transition: background-color .15s ease, transform .15s ease;
}
.table tbody tr:hover {
  background-color: var(--bg-soft-indigo);
}
.table tbody tr:hover td { color: var(--text-main); }

/* Stat tiles / score tiles "pop" in with a stagger too */
@keyframes tile-pop {
  from { opacity: 0; transform: scale(.92); }
  to   { opacity: 1; transform: scale(1); }
}
.stat-tile, .score-tile, .info-pill { animation: tile-pop .35s ease both; }
.row > div:nth-child(1) .stat-tile, .row > div:nth-child(1) .score-tile, .row > div:nth-child(1) .info-pill { animation-delay: 0s; }
.row > div:nth-child(2) .stat-tile, .row > div:nth-child(2) .score-tile, .row > div:nth-child(2) .info-pill { animation-delay: .04s; }
.row > div:nth-child(3) .stat-tile, .row > div:nth-child(3) .score-tile, .row > div:nth-child(3) .info-pill { animation-delay: .08s; }
.row > div:nth-child(4) .stat-tile, .row > div:nth-child(4) .score-tile, .row > div:nth-child(4) .info-pill { animation-delay: .12s; }
.row > div:nth-child(5) .stat-tile, .row > div:nth-child(5) .score-tile, .row > div:nth-child(5) .info-pill { animation-delay: .16s; }
.row > div:nth-child(6) .stat-tile, .row > div:nth-child(6) .score-tile, .row > div:nth-child(6) .info-pill { animation-delay: .20s; }

/* Badges get a tiny "breathe" when freshly live (used sparingly via .badge-pulse) */
@keyframes badge-pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(15,157,99,.4); } 50% { box-shadow: 0 0 0 5px rgba(15,157,99,0); } }
.badge-pulse { animation: badge-pulse 1.6s ease-in-out infinite; }
.live-now-card { border: 1px solid var(--bg-soft-rose) !important; box-shadow: 0 6px 24px rgba(244,63,94,0.12); }

/* Respect users who've asked for reduced motion */
@media (prefers-reduced-motion: reduce) {
  .container, .container-fluid, .card, .stat-tile, .score-tile, .info-pill { animation: none !important; }
  .table tbody tr { transition: none !important; }
}

/* =========================================================
   Auth pages (student + admin login) - split branded panel + form
   ========================================================= */
.auth-page {
  min-height: calc(100vh - 70px);
  display: flex; align-items: center; justify-content: center;
  padding: 40px 16px;
}
.auth-split-card {
  display: flex; max-width: 920px; width: 100%; min-height: 520px;
  background: #fff; border-radius: 22px; overflow: hidden;
  box-shadow: 0 24px 60px rgba(31,36,64,0.14);
  animation: card-rise .5s cubic-bezier(.22,.61,.36,1) both;
}
.auth-side { flex: 1 1 50%; padding: 48px 40px; display: flex; flex-direction: column; justify-content: center; }
.auth-side-form { background: #fff; }
.auth-side-content { color: #fff; max-width: 360px; }
.auth-side-icon { font-size: 2.6rem; margin-bottom: 18px; opacity: .95; }
.auth-side-content h3 { color: #fff; font-size: 1.5rem; margin-bottom: 10px; }
.auth-side-content p { opacity: .9; font-size: .92rem; line-height: 1.5; }
.auth-side-list { list-style: none; padding: 0; margin: 22px 0 0; }
.auth-side-list li { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; font-size: .88rem; opacity: .95; }
.auth-side-list i { font-size: 1.1rem; }

.auth-side-student {
  background: linear-gradient(155deg, var(--brand-indigo) 0%, var(--brand-violet) 55%, var(--brand-pink) 130%);
  position: relative; overflow: hidden;
}
.auth-side-admin {
  background: linear-gradient(155deg, #20243d 0%, #383f6b 55%, #4f5fed 140%);
  position: relative; overflow: hidden;
}
/* Soft floating decorative blobs for visual interest, purely cosmetic */
.auth-side-student::before, .auth-side-admin::before {
  content: ''; position: absolute; width: 220px; height: 220px; border-radius: 50%;
  background: rgba(255,255,255,0.08); top: -60px; right: -60px;
}
.auth-side-student::after, .auth-side-admin::after {
  content: ''; position: absolute; width: 160px; height: 160px; border-radius: 50%;
  background: rgba(255,255,255,0.06); bottom: -40px; left: -40px;
}

.auth-side-form .input-group-text { background: #f8f9fd; border-right: none; color: var(--text-muted); }
.auth-side-form .input-group .form-control { border-left: none; }
.auth-side-form .input-group:focus-within .input-group-text { border-color: var(--brand-indigo); }

@media (max-width: 767.98px) {
  .auth-split-card { flex-direction: column; min-height: 0; }
  .auth-side { padding: 32px 26px; }
  .auth-side-content { max-width: none; }
}

.register-banner {
  background: linear-gradient(135deg, var(--brand-indigo) 0%, var(--brand-violet) 100%);
  color: #fff; padding: 28px 32px; display: flex; align-items: center; gap: 16px;
}
.register-banner i { font-size: 2.2rem; opacity: .95; }
.register-banner h3 { color: #fff; }

/* ---------- Branding / logo ---------- */
.brand-logo-img { vertical-align: middle; object-fit: contain; }
.brand-mark-text { font-family: 'Poppins', sans-serif; font-weight: 700; }
.auth-side-logo { max-height: 64px; max-width: 220px; object-fit: contain; margin-bottom: 18px; filter: drop-shadow(0 2px 8px rgba(0,0,0,0.15)); }

/* =========================================================
   Marksheet & Certificate documents
   - Designed to look good on-screen AND when the student uses the browser's
     "Print > Save as PDF" - which is exactly how the Download button works
     (window.print()). No PDF library needed; @media print below does the
     formatting work for the saved PDF.
   ========================================================= */
.doc-toolbar { background: #fff; border-bottom: 1px solid rgba(31,36,64,0.08); position: sticky; top: 0; z-index: 100; }
.doc-page-wrap { padding: 30px 16px 60px; display: flex; justify-content: center; }
.doc-sheet {
  background: #fff; width: 100%; max-width: 800px; padding: 40px 48px;
  border-radius: var(--radius-lg); box-shadow: 0 14px 40px rgba(31,36,64,0.12);
  border: 1px solid rgba(31,36,64,0.06); position: relative; overflow: hidden;
}
.doc-sheet-accent { border-top: 7px solid; border-image: linear-gradient(90deg, var(--brand-indigo), var(--brand-violet), var(--brand-teal)) 1; }

/* Faint diagonal repeating watermark - purely decorative, gives the
   document an "official" feel and a mild anti-tamper visual cue */
.doc-watermark {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%) rotate(-32deg);
  font-family: 'Poppins', sans-serif; font-size: 4.2rem; font-weight: 700;
  color: rgba(79,95,237,0.045); white-space: nowrap; pointer-events: none; z-index: 0;
  letter-spacing: .05em;
}
/* Absolutely-positioned elements paint above static siblings by default
   (regardless of DOM order), which would put the watermark ON TOP of the
   text - the opposite of intended. Forcing every other direct child onto
   its own positioned layer with z-index:1 fixes the stacking order. */
.doc-sheet > *:not(.doc-watermark) { position: relative; z-index: 1; }

.doc-letterhead { display: flex; align-items: center; gap: 16px; }
.doc-letterhead-logo img { max-height: 56px; max-width: 140px; object-fit: contain; }
.doc-letterhead-logo i { font-size: 2.4rem; color: var(--brand-indigo); }
.doc-letterhead-org { flex-grow: 1; }
.doc-letterhead-org h4 { margin-bottom: 2px; }
.doc-letterhead-org p { margin: 0; color: var(--text-muted); font-size: .82rem; }
.doc-letterhead-meta { text-align: right; font-size: .78rem; color: var(--text-muted); }
.doc-divider { border-top: 2px solid var(--brand-indigo); opacity: .25; margin: 18px 0; }
.doc-title { letter-spacing: .08em; color: var(--brand-indigo-dark); margin-bottom: 22px; }

.doc-info-row { margin-bottom: 18px; }
.doc-kv { width: 100%; font-size: .88rem; }
.doc-kv td { padding: 5px 4px; }
.doc-kv td:first-child { color: var(--text-muted); width: 40%; }
.doc-kv td:last-child { font-weight: 600; }

.doc-score-table { width: 100%; border-collapse: collapse; margin-bottom: 20px; font-size: .85rem; }
.doc-score-table th, .doc-score-table td { border: 1px solid #e3e6f0; padding: 10px; text-align: center; }
.doc-score-table thead th { background: var(--bg-soft-indigo); color: var(--brand-indigo-dark); font-weight: 600; }
.doc-cell-positive { color: #0f7a52; font-weight: 700; }
.doc-cell-negative { color: #c2273b; font-weight: 700; }

.doc-result-banner {
  text-align: center; padding: 12px; border-radius: var(--radius-md); font-weight: 700;
  letter-spacing: .04em; margin-bottom: 26px; font-size: 1.05rem;
}
.doc-result-pass { background: var(--bg-soft-green); color: #0f7a52; }
.doc-result-fail { background: var(--bg-soft-rose); color: #c2273b; }

/* Circular "official stamp" badge - rotated slightly like a rubber stamp */
.doc-stamp-wrap { display: flex; justify-content: flex-end; margin: -8px 0 22px; }
.doc-stamp {
  width: 108px; height: 108px; border-radius: 50%; display: flex; flex-direction: column;
  align-items: center; justify-content: center; border: 3px solid; transform: rotate(-12deg);
  font-weight: 700; font-size: .72rem; letter-spacing: .04em; text-align: center; line-height: 1.3;
}
.doc-stamp i { font-size: 1.6rem; margin-bottom: 2px; }
.doc-stamp-pass { border-color: #0f9d63; color: #0f9d63; background: var(--bg-soft-green); }
.doc-stamp-fail { border-color: var(--brand-rose); color: var(--brand-rose); background: var(--bg-soft-rose); }

.doc-signature-row { display: flex; justify-content: space-between; align-items: flex-end; margin-top: 40px; }
.doc-signature { text-align: center; font-size: .85rem; }
.doc-signature-line { width: 160px; border-bottom: 1px solid #999; margin-bottom: 6px; }
.doc-seal { text-align: center; color: var(--brand-indigo); font-size: .78rem; }
.doc-seal i { font-size: 1.8rem; }
.doc-footer-note { margin-top: 30px; font-size: .72rem; color: var(--text-muted); text-align: center; border-top: 1px dashed #ddd; padding-top: 12px; }

/* ---------- Certificate (decorative variant) ---------- */
.doc-certificate { padding: 0; max-width: 900px; }
.doc-cert-border {
  position: relative; overflow: hidden; border: 3px solid var(--brand-indigo); border-radius: 14px; margin: 14px;
  padding: 50px 50px 36px; text-align: center;
  background: linear-gradient(160deg, #fff 0%, var(--bg-soft-indigo) 140%);
  box-shadow: inset 0 0 0 8px #fff, inset 0 0 0 9px var(--bg-soft-amber);
}
.doc-cert-border > *:not(.doc-watermark) { position: relative; z-index: 1; }
.doc-cert-watermark { font-size: 3.2rem; color: rgba(139,92,246,0.05); }
.doc-cert-corner { position: absolute; width: 34px; height: 34px; border: 3px solid var(--brand-amber); z-index: 2; }
.doc-cert-corner-tl { top: 6px; left: 6px; border-right: none; border-bottom: none; }
.doc-cert-corner-tr { top: 6px; right: 6px; border-left: none; border-bottom: none; }
.doc-cert-corner-bl { bottom: 6px; left: 6px; border-right: none; border-top: none; }
.doc-cert-corner-br { bottom: 6px; right: 6px; border-left: none; border-top: none; }
.doc-cert-logo img { max-height: 64px; max-width: 160px; object-fit: contain; }
.doc-cert-logo i { font-size: 2.8rem; color: var(--brand-indigo); }
.doc-cert-org { font-family: 'Poppins', sans-serif; font-weight: 600; color: var(--text-muted); letter-spacing: .06em; margin-top: 8px; font-size: .85rem; text-transform: uppercase; }
.doc-cert-heading { font-family: 'Poppins', sans-serif; font-size: 1.8rem; font-weight: 700; color: var(--brand-indigo-dark); margin: 14px 0 6px; }
.doc-cert-rule { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 0 auto 14px; max-width: 280px; }
.doc-cert-rule span { flex: 1; height: 1px; background: linear-gradient(90deg, transparent, var(--brand-amber)); }
.doc-cert-rule span:last-child { background: linear-gradient(90deg, var(--brand-amber), transparent); }
.doc-cert-rule i { color: var(--brand-amber); font-size: .8rem; }
.doc-cert-subtext { color: var(--text-muted); font-size: .9rem; }
.doc-cert-name {
  font-family: 'Poppins', sans-serif; font-size: 2.1rem; font-weight: 700; color: var(--brand-violet); margin: 10px 0;
  text-shadow: 0 0 30px rgba(139,92,246,0.25);
}
.doc-cert-body { max-width: 560px; margin: 0 auto 30px; font-size: .98rem; line-height: 1.7; }
.doc-cert-footer-row { display: flex; justify-content: space-around; align-items: flex-end; margin-top: 20px; }
.doc-cert-date { text-align: center; font-size: .85rem; font-weight: 600; }

/* Ribbon-seal: a circular medal with two angled ribbon tails underneath -
   classic certificate "wax seal" motif, built with plain CSS shapes */
.doc-ribbon-seal { position: relative; width: 70px; margin: 0 auto; }
.doc-ribbon-seal-circle {
  width: 70px; height: 70px; border-radius: 50%; margin: 0 auto; position: relative; z-index: 2;
  background: linear-gradient(135deg, var(--brand-amber), #d98c00);
  display: flex; align-items: center; justify-content: center; color: #fff; font-size: 1.7rem;
  box-shadow: 0 4px 10px rgba(217,140,0,0.4), inset 0 0 0 3px rgba(255,255,255,0.5);
}
.doc-ribbon-seal-tails {
  position: absolute; top: 52px; left: 50%; transform: translateX(-50%); width: 70px; height: 38px; z-index: 1;
}
.doc-ribbon-seal-tails::before, .doc-ribbon-seal-tails::after {
  content: ''; position: absolute; top: 0; width: 26px; height: 38px; background: var(--brand-indigo);
}
.doc-ribbon-seal-tails::before { left: 4px; transform: skewX(12deg); clip-path: polygon(0 0, 100% 0, 100% 70%, 50% 100%, 0 70%); }
.doc-ribbon-seal-tails::after { right: 4px; transform: skewX(-12deg); clip-path: polygon(0 0, 100% 0, 100% 70%, 50% 100%, 0 70%); }

@media (max-width: 575.98px) {
  .doc-sheet { padding: 24px 20px; }
  .doc-letterhead { flex-wrap: wrap; }
  .doc-cert-border { padding: 32px 20px 24px; }
  .doc-cert-name { font-size: 1.5rem; }
  .doc-cert-heading { font-size: 1.3rem; }
  .doc-cert-footer-row { flex-direction: column; gap: 16px; }
}

/* ---------- Print / Save-as-PDF formatting ---------- */
@media print {
  .no-print, .doc-toolbar, nav, footer { display: none !important; }
  body { background: #fff !important; }
  .container, .container-fluid { animation: none !important; max-width: 100% !important; }
  .doc-page-wrap { padding: 0 !important; }
  .doc-sheet {
    box-shadow: none !important; border: none !important; max-width: 100% !important;
    animation: none !important; padding: 10mm 14mm !important;
  }
  .doc-cert-border { margin: 0 !important; }
  @page { size: A4; margin: 10mm; }
  /* Force background colors/gradients to actually appear in the saved PDF
     instead of printing as plain white (browser default for "no background graphics") */
  * { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }
}

.wallet-banner { color: #fff; padding: 22px 28px; display: flex; align-items: center; gap: 14px; }
.wallet-banner i { font-size: 1.9rem; opacity: .95; }
.wallet-banner h5 { color: #fff; }
.wallet-banner-add { background: linear-gradient(135deg, var(--brand-teal) 0%, #0f9d63 100%); }
.wallet-banner-withdraw { background: linear-gradient(135deg, var(--brand-amber) 0%, #e08e00 100%); }

/* ---------- Attempt summary / violation timeline (instructions & result pages) ---------- */
.attempt-summary-card { background: var(--bg-page); border-radius: var(--radius-lg); }
.badge-live-danger { background: var(--bg-soft-rose) !important; color: #c2273b !important; }
.badge-live-warning { background: var(--bg-soft-amber) !important; color: #a86a00 !important; }
.violation-timeline { list-style: none; padding: 0; margin: 0; }
.violation-timeline li {
  display: flex; align-items: center; gap: 8px; padding: 8px 12px; margin-bottom: 6px;
  background: #fff; border-radius: 8px; border-left: 3px solid var(--brand-rose); font-size: .85rem;
}
.violation-timeline li i { color: var(--brand-rose); }

/* ---------- Exam browse cards: rotating top-accent colors ---------- */
.exam-card { border-top: 4px solid transparent !important; }
.exam-card-indigo { border-top-color: var(--brand-indigo) !important; }
.exam-card-teal   { border-top-color: var(--brand-teal) !important; }
.exam-card-amber  { border-top-color: var(--brand-amber) !important; }
.exam-card-violet { border-top-color: var(--brand-violet) !important; }
.exam-card-cyan   { border-top-color: var(--brand-cyan) !important; }

/* ---------- Browser-notification bell + in-page toast fallback ---------- */
#enable-notif-btn {
  background: rgba(255,255,255,.18); color: #fff; border: 1px solid rgba(255,255,255,.35);
  border-radius: 20px; font-size: .78rem; padding: 5px 12px;
}
#enable-notif-btn:hover { background: rgba(255,255,255,.28); }

.toast-stack {
  position: fixed; top: 16px; right: 16px; z-index: 10000;
  display: flex; flex-direction: column; gap: 10px; max-width: 340px;
}
.app-toast {
  display: flex; align-items: flex-start; gap: 10px;
  background: #fff; border-radius: var(--radius-md); box-shadow: 0 10px 30px rgba(31,36,64,0.18);
  padding: 12px 14px; border-left: 4px solid var(--brand-indigo);
  opacity: 0; transform: translateX(20px); animation: toast-in .25s ease forwards;
}
.app-toast-exam_published { border-left-color: var(--brand-violet); }
.app-toast-results_published { border-left-color: var(--brand-teal); }
.app-toast-exam_reminder { border-left-color: var(--brand-amber); }
.app-toast-payment_approved { border-left-color: #0f9d63; }
.app-toast-icon { font-size: 1.2rem; color: var(--brand-indigo); margin-top: 2px; }
.app-toast-title { font-weight: 700; font-size: .85rem; }
.app-toast-msg { font-size: .78rem; color: var(--text-muted); margin-top: 2px; }
.app-toast-close { background: none; border: none; color: var(--text-muted); font-size: 1rem; line-height: 1; cursor: pointer; margin-left: auto; }
.app-toast-hide { opacity: 0; transform: translateX(20px); transition: all .3s ease; }
@keyframes toast-in { to { opacity: 1; transform: translateX(0); } }

@media (max-width: 575.98px) {
  .toast-stack { left: 10px; right: 10px; top: 10px; max-width: none; }
}

/* =========================================================
   Responsive: tablet (<=991px) and mobile (<=575px)
   ========================================================= */
@media (max-width: 991.98px) {
  .container, .container-fluid { padding-left: 14px; padding-right: 14px; }
  .stat-tile { padding: 12px 10px; }
  .stat-tile .stat-value { font-size: 1.25rem; }
  .score-value { font-size: 1.35rem; }
  #exam-timer { font-size: 1.2rem; padding: 5px 12px; }
  .question-palette button { width: 38px; height: 38px; margin: 2px; }
  #enable-notif-btn { display: inline-block; margin: 6px 0; }
}

@media (max-width: 575.98px) {
  html { font-size: 13px; }
  .navbar-brand { font-size: 1rem; }
  .navbar .btn-sm, .navbar-text { font-size: .8rem; }
  h3 { font-size: 1.1rem; }
  h4 { font-size: 1.02rem; }

  /* Stat tiles: 2-up grid instead of being squeezed 6-across */
  .row.g-3 > [class*="col-md-2"] { flex: 0 0 50%; max-width: 50%; }
  .stat-tile .stat-value { font-size: 1.1rem; }
  .stat-tile .stat-label { font-size: .68rem; }

  .card-body { padding: 1rem; }
  .btn { font-size: .85rem; padding: .45rem .8rem; }
  .btn-lg { font-size: .95rem; padding: .6rem 1.1rem; }

  /* Tables: smaller text + tighter padding so more columns fit before scrolling */
  .table { font-size: .78rem; }
  .table > :not(caption) > * > * { padding: .55rem .5rem; }
  .table thead th { font-size: .65rem; }

  /* Score tiles on the result page: 2 per row instead of 5 squeezed columns */
  .row.text-center.my-4.g-3 > .col { flex: 0 0 50%; max-width: 50%; margin-bottom: .6rem; }
  .score-value { font-size: 1.2rem; }

  /* Exam-taking screen */
  #exam-timer { font-size: 1.05rem; }
  .question-palette button { width: 34px; height: 34px; font-size: .8rem; }
  .option-label { padding: 10px 12px; font-size: .88rem; }
  #question-container { padding: 1rem !important; }

  /* Share buttons / action button rows wrap cleanly */
  .btn-soft-primary, .btn-soft-secondary, .btn-soft-success, .btn-soft-info, .btn-soft-warning {
    font-size: .8rem;
  }

  .chart-container { height: 200px; }
  .chart-container-sm { height: 170px; }
}

/* Touch devices: slightly larger tap targets even though text is smaller,
   so buttons stay comfortably tappable on phones */
@media (hover: none) and (pointer: coarse) {
  .btn { min-height: 38px; }
  .question-palette button { min-width: 36px; min-height: 36px; }
  .option-label { min-height: 44px; }
}
