/* =================================================================== */
/* CẤU TRÚC & LAYOUT CƠ BẢN */
/* =================================================================== */
.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; }
.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; } }

/* =================================================================== */
/* CẢI TIẾN SIDEBAR STICKY CHO LAYOUT MẶC ĐỊNH & NHIỀU ĐOẠN VĂN    */
/* =================================================================== */
.ate-main-layout .ate-sidebar {
    position: -webkit-sticky; /* Safari */
    position: sticky;
    top: 50px; 
    align-self: flex-start;
}

/* =================================================================== */
/* CÁC THÀNH PHẦN GIAO DIỆN */
/* =================================================================== */
.ate-header { border-bottom: 1px solid #e5e7eb; padding-bottom: 15px; margin-bottom: 25px; display: flex; justify-content: space-between; align-items: center; }
.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)); }

.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;
    /* Thay đổi ở dòng dưới đây: từ auto-fill thành cố định 5 cột */
    grid-template-columns: repeat(5, 1fr); 
    gap: 10px; /* Tăng khoảng cách một chút cho thoáng hơn */
}
.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; }

/* =================================================================== */
/* CÁC THEME MÀU */
/* =================================================================== */
/* CODE MỚI */
.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: #10b81; --ate-secondary-color: #6c757d; }

/* =================================================================== */
/* MÀN HÌNH BẮT ĐẦU & KẾT QUẢ */
/* =================================================================== */
.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-result { text-align: left; padding: 10px; }
.ate-results-header h2 { font-size: 24px; font-weight: 600; color: var(--ate-primary-color, #475569); margin-bottom: 20px; text-align: center; }


/* =================================================================== */
/* GIAO DIỆN READING & LISTENING (CHUẨN THEO CODE GỐC) */
/* =================================================================== */

/* --- Cấu hình chung cho các layout đặc biệt --- */
.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;
}

/* --- A. Cấu hình cho READING STICKY (Văn bản trên, 2 cột dưới) --- */

/* Phần 1: Đoạn văn ghim trên cùng */
.layout-reading-sticky .quiz-reading-passage-sticky {
    position: sticky;
    top: 32px; /* Dành cho admin bar của WordPress. Nếu không dùng admin bar, có thể đặt là 0 */
    z-index: 100;
    background: #fdfdfd;
    border-bottom: 2px solid #e0e0e0;
    padding: 20px 2.5%;
    height: 30vh; /* Chiều cao cố định bằng 40% màn hình */
    overflow-y: auto; /* Cho phép cuộn bên trong đoạn văn */
    box-sizing: border-box; /* Quan trọng */
    text-align: justify;
}

/* Phần 2: Khu vực 2 cột bên dưới */
.layout-reading-sticky .reading-bottom-section {
    display: flex;
    flex-wrap: nowrap;
    gap: 30px;
    padding: 30px 2.5%;
}
/* Cột trái: Câu hỏi */
.layout-reading-sticky .reading-bottom-section .all-questions-pane {
    flex: 1; /* Chiếm không gian còn lại */
    min-width: 0; 
}
/* Cột phải: Sidebar */
.layout-reading-sticky .reading-bottom-section .ate-sidebar {
    width: 320px;
    flex-shrink: 0;
    position: sticky;
    /* Vị trí ghim = chiều cao đoạn văn + khoảng cách top của đoạn văn + padding top của khu vực dưới */
    top: calc(30vh + 32px + 30px);
    height: fit-content;
}


/* --- B. Cấu hình cho LISTENING STICKY (2 cột cạnh nhau) --- */
.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;
}
.layout-listening-sticky .sticky-audio-player { 
    position: sticky; top: 50px; 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: 50px;
}

/* === CHO TABLET & MOBILE (<= 1024px) === */
@media (max-width: 1024px) {
    /* Chuyển layout 2 cột thành 1 cột */
    .reading-listening-body { 
        flex-direction: column; 
        padding: 20px 5%;
        gap: 20px;
    }
    
    /* Gỡ sticky cho cột đọc bên trái */
    .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;
    }

    /* Gỡ sticky cho audio player */
    .sticky-audio-player { 
        position: static; 
        box-shadow: none; 
        border-bottom: 2px solid #e5e7eb; 
        border-radius: 0; 
        margin-bottom: 15px;
    }

    /* Gỡ sticky cho sidebar của layout reading-sticky và listening-sticky */
    .ate-main-content-right .ate-sidebar, 
    .layout-listening-sticky .ate-sidebar { 
        position: static; 
        width: 100%; 
        max-width: none; 
        order: 2;
        margin-top: 20px;
    }
    .ate-main-content-right { 
        flex-direction: column; 
        gap: 20px;
    }
}


