/* ═══════════════════════════════════════════════════════
   Practice Test Module — Thi Thử (Reading / Listening)
   ═══════════════════════════════════════════════════════ */

:root {
    --brand-primary: #e87d2a;
    --brand-primary-hover: #d36e23;
    --brand-primary-light: #fdf3eb;
    --brand-primary-border: #f9d5bc;
    --brand-primary-dark: #b85412;
    --brand-gradient-start: #f48e3d;
    --brand-gradient-end: #e87d2a;
}

/* ─── Common ────────────────────────────────────────── */
.pt-page { min-height: 80vh; background: #f8fafc; }

/* Exam page: body override khi trang exam có topbar */
.exam-page-bg { background: #f1f5f9 !important; }

/* ─── Index: Hero ───────────────────────────────────── */
.pt-hero {
    background: linear-gradient(135deg, var(--brand-gradient-start) 0%, var(--brand-gradient-end) 100%);
    border-radius: 20px;
    padding: 48px 40px;
    color: #fff;
    position: relative;
    overflow: hidden;
}
.pt-hero::before {
    content: '';
    position: absolute;
    top: -50%; right: -20%;
    width: 400px; height: 400px;
    background: rgba(255,255,255,0.08);
    border-radius: 50%;
}
.pt-hero h1 { font-size: 2.2rem; font-weight: 800; margin-bottom: 8px; }
.pt-hero p { font-size: 1.05rem; opacity: 0.9; max-width: 600px; }

/* ─── Index: Filter Tabs ────────────────────────────── */
.pt-filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 24px; }
.pt-filter-btn {
    padding: 8px 20px; border-radius: 50px;
    border: 2px solid #e2e8f0; background: #fff;
    color: #64748b; font-weight: 600; font-size: 0.9rem;
    cursor: pointer; transition: all 0.2s ease; text-decoration: none;
}
.pt-filter-btn:hover,
.pt-filter-btn.active {
    background: var(--brand-primary); border-color: var(--brand-primary); color: #fff;
}

/* ─── Index: Skill Tabs ─────────────────────────────── */
.pt-skill-tabs { display: flex; gap: 12px; margin-bottom: 30px; flex-wrap: wrap; justify-content: center; }
.pt-skill-tab {
    padding: 10px 24px; border-radius: 30px; font-weight: 600; font-size: 0.95rem;
    background: #f1f5f9; border: 2px solid transparent !important; color: #475569;
    text-decoration: none; transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    outline: none !important; cursor: pointer;
}
.pt-skill-tab:hover {
    background: #e2e8f0; color: #1e293b;
}
.pt-skill-tab.active {
    background: var(--brand-primary) !important; color: #fff !important;
    box-shadow: 0 4px 14px rgba(232, 125, 42, 0.35);
}

/* ─── Index: Test Card ──────────────────────────────── */
.pt-card {
    background: #fff; border-radius: 16px;
    border: 1px solid #e2e8f0; padding: 24px;
    transition: all 0.3s ease; height: 100%;
    display: flex; flex-direction: column;
}
.pt-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(0,0,0,0.08);
    border-color: var(--brand-primary-border);
}
.pt-card-img {
    display: block;
    margin: -24px -24px 20px -24px;
    border-radius: 14px 14px 0 0;
    overflow: hidden;
    position: relative;
}
.pt-card-img img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    transition: transform 0.3s ease;
}
.pt-card:hover .pt-card-img img {
    transform: scale(1.05);
}

