.page-main-title {
    color: var(--primary-color); /* Màu xanh dương chủ đạo */
    font-weight: 800;
    text-transform: uppercase;
    font-size: 28px;
    margin-bottom: 10px;
    text-align: center;
}

.header-divider {
    width: 60px;
    height: 4px;
    background: var(--primary-color);
    margin: 0 auto 30px;
    border-radius: 2px;
}

.intro-box {
    background: var(--bg-light-color);
    border: 1px solid var(--primary-light-color); /* Sử dụng màu primary nhạt hơn */
    border-radius: 12px;
    padding: 20px;
    max-width: 800px;
    margin: 0 auto 40px;
    color: var(--text-color);
    font-size: 14px;
    line-height: 1.6;
}

/* Khung Lọc */
.filter-container {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    padding: 25px;
    margin-bottom: 40px;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.02);
}

/* Nút Category (Tròn, Bầu dục) */
.cat-filters {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.cat-btn {
    display: inline-block;
    padding: 8px 24px;
    border: 1px solid var(--border-color);
    border-radius: 30px;
    color: var(--text-color);
    text-decoration: none;
    font-weight: 500;
    font-size: 14px;
    transition: all 0.2s;
    background: #fff; /* Giữ trắng */
}

.cat-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.cat-btn.active {
    background: var(--primary-color);
    color: var(--button-text-color);
    border-color: var(--primary-color);
    box-shadow: 0 4px 10px var(--primary-color)30; /* Sử dụng màu primary với 30% opacity */
}

.filter-divider {
    border: 0;
    border-top: 1px solid #f1f5f9;
    margin: 20px 0;
}

/* Hàng lọc nâng cao */
.filter-row {
    display: flex;
    gap: 20px;
    align-items: flex-end;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.filter-group.flex-grow {
    flex-grow: 1;
    position: relative;
}

.filter-group label {
    font-size: 13px;
    font-weight: 600;
    color: #64748b;
}

.form-select, .form-input {
    padding: 10px 15px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    color: var(--text-color);
    outline: none;
    height: 42px;
    box-sizing: border-box;
}
.form-input {
    width: 100%;
    padding-right: 40px;
    background: var(--bg-light-color); /* Hoặc giữ #f8fafc */
}
.form-input:focus, .form-select:focus {
    border-color: var(--primary-color);
    background: #fff;
}

.search-icon-btn {
    position: absolute;
    right: 5px;
    bottom: 5px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 16px;
    height: 32px;
    width: 32px;
}

/* --- QUIZ CARD (STYLE MỚI - GIỐNG MẪU) --- */
.quiz-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 30px;
}

.quiz-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 20px; /* Giảm padding một chút */
    box-sizing: border-box; /* Đảm bảo padding không làm vỡ khung */
}

.quiz-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    border-color: #bae6fd;
}

.cat-label {
    display: inline-block;
    background: #e0f2fe;
    color: #0284c7;
    font-size: 12px;
    font-weight: 700;
    padding: 4px 12px;
    border-radius: 20px;
    margin-bottom: 15px;
}