/* CODE MỚI */
/* =================================================================== */
/* NÚT BẤM VÀ XEM LẠI ĐÁP ÁN (ĐÃ CẬP NHẬT) */
/* =================================================================== */
/* CODE MỚI */
.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);
}
.back-to-list-btn:hover { background-color: #e5e7eb; }
.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; }


/* === GIAO DIỆN REVIEW MODE === */
.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 { cursor: default; pointer-events: none; }
.review-mode .answer-option label { cursor: default; }

/* Đáp án ĐÚNG của hệ thống (luôn có viền xanh) */
.review-mode .answer-option.is-correct-answer {
    border: 2px solid var(--ate-answered-color, #10b981) !important;
}

/* Người dùng chọn ĐÚNG (nền xanh lá nhạt) */
.review-mode .answer-option.user-correct {
    background-color: #e9f7ec !important;
    border-color: var(--ate-answered-color, #10b981) !important;
}

/* Người dùng chọn SAI (nền đỏ nhạt) */
.review-mode .answer-option.user-incorrect {
    background-color: #fbe9e9 !important;
    border-color: #dc3545 !important;
}
/* =================================================================== */
/* 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: 28px; margin-bottom: 30px; }
.ate-controls-container { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 20px; margin-bottom: 30px; }
.ate-filters { display: flex; justify-content: center; flex-wrap: wrap; gap: 10px; }
.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-search-container { flex-grow: 1; max-width: 350px; }
#ate-search-input { width: 100%; padding: 9px 15px; border: 1px solid #d1d5db; border-radius: 99px; font-size: 14px; }
.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); }
.ate-card .card-tag { align-self: flex-start; 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; 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-button { background-color: var(--ate-primary-color, #475569); color: #fff; text-align: center; padding: 12px; border-radius: 8px; font-weight: 600; cursor: pointer; }

/* =================================================================== */
/* HERO SECTION GIỚI THIỆU CHUYÊN MỤC ĐỀ THI                       */
/* =================================================================== */
.ate-category-description-wrapper {
    margin-bottom: 30px;
}

/* Gỡ bỏ thẻ p mặc định của WordPress */
.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; /* Đã có wrapper bao ngoài */
    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;
}

/* Tìm và thay thế quy tắc này */
.ate-hero-filters .filter-tag {
    /* Màu sắc được đặt inline */
    padding: 10px 25px;
    border-radius: 99px;
    text-decoration: none;
    font-weight: 600;
    transition: transform 0.2s, box-shadow 0.2s; /* Thêm transition cho box-shadow */
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1), inset 0 1px 1px rgba(255, 255, 255, 0.2); /* Hiệu ứng đổ bóng & viền trong */
}
.ate-hero-filters .filter-tag:hover {
    transform: scale(1.05) translateY(-2px); /* Hiệu ứng nhấc lên khi hover */
    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;
}
/* Tìm và thay thế quy tắc này */
.ate-feature-item {
    background-color: rgba(0, 0, 0, 0.15); /* Tăng độ đậm của nền để nổi bật hơn */
    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); /* Hiệu ứng nhấn vào trong */
    transition: transform 0.2s;
}

.ate-feature-item:hover {
    transform: scale(1.02); /* Phóng to nhẹ khi hover */
}

.feature-icon {
    font-size: 20px;
}

/* Tìm và thay thế quy tắc này */
.ate-main-cta-button {
    display: inline-block;
    /* Màu sắc được đặt inline */
    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); /* Hiệu ứng 3D mạnh hơn */
    transition: all 0.3s;
    border-bottom: 3px solid rgba(0, 0, 0, 0.2); /* Thêm viền dưới để tạo cảm giác nút bấm */
}
.ate-main-cta-button:hover {
    filter: brightness(1.1); /* Làm sáng màu hơn khi hover */
    transform: translateY(-4px); /* Nhấc lên cao hơn */
    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); /* Hiệu ứng nhấn xuống khi click */
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2), inset 0 2px 2px rgba(255, 255, 255, 0.3);
}

