/* ==========================================================================
   Shared styles - TOGAF 9.1 Certification Exam (initial page + exam page)
   ========================================================================== */
:root {
  --navy: #0b1f3a;
  --navy-2: #12305c;
  --blue: #2563eb;
  --blue-dark: #1d4ed8;
  --blue-soft: #eaf1ff;
  --green: #198754;
  --green-soft: #e6f6ec;
  --red: #dc3545;
  --bg: #f3f5fa;
  --card: #ffffff;
  --line: #e3e8f0;
  --text: #1b2433;
  --muted: #5b6678;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(15, 31, 58, .06), 0 8px 24px rgba(15, 31, 58, .07);
}

html { scroll-behavior: smooth; }
body {
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
main { flex: 1 0 auto; }

/* ---- Top navigation bar ---------------------------------------------------- */
.app-nav { background: var(--navy); color: #fff; }
.app-nav .inner {
  max-width: 1320px; margin: 0 auto; padding: .8rem 1.25rem;
  display: flex; align-items: center; justify-content: space-between;
}
.brand { display: flex; align-items: center; gap: .7rem; color: #fff; text-decoration: none; }
.brand-mark {
  width: 36px; height: 36px; border-radius: 10px;
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  display: grid; place-items: center;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .25);
}
.brand-text { line-height: 1.15; }
.brand-text strong { display: block; font-size: .98rem; letter-spacing: .01em; }
.brand-text span { font-size: .72rem; color: #9fb3d4; letter-spacing: .08em; text-transform: uppercase; }
.nav-tag {
  font-size: .78rem; color: #cfe0ff; border: 1px solid rgba(255, 255, 255, .22);
  padding: .3rem .75rem; border-radius: 999px;
}

/* ---- Hero bands ------------------------------------------------------------ */
.hero {
  background:
    radial-gradient(700px 300px at 85% -10%, rgba(59, 130, 246, .45), transparent 60%),
    radial-gradient(500px 260px at 0% 110%, rgba(56, 189, 248, .22), transparent 60%),
    linear-gradient(135deg, var(--navy) 0%, var(--navy-2) 100%);
  color: #fff;
}
.hero-inner { max-width: 1320px; margin: 0 auto; padding: 3.2rem 1.25rem 6rem; }
.eyebrow {
  display: inline-block; font-size: .75rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase;
  color: #bcd3ff; background: rgba(255, 255, 255, .09); border: 1px solid rgba(255, 255, 255, .18);
  padding: .35rem .8rem; border-radius: 999px; margin-bottom: 1.1rem;
}
.hero h1 { font-size: clamp(2rem, 4.4vw, 3.1rem); font-weight: 800; letter-spacing: -.02em; margin: 0 0 .4rem; }
.hero h2 { font-size: clamp(1.15rem, 2.2vw, 1.55rem); font-weight: 500; color: #cfe0ff; margin: 0 0 1.2rem; }
.hero p.lead { max-width: 640px; color: #d6e3fb; font-size: 1.05rem; line-height: 1.65; margin-bottom: 1.8rem; }

.hero.compact { text-align: center; }
.hero.compact .hero-inner { padding: 1.8rem 1.25rem 4.2rem; }
.hero.compact h1 { font-size: clamp(1.7rem, 3.4vw, 2.4rem); margin-bottom: .2rem; }
.hero.compact h2 { margin: 0; }

/* ---- Buttons ----------------------------------------------------------------- */
.btn { border-radius: 10px; font-weight: 600; letter-spacing: .01em; transition: transform .08s ease, box-shadow .15s ease, background-color .15s; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn-cta {
  background: #fff; color: var(--navy); padding: .9rem 1.9rem; font-size: 1.05rem; border: 0;
  box-shadow: 0 8px 22px rgba(0, 0, 0, .28);
}
.btn-cta:hover { background: #eef4ff; color: var(--navy); }
.btn-cta .arrow { display: inline-block; margin-left: .45rem; transition: transform .15s; }
.btn-cta:hover .arrow { transform: translateX(4px); }
.btn-cta-solid { background: var(--blue); color: #fff; padding: .85rem 1.6rem; font-size: 1.02rem; border: 0; width: 100%; }
.btn-cta-solid:hover { background: var(--blue-dark); color: #fff; }
.btn-primary { background: var(--blue); border-color: var(--blue); }
.btn-primary:hover:not(:disabled) { background: var(--blue-dark); border-color: var(--blue-dark); }
.btn-success { background: var(--green); border-color: var(--green); }
.btn-danger { background: var(--red); border-color: var(--red); }
.btn:focus-visible { outline: 3px solid rgba(37, 99, 235, .45); outline-offset: 2px; }

/* ---- Cards --------------------------------------------------------------------- */
.panel {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
}
.panel-head {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 1rem 1.4rem; border-bottom: 1px solid var(--line);
}
.panel-head h3 { font-size: 1.02rem; font-weight: 700; margin: 0; }
.panel-body { padding: 1.3rem 1.4rem; }

/* ==========================================================================
   INITIAL PAGE
   ========================================================================== */
.content-wrap { max-width: 1320px; margin: 0 auto; padding: 0 1.25rem 3rem; }
.stats { margin-top: -3.4rem; display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; position: relative; z-index: 2; }
.stat { padding: 1.15rem 1.3rem; display: flex; gap: .95rem; align-items: center; }
.stat-icon {
  flex: 0 0 46px; height: 46px; border-radius: 12px; background: var(--blue-soft); color: var(--blue);
  display: grid; place-items: center;
}
.stat small { display: block; font-size: .72rem; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.stat strong { font-size: 1.3rem; font-weight: 800; letter-spacing: -.01em; }

.info-grid { display: grid; grid-template-columns: 1.55fr 1fr; gap: 1.4rem; margin-top: 1.4rem; align-items: start; }
.stack { display: grid; gap: 1.4rem; }

.spec { margin: 0; }
.spec .row-item { display: flex; justify-content: space-between; gap: 1rem; padding: .8rem 0; border-bottom: 1px dashed var(--line); }
.spec .row-item:last-child { border-bottom: 0; }
.spec dt { font-weight: 500; color: var(--muted); }
.spec dd { margin: 0; font-weight: 600; text-align: right; }

.steps { list-style: none; counter-reset: step; margin: 0; padding: 0; }
.steps li { counter-increment: step; display: flex; gap: .9rem; padding: .7rem 0; line-height: 1.55; }
.steps li::before {
  content: counter(step); flex: 0 0 28px; height: 28px; border-radius: 50%;
  background: var(--navy); color: #fff; font-size: .82rem; font-weight: 700; display: grid; place-items: center; margin-top: .05rem;
}
.steps b { font-weight: 650; }

.checklist { list-style: none; margin: 0; padding: 0; }
.checklist li { display: flex; gap: .7rem; padding: .5rem 0; line-height: 1.5; color: #2a3547; }
.checklist li::before { content: "\2713"; flex: 0 0 22px; height: 22px; border-radius: 50%; background: var(--green-soft); color: var(--green); font-weight: 800; font-size: .8rem; display: grid; place-items: center; margin-top: .1rem; }

.verdict { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; margin-top: 1rem; }
.verdict div { border-radius: 12px; padding: .9rem 1rem; text-align: center; }
.verdict .pass { background: var(--green-soft); color: #14532d; }
.verdict .fail { background: #fdecee; color: #842029; }
.verdict b { display: block; font-size: 1.25rem; }
.verdict span { font-size: .82rem; }

.cta-card { padding: 1.4rem; text-align: center; background: linear-gradient(160deg, #ffffff, #f2f7ff); }
.cta-card p { color: var(--muted); font-size: .92rem; margin: .8rem 0 0; }
.status-note {
  display: inline-flex; align-items: center; gap: .5rem; background: rgba(255, 255, 255, .1); color: #ffe9a8;
  border: 1px solid rgba(255, 233, 168, .35); padding: .4rem .85rem; border-radius: 10px; font-size: .9rem; margin-bottom: 1rem;
}
.hero-note { margin-top: .9rem; color: #b9cdf0; font-size: .9rem; }

/* ==========================================================================
   EXAM PAGE
   ========================================================================== */
.exam-wrap { max-width: 1320px; margin: -2.6rem auto 0; padding: 0 1.25rem 2.5rem; position: relative; z-index: 2; }

.timer-row { display: flex; justify-content: flex-end; align-items: center; gap: .75rem; margin-bottom: 1rem; }
.timer-label { color: #e5edff; font-size: 1rem; font-weight: 500; }
.timer-pill {
  display: inline-flex; align-items: center; gap: .55rem; background: #fff; color: var(--navy);
  border-radius: 999px; padding: .45rem 1.1rem; font-weight: 700; font-size: 1.2rem;
  box-shadow: 0 4px 16px rgba(15, 31, 58, .22); font-variant-numeric: tabular-nums;
}
.timer-pill svg { color: var(--blue); }
.timer-pill.low { background: #fff1f2; color: #b4232f; animation: pulse 1.2s ease-in-out infinite; }
.timer-pill.low svg { color: #b4232f; }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px rgba(220, 53, 69, .22); } }

.q-meta { display: flex; align-items: center; gap: 1.2rem; flex-wrap: wrap; width: 100%; }
.q-count { font-weight: 700; }
.q-count span { color: var(--muted); font-weight: 500; }
.progress-mini { flex: 1 1 220px; max-width: 340px; height: 8px; background: #e9eef7; border-radius: 99px; overflow: hidden; }
.progress-mini i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #3b82f6, #16a34a); border-radius: 99px; transition: width .3s ease; }
.answered-count { font-size: .88rem; color: var(--muted); margin-left: auto; }
.answered-count b { color: var(--green); }

table.q-table { width: 100%; margin: 0; border-collapse: collapse; }
.q-table thead th {
  background: #f1f5fb; color: #44506a; font-size: .74rem; letter-spacing: .1em; text-transform: uppercase;
  padding: .85rem 1.4rem; border-bottom: 1px solid var(--line);
}
.q-table td, .q-table tbody th { padding: 1rem 1.4rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.q-table .num-col { width: 9%; }
.q-table .opt-col { width: 12%; }
.q-table tr.q-row th, .q-table tr.q-row td { background: #fbfcff; font-size: 1.12rem; font-weight: 600; padding-top: 1.3rem; padding-bottom: 1.3rem; }
.q-table tr.q-row th { color: var(--blue); font-size: 1.3rem; }
.key-badge {
  display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 50%;
  background: #eef2f9; color: #33415c; font-weight: 700; transition: all .15s;
}
tr.option-row { cursor: pointer; transition: background .12s; }
tr.option-row:hover { background: #f5f8ff; }
tr.option-row.selected { background: var(--blue-soft); box-shadow: inset 4px 0 0 var(--blue); }
tr.option-row.selected .key-badge { background: var(--blue); color: #fff; }
tr.option-row.selected td:nth-child(2) { font-weight: 600; }
.locked tr.option-row { cursor: default; }
.locked tr.option-row:hover { background: transparent; }
.locked tr.option-row.selected:hover { background: var(--blue-soft); }
.q-table tbody tr:last-child td, .q-table tbody tr:last-child th { border-bottom: 0; }
.form-check-input { width: 1.2rem; height: 1.2rem; cursor: pointer; margin: 0; }
.form-check-input:checked { background-color: var(--blue); border-color: var(--blue); }
.locked .form-check-input { cursor: default; }

.nav-buttons { display: flex; justify-content: center; gap: 1.2rem; margin: 1.4rem 0; }
.nav-buttons .btn { min-width: 130px; padding: .6rem 1.4rem; }
.nav-buttons .btn:disabled { opacity: .45; }

/* Track Table: one row, one cell per question number */
.track-panel { margin-bottom: 1.4rem; }
.legend { display: flex; gap: 1.1rem; font-size: .8rem; color: var(--muted); align-items: center; }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: .35rem; vertical-align: -1px; }
.track-wrap { overflow-x: auto; padding: 1rem 1.1rem 1.1rem; }
#track-table { table-layout: fixed; width: 100%; min-width: 1200px; margin: 0; border-collapse: separate; border-spacing: 3px 0; }
#track-table td {
  text-align: center; padding: .6rem .1rem; border: 0; background: #eef3fc; color: #33415c;
  font-size: .9rem; font-weight: 600; border-radius: 8px; transition: background .15s;
}
#track-table td.answered { background: var(--green-soft); color: #14532d; }
#track-table td.current { background: var(--blue); color: #fff; box-shadow: 0 3px 10px rgba(37, 99, 235, .4); }
#track-table td.na { color: #9aa6bb; background: #f4f6fb; font-weight: 500; }
#track-table td .tick { color: var(--green); font-weight: 800; font-size: .75em; vertical-align: super; margin-left: 1px; }
#track-table td.current .tick { color: #bbf7d0; }

.action-row { display: flex; justify-content: space-between; align-items: center; }
.action-row .btn { padding: .7rem 1.7rem; font-size: 1.02rem; }

#ended.alert { border-radius: var(--radius); border: 1px solid #cfd8e6; background: #fff; box-shadow: var(--shadow); font-weight: 600; }

/* ---- Footer ---------------------------------------------------------------------- */
.app-footer { text-align: center; color: #7a869b; font-size: .8rem; padding: 1.2rem; flex-shrink: 0; }

/* ---- Responsive -------------------------------------------------------------------- */
@media (max-width: 992px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .info-grid { grid-template-columns: 1fr; }
}
@media (max-width: 576px) {
  .stats { grid-template-columns: 1fr; }
  .q-table td, .q-table tbody th, .q-table thead th { padding-left: .8rem; padding-right: .8rem; }
  .nav-tag { display: none; }
  .timer-row { justify-content: center; }
}

/* ==========================================================================
   DISCLAIMER MODAL (initial page)
   ========================================================================== */
.modal-overlay {
  position: fixed; inset: 0; z-index: 1000; display: none; align-items: center; justify-content: center;
  padding: 1rem; background: rgba(8, 18, 36, .62); backdrop-filter: blur(3px);
}
.modal-overlay.open { display: flex; animation: fadeIn .18s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.disclaimer-box {
  background: #fff; width: 100%; max-width: 660px; max-height: calc(100vh - 2rem); display: flex; flex-direction: column;
  border-radius: 16px; box-shadow: 0 24px 60px rgba(0, 0, 0, .4); overflow: hidden; animation: popIn .2s ease;
}
@keyframes popIn { from { transform: translateY(10px) scale(.98); opacity: 0; } to { transform: none; opacity: 1; } }
.disclaimer-head { display: flex; align-items: center; gap: .85rem; padding: 1.15rem 1.5rem; background: #fff8e6; border-bottom: 1px solid #f3e2b3; }
.disclaimer-head .icon { flex: 0 0 40px; height: 40px; border-radius: 50%; background: #fdecb6; color: #8a5a00; display: grid; place-items: center; }
.disclaimer-head h3 { margin: 0; font-size: 1.15rem; font-weight: 800; color: #4a3200; }
.disclaimer-head p { margin: 0; font-size: .85rem; color: #7a5a1a; }
.disclaimer-body { padding: 1.2rem 1.5rem; overflow-y: auto; }
.disclaimer-body ol { margin: 0; padding-left: 1.3rem; }
.disclaimer-body li { margin-bottom: .75rem; line-height: 1.55; color: #2a3547; font-size: .95rem; }
.disclaimer-body li b { color: var(--navy); }
.disclaimer-body .confirm-line { margin: .3rem 0 0; padding: .8rem 1rem; background: #f3f6fc; border-radius: 10px; font-size: .9rem; color: #33415c; }
.disclaimer-foot { display: flex; justify-content: flex-end; gap: .75rem; padding: 1rem 1.5rem; border-top: 1px solid var(--line); background: #fafbfd; }
.disclaimer-foot .btn { padding: .65rem 1.4rem; }
@media (max-width: 576px) { .disclaimer-foot { flex-direction: column-reverse; } }
