:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --success: #16a34a;
    --danger: #dc2626;
    --warning: #d97706;
    --info: #0891b2;
    --bg: #f8fafc;
    --card-bg: #ffffff;
    --text: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --shadow: 0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,.1);
    --radius: .5rem;
    --transition: .2s ease;
}

body {
    background-color: var(--bg);
    color: var(--text);
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    transition: background-color var(--transition), color var(--transition);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ── Navbar ───────────────────────────────────────────────────────────────── */
.navbar {
    background: var(--card-bg) !important;
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow);
}
.navbar-brand { font-weight: 700; color: var(--primary) !important; font-size: 1.3rem; }
.navbar-nav .nav-link { color: var(--text) !important; transition: color var(--transition); }
.navbar-nav .nav-link:hover { color: var(--primary) !important; }
.navbar-toggler { border-color: var(--border); }

/* ── Cards ────────────────────────────────────────────────────────────────── */
.card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    transition: box-shadow var(--transition), transform var(--transition);
}
.card:hover { box-shadow: var(--shadow-lg); }
.card-header { background: transparent; border-bottom: 1px solid var(--border); }

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.btn-primary { background: var(--primary); border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }

/* ── Progress ─────────────────────────────────────────────────────────────── */
.progress { background-color: var(--border); }

/* ── Hero ─────────────────────────────────────────────────────────────────── */
.hero {
    background-color: #0f172a;
    background-image: linear-gradient(135deg, var(--primary) 0%, #7c3aed 100%);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    color: white;
    padding: 5rem 0;
    position: relative;
    overflow: hidden;
}

/* When a banner photo is present, the photo overrides the gradient */
.hero.hero-with-banner {
    background-image: var(--hero-banner-url, linear-gradient(135deg, var(--primary) 0%, #7c3aed 100%));
}

/* Dark overlay so text stays readable over the banner photo */
.hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.45);
    pointer-events: none;
}

/* Everything inside hero must sit above the overlay */
.hero > * { position: relative; z-index: 1; }

.hero h1 { font-size: 2.8rem; font-weight: 800; }

/* ── Category cards ───────────────────────────────────────────────────────── */
.category-card { cursor: pointer; transition: transform var(--transition), box-shadow var(--transition); }
.category-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.category-icon { font-size: 2.5rem; }

/* ── Question ─────────────────────────────────────────────────────────────── */
.question-block {
    background: rgba(37,99,235,.06);
    border-left: 4px solid var(--primary);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    margin-bottom: 1.25rem;
}
.question-block p { font-size: 1rem; font-weight: 400; color: var(--text-muted); margin-bottom: .75rem; }
.question-block p:last-child { margin-bottom: 0; font-size: 1.1rem; color: var(--text); font-weight: 600; font-style: normal; }

.option-label {
    display: block;
    padding: .75rem 1rem;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: border-color var(--transition), background var(--transition);
    background: var(--card-bg);
    color: var(--text);
    margin-bottom: .5rem;
}
.option-label:hover { border-color: var(--primary); background: rgba(37,99,235,.05); }
input[type="radio"]:checked + .option-label { border-color: var(--primary); background: rgba(37,99,235,.1); }
.option-label-static { cursor: default !important; }
.option-label-static:hover { border-color: var(--border); background: transparent; }
.option-correct { border-color: var(--success) !important; background: rgba(22,163,74,.1) !important; }
.option-wrong   { border-color: var(--danger)  !important; background: rgba(220,38,38,.1)  !important; }

/* ── Timer ────────────────────────────────────────────────────────────────── */
#countdown {
    font-size: 1.4rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--text);
    padding: .4rem .8rem;
    border-radius: var(--radius);
    background: var(--card-bg);
    border: 2px solid var(--border);
}
#countdown.warning { color: var(--warning); border-color: var(--warning); }
#countdown.danger  { color: var(--danger);  border-color: var(--danger);  animation: blink 1s step-end infinite; }
@keyframes blink { 50% { opacity: .4; } }