.quiz-title {
    font-size: 18px;
    font-weight: 700;
    line-height: 1.5;
    margin: 0 0 10px 0;
    min-height: 54px;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.quiz-title a {
    text-decoration: none;
    color: #1e293b;
    transition: color 0.2s;
}
.quiz-card:hover .quiz-title a {
    color: #0ea5e9;
}

.quiz-rating {
    margin-bottom: 20px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 5px;
}
.quiz-rating .stars { color: #f59e0b; letter-spacing: 1px; }
.quiz-rating .rating-num { font-weight: 700; color: #475569; }
.quiz-rating .rating-count { color: #94a3b8; font-size: 13px; }

.quiz-meta {
    display: flex;
    gap: 20px;
    color: #64748b;
    font-size: 13px;
    margin-bottom: 25px;
    flex-grow: 1;
    border-top: 1px dashed #e2e8f0;
    padding-top: 15px;
}
.meta-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Sửa nút Luyện bộ đề -> Làm ngay */
.btn-practice {
    display: block;
    width: 100%;
    box-sizing: border-box; 
    text-align: center;
    background: var(--primary-color); /* Màu chủ đạo */
    color: var(--button-text-color) !important; /* Màu chữ nút */
    text-decoration: none;
    padding: 10px 0; 
    border-radius: 8px;
    font-weight: 700;
    font-size: 16px !important;
    transition: background 0.2s;
    margin-top: auto; 
}
.btn-practice:hover {
    background: var(--primary-color); /* Có thể làm màu đậm hơn hoặc giữ màu nguyên và dùng opacity */
    opacity: 0.9;
    box-shadow: 0 4px 6px -1px var(--primary-color)40; /* Bóng đổ từ màu primary */
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .filter-row { flex-direction: column; align-items: stretch; }
    .filter-group { width: 100%; }
    .page-main-title { font-size: 22px; }
}
/* --- NEW HOMEPAGE STYLES --- */
.hero-section {
    background-color: #f0f9ff;
    border: 1px solid #e0f2fe;
    padding: 60px 20px;
    border-radius: 16px;
    box-shadow: 0 8px 16px rgba(0,0,0,0.05);
}
.hero-section .page-main-title {
    font-size: 38px;
    margin-bottom: 15px;
    color: #0ea5e9;
}
.hero-section .lead {
    font-size: 18px;
    color: #475569;
    max-width: 700px;
    margin: 40px auto;
    text-align: center;
}
.search-hero-container {
    display: flex;
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
    border: 2px solid #0ea5e9;
    border-radius: 12px;
    overflow: hidden;
}
.hero-search-input {
    flex-grow: 1;
    padding: 12px 20px;
    border: none;
    outline: none;
    font-size: 16px;
    background-color: #fff;
}
.search-hero-btn {
    background: #0ea5e9;
    color: #fff;
    border: none;
    padding: 12px 25px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s;
}
.search-hero-btn:hover {
    background: #0284c7;
}

.section-header {
    text-align: center;
    margin-bottom: 40px;
}
.section-title {
    font-size: 30px;
    font-weight: 800;
    color: #1e293b;
    margin-bottom: 10px;
}
.section-divider {
    width: 80px;
    height: 4px;
    background: #0ea5e9;
    margin: 0 auto;
    border-radius: 2px;
}

.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 25px;
    margin-bottom: 50px;
}
/* Container chính của Card */
.category-card {
    display: flex;
    flex-direction: column;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
    height: 100%;
}

.category-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 20px rgba(0,0,0,0.1);
    border-color: var(--primary-color);
}

/* Phần bọc ảnh */
.category-img-wrapper {
    height: 140px;
    background: #f8fafc;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.cat-card-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cat-card-icon-placeholder {
    font-size: 40px;
    color: var(--primary-color);
}

/* Body của card */
.category-card-body {
    padding: 20px;
    flex-grow: 1;
}

.category-title {
    font-size: 18px;
    font-weight: 700;
    margin: 0 0 5px 0;
    color: #1e293b;
}

.category-count {
    font-size: 13px;
    color: #64748b;
    margin-bottom: 15px;
}

/* Danh sách con dạng tag */
.sub-category-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.sub-cat-item {
    font-size: 11px;
    background: #f1f5f9;
    color: #475569;
    padding: 4px 10px;
    border-radius: 4px;
    text-decoration: none;
    transition: all 0.2s;
}

.sub-cat-item:hover {
    background: var(--primary-color);
    color: #fff;
}

/* Footer & Nút xem tất cả */
.category-card-footer {
    padding: 15px 20px;
    border-top: 1px solid #f1f5f9;
}

.btn-view-all {
    font-size: 13px;
    font-weight: 600;
    color: var(--primary-color);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 5px;
}

.btn-view-all:hover {
    gap: 10px; /* Hiệu ứng dịch chuyển mũi tên */
}

/* --- NAVIGATION STYLES --- */
.main-nav .nav-item {
    color: #475569;
    text-decoration: none;
    font-weight: 500;
    margin: 0 5px;
    transition: color 0.2s;
}
.main-nav .nav-item:hover {
    color: #0ea5e9;
}
.main-nav .nav-divider {
    color: #94a3b8;
    margin: 0 5px;
}

/* Admin Bar Fix */
html.admin-bar .main-nav {
    margin-top: 32px; /* Dịch chuyển menu xuống dưới admin bar */
}
@media screen and (max-width: 782px) {
    html.admin-bar .main-nav {
        margin-top: 46px; /* Admin bar nhỏ hơn trên mobile */
    }
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .hero-section {
        padding: 40px 15px;
    }
    .hero-section .page-main-title {
        font-size: 28px;
    }
    .hero-section .lead {
        font-size: 16px;
    }
    .search-hero-container {
        flex-direction: column;
        border: none;
        border-radius: 0;
    }
    .hero-search-input {
        border: 1px solid #0ea5e9;
        border-radius: 8px;
        margin-bottom: 10px;
    }
    .search-hero-btn {
        border-radius: 8px;
    }
    .section-title {
        font-size: 24px;
    }
    .category-grid {
        grid-template-columns: 1fr;
    }
    .main-nav {
        display: none; /* Ẩn navigation phụ trên mobile nếu không có menu toggle */
    }
    header .logo {
        text-align: left;
        font-size: 20px;
    }
    .main-content-wrapper {
        padding: 10px;
    }
}

/* --- NEW NAVIGATION STYLES FOR MULTI-LEVEL MENU --- */
.main-nav {
    display: flex;
    justify-content: center; /* Căn giữa menu */
    margin: 15px auto;
}

.main-menu {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    gap: 15px; /* Khoảng cách giữa các mục menu chính */
}

/* --- FIX DESKTOP DROPDOWN --- */
.main-menu > li {
    position: relative;
    padding-bottom: 15px; /* Tạo vùng đệm để không mất hover khi rà chuột xuống */
    margin-bottom: -15px;
}

.dropdown-menu {
    position: absolute;
    top: 100%; /* Sát mép dưới của li */
    left: 0;
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.15); /* Đổ bóng đậm hơn cho rõ */
    min-width: 220px;
    z-index: 9999; /* Đảm bảo nằm trên cùng */
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    margin-top: 0; /* Đảm bảo không có khoảng cách */
}

/* Cầu nối ảo để giữ hover */
.dropdown-menu::before {
    content: "";
    position: absolute;
    top: -20px;
    left: 0;
    width: 100%;
    height: 20px;
    background: transparent;
}

.has-dropdown:hover .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Mũi tên chỉ xuống cho menu có con */
.dropdown-arrow {
    margin-left: 5px;
    font-size: 12px;
    transition: transform 0.3s;
}

.has-dropdown:hover .dropdown-arrow {
    transform: rotate(180deg);
}

.main-menu > li > a {
    display: flex;
    align-items: center;
    padding: 10px 15px;
    text-decoration: none;
    color: #fff; /* Màu chữ menu chính */
    font-weight: 700;
    font-size: 16px;
    transition: color 0.2s;
}

.main-menu > li > a:hover {
        color: #fff; /* Màu khi hover */
}

.user-profile .user-info .dropdown-arrow {
    margin-left: 8px;
    font-size: 14px; /* Tăng kích thước mũi tên */
    transition: transform 0.2s ease-in-out;
}

/* Rotate arrow when menu is active (JS adds/removes fa-chevron-up/down) */
.user-profile .user-info .fa-chevron-up {
    transform: rotate(180deg);
}

.dropdown-menu li a {
    display: block;
    padding: 10px 15px;
    text-decoration: none;
    color: #333;
    font-size: 15px;
    transition: background-color 0.2s, color 0.2s;
}

.dropdown-menu li a:hover {
    background-color: var(--bg-light-color); /* Sử dụng màu nền nhẹ */
    color: var(--primary-color); /* Sử dụng màu primary */
    border-radius: 6px;
}

/* Responsive for mobile */
@media (max-width: 768px) {
    .main-nav {
        /* Trên mobile, bạn có thể muốn ẩn menu này và thay bằng menu hamburger */
        display: none; 
    }
}

/* --- Breadcrumb Styles --- */
.breadcrumb {
    display: flex;
    flex-wrap: wrap;
    padding: 0;
    margin-bottom: 1rem;
    list-style: none;
    background-color: transparent;
    border-radius: .25rem;
}

.breadcrumb-item + .breadcrumb-item::before {
    display: inline-block;
    padding-right: .5rem;
    padding-left: .5rem;
    color: #6c757d;
    content: "/";
}

.breadcrumb-item a {
    color: #0ea5e9;
    text-decoration: none;
}

.breadcrumb-item.active {
    color: #6c757d;
}

/* Container nút lọc có ảnh */
.cat-btn-with-img {
    display: inline-flex !important;
    align-items: center;
    gap: 8px;
    padding: 6px 16px 6px 8px !important; /* Padding trái nhỏ lại để ảnh sát lề */
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 50px;
    transition: all 0.2s ease;
}

.cat-btn-with-img:hover {
    border-color: var(--primary-color);
    background: var(--bg-light-color);
}

/* Ảnh nhỏ trong nút */
.cat-btn-img {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    background: #f1f5f9;
}

/* Placeholder nếu không có ảnh */
.cat-btn-icon-placeholder {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f1f5f9;
    border-radius: 50%;
    font-size: 12px;
    color: #94a3b8;
}

.cat-btn-text {
    font-weight: 600;
    font-size: 14px;
}

/* Nút Active (đang chọn) */
.cat-btn.active {
    background: var(--primary-color) !important;
    color: #fff !important;
    border-color: var(--primary-color) !important;
}

.cat-btn.active .cat-btn-icon-placeholder {
    background: rgba(255,255,255,0.2);
    color: #fff;
}

/* Container bọc ngoài */
.sub-cat-grid-container {
    margin-bottom: 20px;
}

.sub-cat-title {
    font-size: 16px;
    font-weight: 700;
    color: #475569;
    margin-bottom: 15px;
    text-align: left;
}

/* Grid 4 cột */
.sub-cat-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr); /* Chia 4 cột bằng nhau */
    gap: 15px;
}