/* Responsive cho mobile */
@media (max-width: 768px) {
    .ate-hero-title {
        font-size: 32px;
    }
    .ate-feature-grid {
        grid-template-columns: 1fr; /* 1 cột trên mobile */
    }
}

/* =================================================================== */
/* TIÊU ĐỀ DANH SÁCH ĐỀ THI [advanced_test_list]                  */
/* =================================================================== */
.ate-list-container h2 {
    text-align: center;
    font-size: 36px;  /* Tăng kích thước cho nổi bật */
    font-weight: 700; /* Đậm hơn */
    margin-bottom: 50px; /* Tăng khoảng cách với lưới đề thi */
    margin-top: 40px; /* Thêm khoảng cách ở trên, tách biệt với phần giới thiệu */
    color: var(--ate-primary-color, #475569); /* Sử dụng màu của theme */
    position: relative; /* Cần thiết để định vị đường gạch chân */
    padding-bottom: 20px; /* Tạo không gian cho đường gạch chân */
}

/* Tạo một đường gạch chân trang trí ngắn ở dưới */
.ate-list-container h2::after {
    content: '';
    display: block;
    width: 80px; /* Độ rộng của đường gạch chân */
    height: 4px; /* Độ dày */
    background-color: var(--ate-primary-color, #475569); /* Cùng màu với chữ */
    border-radius: 2px; /* Bo tròn nhẹ các cạnh */
    
    /* Căn giữa đường gạch chân */
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
}

/* Responsive cho mobile */
@media (max-width: 768px) {
    .ate-list-container h2 {
        font-size: 28px;
        margin-bottom: 40px;
    }
}

/* =================================================================== */
/* CẢI TIẾN SIDEBAR - THÊM THANH CUỘN CHO DANH SÁCH CÂU HỎI     */
/* =================================================================== */

/* 1. Biến sidebar thành một flex container để dễ dàng quản lý không gian */
.ate-sidebar {
    display: flex;
    flex-direction: column;
    /* Giới hạn chiều cao tối đa của sidebar, trừ đi khoảng trống cho header/footer */
    /* Điều này quan trọng để thanh cuộn bên trong hoạt động đúng */
    max-height: calc(100vh - 120px); 
}

/* 2. Cho phép phần danh sách câu hỏi co giãn và có thanh cuộn */
.ate-sidebar .ate-navigation {
    flex-grow: 1; /* Cho phép phần tử này chiếm hết không gian dọc còn lại */
    overflow-y: auto; /* Tự động hiển thị thanh cuộn dọc khi cần */
    padding-right: 30px; /* Thêm một chút không gian để thanh cuộn không che mất nội dung */
    margin-right: -20px; /* Bù lại phần padding để căn chỉnh không bị lệch */
    max-height: 25vh;
}

/* 3. Đảm bảo nút Nộp bài không bị co lại và luôn ở dưới cùng */
.ate-sidebar .ate-submit-btn {
    flex-shrink: 0; 
}

/* Responsive cho mobile */
@media (max-width: 768px) {
    .ate-header h2 {
        font-size: 14px;
    }
    
    .back-to-list-btn {
        font-size: 10px;
    }
}

.quiz-reading-passage {
    text-align: justify;
}

/* =================================================================== */
/* RESPONSIVE CHO LAYOUT NHIỀU ĐOẠN VĂN (MOBILE)                  */
/* =================================================================== */

@media (max-width: 768px) {
    /* 1. Chuyển layout chính thành dạng cột */
    .ate-test-container.layout-reading-multiple-passages .ate-main-layout,
    .ate-test-container.layout-default .ate-main-layout {
        flex-direction: column;
    }

    /* 2. Gỡ bỏ chế độ sticky và đặt lại kích thước cho sidebar */
    .ate-test-container.layout-reading-multiple-passages .ate-sidebar,
    .ate-test-container.layout-default .ate-sidebar {
        position: static; /* Gỡ bỏ sticky */
        width: 100%;      /* Chiếm toàn bộ chiều rộng */
        max-width: none;  /* Bỏ giới hạn chiều rộng tối đa */
        margin-top: 30px; /* Tạo khoảng cách với phần câu hỏi ở trên */
        order: 2;         /* Quan trọng: Di chuyển sidebar xuống vị trí thứ 2 (dưới câu hỏi) */
        max-height: none; /* Bỏ giới hạn chiều cao để không bị cuộn vô lý */
    }

    /* 3. Gỡ bỏ thanh cuộn bên trong sidebar trên mobile */
    .ate-test-container.layout-reading-multiple-passages .ate-sidebar .ate-navigation,
    .ate-test-container.layout-default .ate-sidebar .ate-navigation {
        overflow-y: visible; /* Tắt thanh cuộn */
        max-height: none;    /* Bỏ giới hạn chiều cao */
    }
}

/* THÊM VÀO CUỐI FILE ate-style.css */
.card-tags-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    /* Ghi đè lên align-self của .card-tag cũ để đảm bảo căn trái */
    align-self: flex-start; 
}

.ate-card .card-tag {
    /* Bỏ align-self vì đã có wrapper xử lý */
    align-self: auto; 
}

/* THÊM VÀO CUỐI FILE ate-style.css */

/* THAY BẰNG KHỐI CODE MỚI NÀY */
/* Cải thiện layout cho khu vực control */
.ate-controls-container {
    display: flex;
    flex-wrap: wrap; /* Cho phép các item xuống dòng khi không đủ chỗ */
    gap: 15px;
    align-items: center; /* Căn giữa các item theo chiều dọc */
    justify-content: space-between; /* Căn đều các nhóm */
}

.ate-filters {
    margin-right: auto; /* Đẩy nhóm filter kỹ năng sang trái */
}

.ate-secondary-filters {
    display: flex;
    gap: 15px;
    align-items: center; /* Căn các bộ lọc phụ thẳng hàng */
}
/* THAY BẰNG KHỐI NÀY */
.ate-number-filter-container {
    display: flex;
    align-items: center;
    gap: 8px; /* Khoảng cách giữa nhãn và ô lọc */
}

.ate-filter-label {
    font-size: 14px;
    font-weight: 500;
    color: #4b5563;
    white-space: nowrap; /* Đảm bảo chữ không bị xuống dòng */
    flex-shrink: 0;
}

#ate-number-filter {
    min-width: 120px; /* Đặt độ rộng tối thiểu cho ô lọc */
}
.ate-search-container {
    min-width: 250px;
}

