@import url('open-iconic/font/css/open-iconic-bootstrap.min.css');

/* ── Base ── */
html, body {
    font-family: 'Inter', 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg);
    color: var(--text);
}

h1:focus { outline: none; }

a, .btn-link { color: var(--primary-bright); }

/* ── Primary button ── */
.btn-primary {
    color: var(--text-on-accent);
    background-color: var(--primary);
    border-color: var(--primary);
}

.btn-primary:hover, .btn-primary:focus {
    background-color: var(--primary);
    border-color: var(--primary);
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus,
.form-control:focus, .form-check-input:focus {
    box-shadow: 0 0 0 0.1rem color-mix(in srgb, var(--white) 5%, transparent), 0 0 0 0.25rem color-mix(in srgb, var(--primary) 25%, transparent);
}

/* ── Layout ── */
.content { padding-top: 0; }

/* ── Shared page header ── */
.page-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: .4rem 1.5rem;
    margin-top: 0;
    margin-bottom: .6rem;
    /* background: var(--surface-raised); */
    /* border: 1px solid var(--border); */
    border-radius: 14px;
    min-height: 4rem;
    box-sizing: border-box;
}

.page-header h2 {
    margin: 0;
    font-size: clamp(1.4rem, 5vw, 2rem);
    font-weight: 800;
    line-height: 1.15;
    color: var(--text);
    padding: 0;
}

.page-header .clickable {
    cursor: pointer;
    transition: color 0.15s;
}

.page-header .clickable:hover {
    color: var(--primary);
}

.page-header-action {
    margin-left: auto;
    color: var(--text-muted);
    font-size: 1.2rem;
    text-decoration: none;
    transition: color 0.15s;
    background: none;
    border: none;
    padding: 0.4rem 0.5rem;
    cursor: pointer;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    position: relative;
    border-radius: 6px;
}

.page-header-action:hover {
    color: var(--primary);
    background: color-mix(in srgb, var(--primary) 25%, transparent);
}

.filter-active-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--primary);
    display: inline-block;
    position: absolute;
    top: 4px;
    right: 4px;
}


/* ── Question ID badge (also used in page headers outside QuestionComponent) ── */
.question-id-badge {
    font-size: .8rem;
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--primary-bright);
    background: color-mix(in srgb, var(--primary) 12%, transparent);
    padding: .2rem .65rem;
    border-radius: 20px;
    border: 1px solid color-mix(in srgb, var(--primary) 25%, transparent);
}

/* ── Copy button ── */
.btn-copy {
    font-size: .8rem;
    padding: .2rem .5rem;
    border-radius: 6px;
    line-height: 1;
}

/* ── Loading state ── */
.loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 1rem;
    color: var(--text-muted);
}

/* ── Form controls (dark override for Bootstrap) ── */
.form-control,
.form-select {
    background-color: var(--surface-raised);
    border-color: var(--border);
    color: var(--text);
}

.form-control:focus,
.form-select:focus {
    background-color: var(--surface-raised);
    color: var(--text);
    border-color: var(--primary);
    box-shadow: 0 0 0 0.2rem color-mix(in srgb, var(--primary) 25%, transparent);
}

.form-control::placeholder { color: var(--text-muted); }
.form-label { color: var(--text-muted); font-size: .9rem; }

.form-check-input {
    background-color: var(--surface-raised);
    border-color: var(--border);
}

.form-check-input:checked {
    background-color: var(--primary);
    border-color: var(--primary);
}

/* ── Form validation ── */
.valid.modified:not([type=checkbox]) { outline: 1px solid var(--success); }
.invalid { outline: 1px solid var(--danger); }
.validation-message { color: var(--danger); }


.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbmsiPjwvc3ZnPg==) no-repeat 1rem/1.8rem, var(--danger-deep);
    padding: 1rem 1rem 1rem 3.7rem;
    color: var(--text-on-accent);
}