/* Style cho từng Card con */
.sub-cat-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 15px;
    text-decoration: none;
    transition: all 0.3s ease;
    text-align: center;
}

.sub-cat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 15px rgba(0,0,0,0.08);
    border-color: var(--primary-color);
}

/* Ảnh trong card con (to hơn cũ) */
.sub-cat-card-img {
    width: 60px; /* Độ rộng ảnh */
    height: 60px;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 10px;
    background: #f8fafc;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sub-cat-card-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.sub-cat-card-img i {
    font-size: 24px;
    color: var(--primary-color);
}

.sub-cat-card-name {
    font-size: 14px;
    font-weight: 700;
    color: #1e293b;
    line-height: 1.3;
}

/* Mobile: Chuyển về 2 cột */
@media (max-width: 768px) {
    .sub-cat-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Ép grid hiển thị 4 cột cho danh mục con */
.category-grid-4col {
    display: grid;
    grid-template-columns: repeat(4, 1fr) !important; /* Force 4 columns */
    gap: 20px;
}

/* Đảm bảo ảnh trong card danh mục con đồng bộ */
.category-grid-4col .category-img-wrapper {
    height: 120px; /* Thấp hơn trang chủ một chút để cân đối 4 cột */
}

/* Responsive: Tablet 2 cột, Mobile 1 cột */
@media (max-width: 1024px) {
    .category-grid-4col {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

@media (max-width: 600px) {
    .category-grid-4col {
        grid-template-columns: 1fr !important;
    }
}
/* --- NEW STYLES FOR USER AREA & ICONS - CẬP NHẬT (bao gồm MOBILE) --- */
header {
    background: var(--primary-color);
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    position: sticky;
    top: 0;
    z-index: 1000;
    
    /* [TỐI ƯU MỚI] Giúp chuyển động mượt hơn */
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    
    /* Kích hoạt GPU để không bị giật hình */
    will-change: transform; 
    transform: translateZ(0); 
}

/* Class ẩn header */
header.header-hidden {
    transform: translateY(-100%);
}

header .header-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
}

header .logo {
    font-size: 24px;
    font-weight: bold;
    text-decoration: none;
    color: #fff;
    display: block;
    text-align: left; /* Default desktop */
    flex-shrink: 0; /* Prevent shrinking on desktop */
}

/* Hamburger Menu Icon */
.hamburger-menu {
    display: none; /* Hidden by default on desktop */
    background: none;
    border: none;
    font-size: 24px;
    color: #fff;
    cursor: pointer;
    padding: 5px;
    flex-shrink: 0; /* Prevent shrinking */
}

/* Main Navigation (Desktop) */
.main-nav {
    display: flex; /* Default to flex for desktop */
    flex-grow: 1; /* Allow to take available space */
    justify-content: center; /* Center main menu links */
}

/* User Area Icon Container (Mobile Only Placeholder) */
.user-area-icon-container {
    flex-shrink: 0; /* Prevent shrinking */
}

.user-area-icon-container .user-avatar-mobile-icon,
.user-area-icon-container .auth-icon-mobile {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.2); /* Nền nhẹ cho icon trên header */
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    font-size: 16px;
    text-decoration: none;
}


/* Responsive: Bố cục Header trên Mobile (Hamburger | Logo | User/Auth Icon) */
@media (max-width: 768px) {
    header .header-wrapper {
        padding: 8px 15px;
        justify-content: space-between;
        align-items: center;
    }

    .hamburger-menu {
        display: block; /* Show hamburger on mobile */
        order: 1; /* First item */
        width: auto;
        margin: 0;
    }

    header .logo {
        flex-grow: 1; /* Allow logo to take available space */
        text-align: center; /* Center the logo text */
        font-size: 20px; /* Adjust font size */
        order: 2; /* Second item */
        margin: 0 10px; /* Space from hamburger and user icon */
    }

    .main-nav {
        display: none; /* Hide desktop main nav on mobile */
    }

    .user-area-icon-container {
        display: flex; /* Show user icon on mobile header */
        order: 3; /* Third item */
        margin: 0;
    }

    /* Ẩn hoàn toàn user area/auth buttons của desktop trên mobile */
    #userAreaDesktop {
        display: none !important;
    }
}