#ate-number-filter {
    width: 100%;
    padding: 8px 15px;
    border: 2px solid #e5e7eb; /* Viền dày hơn một chút */
    border-radius: 8px; /* Bo tròn vừa phải, đồng bộ với card */
    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; /* Thêm hiệu ứng chuyển động */
    cursor: pointer;
    font-size: 14px;
}

/* Làm nổi bật khi người dùng tương tác */
#ate-number-filter:hover {
    border-color: #d1d5db;
}
#ate-number-filter:focus {
    outline: none;
    border-color: var(--ate-primary-color, #475569); /* Đổi màu viền theo theme */
    box-shadow: 0 0 0 3px var(--ate-primary-color-light, rgba(71, 85, 105, 0.3)); /* Thêm hiệu ứng đổ bóng */
}

/* Responsive cho mobile */
@media (max-width: 900px) {
    .ate-controls-container {
        flex-direction: column;
        align-items: stretch;
    }
    .ate-secondary-filters {
        flex-direction: column;
        width: 100%;
    }
    .ate-set-filter-container,
    .ate-search-container {
        min-width: 100%;
        max-width: none;
    }
}

/* =================================================================== */
/* BỔ SUNG CSS CHO BỘ LỌC PRACTICE TEST                             */
/* =================================================================== */

.ate-practice-test-filter-container {
    display: flex;
    align-items: center;
    gap: 8px; /* Khoảng cách giữa nhãn và ô lọc */
}

#ate-practice-test-filter {
    min-width: 150px; /* Đặt độ rộng tối thiểu cho ô lọc */
    width: 100%;
    padding: 8px 15px;
    border: 2px solid #e5e7eb; /* Viền dày hơn một chút */
    border-radius: 8px; /* Bo tròn vừa phải, đồng bộ với card */
    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; /* Thêm hiệu ứng chuyển động */
    cursor: pointer;
    font-size: 14px;
}