.blazor-error-boundary::after { content: "An error has occurred." }

@media (max-width: 640.98px), (orientation: landscape) and (max-height: 600px) {
    article.content {
        padding-left: 0 !important;
        padding-right: 0 !important;
        padding-top: 0;
    }

    .page-header { padding-left: 1rem; padding-right: 1rem; }
}

/* ── History / Exam-results shared styles ── */
.history-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: .5rem;
    margin-bottom: .6rem;
}

.history-filter {
    display: flex;
    gap: .5rem;
    margin-bottom: .35rem;
    flex-wrap: wrap;
}

.history-filter + .history-list { margin-top: .65rem; }

.filter-tab {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .4rem .85rem;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-muted);
    font-size: .8rem;
    font-weight: 500;
    cursor: pointer;
    transition: background .12s, border-color .12s, color .12s;
    font-family: inherit;
}

.filter-tab span {
    font-size: .68rem;
    background: var(--surface-raised);
    padding: .1rem .45rem;
    border-radius: 99px;
    font-weight: 600;
    min-width: 4ch;
    text-align: center;
    font-variant-numeric: tabular-nums;
    box-sizing: content-box;
}

.filter-tab:hover:not(.active) {
    border-color: var(--border-strong);
    color: var(--text);
}

.filter-tab.active {
    background: var(--info);
    border-color: var(--info);
    color: var(--text-on-accent);
}

.filter-tab.active span { background: color-mix(in srgb, var(--white) 20%, transparent); }

.filter-tab-correct.active { background: var(--success); border-color: var(--success); }
.filter-tab-wrong.active   { background: var(--danger);  border-color: var(--danger); }
.filter-tab-basic.active      { background: var(--info); border-color: var(--info); color: var(--text-on-accent); }
.filter-tab-specialist.active { background: var(--info); border-color: var(--info); color: var(--text-on-accent); }

.history-filters-sep { margin: .9rem 0 .6rem; }

.history-filter-header { margin-left: auto; flex-wrap: nowrap; }

a.hc-link { color: inherit; text-decoration: none; }
a.hc-link:hover { text-decoration: none; color: inherit; }
a.filter-tab { text-decoration: none; }
a.filter-tab:hover { text-decoration: none; }

.exam-result-actions { display: flex; justify-content: center; margin: 1.5rem 0; }

.eh-bars { display: flex; flex-direction: column; gap: .42rem; margin: .15rem 0 .35rem; }
.eh-bar-row { max-width: 100%; }
.eh-bar {
    position: relative;
    width: 100%;
    height: 33px;
    background: color-mix(in srgb, var(--white) 6%, transparent);
    border-radius: 99px;
    overflow: hidden;
}
.eh-bar-total { height: 6px; }
.eh-breakdown {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    font-size: .72rem;
    color: var(--text);
}
.eh-bar-track-pass  { background: color-mix(in srgb, var(--exam-pass) 25%, transparent); }
.eh-bar-track-fail  { background: color-mix(in srgb, var(--exam-fail) 25%, transparent); }
.eh-bar-track-spec  { background: color-mix(in srgb, var(--exam-specialist) 25%, transparent); }
.eh-bar-fill {
    position: absolute;
    top: 0; left: 0;
    height: 100%;
    border-radius: 99px;
}
.eh-bar-fill-pass  { background: var(--exam-pass); }
.eh-bar-fill-fail  { background: var(--exam-fail); }
.eh-bar-fill-spec  { background: var(--exam-specialist); }
.eh-bar-threshold {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 1px;
    background: color-mix(in srgb, var(--white) 45%, transparent);
    z-index: 2;
    pointer-events: none;
}
.eh-bar-split { display: flex; width: 100%; gap: 0; }
.eh-bar-left  { border-radius: 99px 0 0 99px; }
.eh-bar-right { border-radius: 0 99px 99px 0; }
.eh-bar-left .eh-bar-fill  { border-radius: 99px 0 0 99px; }
.eh-bar-right .eh-bar-fill { border-radius: 0; }