/* Admin Bar Fix (giữ nguyên) */
html.admin-bar header {
    top: 32px;
}
@media screen and (max-width: 782px) {
    html.admin-bar header {
        top: 46px;
    }
}

.user-profile {
    position: relative;
    z-index: 1000;
}

.user-profile .user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: #fff;
    font-weight: 700;
    font-size: 16px;
    padding: 8px 15px;
    border-radius: 8px;
    transition: background-color 0.2s;
    cursor: pointer; /* Cho biết đây là một nút */
}

.user-profile .user-info:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.user-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.user-username {
    max-width: 120px; /* Giới hạn độ rộng username trên desktop */
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.user-dropdown-menu {
    position: absolute;
    top: calc(100% + 10px); /* Dưới thanh user info một chút */
    right: 0; /* Căn phải với header */
    left: auto;
    min-width: 220px;
    background-color: #fff;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    z-index: 1001;

    /* Mặc định ẩn, sẽ hiện bằng JS */
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s;
}

.user-dropdown-menu.active { /* Class được thêm bởi JS */
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.user-dropdown-menu li a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 15px;
    color: var(--text-color);
    font-size: 15px;
    transition: background-color 0.2s, color 0.2s;
    text-decoration: none;
}

.user-dropdown-menu li a:hover {
    background-color: var(--bg-light-color);
    color: var(--primary-color);
}

.user-dropdown-menu li a .fas {
    width: 20px; /* Đảm bảo icon có cùng kích thước */
    text-align: center;
    color: #64748b;
}

.user-dropdown-menu li a:hover .fas {
    color: var(--primary-color);
}

.user-dropdown-menu li a.text-danger {
    color: #dc3545;
}
.user-dropdown-menu li a.text-danger .fas {
    color: #dc3545;
}
.user-dropdown-menu li a.text-danger:hover {
    background-color: rgba(220, 53, 69, 0.1);
    color: #bb2d3b;
}


/* Auth Buttons (Login/Register) */
.auth-buttons .btn {
    font-size: 14px;
    font-weight: 600;
    padding: 8px 15px;
    border-radius: 8px;
    transition: all 0.2s;
    text-decoration: none;
}
.auth-buttons .btn-light {
    background-color: #fff;
    color: var(--primary-color);
}
.auth-buttons .btn-light:hover {
    background-color: var(--bg-light-color);
    color: var(--primary-color);
}
.auth-buttons .btn-primary {
    background-color: var(--primary-color);
    color: var(--button-text-color);
    border: none;
}
.auth-buttons .btn-primary:hover {
    background-color: var(--primary-color);
    opacity: 0.9;
}
.auth-buttons .btn .fas {
    margin-right: 5px;
}

/* Quiz Card Actions (Collection/Favorite Icons) */
.quiz-card {
    position: relative; /* Đảm bảo các icon có thể định vị tương đối */
}

.quiz-card-actions {
    position: absolute;
    top: 15px;
    right: 15px;
    display: flex;
    gap: 8px;
}

.action-icon {
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    outline: none;
}

.action-icon:hover {
    background: #e0f2fe;
    border-color: #94a3b8;
}

.action-icon i {
    font-size: 16px;
    color: #64748b;
}

/* Filled states */
.action-icon .fas.fa-bookmark {
    color: var(--primary-color); /* Màu primary cho bookmark đã lưu */
}

.action-icon .fas.fa-heart {
    color: #ef4444; /* Màu đỏ cho trái tim yêu thích */
}

.action-icon:hover .fas.fa-bookmark {
    color: var(--primary-color);
}

.action-icon:hover .fas.fa-heart {
    color: #dc2626;
}

/* Responsive adjustments for user area */
@media (max-width: 768px) {
    header .container {
        padding: 10px;
    }
    header .logo {
        margin-bottom: 10px;
        text-align: left;
    }
    .main-nav {
        display: none; /* Hide main nav on mobile */
    }
    .user-area {
        width: 100%;
        justify-content: space-between;
        margin-top: 10px;
    }
    .user-profile .user-info {
        padding: 5px 10px;
    }
    .auth-buttons {
        width: 100%;
        display: flex;
        justify-content: space-around;
    }
    .auth-buttons .btn {
        flex: 1;
        text-align: center;
    }
    .user-dropdown-menu {
        position: static; /* Make it block level on mobile */
        width: 100%;
        border-top: 1px solid var(--border-color);
        border-radius: 0;
        box-shadow: none;
        opacity: 1;
        visibility: visible;
        transform: none;
        margin-top: 10px;
    }
    .user-profile:hover .dropdown-arrow {
        transform: none; /* Prevent arrow rotation on mobile */
    }
    .user-profile.has-dropdown .user-info .dropdown-arrow {
        display: none; /* Hide dropdown arrow on mobile */
    }
    .user-profile .user-info:after {
        content: ''; /* Remove pseudo element that might create space */
    }
    .quiz-card-actions {
        margin-top: 0px;
        justify-content: flex-end;
    }
}

/* --- Profile Page Styles --- */
.user-profile-avatar img {
    width: 80px;
    height: 80px;
    object-fit: cover;
}

.profile-details-list dt {
    font-weight: 600;
    color: #475569;
    margin-bottom: 8px;
}
.profile-details-list dd {
    margin-bottom: 8px;
    color: var(--text-color);
}

.profile-features-list .list-group-item {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    font-size: 15px;
    color: var(--text-color);
    transition: background-color 0.2s, color 0.2s;
    border-color: var(--border-color);
}

.profile-features-list .list-group-item:hover {
    background-color: var(--bg-light-color);
    color: var(--primary-color);
}
.profile-features-list .list-group-item:hover i {
    color: var(--primary-color);
}

.profile-features-list .list-group-item i {
    width: 25px; /* Giữ icon có kích thước cố định */
    text-align: center;
    color: #64748b;
}

.profile-features-list .list-group-item .badge {
    font-size: 0.75em;
    font-weight: 500;
    background-color: #e2e8f0;
    color: #fff;
}
.profile-features-list .list-group-item.text-danger:hover {
    background-color: rgba(220, 53, 69, 0.1);
}

/* --- MOBILE NAVIGATION OVERLAY (HAMBURGER MENU) --- */

/* Lớp phủ mờ toàn màn hình */
.mobile-nav-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    /* [QUAN TRỌNG] Tăng z-index lên mức cao nhất */
    z-index: 2147483647; /* Max safe integer */
    display: block;
    visibility: hidden;
    opacity: 0;
    transition: visibility 0.3s ease, opacity 0.3s ease;
}
/* Khi active thì hiện lên */
.mobile-nav-overlay.active {
    visibility: visible;
    opacity: 1;
}

