/* =================================================================== */
/* CẤU TRÚC & LAYOUT CƠ BẢN CỦA BÀI THI
/* =================================================================== */
.ate-test-container {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    background-color: #fff;
    padding: 2.5%;
    border-radius: 12px;
    border: 1px solid #e0e0e0;
    max-width: 1000px;
    margin: 20px auto;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
}
.ate-main-layout { display: flex; flex-wrap: wrap; gap: 25px; }
.all-questions-pane { flex: 1; min-width: 0; text-align: justify; }
.ate-sidebar { width: 100%; max-width: 300px; flex-shrink: 0; background-color: #f9fafb; padding: 20px; border: 1px solid #e5e7eb; border-radius: 8px; }
@media (min-width: 768px) { .ate-sidebar { width: 280px; } }

/* Sidebar dính (sticky) */
.ate-main-layout .ate-sidebar {
    position: -webkit-sticky;
    position: sticky;
    top: 50px; 
    align-self: flex-start;
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 120px); 
}
.ate-sidebar .ate-navigation {
    flex-grow: 1;
    overflow-y: auto;
    padding-right: 10px;
    overflow-x: auto;
    max-height: 30vh;
}
.ate-sidebar .ate-submit-btn {
    flex-shrink: 0; 
}


/* =================================================================== */
/* CÁC THÀNH PHẦN GIAO DIỆN BÊN TRONG BÀI THI
/* =================================================================== */
.ate-header { border-bottom: 1px solid #e5e7eb; padding-bottom: 15px; margin-bottom: 25px; display: flex; justify-content: space-between; align-items: center; gap: 15px; }
.ate-header h2 { margin: 0; font-size: 24px; font-weight: 600; color: var(--ate-primary-color, #475569); text-align: center; flex-grow: 1; }
.ate-timer-display { font-size: 18px; font-weight: bold; color: var(--ate-primary-color, #475569); background: var(--ate-light-bg, #f8fafc); padding: 8px 15px; border-radius: 20px; border: 1px solid var(--ate-primary-color-light, rgba(71, 85, 105, 0.3)); white-space: nowrap; }

.single-question-block { background: #fff; padding-bottom: 20px; margin-bottom: 20px; border-bottom: 1px solid #e5e7eb; }
.single-question-block .question-content { font-size: 16px; line-height: 1.7; color: #374151; }
.single-question-block .answers-list { margin-top: 20px; list-style: none; padding: 0; display: grid; gap: 12px; }
.answers-list label { display: flex; align-items: center; padding: 15px; border: 1px solid #d1d5db; border-radius: 8px; cursor: pointer; transition: all 0.2s ease-in-out; }
.answers-list label:hover { border-color: var(--ate-primary-color, #475569); background-color: var(--ate-light-bg, #f8fafc); }
.answers-list input[type="radio"], .answers-list input[type="checkbox"] { margin-right: 10px; }
.answers-list .answer-option.selected { border-color: var(--ate-primary-color, #475569); background-color: var(--ate-light-bg, #f8fafc); box-shadow: 0 0 0 2px var(--ate-primary-color-light, rgba(71, 85, 105, 0.3)); }

.ate-sidebar h4 { margin-top: 0; margin-bottom: 15px; font-size: 16px; font-weight: 600; }
.ate-navigation {
    display: grid;
    grid-template-columns: repeat(5, 1fr); 
    gap: 5px;
}
.ate-nav-item { display: flex; justify-content: center; align-items: center; width: 38px; height: 38px; border: 1px solid #d1d5db; border-radius: 50%; cursor: pointer; background-color: #fff; font-weight: 500; transition: all 0.2s; }
.ate-nav-item.answered { background-color: var(--ate-answered-color, #10b981); color: #fff; border-color: var(--ate-answered-color, #10b981); }
.ate-submit-btn { width: 100%; padding: 12px; margin-top: 20px; background-color: var(--ate-primary-color, #475569); color: #fff; border: none; border-radius: 8px; font-size: 18px; font-weight: bold; cursor: pointer; transition: background-color 0.2s; }
.ate-submit-btn:hover { opacity: 0.9; }

.quiz-reading-passage { text-align: justify; }

/* =================================================================== */
/* THEME MÀU
/* =================================================================== */
.theme-slate { --ate-primary-color: #475569; --ate-primary-color-light: rgba(71, 85, 105, 0.3); --ate-light-bg: #f8fafc; --ate-answered-color: #059669; --ate-secondary-color: #6c757d; }
.theme-ocean { --ate-primary-color: #0ea5e9; --ate-primary-color-light: rgba(14, 165, 233, 0.3); --ate-light-bg: #f0f9ff; --ate-answered-color: #22c55e; --ate-secondary-color: #6c757d; }
.theme-forest { --ate-primary-color: #16a34a; --ate-primary-color-light: rgba(22, 163, 74, 0.3); --ate-light-bg: #f0fdf4; --ate-answered-color: #16a34a; --ate-secondary-color: #556b2f; }
.theme-ruby { --ate-primary-color: #e11d48; --ate-primary-color-light: rgba(225, 29, 72, 0.3); --ate-light-bg: #fff1f2; --ate-answered-color: #14b8a6; --ate-secondary-color: #6c757d; }
.theme-indigo { --ate-primary-color: #4338ca; --ate-primary-color-light: rgba(67, 56, 202, 0.3); --ate-light-bg: #eef2ff; --ate-answered-color: #10b981; --ate-secondary-color: #6c757d; }


/* =================================================================== */
/* MÀN HÌNH BẮT ĐẦU, KẾT QUẢ VÀ XEM LẠI
/* =================================================================== */
.ate-start-screen { text-align: center; padding: 40px 20px; }
.ate-start-screen h2 { font-size: 26px; color: var(--ate-primary-color, #475569); margin-bottom: 15px; }
.ate-start-screen p { font-size: 16px; color: #4b5563; line-height: 1.7; max-width: 600px; margin: 15px auto; }
.ate-start-btn { padding: 12px 30px; background-color: var(--ate-primary-color, #475569); color: #fff; border: none; border-radius: 8px; font-size: 18px; font-weight: bold; cursor: pointer; }

.ate-results-header h2 { font-size: 24px; font-weight: 600; color: var(--ate-primary-color, #475569); margin-bottom: 20px; text-align: center; }
.ate-result { text-align: left; padding: 10px; }
.ate-results-actions { text-align: center; margin-top: 25px; padding-top: 25px; border-top: 1px solid #eee; display: flex; justify-content: center; gap: 15px; flex-wrap: wrap; }
.ate-results-actions button { padding: 12px 25px; font-size: 16px; cursor: pointer; border-radius: 8px; color: white; border: none; font-weight: 600; }
.ate-results-actions .review-answers-btn { background-color: var(--ate-answered-color, #28a745); }
.ate-results-actions .try-again-btn { background-color: #007bff; }
.ate-results-actions .back-to-list-btn { background-color: var(--ate-secondary-color, #6c757d); color: white; }
.back-to-list-btn { background-color: #fff; color: #4b5563; border: 1px solid #d1d5db; padding: 8px 15px; border-radius: 6px; cursor: pointer; font-size: 14px; font-weight: 500; transition: all 0.2s; }
.back-to-list-btn:hover { border-color: var(--ate-primary-color, #475569); color: var(--ate-primary-color, #475569); background-color: #e5e7eb; }

/* Chế độ xem lại */
.review-mode .ate-header h2 .review-title { color: var(--ate-answered-color, #10b981); }
.review-mode .ate-sidebar .review-actions { display: flex; flex-direction: column; gap: 10px; }
.review-mode .ate-sidebar .review-actions button { width: 100%; padding: 12px; font-size: 16px; font-weight: 600; border-radius: 8px; border: none; cursor: pointer; color: #fff; }
.review-mode .ate-sidebar .try-again-btn { background-color: #007bff; }
.review-mode .ate-sidebar .back-to-list-btn { background-color: #6c757d; }
.review-mode .answer-option, .review-mode .answer-option label { cursor: default; pointer-events: none; }
.review-mode .answer-option.is-correct-answer { border: 2px solid var(--ate-answered-color, #10b981) !important; }
.review-mode .answer-option.user-correct { background-color: #e9f7ec !important; border-color: var(--ate-answered-color, #10b981) !important; }
.review-mode .answer-option.user-incorrect { background-color: #fbe9e9 !important; border-color: #dc3545 !important; }

/* =================================================================== */
/* CÁC LAYOUT ĐẶC BIỆT (READING/LISTENING STICKY)
/* =================================================================== */
.ate-test-container.layout-reading-sticky,
.ate-test-container.layout-listening-sticky { padding: 0; border: none; box-shadow: none; max-width: 1280px; }
.ate-test-container.layout-reading-sticky .ate-header,
.ate-test-container.layout-listening-sticky .ate-header { padding: 15px 3.5%; border-bottom: 1px solid #e0e0e0; }

.layout-reading-sticky .quiz-reading-passage-sticky { position: sticky; top: 32px; z-index: 100; background: #fdfdfd; border-bottom: 2px solid #e0e0e0; padding: 20px 2.5%; height: 30vh; overflow-y: auto; box-sizing: border-box; text-align: justify; }
.layout-reading-sticky .reading-bottom-section { display: flex; flex-wrap: nowrap; gap: 30px; padding: 30px 2.5%; }
.layout-reading-sticky .reading-bottom-section .all-questions-pane { flex: 1; min-width: 0; text-align: justify; }
.layout-reading-sticky .reading-bottom-section .ate-sidebar { width: 320px; flex-shrink: 0; position: sticky; top: calc(30vh + 32px + 30px); height: fit-content; }

.layout-listening-sticky .reading-listening-body { display: flex; gap: 30px; padding: 20px 2.5%; align-items: flex-start; }
.layout-listening-sticky .all-questions-pane { flex: 1; min-width: 0; text-align: justify;}
.layout-listening-sticky .sticky-audio-player { position: sticky; top: 0px; z-index: 100; background: #fff; padding: 15px; border-radius: 8px; box-shadow: 0 4px 10px rgba(0,0,0,0.08); margin-bottom: 25px; }
.layout-listening-sticky .sticky-audio-player audio { width: 100%; }
.layout-listening-sticky .ate-sidebar { width: 280px; flex-shrink: 0; position: sticky; top: 0px; }


/* =================================================================== */
/* DANH SÁCH ĐỀ THI [advanced_test_list]
/* =================================================================== */
.ate-list-container { max-width: 1100px; margin: 30px auto; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
.ate-list-container h2 { text-align: center; font-size: 36px; font-weight: 700; margin-bottom: 50px; margin-top: 40px; color: var(--ate-primary-color, #475569); position: relative; padding-bottom: 20px; }
.ate-list-container h2::after { content: ''; display: block; width: 80px; height: 4px; background-color: var(--ate-primary-color, #475569); border-radius: 2px; position: absolute; bottom: 0; left: 50%; transform: translateX(-50%); }
.ate-list-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 25px; }
.ate-card { background: #fff; border: 1px solid #e5e7eb; border-radius: 12px; padding: 20px; display: flex; flex-direction: column; box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05); transition: transform 0.2s; }
.ate-card:hover { transform: translateY(-5px); }
.card-tags-wrapper { display: flex; flex-wrap: wrap; gap: 8px; align-self: flex-start; }
.ate-card .card-tag { align-self: auto; background-color: var(--ate-light-bg, #f8fafc); color: var(--ate-primary-color, #475569); padding: 4px 10px; border-radius: 99px; font-size: 12px; font-weight: 600; }
.ate-card .card-title { font-size: 18px; font-weight: 600; margin: 15px 0; flex-grow: 1; }
.ate-card .card-meta { display: flex; flex-wrap: wrap; gap: 15px; font-size: 14px; color: #6b7280; margin-bottom: 20px; border-top: 1px solid #f3f4f6; padding-top: 15px; }
.ate-card .card-meta span { display: flex; align-items: center; gap: 5px; }
.ate-card .card-meta span svg { flex-shrink: 0; }
.ate-card .card-button { background-color: var(--ate-primary-color, #475569); color: #fff; text-align: center; padding: 12px; border-radius: 8px; font-weight: 600; cursor: pointer; }


/* =================================================================== */
/* BỘ LỌC CHO DANH SÁCH ĐỀ THI
/* =================================================================== */
.ate-controls-container {
    background-color: #f8fafc;
    padding: 20px;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    margin-bottom: 40px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}
.ate-filters { display: flex; flex-wrap: wrap; gap: 5px; justify-content: center; }
.ate-filters .filter-btn { background-color: #fff; color: #4b5563; border: 1px solid #d1d5db; padding: 8px 20px; border-radius: 99px; font-size: 14px; font-weight: 500; cursor: pointer; }
.ate-filters .filter-btn.active { background-color: var(--ate-primary-color, #475569); color: #fff; border-color: var(--ate-primary-color, #475569); }

.ate-secondary-filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 15px; width: 100%; }

.ate-number-filter-container,
.ate-practice-test-filter-container,
.ate-part-filter-container,
.ate-university-filter-container,
.ate-de-number-filter-container,
.ate-phan-number-filter-container { display: flex; flex-direction: column; align-items: flex-start; gap: 5px; }

.ate-filter-label { font-size: 13px; font-weight: 500; color: #4b5563; white-space: nowrap; }

#ate-number-filter,
#ate-practice-test-filter,
#ate-part-filter,
#ate-university-filter,
#ate-de-number-filter,
#ate-phan-number-filter {
    width: 100%;
    padding: 8px 15px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-weight: 500;
    color: #374151;
    background-color: #fff;
    -webkit-appearance: none; -moz-appearance: none; appearance: none;
    background-image: url('data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%236b7280%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E');
    background-repeat: no-repeat;
    background-position: right 15px top 50%;
    background-size: .65em auto;
    padding-right: 40px;
    transition: border-color 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
    cursor: pointer;
    font-size: 14px;
}
#ate-number-filter:hover, #ate-practice-test-filter:hover, #ate-part-filter:hover, #ate-university-filter:hover { border-color: #d1d5db; }
#ate-number-filter:focus, #ate-practice-test-filter:focus, #ate-part-filter:focus, #ate-university-filter:focus { outline: none; border-color: var(--ate-primary-color, #475569); box-shadow: 0 0 0 3px var(--ate-primary-color-light, rgba(71, 85, 105, 0.3)); }

.ate-search-container { grid-column: span 2; align-self: end; }
#ate-search-input { width: 100%; padding: 9px 15px; border: 1px solid #d1d5db; border-radius: 8px; font-size: 14px; }


/* =================================================================== */
/* HERO SECTION & CÁC THÀNH PHẦN PHỤ
/* =================================================================== */
.ate-category-description-wrapper { margin-bottom: 30px; }
.ate-category-description-wrapper p:first-child { margin-top: 0; }
.ate-category-description-wrapper p:last-child { margin-bottom: 0; }
.ate-hero-section { color: #fff; padding: 25px 20px; border-radius: 16px; margin: 0 auto; max-width: 1100px; text-align: center; box-shadow: 0 10px 25px rgba(0,0,0,0.1); }
.ate-hero-container { max-width: 800px; margin: 0 auto; }
.ate-hero-badge { display: inline-block; background-color: rgba(255, 255, 255, 0.15); padding: 8px 16px; border-radius: 99px; font-size: 14px; font-weight: 500; margin-bottom: 20px; }
.ate-hero-title { font-size: 42px; font-weight: 700; color: #fff; margin-bottom: 15px; line-height: 1.2; }
.ate-hero-description { font-size: 16px; line-height: 1.7; opacity: 0.9; margin-bottom: 30px; }
.ate-hero-filters { display: flex; justify-content: center; gap: 15px; flex-wrap: wrap; margin-bottom: 40px; }
.ate-hero-filters .filter-tag { padding: 10px 25px; border-radius: 99px; text-decoration: none; font-weight: 600; transition: transform 0.2s, box-shadow 0.2s; box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1), inset 0 1px 1px rgba(255, 255, 255, 0.2); }
.ate-hero-filters .filter-tag:hover { transform: scale(1.05) translateY(-2px); box-shadow: 0 8px 12px rgba(0, 0, 0, 0.15), inset 0 1px 1px rgba(255, 255, 255, 0.2); }
.ate-feature-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; margin-bottom: 40px; }
.ate-feature-item { background-color: rgba(0, 0, 0, 0.15); border: 1px solid rgba(255, 255, 255, 0.2); padding: 20px; border-radius: 12px; font-size: 16px; font-weight: 500; display: flex; align-items: center; justify-content: center; gap: 10px; text-align: left; box-shadow: inset 0 2px 2px rgba(0, 0, 0, 0.2), inset 0 -1px 1px rgba(255, 255, 255, 0.1); transition: transform 0.2s; }
.ate-feature-item:hover { transform: scale(1.02); }
.feature-icon { font-size: 20px; }
.ate-main-cta-button { display: inline-block; padding: 15px 40px; border-radius: 99px; text-decoration: none; font-size: 18px; font-weight: 700; box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2), inset 0 2px 2px rgba(255, 255, 255, 0.3); transition: all 0.3s; border-bottom: 3px solid rgba(0, 0, 0, 0.2); }
.ate-main-cta-button:hover { filter: brightness(1.1); transform: translateY(-4px); box-shadow: 0 8px 15px rgba(0, 0, 0, 0.25), inset 0 2px 2px rgba(255, 255, 255, 0.3); }
.ate-main-cta-button:active { transform: translateY(-1px); box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2), inset 0 2px 2px rgba(255, 255, 255, 0.3); }

.ate-list-disclaimer { max-width: 800px; margin: -20px auto 40px auto; padding: 15px 25px; background-color: var(--ate-light-bg, #f8f9fa); border: 1px solid var(--ate-primary-color-light, #e9ecef); border-radius: 12px; text-align: center; font-size: 14px; color: var(--ate-secondary-color, #6c757d); line-height: 1.7; font-style: italic; }


/* =================================================================== */
/* THỐNG KÊ ẢO & CÁC THÀNH PHẦN LIÊN QUAN
/* =================================================================== */
.ate-card .card-stats-wrapper { margin-bottom: 15px; margin-top: -5px; }
.ate-card .card-rating { display: flex; align-items: center; gap: 8px; }
.ate-card .stars-container { position: relative; display: inline-block; color: #d1d5db; font-size: 16px; line-height: 1; }
.ate-card .stars-foreground { position: absolute; top: 0; left: 0; white-space: nowrap; overflow: hidden; color: #f59e0b; }
.ate-card .rating-text { font-size: 13px; color: #6b7280; font-weight: 500; }
.ate-start-screen .ate-start-stats { display: flex; justify-content: center; align-items: center; gap: 20px; flex-wrap: wrap; margin: 20px 0; }
.ate-start-screen .stat-item { display: flex; align-items: center; gap: 8px; background-color: #f8f9fa; padding: 8px 15px; border-radius: 99px; font-size: 14px; font-weight: 500; color: #495057; }
.ate-start-screen .stat-item svg { flex-shrink: 0; }
.ate-start-screen .rating-stat .stars-container { position: relative; display: inline-block; color: #d1d5db; font-size: 18px; line-height: 1; }
.ate-start-screen .rating-stat .stars-foreground { position: absolute; top: 0; left: 0; white-space: nowrap; overflow: hidden; color: #f59e0b; }
.ate-start-screen .rating-stat strong { font-size: 15px; color: #212529; }
.ate-start-screen .rating-stat span { font-size: 13px; color: #6c757d; }

.ate-related-tests { margin-top: 40px; padding-top: 40px; border-top: 1px solid #e9ecef; }
.ate-related-tests h3 { text-align: center; font-size: 24px; font-weight: 600; color: var(--ate-primary-color, #475569); margin-bottom: 30px; }
.ate-related-tests .related-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 15px; }
.ate-related-tests .related-card { display: block; padding: 20px 15px; background-color: #fff; border: 1px solid #dee2e6; border-radius: 8px; text-align: center; font-weight: 500; color: #495057; text-decoration: none; transition: all 0.2s ease-in-out; box-shadow: 0 2px 4px rgba(0,0,0,0.04); cursor: pointer; }
.ate-related-tests .related-card:hover { transform: translateY(-3px); border-color: var(--ate-primary-color, #475569); color: var(--ate-primary-color, #475569); box-shadow: 0 5px 15px rgba(0,0,0,0.08); }


/* =================================================================== */
/* HIỆU ỨNG SPINNER CHO NÚT BẤM
/* =================================================================== */
.ate-btn-loading { cursor: wait; display: inline-flex !important; align-items: center; justify-content: center; }
.ate-btn-loading .button-spinner { display: inline-block; width: 18px; height: 18px; border: 2px solid rgba(255, 255, 255, 0.5); border-top-color: #ffffff; border-radius: 50%; animation: spin 0.8s linear infinite; margin-right: 10px; }
@keyframes spin { to { transform: rotate(360deg); } }


/* =================================================================== */
/* RESPONSIVE (ĐIỀU CHỈNH CHO MÀN HÌNH NHỎ)
/* =================================================================== */
@media (max-width: 1024px) {
    /* Layout reading/listening sticky */
    .reading-listening-body, .ate-main-content-right { flex-direction: column; padding: 20px 5%; gap: 20px; }
    .reading-passage-pane-sticky { position: static; height: auto; max-height: 400px; border-right: none; border-bottom: 1px solid #e5e7eb; margin-bottom: 20px; padding-right: 0; flex-basis: auto; min-width: auto; }
    .sticky-audio-player { position: static; box-shadow: none; border-bottom: 2px solid #e5e7eb; border-radius: 0; margin-bottom: 15px; }
    .ate-main-content-right .ate-sidebar, .layout-listening-sticky .ate-sidebar { position: static; width: 100%; max-width: none; order: 2; margin-top: 20px; }
}

@media (max-width: 768px) {
    /* Tiêu đề chính của danh sách */
    .ate-list-container h2 { font-size: 28px; margin-bottom: 40px; }

    /* Hero section */
    .ate-hero-title { font-size: 32px; }
    .ate-feature-grid { grid-template-columns: 1fr; }
    
    /* Giao diện bên trong bài thi */
    .ate-header h2 { font-size: 14px; }
    .back-to-list-btn { font-size: 12px; padding: 6px 12px; }
    .ate-test-container.layout-reading-multiple-passages .ate-main-layout,
    .ate-test-container.layout-default .ate-main-layout { flex-direction: column; }
    .ate-test-container.layout-reading-multiple-passages .ate-sidebar,
    .ate-test-container.layout-default .ate-sidebar { position: static; width: 100%; max-width: none; margin-top: 30px; order: 2; max-height: none; }
    .ate-test-container.layout-reading-multiple-passages .ate-sidebar .ate-navigation,
    .ate-test-container.layout-default .ate-sidebar .ate-navigation { overflow-y: visible; max-height: none; }

    /* Bộ lọc */
    .ate-secondary-filters { grid-template-columns: 1fr 1fr; }
    .ate-search-container { grid-column: 1 / -1; }
}

/* =================================================================== */
/* LAYOUT ĐỀ THI & ĐÁP ÁN (FILE)
/* =================================================================== */
.ate-test-container.layout-file-answer .ate-file-viewer {
    margin-top: 20px;
    border: 1px solid #e0e0e0;
    min-height: 500px;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #f9f9f9;
}
.ate-test-container.layout-file-answer .ate-file-viewer img {
    max-width: 100%;
    height: auto;
    display: block;
}
.ate-test-container.layout-file-answer .ate-file-viewer iframe {
    border: none;
}
.ate-test-container.layout-file-answer .ate-file-actions {
    text-align: center;
    margin-top: 25px;
}
.ate-test-container.layout-file-answer .ate-show-answer-btn {
    padding: 12px 30px;
    background-color: var(--ate-primary-color, #475569);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
}
.ate-test-container.layout-file-answer .ate-show-answer-btn:hover {
    opacity: 0.9;
}
.ate-test-container.layout-file-answer .ate-show-answer-btn:disabled {
    background-color: #6c757d;
    cursor: not-allowed;
    display: none;
}

/* =================================================================== */
/* PHẦN ĐÁP ÁN CHO ĐỀ FILE
/* =================================================================== */
.ate-answer-viewer {
    margin-top: 40px;
    padding-top: 40px;
    border-top: 2px dashed #e0e0e0;
}
.ate-answer-viewer h3 {
    text-align: center;
    font-size: 24px;
    font-weight: 600;
    color: var(--ate-primary-color, #475569);
    margin-bottom: 25px;
}
.ate-answer-viewer img {
    max-width: 100%;
    height: auto;
    display: block;
    margin-left: auto;
    margin-right: auto;
    border: 1px solid #ddd;
}
.ate-answer-viewer iframe {
    border: 1px solid #ddd;
    display: block;
}

/* =================================================================== */
/* BỘ LỌC CẤP 3 (KỸ NĂNG)
/* =================================================================== */
.ate-filters-l3 {
    margin-top: 15px; /* Tạo khoảng cách với hàng lọc cấp 2 */
    padding-top: 15px;
    border-top: 1px solid #e5e7eb;
}

.ate-filters-l3 .filter-l3-btn {
    background-color: #475569; /* Màu nền xám đậm */
    color: #ffffff; /* Chữ màu trắng */
    border: none; /* Bỏ viền */
    padding: 8px 20px;
    border-radius: 25px; /* Bo góc vuông hơn */
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s ease-in-out;
}

.ate-filters-l3 .filter-l3-btn:hover {
    background-color: #64748b; /* Màu nền sáng hơn khi hover */
}

.ate-filters-l3 .filter-l3-btn.active {
    background-color: #16a34a; /* Màu xanh lá cây cho nút được chọn (giống theme forest) */
    box-shadow: 0 0 0 2px rgba(22, 163, 74, 0.4);
}

/* =================================================================== */
/* FULL SCREEN LOADER & SPINNER
/* =================================================================== */
.ate-full-screen-loader {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 300px; /* Chiều cao tối thiểu để spinner nằm giữa */
    width: 100%;
    text-align: center;
}

.ate-loader-content .ate-spinner {
    display: inline-block;
    width: 50px;
    height: 50px;
    border: 4px solid var(--ate-primary-color-light, rgba(71, 85, 105, 0.3));
    border-top-color: var(--ate-primary-color, #475569);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

.ate-loader-content p {
    font-size: 18px;
    font-weight: 500;
    color: var(--ate-secondary-color, #6c757d);
}

/* Tái sử dụng keyframe 'spin' đã có */
@keyframes spin { 
    to { transform: rotate(360deg); } 
}

/* =================================================================== */
/* MULTI-SET TABS LAYOUT
/* =================================================================== */
.ate-multi-header {
    margin-bottom: 25px;
    border-bottom: 1px solid #e5e7eb;
    padding-bottom: 0;
}

.ate-tabs-nav-wrapper {
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 5px;
}

.ate-tabs-nav {
    display: flex;
    gap: 15px; /* Khoảng cách giữa các tab */
}

.ate-tab-btn {
    background: none;
    border: none;
    padding: 10px 15px;
    font-size: 16px;
    font-weight: 500;
    color: #64748b;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all 0.2s;
    white-space: nowrap;
}

.ate-tab-btn:hover {
    color: var(--ate-primary-color, #475569);
    background-color: #f8fafc;
}

.ate-tab-btn.active {
    color: var(--ate-primary-color, #475569);
    border-bottom-color: var(--ate-primary-color, #475569);
    font-weight: 700;
}

/* HIỆN tiêu đề cho sub-test (Đã sửa lỗi ẩn) */
.ate-multi-content-area .ate-start-screen h2 {
    display: block !important;
    color: #2271b1; /* Màu xanh */
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px dashed #ddd;
}

.ate-multi-content-area {
    min-height: 400px;
}

/* =================================================================== */
/* MULTI-SET TABS & UI UPDATE
/* =================================================================== */
.ate-multi-header {
    margin-bottom: 25px;
    border-bottom: 1px solid #e5e7eb;
    padding-bottom: 0;
    text-align: center; /* Căn giữa nội dung header */
}

.ate-tabs-nav-wrapper {
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 0; /* Bỏ padding dưới */
    display: inline-block; /* Để căn giữa hoạt động */
    max-width: 100%;
}

.ate-tabs-nav {
    display: flex;
    gap: 5px; /* Giảm khoảng cách */
}

.ate-tab-btn {
    background: none;
    border: none;
    padding: 12px 20px;
    font-size: 16px;
    font-weight: 500;
    color: #64748b;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all 0.2s;
    white-space: nowrap;
    position: relative; /* Để đặt dấu tích */
}

.ate-tab-btn:hover {
    color: var(--ate-primary-color, #475569);
    background-color: #f8fafc;
}

.ate-tab-btn.active {
    color: var(--ate-primary-color, #475569);
    border-bottom-color: var(--ate-primary-color, #475569);
    font-weight: 700;
}

/* Dấu tích xanh khi hoàn thành */
.ate-tab-btn.completed::after {
    content: '✓';
    display: inline-block;
    margin-left: 5px;
    color: #10b981; /* Màu xanh lá */
    font-weight: bold;
}

/* Tiêu đề bộ đề con */
.ate-sub-test-title {
    text-align: center;
    font-size: 20px;
    font-weight: 600;
    margin: 0 0 20px 0;
    color: var(--ate-primary-color, #475569);
    padding-bottom: 10px;
    border-bottom: 1px dashed #e0e0e0;
}

/* Nút quay lại ở chế độ Multi Set */
.ate-multi-header .back-to-list-btn {
    float: left; /* Đẩy sang trái */
    margin-bottom: 10px;
}
/* Clear float */
.ate-multi-header::after {
    content: "";
    display: table;
    clear: both;
}

/* Tiêu đề màu xanh cho Bộ đề (Multi Set) */
.ate-start-screen h2.ate-title-blue {
    color: #2271b1 !important; /* Màu xanh WordPress */
    font-size: 22px;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px dashed #ddd;
}



/* Container bao ngoài nhóm câu hỏi */
.tf-group-wrapper {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 30px;
}

/* Phần đề bài chung */
.tf-context {
    font-size: 16px;
    line-height: 1.6;
    margin-bottom: 20px;
    color: #333;
    text-align: justify;
}

/* Style cho từng dòng câu hỏi con (a, b, c, d) */
.tf-sub-item.single-question-block {
    border-bottom: 1px dashed #eee; /* Đường kẻ mờ giữa các ý */
    padding-bottom: 10px;
    margin-bottom: 10px;
    background: transparent; /* Bỏ nền mặc định */
}

.tf-sub-item.single-question-block:last-child {
    border-bottom: none;
}

/* Ẩn tiêu đề "Câu 1, Câu 2..." do JS tự sinh ra */
.tf-sub-item h3 {
    display: none !important;
}

/* Nội dung câu hỏi con */
.tf-sub-item .question-content {
    font-size: 15px;
    margin-bottom: 8px;
    font-weight: 500;
}

/* Danh sách đáp án (Đúng/Sai) nằm ngang */
.tf-sub-item .answers-list {
    display: flex;
    gap: 20px; /* Khoảng cách giữa nút Đúng và Sai */
    margin-top: 5px;
}

/* Nút đáp án nhỏ gọn hơn */
.tf-sub-item .answers-list label {
    padding: 6px 15px;
    border-radius: 20px;
    font-size: 14px;
}

/* --- CHẾ ĐỘ XEM LẠI (REVIEW MODE) --- */
/* Thêm dấu X màu đỏ trước câu sai giống ảnh */
.review-mode .tf-sub-item:has(.user-incorrect) .question-content::before {
    content: "✕ ";
    color: red;
    font-weight: bold;
    font-size: 18px;
    margin-right: 5px;
}
/* Thêm dấu V màu xanh trước câu đúng (tùy chọn) */
.review-mode .tf-sub-item:has(.user-correct) .question-content::before {
    content: "✓ ";
    color: green;
    font-weight: bold;
    font-size: 18px;
    margin-right: 5px;
}

/* Style cho ô nhập liệu */
.ate-text-answer-wrapper {
    margin-top: 15px;
}
.ate-form-control {
    width: 100%;
    padding: 12px;
    border: 2px solid #d1d5db;
    border-radius: 8px;
    font-size: 16px;
    font-family: inherit;
    transition: border-color 0.2s;
    background: #fff;
}
.ate-form-control:focus {
    border-color: var(--ate-primary-color, #475569);
    outline: none;
    box-shadow: 0 0 0 3px rgba(71, 85, 105, 0.1);
}

/* Style kết quả Xem lại */
.ate-input-correct {
    border-color: #10b981 !important;
    background-color: #e9f7ec !important;
    color: #047857;
}
.ate-input-incorrect {
    border-color: #ef4444 !important;
    background-color: #fef2f2 !important;
}
.ate-correct-answer-text {
    margin-top: 10px;
    color: #10b981;
    font-weight: 500;
    padding: 10px;
    background: #f0fdf4;
    border-radius: 6px;
    border: 1px dashed #10b981;
}

/* Style kết quả Xem lại cho ô nhập liệu */
.ate-input-correct {
    border-color: #10b981 !important;
    background-color: #e9f7ec !important;
    color: #047857;
    font-weight: 500;
}
.ate-input-incorrect {
    border-color: #ef4444 !important;
    background-color: #fef2f2 !important;
}
.ate-correct-answer-text {
    margin-top: 10px;
    color: #10b981; /* Màu xanh lá */
    font-weight: 600;
    padding: 10px;
    background: #f0fdf4;
    border-radius: 6px;
    border: 1px dashed #10b981;
}

/* ======================================================== */
/* CSS CHO DẠNG CÂU HỎI ĐÚNG SAI (TRUE/FALSE GROUP) */
/* ======================================================== */

/* Style cho đoạn văn đề bài chung */
.tf-context, .group-context-wrapper {
    background: #f8f9fa;
    border-left: 4px solid #2271b1;
    padding: 15px;
    margin-bottom: 20px;
    font-size: 16px;
    line-height: 1.6;
    color: #333;
}

/* Style cho từng ý nhỏ (a, b, c, d) */
.single-question-block.tf-sub-item {
    border-bottom: 1px dashed #e0e0e0;
    padding-bottom: 15px;
    margin-bottom: 15px;
    display: flex;
    flex-direction: column;
}

/* Ẩn tiêu đề "Câu X" thừa thãi trong các ý nhỏ */
.single-question-block.tf-sub-item h3 {
    display: none !important;
}

/* Đẩy nội dung câu hỏi và đáp án nằm ngang (tùy chọn, nếu muốn gọn hơn) */
@media (min-width: 768px) {
    .single-question-block.tf-sub-item {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 20px;
    }
    .single-question-block.tf-sub-item .question-content {
        flex: 1;
        margin-bottom: 0;
    }
    .single-question-block.tf-sub-item .answers-list {
        margin-top: 0;
        flex-shrink: 0;
    }
}

/* Danh sách đáp án Đúng/Sai nằm ngang */
.tf-sub-item .answers-list {
    display: flex !important; /* Bắt buộc flex */
    gap: 15px;
    grid-gap: 15px; /* Hỗ trợ trình duyệt cũ */
    padding: 0;
    list-style: none;
}

/* Nút đáp án nhỏ gọn */
.tf-sub-item .answers-list label {
    padding: 6px 15px;
    border-radius: 20px;
    font-size: 14px;
    white-space: nowrap;
    border: 1px solid #ccc;
    cursor: pointer;
}
.tf-sub-item .answers-list label:hover {
    background-color: #f0f0f0;
}

/* Chỉnh sửa ô nhập liệu tự luận cho đẹp hơn */
.ate-text-answer-wrapper textarea {
    border: 1px solid #ccc;
    border-radius: 5px;
    padding: 10px;
    width: 100%;
    background: #fafafa;
    min-height: 50px;
}
.ate-text-answer-wrapper textarea:focus {
    background: #fff;
    border-color: #2271b1;
    outline: none;
    box-shadow: 0 0 5px rgba(34, 113, 177, 0.2);
}

/* ======================================================== */
/* STYLE CHO NHÓM CÂU HỎI ĐÚNG/SAI & ĐỀ BÀI CHUNG */
/* ======================================================== */

/* Khung chứa đề bài chung (Câu 2: Cho hàm số...) */
.group-context-wrapper .tf-context {
    background: #f0f7ff; /* Màu nền xanh nhạt */
    border-left: 4px solid #2271b1; /* Viền xanh bên trái */
    padding: 15px 20px;
    margin-bottom: 25px;
    border-radius: 0 4px 4px 0;
    font-size: 16px;
    color: #333;
    line-height: 1.6;
}

/* Style riêng cho các ý a, b, c, d (Class tf-sub-item) */
.single-question-block.tf-sub-item {
    border-bottom: 1px dashed #e0e0e0; /* Đường kẻ mờ ngăn cách */
    padding-bottom: 15px;
    margin-bottom: 15px;
    
    /* Layout Flex để nội dung bên trái, đáp án bên phải */
    display: flex;
    flex-direction: column; 
    gap: 10px;
}

/* Ẩn chữ "Câu X" thừa thãi trong các ý a,b,c,d */
.single-question-block.tf-sub-item h3 {
    display: none !important;
}

/* Trên màn hình máy tính: Xếp ngang */
@media (min-width: 768px) {
    .single-question-block.tf-sub-item {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }
    
    .single-question-block.tf-sub-item .question-content {
        flex: 1; /* Chiếm hết khoảng trống bên trái */
        margin-right: 20px;
        margin-bottom: 0;
        font-weight: 500;
    }
    
    .single-question-block.tf-sub-item .answers-list {
        flex-shrink: 0; /* Không bị co lại */
        margin-top: 0;
    }
}

/* Danh sách đáp án Đúng/Sai xếp ngang */
.tf-sub-item .answers-list {
    display: flex !important;
    gap: 15px;
    list-style: none;
    padding: 0;
    margin: 0;
}

/* Nút Đúng/Sai nhỏ gọn */
.tf-sub-item .answers-list .answer-option label {
    padding: 6px 15px;
    border-radius: 20px;
    font-size: 14px;
    white-space: nowrap;
    border: 1px solid #ccc;
    background: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
}

.tf-sub-item .answers-list .answer-option label:hover {
    background-color: #f1f1f1;
}

/* ======================================================== */
/* STYLE CHO Ô NHẬP LIỆU (TỰ LUẬN NGẮN) */
/* ======================================================== */
.ate-text-answer-wrapper {
    margin-top: 10px;
}
.ate-text-answer-wrapper textarea {
    width: 100%;
    padding: 10px 15px;
    border: 1px solid #ced4da;
    border-radius: 6px;
    background-color: #fafafa;
    font-size: 15px;
    transition: all 0.2s;
}
.ate-text-answer-wrapper textarea:focus {
    background-color: #fff;
    border-color: #2271b1;
    box-shadow: 0 0 0 3px rgba(34, 113, 177, 0.1);
    outline: none;
}