.history-list { display: flex; flex-direction: column; gap: .45rem; }

.scroll-sentinel { height: 1px; }

.history-card {
    display: flex;
    gap: .9rem;
    align-items: flex-start;
    border-radius: 14px;
    padding: .85rem 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    transition: border-color .12s, background .12s;
    cursor: pointer;
    user-select: none;
}

.history-card-correct    { border-left: 3px solid var(--success); }
.history-card-wrong      { border-left: 3px solid var(--danger); }
.history-card-unanswered { border-left: 3px solid var(--text-muted); }
.history-card-inprogress { border-left: 3px solid var(--warning); }
.history-card:hover   { background: var(--surface-raised); }

.history-card-static {
    cursor: default;
    user-select: auto;
    margin: 1rem 0;
}
.history-card-static:hover { background: var(--surface); }

.hc-chevron-placeholder { visibility: hidden; }

.verdict {
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .85rem;
    font-weight: 700;
    flex-shrink: 0;
    margin-top: .1rem;
}

.verdict-correct { color: var(--success); }
.verdict-wrong   { color: var(--danger); }

.hc-body { flex: 1; min-width: 0; }

.hc-question {
    font-size: .95rem;
    color: var(--text);
    line-height: 1.5;
    margin-bottom: .35rem;
}

.hc-pass-fail {
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    margin-bottom: .2rem;
    line-height: 2rem;
}
.hc-pass { color: var(--success); }
.hc-fail { color: var(--danger); }

.hc-score {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: .35rem;
    line-height: 1.4;
}

.hc-meta {
    display: flex;
    gap: .75rem;
    font-size: .72rem;
    color: var(--text-muted);
}

.history-group-sep {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .3rem;
    margin: 1rem 0 .5rem;
}

.history-group-rule {
    display: flex;
    align-items: center;
    gap: .75rem;
    width: 100%;
}

.history-group-rule::before,
.history-group-rule::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

.history-group-label {
    font-size: .65rem;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--text-muted);
    white-space: nowrap;
}