/* Nội dung Menu trượt ra từ trái */
.mobile-nav-content {
    /* [QUAN TRỌNG] Đảm bảo nền trắng đục, không trong suốt */
    background-color: #fff;
    width: 85%;
    max-width: 300px;
    height: 100%;
    position: relative;
    z-index: 2147483648; /* Cao hơn overlay 1 đơn vị */
    /* ... các thuộc tính khác giữ nguyên ... */
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

/* Khi active thì trượt vào */
.mobile-nav-overlay.active .mobile-nav-content {
    transform: translateX(0);
}

/* Header bên trong Menu Mobile (Chứa nút đóng và tiêu đề) */
.mobile-menu-header-inside-overlay {
    background-color: var(--primary-color);
    padding: 15px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: white;
    flex-shrink: 0; /* Không bị co lại */
}

.mobile-menu-title-inside-overlay {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
}

.mobile-nav-close {
    background: none;
    border: none;
    color: white;
    font-size: 28px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Danh sách link trong menu */
.mobile-menu-list {
    list-style: none;
    padding: 10px 0;
    margin: 0;
}

.mobile-menu-list li {
    border-bottom: 1px solid #f0f0f0;
}

.mobile-menu-list li a {
    display: block;
    padding: 12px 20px;
    color: #333;
    text-decoration: none;
    font-size: 16px;
    font-weight: 500;
    transition: background 0.2s;
    display: flex;
    justify-content: space-between; /* Để mũi tên sub-menu nằm phải */
    align-items: center;
}

.mobile-menu-list li a:hover {
    background-color: #f9f9f9;
    color: var(--primary-color);
}

/* Container bọc Link và Nút toggle */
.menu-item-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0; /* Xóa padding ở đây, chuyển vào con */
}

/* Link chính (Tên menu) - Bấm là chuyển trang */
.mobile-menu-list li .menu-link {
    flex-grow: 1; /* Chiếm hết khoảng trống bên trái */
    padding: 12px 20px;
    color: #333;
    text-decoration: none;
    font-size: 16px;
    font-weight: 500;
    display: block; /* Để vùng click rộng */
}

/* Nút Toggle (Mũi tên) - Bấm là xổ menu */
.sub-menu-toggle {
    width: 50px; /* Vùng bấm đủ rộng */
    height: 48px; /* Bằng chiều cao dòng menu */
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-left: 1px solid #f0f0f0; /* Ngăn cách nhẹ */
    color: #666;
    transition: background 0.2s;
}

.sub-menu-toggle:hover {
    background-color: #f5f5f5;
    color: var(--primary-color);
}

/* Hiệu ứng xoay mũi tên khi mở */
.mobile-menu-list li.open .sub-menu-toggle .sub-menu-arrow {
    transform: rotate(180deg);
}

/* Menu con */
.mobile-sub-menu {
    list-style: none;
    padding: 0;
    margin: 0;
    background-color: #f9fafb;
    display: none; /* Mặc định ẩn */
    border-top: 1px solid #eee;
}

/* Hiện menu con khi li có class open */
.mobile-menu-list li.open > .mobile-sub-menu {
    display: block;
    animation: slideDown 0.3s ease;
}

.mobile-sub-menu li a {
    padding-left: 35px; /* Thụt đầu dòng cho menu con */
    font-size: 15px;
    color: #555;
}

/* Mũi tên chỉ xuống cho menu có con */
.sub-menu-arrow {
    font-size: 12px;
    transition: transform 0.3s;
}

.mobile-menu-list li.open > a .sub-menu-arrow {
    transform: rotate(180deg);
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --- FIX CHUYÊN SÂU MENU DESKTOP --- */
@media (min-width: 992px) {
    /* Đảm bảo menu cha có vị trí tương đối */
    .main-menu li.has-dropdown {
        position: relative;
    }

    /* Ghi đè thuộc tính ẩn của Bootstrap */
    .main-menu li.has-dropdown:hover > .dropdown-menu {
        display: block !important;
        opacity: 1 !important;
        visibility: visible !important;
        transform: translateY(0);
        margin-top: 0; /* Xóa khoảng cách để không bị mất hover */
    }

    .dropdown-menu {
        display: none; /* Ẩn mặc định */
        position: absolute;
        top: 100%;
        left: 0;
        z-index: 9999;
        min-width: 220px;
        padding: 10px 0;
        background-color: #fff;
        border: 1px solid var(--border-color);
        border-radius: 8px;
        box-shadow: 0 10px 30px rgba(0,0,0,0.1);
        transition: all 0.3s ease;
        transform: translateY(10px);
        opacity: 0;
        visibility: hidden;
    }

    /* Tạo cầu nối để khi di chuột từ menu cha xuống menu con không bị ngắt quãng */
    .main-menu li.has-dropdown::after {
        content: "";
        position: absolute;
        bottom: -15px;
        left: 0;
        width: 100%;
        height: 15px;
        background: transparent;
    }

    /* Xoay mũi tên khi hover */
    .has-dropdown:hover .dropdown-arrow {
        transform: rotate(180deg);
    }
}



/* --- Mobile Menu List (Main navigation items) --- */
.mobile-menu-list {
    list-style: none;
    padding: 20px; /* Padding cho danh sách menu */
    margin: 0;
    flex-grow: 1; /* Cho phép chiếm hết không gian còn lại */
    overflow-y: auto; /* Thêm thanh cuộn nếu danh sách quá dài */
}
.mobile-menu-list li {
    margin-bottom: 10px;
}
.mobile-menu-list li a {
    display: block;
    padding: 10px 15px;
    text-decoration: none;
    color: var(--text-color);
    font-size: 1em;
    font-weight: 500;
    transition: background-color 0.2s, color 0.2s;
    border-radius: 5px;
    display: flex; /* Dùng flex để căn chỉnh icon và text */
    align-items: center;
    gap: 10px; /* Khoảng cách giữa icon và text */
}
.mobile-menu-list li a:hover {
    background-color: var(--bg-light-color);
    color: var(--primary-color);
}
.mobile-menu-list li a .fas {
    width: 20px; /* Cố định chiều rộng icon */
    text-align: center;
    color: #64748b;
}
.mobile-menu-list li a.text-danger {
    color: #dc3545;
}
.mobile-menu-list li a.text-danger .fas {
    color: #dc3545;
}
.mobile-menu-list li a.text-danger:hover .fas {
    color: #bb2d3b; /* Đậm hơn khi hover */
}

/* Sub-menu for mobile (categories) */
.mobile-menu-list li.has-sub-menu > a {
    position: relative;
    padding-right: 40px; /* Space for arrow */
}
.mobile-menu-list li.has-sub-menu > a .sub-menu-arrow {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    transition: transform 0.2s ease;
}
.mobile-sub-menu {
    list-style: none;
    padding-left: 20px;
    max-height: 0; /* Hidden by default */
    overflow: hidden;
    transition: max-height 0.3s ease-out;
}
.mobile-sub-menu li a {
    padding: 8px 10px;
    font-size: 0.9em;
}
.mobile-menu-list li.has-sub-menu.open > a .sub-menu-arrow {
    transform: translateY(-50%) rotate(180deg);
}
.mobile-menu-list li.has-sub-menu.open > .mobile-sub-menu {
    max-height: 300px; /* Adjust as needed */
}

/* --- Profile Dashboard Layout --- */
.profile-dashboard-layout {
    padding: 30px;
}

.profile-header-summary {
    display: flex;
    align-items: center;
    gap: 20px;
    padding-bottom: 25px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 30px;
}

.profile-avatar-large img {
    width: 80px;
    height: 80px;
    border-width: 2px !important;
}

.profile-greeting h4 {
    font-size: 1.6em;
    margin-bottom: 5px !important;
}
.profile-greeting p {
    font-size: 0.95em;
    color: #64748b;
    margin-bottom: 0;
}

.summary-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.summary-card {
    background-color: var(--bg-light-color);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 8px rgba(0,0,0,0.03);
}

.summary-card .icon-large {
    font-size: 2.5em;
    margin-bottom: 15px;
}

.summary-card .card-data .count {
    display: block;
    font-size: 1.8em;
    font-weight: 700;
    color: var(--text-color);
    line-height: 1.2;
}

.summary-card .card-data .label {
    font-size: 0.9em;
    color: #64748b;
}

.profile-section {
    margin-bottom: 30px;
    padding-top: 20px;
    border-top: 1px dashed var(--border-color);
}

.section-header-flex {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.section-header-flex h5 {
    font-size: 1.25em;
    margin-bottom: 0;
}

.section-header-flex .btn-outline-primary,
.section-header-flex .btn-outline-danger {
    font-size: 0.85em;
    font-weight: 600;
    border-radius: 20px;
    padding: 6px 15px;
}

.recent-activity-list .list-group-item {
    padding: 12px 15px;
    font-size: 0.95em;
    color: var(--text-color);
    border-color: var(--border-color);
}
.recent-activity-list .list-group-item strong {
    color: var(--primary-color);
}
.recent-activity-list .list-group-item .badge {
    background-color: var(--primary-light-color);
    color: #fff;
}

/* History table specific styles */
.history-table th, .history-table td {
    white-space: nowrap; /* Prevent text wrapping in table headers/cells */
}
.history-table strong {
    color: var(--text-color); /* Keep quiz title black */
}

/* Mobile adjustments for profile dashboard */
@media (max-width: 768px) {
    .profile-dashboard-layout {
        padding: 15px;
    }
    .profile-header-summary {
        flex-direction: column;
        text-align: center;
        gap: 10px;
    }
    .profile-avatar-large {
        margin-bottom: 10px;
    }
    .summary-cards-grid {
        grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); /* 2 cột trên mobile */
        gap: 15px;
    }
    .summary-card .icon-large {
        font-size: 2em;
        margin-bottom: 10px;
    }
    .summary-card .card-data .count {
        font-size: 1.5em;
    }
    .summary-card .card-data .label {
        font-size: 0.8em;
    }
    .profile-section .section-header-flex {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    .profile-section .section-header-flex .btn {
        width: 100%;
        text-align: center;
    }
    .recent-activity-list .list-group-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
    .recent-activity-list .list-group-item .badge,
    .recent-activity-list .list-group-item .btn {
        margin-left: 0 !important;
        width: 100%;
        text-align: center;
    }
}

/* --- USER HEADER STYLES (CẬP NHẬT GIAO DIỆN & VỊ TRÍ) --- */

/* Container bên phải header */
.header-user-actions {
    display: flex;
    align-items: center;
    gap: 15px;
    position: relative;
    /* Đảm bảo container này không bị co lại quá mức */
    flex-shrink: 0; 
}

/* 1. CHƯA ĐĂNG NHẬP (DESKTOP) - STYLE NÚT BẤM NỔI BẬT */
.auth-links-desktop {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    
    /* [MỚI] Style Nút bấm nền trắng */
    background-color: #ffffff; 
    padding: 8px 20px;       /* Độ dày nút */
    border-radius: 30px;     /* Bo tròn viền (Pill shape) */
    box-shadow: 0 4px 6px rgba(0,0,0,0.1); /* Bóng đổ nhẹ */
    transition: all 0.3s ease;
    border: 2px solid transparent; /* Để dành cho hiệu ứng hover nếu cần */
}

/* Hiệu ứng khi di chuột vào nút */
.auth-links-desktop:hover {
    transform: translateY(-2px); /* Nổi lên nhẹ */
    box-shadow: 0 6px 12px rgba(0,0,0,0.15);
}

/* Style cho chữ bên trong nút */
.auth-links-desktop .auth-link {
    text-decoration: none;
    color: var(--primary-color) !important; /* Chữ màu Xanh Dương (theo theme) */
    font-weight: 700;        /* Chữ đậm */
    font-size: 14px;
    text-transform: uppercase; /* Chữ in hoa (tùy chọn) */
}

.auth-links-desktop .sep {
    color: var(--primary-color);
    opacity: 0.5;
    font-weight: 400;
}

/* Mobile Icon (Mặc định ẩn trên Desktop) */
.auth-icon-mobile {
    display: none; 
}
.auth-icon-mobile a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    /* Border trắng mờ để nổi trên nền xanh */
    border: 1px solid rgba(255,255,255,0.4); 
    color: white;
    text-decoration: none;
}

/* 2. ĐÃ ĐĂNG NHẬP */
.user-profile-wrapper {
    position: relative;
    cursor: pointer;
}

.user-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    color: white;
}

.user-toggle .user-avatar {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.5);
    object-fit: cover;
}