/* ── Question navigator ───────────────────────────────────────────────────── */
.q-nav-btn {
    width: 2rem; height: 2rem;
    border-radius: .25rem;
    border: 1px solid var(--border);
    background: var(--card-bg);
    color: var(--text);
    font-size: .8rem;
    display: inline-flex; align-items: center; justify-content: center;
    text-decoration: none;
    transition: background var(--transition);
}
.q-nav-btn:hover    { background: var(--primary); color: white; border-color: var(--primary); }
.q-nav-btn.answered { background: var(--success); color: white; border-color: var(--success); }
.q-nav-btn.current  { background: var(--primary); color: white; border-color: var(--primary); font-weight: 700; }

/* ── Score circle ─────────────────────────────────────────────────────────── */
.score-circle {
    width: 140px; height: 140px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 2.2rem; font-weight: 800;
    margin: 0 auto 1.5rem;
    border: 8px solid;
}
.score-high   { color: var(--success); border-color: var(--success); background: rgba(22,163,74,.1); }
.score-medium { color: var(--warning); border-color: var(--warning); background: rgba(217,119,6,.1); }
.score-low    { color: var(--danger);  border-color: var(--danger);  background: rgba(220,38,38,.1); }

/* ── Stat bars ────────────────────────────────────────────────────────────── */
.stat-bar-track { background: var(--border); border-radius: 999px; height: 10px; }
.stat-bar-fill  { border-radius: 999px; height: 10px; transition: width .6s ease; }

/* ── Footer ───────────────────────────────────────────────────────────────── */
footer {
    background: var(--card-bg);
    border-top: 1px solid var(--border);
    padding: 1.5rem 0;
    margin-top: auto;
    color: var(--text-muted);
    font-size: .875rem;
}

/* ── Forms ────────────────────────────────────────────────────────────────── */
.form-control, .form-select {
    background-color: var(--card-bg);
    border-color: var(--border);
    color: var(--text);
}
.form-control:focus, .form-select:focus {
    background-color: var(--card-bg);
    color: var(--text);
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,.15);
}

/* ── Alerts ───────────────────────────────────────────────────────────────── */
.alert { border-radius: var(--radius); }

/* ── Table ────────────────────────────────────────────────────────────────── */
.table { color: var(--text); }
.table th { border-color: var(--border); background: var(--bg); color: var(--text-muted); font-weight: 600; text-transform: uppercase; font-size: .75rem; letter-spacing: .05em; }
.table td { border-color: var(--border); vertical-align: middle; }

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .hero h1 { font-size: 2rem; }
    .hero { padding: 3rem 0; }
}

/* ── Themed dropdown menu ─────────────────────────────────────────────────── */
.dropdown-menu-themed {
    background: var(--card-bg);
    border-color: var(--border);
}
.dropdown-menu-themed .dropdown-item {
    color: var(--text);
}
.dropdown-menu-themed .dropdown-item-danger {
    color: var(--danger);
}
.dropdown-menu-themed .dropdown-divider {
    border-color: var(--border);
}

/* ── Navbar logo ─────────────────────────────────────────────────────────── */
.navbar-logo {
    height: 36px;
    width: auto;
    max-width: 200px;
    background: #fff;
    border-radius: 4px;
    padding: 3px 8px;
}

/* ── Hero banner ──────────────────────────────────────────────────────────── */
.hero-banner-wrap {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px 28px;
}

/* Transparent background – logo floats on the gradient hero */
.hero-banner-logo {
    max-width: 620px;
    width: 82%;
    height: auto;
    background: transparent;
    border-radius: 0;
    padding: 0;
    box-shadow: none;
}

@media (max-width: 768px) {
    .hero-banner-logo { max-width: 420px; }
    .navbar-logo { height: 30px; max-width: 150px; }
}

@media (max-width: 480px) {
    .hero-banner-logo { max-width: 300px; }
}