.history-group-stats {
    display: flex;
    align-items: center;
    gap: .45rem;
    font-size: .72rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.hgs-pipe    { opacity: .3; }
.hgs-pass    { color: var(--success); font-weight: 700; }
.hgs-fail    { color: var(--danger);  font-weight: 700; }

.hc-wrapper { display: flex; flex-direction: column; gap: 0; }

.hc-expanded-card {
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    border-bottom-color: transparent;
}

.hc-chevron {
    font-size: 1.2rem;
    color: var(--text-muted);
    flex-shrink: 0;
    transition: transform .2s ease;
    line-height: 1;
    align-self: center;
}

.hc-chevron-open { transform: rotate(90deg); }

.hc-detail {
    border: 1px solid var(--border);
    border-top: none;
    border-radius: 0 0 14px 14px;
    overflow: hidden;
}

.hc-detail .question-card {
    border-radius: 0 0 14px 14px;
    border: none;
    margin: 0;
    box-shadow: none;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 4rem 1rem;
    gap: .75rem;
    color: var(--text-muted);
}

.empty-icon { font-size: 3rem; }

@media (max-width: 640.98px), (orientation: landscape) and (max-height: 600px) {
    .history-stats,
    .history-filter,
    .history-list,
    .history-group-sep {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    .history-card-static {
        margin-left: 1rem;
        margin-right: 1rem;
    }
}

@media (min-width: 641px) {
    .history-filter,
    .history-list,
    .history-group-sep {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    .history-card-static {
        margin-left: 1rem;
        margin-right: 1rem;
    }
}

/* ── Shared utilities ── */
.pj-mono { font-variant-numeric: tabular-nums; }

/* ── Shared hero / eyebrow ── */
.revision-hero {
    background: var(--surface);
    border: 2px solid color-mix(in srgb, var(--primary) 60%, transparent);
    border-radius: 16px;
    padding: 20px 20px 18px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin: 0 1rem 1.125rem;
}

.revision-eyebrow {
    font-size: .75rem;
    font-weight: 600;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.revision-hero > .revision-eyebrow {
    color: var(--primary-bright);
}

/* ── Shared session size selector ── */
.revision-size-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.revision-batch-select {
    display: flex;
    gap: 6px;
    background: var(--surface-raised);
    border-radius: 10px;
    padding: 4px;
    width: 100%;
}

.revision-batch-btn {
    flex: 1;
    background: none;
    border: none;
    border-radius: 7px;
    padding: 5px 14px;
    font-size: .85rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.revision-batch-btn:hover {
    background: color-mix(in srgb, var(--white) 6%, transparent);
    color: var(--text);
}

.revision-batch-btn.active {
    background: var(--surface);
    color: var(--primary-bright);
}

/* ── Shared hero ── */
.revision-count-row {
    display: flex;
    align-items: baseline;
    gap: 10px;
}

.revision-numeral {
    font-size: 2.5rem;
    font-weight: 800;
    letter-spacing: -.03em;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.revision-eta {
    font-size: .9rem;
    color: var(--text);
}

.revision-overflow {
    font-size: .8rem;
    color: var(--text);
    opacity: 0.7;
    margin-top: -6px;
}


/* ── Shared intro setting rows ── */
.exam-intro-setting-row {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 12px 14px;
    margin-bottom: 6px;
    margin-left: 0;
}

.exam-intro-setting-row-btn { cursor: pointer; }
.exam-intro-setting-row-btn:hover { border-color: var(--border-strong); }

.exam-intro-setting-label { font-size: 1rem; font-weight: 500; }

.exam-intro-category-pill {
    background: color-mix(in srgb, var(--primary) 16%, transparent);
    color: var(--primary-bright);
    border: 1px solid color-mix(in srgb, var(--primary) 45%, transparent);
    border-radius: 6px;
    padding: 2px 8px;
    font-size: 1rem;
    font-weight: 600;
    margin-left: auto;
}

.exam-intro-setting-row .form-check-input {
    background-color: var(--surface-raised);
    border: 2px solid color-mix(in srgb, var(--white) 35%, transparent);
    cursor: pointer;
}

.exam-intro-setting-row .form-check-input:checked {
    background-color: var(--primary);
    border-color: var(--primary);
}

/* ── Shared category modal ── */
.cat-modal-backdrop {
    position: fixed;
    inset: 0;
    background: var(--overlay);
    z-index: 900;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.cat-modal {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 20px;
    max-width: 380px;
    width: 100%;
}

.cat-modal-title {
    font-size: .85rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 14px;
    text-transform: uppercase;
    letter-spacing: .05em;
}

.exam-intro-category-picker {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.exam-intro-cat-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 10px 6px;
    border-radius: 10px;
    border: 1px solid var(--border-strong);
    background: color-mix(in srgb, var(--white) 4%, transparent);
    color: var(--text-muted);
    cursor: pointer;
    transition: border-color .12s, background .12s;
}

.exam-intro-cat-btn:hover {
    background: color-mix(in srgb, var(--white) 8%, transparent);
    border-color: var(--border-strong);
}

.exam-intro-cat-btn-active {
    background: color-mix(in srgb, var(--primary) 16%, transparent) !important;
    border-color: color-mix(in srgb, var(--primary) 55%, transparent) !important;
    color: var(--primary-bright);
}

.cat-btn-letter {
    font-size: 1rem;
    font-weight: 700;
    line-height: 1;
}

.cat-btn-desc {
    font-size: .65rem;
    color: var(--text-muted);
    text-align: center;
    line-height: 1.2;
}


.video-host {
    position: relative;
    width: 100%;
    height: 100%;
}

.dbuf-video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: none;
}

.dbuf-video.dbuf-active {
    display: block;
}