.user-toggle .user-name-desktop {
    font-weight: 600;
    font-size: 15px;
    display: flex;
    align-items: center;
    gap: 5px;
}

/* DROPDOWN MENU USER (Chung) */
.user-dropdown-menu {
    position: absolute;
    top: 130%;
    right: 0;
    width: 220px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
    padding: 10px 0;
    list-style: none;
    z-index: 1100;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.2s ease;
    border: 1px solid var(--border-color);
}

.user-dropdown-menu.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.user-dropdown-menu::before {
    content: '';
    position: absolute;
    top: -6px;
    right: 12px;
    width: 12px;
    height: 12px;
    background: white;
    transform: rotate(45deg);
    border-left: 1px solid var(--border-color);
    border-top: 1px solid var(--border-color);
}

.user-dropdown-menu li a {
    display: block;
    padding: 10px 20px;
    color: var(--text-color);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-dropdown-menu li a:hover {
    background: var(--bg-light-color);
    color: var(--primary-color);
}

.user-dropdown-menu li.divider {
    height: 1px;
    background: #eee;
    margin: 5px 0;
}

.user-dropdown-menu li a.text-danger { color: #dc2626; }
.user-dropdown-menu li a.text-danger:hover { background: #fee2e2; }

/* --- [QUAN TRỌNG] RESPONSIVE MOBILE (< 768px) --- */
@media (max-width: 768px) {
    /* 1. Sắp xếp lại Header Mobile: Hamburger - Logo - User */
    header .header-wrapper {
        justify-content: space-between; /* Giãn đều các phần tử */
    }

    /* Nút Hamburger: Ở bên trái */
    .hamburger-menu {
        order: 1;
        margin-right: 0; 
    }

    /* Logo: Ở giữa */
    header .logo {
        order: 2;
        flex-grow: 1;         /* Logo chiếm khoảng trống giữa */
        text-align: center;   /* Căn giữa chữ */
        margin: 0;            /* Reset margin */
    }

    /* Khu vực User: Đẩy về sát bên phải */
    .header-user-actions {
        order: 3;
        margin-left: 0;       /* Không cần margin auto nếu dùng justify-content: space-between */
    }

    /* 2. Ẩn/Hiện các thành phần */
    .auth-links-desktop { display: none !important; }
    .auth-icon-mobile { display: block !important; }
    .user-toggle .user-name-desktop { display: none; }
    
    /* 3. Tinh chỉnh Dropdown trên mobile để không bị tràn màn hình */
    .user-dropdown-menu {
        right: -10px; 
        width: 200px;
    }
    .user-dropdown-menu::before {
        right: 22px;
    }
}

/* --- STYLE CHO NÚT QUAY LẠI TRANG CHỦ --- */
.btn-home {
    display: inline-flex;
    align-items: center;
    gap: 8px; /* Khoảng cách giữa mũi tên và chữ */
    padding: 8px 20px;
    background-color: #ffffff; /* Nền trắng */
    color: var(--primary-color) !important; /* Chữ xanh */
    border: 1px solid var(--border-color); /* Viền xám nhẹ */
    border-radius: 30px; /* Bo tròn viên thuốc */
    text-decoration: none !important; /* Bỏ gạch chân mặc định */
    font-weight: 600;
    font-size: 14px;
    margin-top: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05); /* Bóng đổ nhẹ */
    transition: all 0.2s ease-in-out;
}

/* Hiệu ứng khi di chuột vào */
.btn-home:hover {
    border-color: var(--primary-color); /* Viền chuyển xanh */
    background-color: var(--primary-color); /* Nền chuyển xanh */
    color: #ffffff !important; /* Chữ chuyển trắng */
    transform: translateX(-3px); /* Nút dịch nhẹ sang trái tạo cảm giác "Back" */
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

/* --- CSS CHO TRANG LỊCH SỬ THI (HISTORY) --- */
.history-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
}

.history-item {
    transition: transform 0.2s, box-shadow 0.2s;
    border-radius: 12px !important;
    overflow: hidden;
    background: #fff;
    border: 1px solid #e5e7eb !important;
}

.history-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05) !important;
    border-color: var(--primary-color) !important;
}