#ate-practice-test-filter:hover {
    border-color: #d1d5db;
}
#ate-practice-test-filter:focus {
    outline: none;
    border-color: var(--ate-primary-color, #475569); /* Đổi màu viền theo theme */
    box-shadow: 0 0 0 3px var(--ate-primary-color-light, rgba(71, 85, 105, 0.3)); /* Thêm hiệu ứng đổ bóng */
}

/* Sửa lại độ rộng tối thiểu của search container để không bị đẩy quá nhiều */
.ate-search-container {
    min-width: 200px;
}

/* =================================================================== */
/* MỚI: BỔ SUNG CSS CHO BỘ LỌC PART                                 */
/* =================================================================== */

.ate-part-filter-container {
    display: flex;
    align-items: center;
    gap: 8px;
}

#ate-part-filter {
    min-width: 150px;
    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-part-filter:hover {
    border-color: #d1d5db;
}
#ate-part-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));
}

/* =================================================================== */
/* CSS CHO MODULE THỐNG KÊ ẢO (SOCIAL PROOF)                       */
/* =================================================================== */

.ate-card .card-stats-wrapper {
    margin-bottom: 15px;
    margin-top: -5px; /* Kéo lên gần title hơn */
}

.ate-card .card-rating {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ate-card .stars-container {
    position: relative;
    display: inline-block;
    color: #d1d5db; /* Màu sao nền (xám) */
    font-size: 16px;
    line-height: 1;
}

.ate-card .stars-foreground {
    position: absolute;
    top: 0;
    left: 0;
    white-space: nowrap;
    overflow: hidden;
    color: #f59e0b; /* Màu sao nổi (vàng) */
}

.ate-card .rating-text {
    font-size: 13px;
    color: #6b7280;
    font-weight: 500;
}

/* Căn chỉnh lại icon lượt làm bài trong card-meta */
.ate-card .card-meta span svg {
    flex-shrink: 0; /* Đảm bảo icon không bị co lại */
}

/* =================================================================== */
/* CSS CHO MIỄN TRỪ TRÁCH NHIỆM & THỐNG KÊ MÀN HÌNH BẮT ĐẦU        */
/* =================================================================== */

/* 1. Khối Miễn trừ trách nhiệm (Đã cập nhật để theo theme) */
.ate-list-disclaimer {
    max-width: 800px;
    margin: -20px auto 40px auto;
    padding: 15px 25px;
    background-color: var(--ate-light-bg, #f8f9fa); /* Sử dụng màu nền nhạt của theme */
    border: 1px solid var(--ate-primary-color-light, #e9ecef); /* Sử dụng màu viền nhạt của theme */
    border-radius: 12px; /* Bo tròn nhiều hơn cho mềm mại */
    text-align: center;
    font-size: 14px;
    color: var(--ate-secondary-color, #6c757d); /* Sử dụng màu chữ phụ của theme */
    line-height: 1.7;
    font-style: italic; /* In nghiêng để nhấn mạnh */
}

/* 2. Khối Thống kê ở màn hình bắt đầu */
.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; /* Màu sao nền */
    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; /* Màu sao nổi */
}

.ate-start-screen .rating-stat strong {
    font-size: 15px;
    color: #212529;
}

.ate-start-screen .rating-stat span {
    font-size: 13px;
    color: #6c757d;
}

/* =================================================================== */
/* CSS CHO KHỐI ĐỀ THI LIÊN QUAN (TRANG KẾT QUẢ)                    */
/* =================================================================== */

.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; /* THÊM DÒNG NÀY */
}

.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);
}

/* =================================================================== */
/* === CẢI TIẾN NÚT BẤM VỚI SPINNER =============================== */
/* =================================================================== */

/* Thêm vào nút bấm để căn chỉnh spinner và text */
.ate-submit-btn.ate-btn-loading {
    cursor: wait;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Spinner quay tròn */
.ate-btn-loading .button-spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.5); /* Màu nền mờ của vòng quay */
    border-top-color: #ffffff; /* Màu của phần đang quay */
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-right: 10px;
}

/* Animation cho spinner */
@keyframes spin {
  to { 
    transform: rotate(360deg); 
  }
}