/* List View Modifier */
.pt-card-list.flex-md-row .pt-card-img {
    width: 320px;
    margin: -24px 0 -24px -24px;
    border-radius: 14px 0 0 14px;
    flex-shrink: 0;
}
.pt-card-list.flex-md-row .pt-card-img img {
    height: 100%;
    min-height: 220px;
}
@media (max-width: 767.98px) {
    .pt-card-list.flex-md-row .pt-card-img {
        width: auto;
        margin: -24px -24px 20px -24px;
        border-radius: 14px 14px 0 0;
    }
    .pt-card-list .pt-card-body {
        padding-left: 0 !important;
    }
}
.pt-card-badges { display: flex; gap: 6px; margin-bottom: 12px; flex-wrap: wrap; }
.pt-badge {
    padding: 4px 10px; border-radius: 6px; font-size: 0.75rem;
    font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px;
}
.pt-badge-exam { background: var(--brand-primary-light); color: var(--brand-primary-dark); }
.pt-badge-skill { background: #fef3c7; color: #92400e; }
.pt-badge-featured { background: #fce7f3; color: #be185d; }
.pt-card-title {
    font-size: 1.05rem; font-weight: 700; color: #1e293b;
    margin-bottom: 12px; line-height: 1.4; flex-grow: 1;
}
.pt-card-title a { color: inherit; text-decoration: none; }
.pt-card-title a:hover { color: var(--brand-primary); }
.pt-card-stats { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 16px; }
.pt-stat { display: flex; align-items: center; gap: 4px; font-size: 0.82rem; color: #64748b; }
.pt-stat-icon { font-size: 0.9rem; }
.pt-card-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 16px; }
.pt-tag { padding: 2px 8px; background: #f1f5f9; border-radius: 4px; font-size: 0.72rem; color: #64748b; }
.pt-card-btn {
    display: block; width: 100%; padding: 10px; border-radius: 10px;
    background: linear-gradient(135deg, var(--brand-gradient-start), var(--brand-gradient-end));
    color: #fff; font-weight: 700; text-align: center;
    text-decoration: none; transition: all 0.2s; margin-top: auto;
}
.pt-card-btn:hover {
    transform: scale(1.02); color: #fff;
    box-shadow: 0 4px 16px rgba(232, 125, 42, 0.3);
}

/* ─── Index: Search ─────────────────────────────────── */
.pt-search { position: relative; max-width: 400px; }
.pt-search input {
    width: 100% !important;
    padding: 10px 16px 10px 40px !important;
    border: 2px solid #e2e8f0 !important;
    border-radius: 12px !important;
    font-size: 0.9rem !important;
    outline: none !important;
    transition: border-color 0.2s;
    background: #fff !important;
    color: #1e293b !important;
    height: auto !important;
    box-shadow: none !important;
    -webkit-appearance: none !important;
}
.pt-search input:focus {
    border-color: var(--brand-primary) !important;
    box-shadow: 0 0 0 3px rgba(232, 125, 42, 0.1) !important;
}
.pt-search-icon {
    position: absolute; left: 14px; top: 50%;
    transform: translateY(-50%); color: #94a3b8;
}

/* ─── Index: Empty State ────────────────────────────── */
.pt-empty { text-align: center; padding: 60px 20px; color: #94a3b8; }
.pt-empty-icon { font-size: 4rem; margin-bottom: 16px; }

/* ═══════ Show: Detail Hero ═════════════════════════ */
.pt-detail-hero {
    background: linear-gradient(135deg, var(--brand-gradient-start) 0%, var(--brand-gradient-end) 100%);
    border-radius: 20px; padding: 40px; color: #fff;
    position: relative; overflow: hidden;
}
.pt-detail-hero::before {
    content: '';
    position: absolute; right: -80px; top: -80px;
    width: 300px; height: 300px;
    background: rgba(255,255,255,0.06); border-radius: 50%;
}
.pt-detail-badges { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.pt-detail-badge {
    padding: 4px 12px; border-radius: 8px; font-size: 0.8rem;
    font-weight: 700; background: rgba(255,255,255,0.2); color: #fff;
}
.pt-detail-title { font-size: 1.8rem; font-weight: 800; margin-bottom: 8px; }
.pt-detail-desc { font-size: 1rem; opacity: 0.85; line-height: 1.6; max-width: 700px; }
.pt-detail-stats { display: flex; flex-wrap: wrap; gap: 20px; margin-top: 20px; }
.pt-detail-stat {
    background: rgba(255,255,255,0.15); border-radius: 12px;
    padding: 12px 20px; text-align: center; min-width: 100px;
}
.pt-detail-stat-value { font-size: 1.4rem; font-weight: 800; }
.pt-detail-stat-label { font-size: 0.78rem; opacity: 0.8; }

/* ─── Show: Mode Tabs ───────────────────────────────── */
.pt-mode-tabs { display: flex; gap: 0; margin-bottom: 0; }
.pt-mode-tab {
    flex: 1; padding: 14px 20px; text-align: center;
    font-weight: 700; font-size: 0.95rem; cursor: pointer;
    border-bottom: 3px solid transparent; color: #64748b;
    background: #f8fafc; transition: all 0.2s;
    border-radius: 12px 12px 0 0;
}
.pt-mode-tab:hover { color: var(--brand-primary); }
.pt-mode-tab.active { color: var(--brand-primary); border-bottom-color: var(--brand-primary); background: #fff; }
.pt-mode-content {
    display: none; background: #fff; padding: 24px;
    border-radius: 0 0 16px 16px; border: 1px solid #e2e8f0; border-top: none;
}
.pt-mode-content.active { display: block; }

/* ─── Show: Section Card ────────────────────────────── */
.pt-section-card {
    border: 2px solid #e2e8f0; border-radius: 12px;
    padding: 16px; margin-bottom: 12px; transition: all 0.2s;
}
.pt-section-card:hover { border-color: var(--brand-primary-border); }
.pt-section-card label {
    display: flex; align-items: center; gap: 12px;
    cursor: pointer; font-weight: 600; color: #1e293b; margin: 0;
}
.pt-section-card input[type="checkbox"] { 
    appearance: none;
    -webkit-appearance: none;
    width: 22px; 
    height: 22px; 
    border: 2px solid #cbd5e1;
    border-radius: 6px;
    background-color: #fff;
    cursor: pointer;
    position: relative;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.pt-section-card input[type="checkbox"]:checked {
    background-color: var(--brand-primary);
    border-color: var(--brand-primary);
}

.pt-section-card input[type="checkbox"]:checked::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 6px;
    width: 6px;
    height: 11px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.pt-section-card input[type="checkbox"]:hover {
    border-color: var(--brand-primary);
}
.pt-section-meta { font-size: 0.82rem; color: #64748b; margin-top: 4px; padding-left: 32px; }

/* ─── Show: Start Buttons ───────────────────────────── */
.pt-start-btn {
    display: inline-block; padding: 14px 40px; border-radius: 12px;
    background: linear-gradient(135deg, var(--brand-gradient-start), var(--brand-gradient-end)); color: #fff;
    font-weight: 700; font-size: 1.05rem; border: none; cursor: pointer;
    transition: all 0.2s; margin-top: 16px;
}
.pt-start-btn:hover {
    transform: scale(1.02); color: #fff;
    box-shadow: 0 8px 24px rgba(232, 125, 42, 0.3);
}
.pt-start-btn-full { background: linear-gradient(135deg, #ec4899, #f43f5e); }
.pt-start-btn-full:hover { box-shadow: 0 8px 24px rgba(236,72,153,0.3); }

/* ─── Show: History ─────────────────────────────────── */
.pt-history-card {
    background: #fff; border-radius: 16px;
    border: 1px solid #e2e8f0; padding: 24px; margin-top: 24px;
}
.pt-history-card h5 { font-weight: 700; color: #1e293b; margin-bottom: 16px; }

/* ═══════ Exam: Layout ══════════════════════════════ */
.exam-topbar {
    position: fixed; top: 0; left: 0; right: 0; z-index: 1000;
    background: #fff; border-bottom: 1px solid #e2e8f0;
    padding: 10px 20px; display: flex; align-items: center;
    justify-content: space-between; box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.exam-topbar-title {
    font-weight: 700; font-size: 0.95rem; color: #1e293b;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 300px;
}
.exam-timer {
    background: #fef3c7; color: #92400e; padding: 6px 16px;
    border-radius: 8px; font-weight: 700; font-size: 1.1rem;
    display: flex; align-items: center; gap: 6px;
}
.exam-timer.warning { background: #fee2e2; color: #dc2626; animation: pulse-timer 1s infinite; }
.exam-stopwatch {
    background: #e0e7ff !important;
    color: #4338ca !important;
    font-size: 0.95rem !important;
}
@keyframes pulse-timer { 0%, 100% { opacity: 1; } 50% { opacity: 0.7; } }
.exam-submit-btn {
    background: linear-gradient(135deg, #ec4899, #f43f5e); color: #fff;
    padding: 8px 24px; border-radius: 10px; border: none;
    font-weight: 700; cursor: pointer; transition: all 0.2s;
}
.exam-submit-btn:hover { transform: scale(1.03); box-shadow: 0 4px 16px rgba(236,72,153,0.3); }
.exam-topbar-actions {
    display: flex; align-items: center; gap: 8px;
}
.exam-abandon-btn {
    background: #f1f5f9; color: #64748b;
    padding: 8px 16px; border-radius: 10px; border: 2px solid #e2e8f0;
    font-weight: 600; font-size: 0.88rem; cursor: pointer; transition: all 0.2s;
}
.exam-abandon-btn:hover {
    background: #fee2e2; color: #dc2626; border-color: #fecaca;
}

/* ─── Exam: Panels ──────────────────────────────────── */
.exam-body {
    margin-top: 60px; padding: 16px; display: flex; gap: 16px;
    height: calc(100vh - 60px - 60px);
}
.exam-panel-left,
.exam-panel-right {
    flex: 1; overflow-y: auto; background: #fff; border-radius: 16px;
    padding: 24px; border: 1px solid #e2e8f0;
}

/* ─── Exam: Section Tabs ────────────────────────────── */
.exam-section-tabs { display: flex; gap: 4px; margin-bottom: 16px; flex-wrap: wrap; }
.exam-section-tab {
    padding: 6px 14px; border-radius: 8px; font-size: 0.82rem;
    font-weight: 600; cursor: pointer; border: 2px solid #e2e8f0;
    color: #64748b; background: #f8fafc; transition: all 0.2s;
}
.exam-section-tab.active { background: var(--brand-primary); color: #fff; border-color: var(--brand-primary); }

/* ─── Exam: Questions ───────────────────────────────── */
.exam-question {
    margin-bottom: 24px !important;
    padding-bottom: 20px !important;
    border-bottom: 1px solid #f1f5f9;
    text-align: left !important;
}
.exam-question:last-child { border-bottom: none; }
.exam-q-number {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 28px; height: 28px;
    min-width: 28px;
    border-radius: 50%;
    background: var(--brand-primary) !important;
    color: #fff !important;
    font-weight: 700;
    font-size: 0.82rem;
    margin-right: 8px;
    flex-shrink: 0;
}
.exam-q-text {
    font-size: 0.95rem;
    color: #1e293b;
    font-weight: 600;
    margin-bottom: 12px;
    text-align: left !important;
}

/* ─── Exam: MCQ Options ─────────────────────────────── */
.exam-option {
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 10px !important;
    padding: 10px 14px !important;
    border: 2px solid #e2e8f0 !important;
    border-radius: 10px !important;
    margin-bottom: 8px !important;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.9rem;
    text-align: left !important;
    width: 100%;
    box-sizing: border-box;
}
.exam-option:hover { border-color: #c7d2fe !important; background: #f8fafc; }
.exam-option.selected { border-color: var(--brand-primary) !important; background: var(--brand-primary-light) !important; }
.exam-option input[type="radio"] {
    display: inline-block !important;
    margin: 0 !important;
    padding: 0 !important;
    width: 18px !important;
    height: 18px !important;
    min-width: 18px;
    accent-color: var(--brand-primary);
    flex-shrink: 0;
    position: relative !important;
    appearance: auto !important;
    -webkit-appearance: auto !important;
}
.exam-option span {
    flex: 1;
    text-align: left !important;
    line-height: 1.4;
}

/* ─── Exam: Options Inline (TOEIC short options) ─────── */
.exam-options-wrapper.options-inline {
    display: flex;
    flex-direction: row !important;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
}
.exam-options-wrapper.options-inline .exam-option {
    width: auto !important;
    flex: 1 1 0;
    min-width: 60px;
    justify-content: center !important;
    margin-bottom: 0 !important;
}

/* ─── Exam: Fill Input ──────────────────────────────── */
.exam-fill-input {
    width: 100% !important;
    max-width: 400px;
    padding: 12px 16px !important;
    border: 2px solid #e2e8f0 !important;
    border-radius: 10px !important;
    font-size: 0.9rem !important;
    transition: all 0.2s;
    outline: none !important;
    text-align: left !important;
    background: #fff !important;
    color: #1e293b !important;
    height: auto !important;
    box-shadow: none !important;
    -webkit-appearance: none !important;
    line-height: 1.5 !important;
}
.exam-fill-input:focus {
    border-color: var(--brand-primary) !important;
    box-shadow: 0 0 0 3px rgba(232, 125, 42, 0.1) !important;
}
.exam-fill-input::placeholder {
    color: #94a3b8 !important;
    font-weight: 400;
}

/* ─── Exam: Essay / Speaking Textarea ──────────────── */
.exam-essay-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-size: 0.9rem;
    font-family: inherit;
    transition: all 0.2s;
    outline: none;
    background: #fff;
    color: #1e293b;
    resize: vertical;
    line-height: 1.6;
}
.exam-essay-input:focus {
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px rgba(232, 125, 42, 0.1);
}
.exam-essay-input::placeholder {
    color: #94a3b8;
    font-weight: 400;
}
.exam-speaking-prompt {
    margin-top: 4px;
}

/* ─── Exam: Panels override — chống style.css can thiệp ─── */
.exam-panel-left,
.exam-panel-right {
    text-align: left !important;
}
.exam-panel-right .exam-question * {
    text-align: left;
}

/* ─── Exam: Answer Sheet ────────────────────────────── */
.exam-answer-sheet {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 999;
    background: #fff; border-top: 1px solid #e2e8f0;
    padding: 10px 20px; display: flex !important; align-items: center;
    justify-content: flex-start !important;
    gap: 6px; overflow-x: auto; box-shadow: 0 -2px 8px rgba(0,0,0,0.04);
}
.exam-answer-cell {
    display: inline-flex !important; align-items: center; justify-content: center;
    width: 32px; height: 32px; border-radius: 6px; font-size: 0.78rem;
    font-weight: 700; border: 2px solid #e2e8f0; color: #64748b;
    cursor: pointer; transition: all 0.15s; flex-shrink: 0;
}
.exam-answer-cell:hover { border-color: #c7d2fe; }
.exam-answer-cell.answered { background: var(--brand-primary); border-color: var(--brand-primary); color: #fff; }
.exam-answer-cell.current { border-color: #f59e0b; box-shadow: 0 0 0 2px rgba(245,158,11,0.3); }

/* ─── Exam: Audio & Passage ─────────────────────────── */
.exam-audio-player {
    background: #f8fafc; border-radius: 12px; padding: 16px;
    margin-bottom: 16px; display: flex !important; align-items: center; gap: 12px;
}
.exam-audio-player audio { width: 100%; height: 40px; }
.exam-passage { font-size: 0.92rem; line-height: 1.8; color: #374151; text-align: left !important; }
.exam-passage p { margin-bottom: 12px; }

/* ─── Exam: Group Context (Table/Summary Completion) ── */
.exam-group-context {
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    border-radius: 12px;
    padding: 16px 20px;
    margin-bottom: 16px;
    font-size: 0.9rem;
    line-height: 1.7;
    color: #0c4a6e;
}
.exam-group-context table {
    width: 100%;
    border-collapse: collapse;
    margin: 8px 0;
}
.exam-group-context table th,
.exam-group-context table td {
    border: 1px solid #bae6fd;
    padding: 8px 12px;
    text-align: left;
    font-size: 0.85rem;
}
.exam-group-context table th {
    background: #e0f2fe;
    font-weight: 700;
    color: #075985;
}
.exam-group-context p { margin-bottom: 8px; }
.exam-group-context strong { color: #0369a1; }

/* ═══════ Result ════════════════════════════════════ */
.result-hero {
    background: linear-gradient(135deg, #059669 0%, #10b981 100%);
    border-radius: 20px; padding: 40px; color: #fff;
    text-align: center; position: relative; overflow: hidden;
}
.result-hero::before {
    content: ''; position: absolute; right: -60px; top: -60px;
    width: 250px; height: 250px; background: rgba(255,255,255,0.08);
    border-radius: 50%;
}
.result-score-circle {
    width: 160px; height: 160px; border-radius: 50%;
    background: rgba(255,255,255,0.15); border: 6px solid rgba(255,255,255,0.4);
    display: flex; flex-direction: column; align-items: center;
    justify-content: center; margin: 0 auto 16px;
}
.result-score-value { font-size: 2.4rem; font-weight: 900; }
.result-score-label { font-size: 0.85rem; opacity: 0.85; }
.result-test-title { font-size: 1.1rem; font-weight: 600; opacity: 0.9; margin-bottom: 4px; }
.result-stats { display: flex; justify-content: center; gap: 32px; margin-top: 20px; flex-wrap: wrap; }
.result-stat { text-align: center; }
.result-stat-val { font-size: 1.6rem; font-weight: 800; }
.result-stat-lbl { font-size: 0.78rem; opacity: 0.8; }

/* ─── Result: Section Breakdown ─────────────────────── */
.result-section-card {
    background: #fff; border-radius: 16px; border: 1px solid #e2e8f0;
    padding: 20px; margin-bottom: 12px;
}
.result-section-header {
    display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px;
}
.result-section-title { font-weight: 700; color: #1e293b; font-size: 0.95rem; }
.result-section-score { font-weight: 800; color: #059669; font-size: 1.05rem; }
.result-progress-bar { height: 8px; border-radius: 4px; background: #e2e8f0; overflow: hidden; }
.result-progress-fill { height: 100%; border-radius: 4px; transition: width 0.8s ease; }

/* ─── Result: Type Breakdown ────────────────────────── */
.result-type-card {
    background: #fff; border-radius: 16px; border: 1px solid #e2e8f0; padding: 20px;
}
.result-type-row {
    display: flex; justify-content: space-between; align-items: center;
    padding: 10px 0; border-bottom: 1px solid #f1f5f9;
}
.result-type-row:last-child { border-bottom: none; }
.result-type-name { font-weight: 600; color: #374151; font-size: 0.9rem; }
.result-type-score { font-weight: 700; color: var(--brand-primary); }

/* ─── Result: Action Buttons ────────────────────────── */
.result-actions { display: flex; justify-content: center; gap: 12px; margin-top: 32px; flex-wrap: wrap; }
.result-btn {
    padding: 12px 28px; border-radius: 12px; font-weight: 700;
    font-size: 0.95rem; text-decoration: none; transition: all 0.2s;
}
.result-btn-review { background: var(--brand-primary); color: #fff; }
.result-btn-review:hover { background: var(--brand-primary-hover); color: #fff; box-shadow: 0 4px 16px rgba(232, 125, 42, 0.3); }
.result-btn-retake { background: #f1f5f9; color: #374151; border: 2px solid #e2e8f0; }
.result-btn-retake:hover { border-color: var(--brand-primary-border); color: var(--brand-primary); }
.result-btn-library { background: #f1f5f9; color: #64748b; }
.result-btn-library:hover { color: #374151; }

/* ═══════ Review ════════════════════════════════════ */
.review-header {
    background: #fff; border-radius: 16px; border: 1px solid #e2e8f0;
    padding: 20px 24px; margin-bottom: 20px;
    display: flex; justify-content: space-between; align-items: center;
    flex-wrap: wrap; gap: 12px;
}
.review-header-left h4 { font-weight: 700; color: #1e293b; margin-bottom: 4px; }
.review-header-left p { color: #64748b; font-size: 0.9rem; margin: 0; }
.review-header-right { display: flex; gap: 8px; }
.review-back-btn {
    padding: 8px 20px; border-radius: 10px; font-weight: 600;
    text-decoration: none; font-size: 0.9rem; transition: all 0.2s;
}
.review-back-result { background: var(--brand-primary); color: #fff; }
.review-back-result:hover { background: var(--brand-primary-hover); color: #fff; }
.review-back-library { background: #f1f5f9; color: #64748b; }
.review-back-library:hover { color: #374151; }

/* ─── Review: Section ───────────────────────────────── */
.review-section {
    background: #fff; border-radius: 16px; border: 1px solid #e2e8f0;
    margin-bottom: 20px; overflow: hidden;
}
.review-section-header {
    padding: 16px 24px; background: #f8fafc; border-bottom: 1px solid #e2e8f0;
    font-weight: 700; color: #1e293b; font-size: 1rem;
    display: flex; justify-content: space-between; align-items: center;
}
.review-section-body { padding: 20px 24px; }

/* ─── Review: Questions ─────────────────────────────── */
.review-question { padding: 16px 0; border-bottom: 1px solid #f1f5f9; }
.review-question:last-child { border-bottom: none; }
.review-q-header { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 12px; }
.review-q-number {
    display: inline-flex; align-items: center; justify-content: center;
    width: 28px; height: 28px; border-radius: 50%;
    font-weight: 700; font-size: 0.82rem; color: #fff; flex-shrink: 0;
}
.review-q-correct { background: #10b981; }
.review-q-wrong { background: #ef4444; }
.review-q-unanswered { background: #94a3b8; }
.review-q-text { font-size: 0.92rem; color: #1e293b; font-weight: 600; }

/* ─── Review: Answers ───────────────────────────────── */
.review-answer-row { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 8px; padding-left: 38px; }
.review-answer-item { padding: 6px 14px; border-radius: 8px; font-size: 0.85rem; font-weight: 600; }
.review-your-answer { border: 2px solid #ef4444; color: #dc2626; background: #fef2f2; }
.review-your-answer.correct { border-color: #10b981; color: #059669; background: #ecfdf5; }
.review-correct-answer { border: 2px solid #10b981; color: #059669; background: #ecfdf5; }

/* ─── Review: MCQ Options ───────────────────────────── */
.review-option {
    display: flex; align-items: flex-start; gap: 8px;
    padding: 8px 12px; border-radius: 8px; margin-bottom: 6px;
    font-size: 0.88rem; margin-left: 38px;
}
.review-option-correct { background: #ecfdf5; border: 1px solid #a7f3d0; }
.review-option-wrong { background: #fef2f2; border: 1px solid #fecaca; }
.review-option-neutral { background: #f8fafc; border: 1px solid #e2e8f0; }

/* ─── Review: Explanation ───────────────────────────── */
.review-explanation {
    margin-top: 12px; margin-left: 38px;
    background: #eff6ff; border-radius: 10px; padding: 12px 16px;
    font-size: 0.88rem; color: #1e40af; line-height: 1.6;
}
.review-explanation strong { color: #1d4ed8; }

/* ─── Review: Passage Toggle ────────────────────────── */
.review-passage-toggle {
    color: var(--brand-primary); font-weight: 600; cursor: pointer;
    font-size: 0.85rem; text-decoration: underline;
}
.review-passage-content {
    display: none; margin-top: 12px; padding: 16px;
    background: #f8fafc; border-radius: 10px; font-size: 0.88rem;
    line-height: 1.7; color: #374151; max-height: 300px; overflow-y: auto;
}

/* ─── Custom Pagination ─────────────────────────────── */
.pt-pagination .pagination {
    gap: 6px;
}
.pt-pagination .page-item .page-link {
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    color: #64748b;
    font-weight: 500;
    padding: 8px 16px;
    box-shadow: none;
    transition: all 0.2s ease;
}
.pt-pagination .page-item:not(.active):not(.disabled) .page-link:hover {
    background: var(--brand-primary-light);
    border-color: var(--brand-primary-border);
    color: var(--brand-primary-hover);
}
.pt-pagination .page-item.active .page-link {
    background: var(--brand-primary);
    border-color: var(--brand-primary);
    color: #ffffff;
}
.pt-pagination .page-item.disabled .page-link {
    background: #f8fafc;
    color: #cbd5e1;
    border-color: #f1f5f9;
}
.pt-pagination .page-item:first-child .page-link,
.pt-pagination .page-item:last-child .page-link {
    border-radius: 8px;
}

/* ═══════ TOEIC Layout ═════════════════════════════ */

/* TOEIC body: thay thế exam-body, chứa toàn bộ nội dung */
.exam-body--toeic {
    display: block;
    height: auto;
    margin-top: 60px;
    padding: 16px;
    padding-bottom: 80px; /* chừa chỗ cho answer sheet */
}

/* Section Tabs cho TOEIC — nằm trên cùng, full-width */
.toeic-section-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 16px;
    flex-wrap: wrap;
    background: #fff;
    border-radius: 12px;
    padding: 8px;
    border: 1px solid #e2e8f0;
    
    /* Sticky Navigation */
    position: sticky;
    top: 80px; /* Chừa khoảng không cho header hệ thống */
    z-index: 99;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05); /* Đổ bóng để tách biệt khỏi nội dung cuộn bên dưới */
}

/* Section-level audio (toàn Part) */
.toeic-section-audio {
    background: #f8fafc;
    border-radius: 12px;
    padding: 12px 16px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid #e2e8f0;
}
.toeic-section-audio audio { width: 100%; height: 40px; }

/* ─── TOEIC: Single Column Layout (Part 1-5) ──────── */
.toeic-single-section {
    max-width: 100%;
    margin: 0 auto;
}

/* Question cards — dạng card cho TOEIC single column */
/* Group card (LMS Style) */
.toeic-group-card {
    background: #fff;
    border-radius: 14px;
    border: 1px solid #e2e8f0;
    padding: 24px;
    margin-bottom: 24px;
    transition: box-shadow 0.2s;
}
.toeic-group-card:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.05);
}

.toeic-question-item {
    position: relative;
    width: 100%;
}

/* Audio Player styling */
.toeic-q-audio {
    margin-bottom: 16px;
    background: #f8fafc;
    border-radius: 8px;
    padding: 8px 16px;
    display: flex;
    align-items: center;
    border: 1px solid #e2e8f0;
    width: 100%;
    box-sizing: border-box;
}
.toeic-q-audio audio {
    height: 36px;
    outline: none;
    flex: 1;
    width: 100%;
}

/* Image styling */
.toeic-q-image {
    margin-bottom: 16px;
}
.toeic-q-image img {
    max-width: 100%;
    max-height: 350px;
    border-radius: 4px;
    object-fit: contain;
}

/* Content wrapper (Question Number + Text + Options) */
.toeic-q-content-wrapper {
    position: relative;
    padding-left: 42px; /* Dành chỗ cho số câu hỏi */
    min-height: 32px;
}

/* Question text layout */
.exam-q-text {
    font-size: 1.05rem;
    font-weight: 500;
    margin-bottom: 12px;
    line-height: 1.5;
    color: #1e293b;
}
.exam-q-text:empty {
    margin-bottom: 0;
    display: none;
}

/* LMS Style MCQ Options */
.exam-options-wrapper {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* ─── Exam: MCQ Options ─────────────────────────────── */
.exam-option {
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 10px !important;
    padding: 10px 14px !important;
    border: 2px solid #e2e8f0 !important;
    border-radius: 10px !important;
    margin-bottom: 8px !important;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.9rem;
    text-align: left !important;
    width: 100%;
    box-sizing: border-box;
}
.exam-option:hover { border-color: #c7d2fe !important; background: #f8fafc; }
.exam-option.selected { border-color: var(--brand-primary) !important; background: var(--brand-primary-light) !important; }
.exam-option input[type="radio"] {
    display: inline-block !important;
    margin: 0 !important;
    padding: 0 !important;
    width: 18px !important;
    height: 18px !important;
    min-width: 18px;
    accent-color: var(--brand-primary);
    flex-shrink: 0;
    position: relative !important;
    appearance: auto !important;
    -webkit-appearance: auto !important;
}
.exam-option span {
    flex: 1;
    text-align: left !important;
    line-height: 1.4;
}
/* MCQ option chứa hình ảnh (HSK Listening) */
.exam-option span img {
    max-width: 150px;
    max-height: 120px;
    object-fit: contain;
    border-radius: 6px;
    display: block;
    margin: 4px 0;
}

/* ─── Exam: Options Inline (TOEIC short options) ─────── */
.exam-options-wrapper.options-inline {
    display: flex;
    flex-direction: row !important;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
}
.exam-options-wrapper.options-inline .exam-option {
    width: auto !important;
    flex: 1 1 0;
    min-width: 60px;
    justify-content: center !important;
    margin-bottom: 0 !important;
}

/* ─── TOEIC: Split Layout (Part 6-7, có passage) ──── */
.toeic-split-section {
    display: flex;
    gap: 16px;
    height: calc(100vh - 60px - 80px);
}
.toeic-split-section .exam-panel-left,
.toeic-split-section .exam-panel-right {
    flex: 1;
    overflow-y: auto;
    background: #fff;
    border-radius: 16px;
    padding: 24px;
    border: 1px solid #e2e8f0;
}

/* ═══════ Responsive ════════════════════════════════ */
@media (max-width: 768px) {
    .exam-body { flex-direction: column; height: auto; }
    .exam-panel-left,
    .exam-panel-right { max-height: 50vh; }
    .exam-topbar-title { max-width: 150px; font-size: 0.85rem; }
    .pt-hero { padding: 32px 24px; }
    .pt-hero h1 { font-size: 1.6rem; }
    .pt-detail-hero { padding: 28px 20px; }
    .pt-detail-title { font-size: 1.4rem; }

    /* TOEIC responsive */
    .toeic-split-section { flex-direction: column; height: auto; }
    .toeic-split-section .exam-panel-left,
    .toeic-split-section .exam-panel-right { max-height: 50vh; }
    .toeic-question-layout { flex-direction: column; gap: 16px; }
    .toeic-question-right { min-width: 100%; }
    .toeic-question-card { padding: 16px; }
    .toeic-q-image img { max-height: 250px; }
}

/* ═══════ HSK Layout ═══════════════════════════════ */

/* HSK body: sử dụng cùng base như TOEIC (block, không flex 2 cột) */
.exam-body--hsk {
    display: block;
    height: auto;
    margin-top: 60px;
    padding: 16px;
    padding-bottom: 80px;
}

/* HSK Group Context: grid 2 cột cho hình A-F */
.hsk-group-context {
    background: #fefce8;
    border: 1px solid #fde68a;
    border-radius: 14px;
    padding: 20px 24px;
    margin-bottom: 20px;
    font-size: 0.92rem;
    line-height: 1.7;
    color: #78350f;
}
/* Grid layout cho các item hình ảnh A-F trong group context */
.hsk-group-context img {
    max-width: 100%;
    max-height: 180px;
    object-fit: contain;
    border-radius: 8px;
    display: block;
    margin: 4px auto;
}
/* Study4 crawled content thường có table → grid hóa */
.hsk-group-context table {
    width: 100%;
    border-collapse: collapse;
}
.hsk-group-context table td {
    padding: 10px 14px;
    vertical-align: middle;
    text-align: center;
    border: 1px solid #fde68a;
    font-weight: 600;
    color: #92400e;
    font-size: 0.9rem;
}
.hsk-group-context table td img {
    max-height: 160px;
}

/* HSK Group Card */
.hsk-group-card {
    background: #fff;
    border-radius: 14px;
    border: 1px solid #e2e8f0;
    padding: 24px;
    margin-bottom: 24px;
    transition: box-shadow 0.2s;
}
.hsk-group-card:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.05);
}

/* HSK Question Item */
.hsk-question-item {
    position: relative;
    width: 100%;
}

/* HSK per-question audio */
.hsk-q-audio {
    margin-bottom: 14px;
}
.hsk-q-audio audio {
    height: 36px;
    width: 100%;
    max-width: 500px;
}

/* HSK per-question image */
.hsk-q-image {
    margin-bottom: 14px;
    text-align: center;
}
.hsk-q-image img {
    max-width: 100%;
    max-height: 250px;
    border-radius: 8px;
    object-fit: contain;
    border: 1px solid #e2e8f0;
}

/* HSK Ruby tags (Pinyin) — render giống Study4 */
.hsk-q-text {
    font-size: 1.15rem;
    line-height: 2.8;           /* Đủ cao để pinyin không chồng lên dòng trên */
    letter-spacing: 0.02em;
    color: #1e293b;
    font-weight: 600;
}
.hsk-q-text ruby {
    ruby-align: center;
    margin: 0 1px;              /* Spacing giữa các chữ Hán */
}
.hsk-q-text ruby rt {
    font-size: 0.55em;
    color: #6366f1;
    font-weight: 400;
    letter-spacing: 0;
    line-height: 1;
}
/* Không override font-size cho tất cả span (gây conflict) */
.hsk-q-text > span {
    font-size: inherit;
}

/**
 * Fix lỗi xuống dòng chữ Hán có pinyin (ruby):
 * Global CSS `a, span { display: inline-block }` ép span trong ruby thành
 * inline-block → trình duyệt bẻ dòng tại khoảng trắng sau dấu phẩy.
 * Override về inline để text chạy liền trên 1 dòng.
 */
.hsk-q-text ruby span,
.hsk-q-text span,
.hsk-group-context ruby span,
.hsk-group-context span,
.hsk-passage ruby span,
.hsk-passage span {
    display: inline !important;
}

/* Group context cũng cần ruby styling */
.hsk-group-context ruby rt {
    font-size: 0.55em;
    color: #6366f1;
}
.hsk-group-context {
    line-height: 2.4;
}

/* HSK Passage (Reading Part 2) */
.hsk-passage {
    font-size: 1rem;
    line-height: 2;
    color: #374151;
    text-align: left;
}
.hsk-passage ruby rt {
    font-size: 0.6em;
    color: #6366f1;
}

/* ─── HSK: Ordering (sắp xếp câu — Writing Part 3) ─── */
.hsk-ordering-container {
    width: 100%;
}
.hsk-ordering-items {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 10px;
    padding: 14px 18px;
    margin-bottom: 12px;
    font-size: 1.05rem;
    line-height: 1.8;
    color: #166534;
}
/* Ordering item cards (từ crawled HTML) */
.hsk-ordering-items .question-ordering-item,
.hsk-ordering-items div[class*="ordering-item"] {
    display: inline-block;
    background: #fff;
    border: 2px solid #86efac;
    border-radius: 8px;
    padding: 6px 14px;
    margin: 4px 6px;
    font-weight: 600;
    font-size: 1rem;
    color: #15803d;
    cursor: default;
    transition: all 0.2s;
}
.hsk-ordering-items .question-ordering-item:hover,
.hsk-ordering-items div[class*="ordering-item"]:hover {
    background: #dcfce7;
    border-color: #4ade80;
    transform: translateY(-1px);
}

.hsk-ordering-answer {
    margin-top: 8px;
}
.hsk-ordering-input {
    max-width: 100% !important;
    font-size: 1rem !important;
}

/* ─── HSK: Single Column Layout ────────────────────── */
.exam-body--hsk .toeic-single-section {
    max-width: 100%;
    margin: 0 auto;
    padding: 0 16px;
}

/* ─── HSK: Responsive ──────────────────────────────── */
@media (max-width: 768px) {
    .exam-body--hsk .toeic-split-section {
        flex-direction: column;
        height: auto;
    }
    .exam-body--hsk .toeic-split-section .exam-panel-left,
    .exam-body--hsk .toeic-split-section .exam-panel-right {
        max-height: 50vh;
    }
    .hsk-group-context table td img {
        max-height: 100px;
    }
    .hsk-q-image img {
        max-height: 180px;
    }
}