.quiz-thumb {
    min-width: 60px;
    height: 60px;
    background-color: #f3f4f6;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
}

.progress-circle {
    position: relative;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: conic-gradient(var(--c) calc(var(--p) * 1%), #e5e7eb 0);
    display: flex;
    align-items: center;
    justify-content: center;
}

.progress-circle::before {
    content: "";
    position: absolute;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: #fff;
}

.progress-circle span {
    position: relative;
    z-index: 1;
    font-size: 12px;
    font-weight: 700;
    color: #374151;
}

/* Responsive cho mobile */
@media (max-width: 768px) {
    .history-item .card-body {
        flex-direction: column;
        align-items: flex-start !important;
    }
    .history-item .d-flex.align-items-center.gap-4 {
        width: 100%;
        justify-content: space-between;
        margin-top: 10px;
        border-top: 1px dashed #eee;
        padding-top: 10px;
    }
}

/* --- CSS CHO TRANG TẠO ĐỀ (CREATE QUIZ) --- */
#userQuizForm .form-control:focus {
    box-shadow: none;
    border-color: var(--primary-color);
}

.question-card {
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    transition: all 0.3s ease;
}

.question-card:hover {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.question-card .card-header {
    background-color: #fff;
    border-bottom: 1px solid #f3f4f6;
}

.question-card .badge {
    font-size: 14px;
    font-weight: 600;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.input-group-text {
    border-right: 0;
    background-color: #fff;
}

.input-group .form-control {
    border-left: 0;
}

.input-group .form-control:focus {
    z-index: 3; /* Đè lên border-left bị ẩn */
}

/* Nút cố định dưới cùng */
.fixed-bottom {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(5px);
}

/* --- FIX XUNG ĐỘT MÀU SẮC BOOTSTRAP --- */

/* Ép tất cả các class text-primary dùng màu của theme */
.text-primary {
    color: var(--primary-color) !important;
}

/* Ép bg-primary dùng màu của theme */
.bg-primary {
    background-color: var(--primary-color) !important;
}

/* Ép các nút outline-primary dùng màu của theme */
.btn-outline-primary {
    color: var(--primary-color) !important;
    border-color: var(--primary-color) !important;
}
.btn-outline-primary:hover {
    background-color: var(--primary-color) !important;
    color: #fff !important;
}

/* Fix tiêu đề trang chủ bị đổi font/màu */
.hero-section .page-main-title {
    color: var(--primary-color) !important;
    font-family: 'Be Vietnam Pro', sans-serif !important; /* Đảm bảo font không bị đổi */
}

/* --- [FIX] Khắc phục lỗi viền xanh đứng yên trên mobile --- */
/* Bỏ cuộn mượt mặc định của trình duyệt để ưu tiên JS animate */
html, body {
    scroll-behavior: auto !important;
}

/* [TỐI ƯU] Tăng cường hiệu ứng khi chọn đáp án */
.vnsatp-quiz-container .option-item input[type=radio]:checked + label {
    border-color: var(--primary-color-quiz) !important;
    background-color: var(--bg-light-quiz) !important;
    box-shadow: 0 0 0 2px var(--primary-light-color); /* Thêm hiệu ứng shadow nhẹ */
}

/* ==================================================
   MOBILE OPTIMIZATION FOR USER PAGES (< 768px)
================================================== */
@media (max-width: 768px) {
    /* 1. Tổng quan trang cá nhân */
    .container.my-5 {
        margin-top: 15px !important;
        padding-left: 10px;
        padding-right: 10px;
    }

    /* 2. Thẻ thống kê (Số đề đã làm, đã tạo...) */
    .icon-circle {
        width: 35px;
        height: 35px;
        font-size: 1rem;
    }
    .card-body h3 {
        font-size: 1.2rem;
    }
    .card-body p.small {
        font-size: 11px !important;
    }

    /* 3. Tối ưu Tab Navigation (Trang Tạo đề) */
    #quizTabs {
        display: flex;
        flex-wrap: nowrap;
        overflow-x: auto;
        justify-content: flex-start;
        padding: 5px !important;
        -webkit-overflow-scrolling: touch;
        gap: 5px;
    }
    #quizTabs .nav-item {
        flex: 0 0 auto;
    }
    #quizTabs .nav-link {
        padding: 8px 15px;
        font-size: 13px;
        white-space: nowrap;
    }

    /* 4. Lịch sử thi & Đề yêu thích (Dạng danh sách mỏng) */
    .list-group-item {
        padding: 12px 10px !important;
    }
    .list-group-item .fw-bold {
        font-size: 14px;
        white-space: normal; /* Cho phép xuống dòng nếu tiêu đề dài */
    }
    .progress-circle {
        width: 40px !important;
        height: 40px !important;
    }
    .progress-circle span {
        font-size: 10px !important;
    }

    /* 5. Giao diện Tạo đề (Các câu hỏi) */
    .question-card .card-header {
        padding: 10px !important;
    }
    .q-content {
        font-size: 14px;
    }
    .input-group-text {
        padding: 0 8px;
        font-size: 13px;
    }
    .q-option {
        font-size: 14px;
    }

    /* Nút hành động cố định dưới màn hình khi tạo đề */
    .fixed-bottom {
        padding: 10px !important;
    }
    .fixed-bottom .btn {
        flex: 1;
        font-size: 13px;
        padding: 8px 5px;
    }
    .fixed-bottom .text-muted {
        display: none !important; /* Ẩn dòng chữ nhỏ để dành chỗ cho nút */
    }

    /* 6. Chỉnh lại kích thước các icon hành động trên Quiz Card */
    .quiz-card-actions {
        top: 10px;
        right: 10px;
    }
    .action-icon {
        width: 32px;
        height: 32px;
    }
    .action-icon i {
        font-size: 14px;
    }

    /* 7. Tiêu đề trang */
    .page-main-title {
        font-size: 20px;
        margin-top: 10px;
    }
}

@media (max-width: 768px) {
label.btn.btn-secondary {
    font-size: 12px;
}
button#process-text-btn {
    font-size: 12px;
}
}