/* ===== Ngân hàng đề thi — Giáo dục vì trẻ em ===== */
/* Dùng lại thang thiết kế ds-* (46px control / radius 14px). */

.exam-bank-main {
    display: grid;
    grid-template-columns: 300px minmax(0, 1fr);
    gap: 20px;
    align-items: start;
    padding: 6px;
}

.exam-filter-group {
    display: grid;
    gap: 6px;
    margin-bottom: 14px;
}

.exam-filter-label {
    font-size: 0.78rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #5f7588;
    padding-left: 4px;
}

.exam-filter-reset {
    width: 100%;
    justify-content: center;
    margin-top: 4px;
}

.exam-filter-count {
    margin-top: 12px;
    font-size: 0.86rem;
    color: #526676;
    text-align: center;
}

.exam-list {
    display: grid;
    gap: 16px;
}

/* --- Thẻ đề thi --- */
.exam-card {
    padding: 18px 20px;
    border-radius: 22px;
    border: 1px solid rgba(16, 34, 51, 0.08);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.97));
}

.exam-card-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.exam-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 11px;
    border-radius: 999px;
    font-size: 0.74rem;
    font-weight: 800;
    letter-spacing: 0.02em;
    background: rgba(15, 118, 110, 0.09);
    color: #0f766e;
}

.exam-badge.is-grade {
    background: rgba(37, 99, 235, 0.08);
    color: #1d4ed8;
}

.exam-badge.is-type {
    background: rgba(16, 34, 51, 0.06);
    color: #30485a;
}

.exam-card h3 {
    margin: 0 0 6px;
    font-size: 1.08rem;
    font-weight: 850;
    line-height: 1.35;
}

.exam-card-desc {
    margin: 0;
    color: #4d6273;
    line-height: 1.55;
    font-size: 0.92rem;
}

.exam-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 14px;
    margin-top: 10px;
    font-size: 0.82rem;
    color: #6a7d8b;
}

.exam-card-meta i {
    margin-right: 4px;
}

.exam-source-line {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed rgba(16, 34, 51, 0.1);
    font-size: 0.82rem;
    color: #526676;
}

.exam-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 12px;
}

/* --- Overlay xem đề chi tiết --- */
.exam-detail-overlay {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 18px;
    background: rgba(9, 22, 33, 0.55);
    backdrop-filter: blur(3px);
}

.exam-detail-overlay.is-open {
    display: flex;
}

.exam-detail-sheet {
    width: min(880px, 100%);
    max-height: calc(100vh - 48px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 24px;
    background: #ffffff;
    box-shadow: 0 30px 60px rgba(9, 22, 33, 0.28);
}

.exam-detail-head {
    position: sticky;
    top: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 16px 20px;
    background: #ffffff;
    border-bottom: 1px solid rgba(16, 34, 51, 0.08);
}

.exam-detail-head h2 {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 850;
}

.exam-detail-close {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 999px;
    border: 0;
    background: rgba(16, 34, 51, 0.07);
    color: #30485a;
    cursor: pointer;
}

.exam-detail-close:hover {
    background: rgba(16, 34, 51, 0.13);
}

.exam-detail-body {
    padding: 18px 20px 24px;
}

.exam-question {
    padding: 16px 18px;
    border-radius: 18px;
    border: 1px solid rgba(16, 34, 51, 0.08);
    background: rgba(248, 250, 252, 0.7);
    margin-bottom: 14px;
}

.exam-question-head {
    display: flex;
    gap: 10px;
    align-items: baseline;
}

.exam-question-num {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 30px;
    height: 30px;
    padding: 0 8px;
    border-radius: 10px;
    background: #0f766e;
    color: #fff;
    font-weight: 800;
    font-size: 0.86rem;
}

.exam-question-content {
    font-size: 0.98rem;
    line-height: 1.6;
    color: #102233;
}

.exam-figure-box {
    margin: 12px 0 4px;
    padding: 12px;
    border-radius: 14px;
    border: 1px solid rgba(15, 118, 110, 0.16);
    background: #fff;
}

.exam-choices {
    list-style: none;
    margin: 12px 0 0;
    padding: 0;
    display: grid;
    gap: 8px;
}

.exam-choice {
    display: flex;
    gap: 10px;
    align-items: baseline;
    padding: 9px 12px;
    border-radius: 12px;
    background: #fff;
    border: 1px solid rgba(16, 34, 51, 0.07);
    font-size: 0.93rem;
}

.exam-choice.is-answer {
    border-color: rgba(22, 130, 90, 0.45);
    background: rgba(22, 163, 111, 0.08);
}

.exam-choice-key {
    font-weight: 850;
    color: #0f766e;
}

.exam-solution-toggle {
    margin-top: 10px;
    border: 0;
    background: none;
    padding: 0;
    color: #0f766e;
    font-weight: 750;
    font-size: 0.88rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.exam-solution {
    display: none;
    margin-top: 10px;
    padding: 12px 14px;
    border-radius: 12px;
    background: rgba(15, 118, 110, 0.06);
    border-left: 3px solid #0f766e;
    font-size: 0.92rem;
    line-height: 1.65;
    color: #23394a;
}

.exam-solution.is-open {
    display: block;
}

.exam-choice.is-selected {
    border-color: rgba(15, 118, 110, 0.55);
    background: rgba(15, 118, 110, 0.09);
}

.exam-choice input {
    accent-color: #0f766e;
    flex: 0 0 auto;
}

.exam-essay-answer {
    display: block;
    width: 100%;
    min-height: 110px;
    margin-top: 12px;
    padding: 11px 12px;
    border: 1px solid rgba(16, 34, 51, 0.14);
    border-radius: 12px;
    resize: vertical;
    font: inherit;
    line-height: 1.55;
}

.exam-taking-tools {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #0f766e;
    white-space: nowrap;
}

.exam-save-status {
    color: #6a7d8b;
    font-weight: 500;
}

.exam-submit-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 18px;
    padding: 14px 0 2px;
    border-top: 1px solid rgba(16, 34, 51, 0.09);
    color: #526676;
    font-size: 0.88rem;
}

.exam-result-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
    padding: 16px 18px;
    border-radius: 16px;
    background: rgba(15, 118, 110, 0.08);
    color: #0f766e;
}

.exam-result-summary strong {
    font-size: 1.25rem;
}

@media (max-width: 600px) {
    .exam-submit-bar,
    .exam-result-summary {
        align-items: flex-start;
        flex-direction: column;
    }

    .exam-taking-tools {
        gap: 6px;
        font-size: 0.84rem;
    }
}

/* KaTeX hiển thị gọn trong đề */
.exam-question .katex-display {
    margin: 8px 0;
    overflow-x: auto;
    overflow-y: hidden;
}

/* --- Responsive --- */
@media (max-width: 1080px) {
    .exam-bank-main {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (max-width: 720px) {
    .exam-detail-overlay {
        padding: 10px;
        align-items: flex-end;
    }

    .exam-detail-sheet {
        max-height: calc(100vh - 20px);
        border-radius: 22px 22px 18px 18px;
    }

    .exam-card,
    .exam-detail-body {
        padding: 14px;
    }
}

/* Badge loại đề (Olympic, HSG, thi thử...) — nổi hơn badge phụ */
.exam-badge.is-category {
    background: rgba(15, 118, 110, 0.1);
    color: #0f766e;
}
