.user-score-display {
    background: linear-gradient(135deg, #007DB3 0%, #056C99 100%);
    color: white;
    padding: 25px;
    text-align: center;
    margin-bottom: 0;
    border-radius: 0;
    color: white;
}

.user-score-display h3 {
    color: white;
    margin: 0 0 10px 0;
    font-size: 1.1rem; /* Match .balance-label-header font-size */
    opacity: 0.9;
    font-weight: 500; /* Match .balance-label-header font-weight */
}

.user-score-display .score {
    font-size: 3rem; /* Match .balance-amount font-size */
    font-weight: bold; /* Match .balance-amount font-weight */
    margin: 0;
    color: white; /* Explicitly match color: white */
    text-shadow: 0 2px 4px rgba(0,0,0,0.3); /* Match .balance-amount text-shadow */
}

.page-content {
    padding: 30px;
}

.page-title-section {
    text-align: center;
    margin-bottom: 40px;
}

.page-title {
    color: #333;
    font-size: 2.5rem;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.page-subtitle {
    color: #666;
    font-size: 1.1rem;
    margin-bottom: 20px;
}

.title-divider {
    width: 150px;
    height: 8px;
    background: linear-gradient(135deg, #FED750 0%, #FFB800 100%);
    margin: 0 auto;
    border-radius: 4px;
}

.tests-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 30px;
    max-width: 1200px;
    margin: 0 auto;
}

/* ✅ THÊM: Đảm bảo card giữ kích thước khi ẩn */
.test-card-wrapper {
    min-width: 0; /* Tránh overflow */
}

/* ✅ THÊM: Responsive - giữ nguyên 3 cột cho màn lớn */
@media (max-width: 1200px) {
    .tests-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 25px;
    }
}

.test-card {
    background: white;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    position: relative;
    border: 2px solid transparent;
    overflow: hidden; 
    transition: all 0.3s ease !important;
    transition-delay: 0s !important;
}


/* Hover với màu tương ứng từng loại test */
.test-card.free:hover,
.test-card.purchased:hover {
    border-color: #28a745;
    box-shadow: 0 15px 35px rgba(0,0,0,0.15);
    transform: translateY(-3px);
}

.test-card.paid:hover {
    border-color: #007DB3; /* Màu xanh dương cho paid */
    box-shadow: 0 15px 35px rgba(0,0,0,0.15);
    transform: translateY(-3px);
}

.test-card.insufficient:hover {
    border-color: #6c757d; /* Màu xám cho insufficient */
    box-shadow: 0 15px 35px rgba(0,0,0,0.15);
    transform: translateY(-3px);
}



/* Thêm border top gradient như action-card */
.test-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 5px;
    width: 100%;
    transition: all 0.1s ease;
    border-radius: 20px 20px 0 0;
}

/* Màu gradient cho từng loại test */
.test-card.free::before,
.test-card.purchased::before {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
}

.test-card.paid::before {
    background: linear-gradient(135deg, #007DB3 0%, #056C99 100%);
}

.test-card.insufficient::before {
    background: linear-gradient(135deg, #007DB3 0%, #056C99 100%);
}

/* Giữ lại ::after cho hiệu ứng hover background */
.test-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, 
                rgba(0,125,179,0.05) 0%, 
                rgba(254,215,80,0.05) 100%);
    border-radius: 20px;
    opacity: 0;
    transition: opacity 0.1s ease;
    pointer-events: none;
    z-index: 0;
    will-change: opacity;
}

.test-card:hover::after {
    opacity: 1;
}

.test-card > * {
    position: relative;
    z-index: 1;
}



.status-badge {
    position: absolute;
    top: -10px;
    right: 20px;
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: bold;
    color: white;
    display: flex;
    align-items: center;
    gap: 5px;
    z-index: 10;
}

.status-badge.free {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
}

.status-badge.purchased {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
}

.test-icon {
    text-align: center;
    margin-bottom: 20px;
    min-height: 80px; /* Đảm bảo chiều cao đồng nhất */
    display: flex;
    align-items: center;
    justify-content: center;
}

.test-icon img {
    width: 80px;
    height: 80px;
    object-fit: contain;
    border-radius: 10px;
    transition: transform 0.3s ease;
}

.test-icon img:hover {
    transform: scale(1.1);
}

.test-icon i {
    font-size: 4rem;
    color: #007DB3;
    transition: color 0.3s ease;
}

.test-info {
    text-align: center;
}

.test-name {
    color: #333;
    font-size: 1.4rem;
    margin-bottom: 15px;
    font-weight: bold;
}

.test-description {
    color: #666;
    line-height: 1.6;
    margin-bottom: 20px;
    text-align: left;
    word-break: break-word; /* Ngắt từ tự động trên màn hình nhỏ */
    hyphens: auto;
}

@media (min-width: 768px) {
    .test-description {
        text-align: justify; /* Căn đều trên màn hình lớn để chuyên nghiệp */
    }
}

.test-cost-display {
    margin-bottom: 20px;
}

.cost-info .cost-amount {
    margin-right: 10px; /* hoặc 10px, 12px tùy ý */
}

.cost-info .original-cost {
    margin-left: 10px; /* hoặc 10px, 12px tùy ý */
}
/* ✅ THÊM: Styles cho original cost (giá gốc bị gạch) */
.original-cost {
    position: relative;
    color: #999;
    font-size: 1rem;
    text-decoration-line: line-through;
    text-decoration-thickness: 1px; /* hoặc giá trị hiện tại */
    text-decoration-color: currentColor;
    text-underline-offset: 20%; /* Thay vì -50% */
    font-weight: normal;
}

/* Optional: Animation khi hover */
.cost-info:hover .original-cost {
    color: #666;
}

/* Đảm bảo cost-info có layout phù hợp */
.cost-info {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 1.1rem;
    font-weight: bold;
    margin-bottom: 10px;
    flex-wrap: wrap; /* ✅ THÊM: Cho phép wrap trên mobile */
}

/* ✅ THÊM: Responsive cho mobile */
@media (max-width: 768px) {
    .original-cost {
        font-size: 0.85rem;
        margin-right: 5px;
    }
    
    .cost-info {
        font-size: 1rem;
    }
}

.cost-info.free {
    color: #28a745;
}

.cost-info.paid {
    color: #007DB3;
}

.cost-info.purchased {
    color:#28a745;
}

.owned-badge {
    color: #28a745;
    font-size: 0.9rem;
    margin-left: 10px;
}

.test-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 15px 25px;
    border-radius: 12px;
    text-decoration: none;
    font-weight: bold;
    font-size: 1rem;
    transition: all 0.3s ease;
    width: 100%;
    margin-bottom: 15px;
}

.test-button.free {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
}

.test-button.paid {
    background: #2183ad;
    color: white;
}

.test-button.purchased {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
}

.test-button.insufficient {
    background: #6c757d;
    color: white;
}

.test-button.disabled {
    background: #e9ecef;
    color: #6c757d;
    cursor: not-allowed;
}

.test-button:hover:not(.disabled) {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

.insufficient-notice {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    padding: 15px;
    border-radius: 10px;
    font-size: 0.9rem;
    color: #856404;
    text-align: center;
}

.top-up-link {
    color: #007DB3;
    font-weight: bold;
    text-decoration: none;
    margin-left: 10px;
}

.top-up-link:hover {
    text-decoration: underline;
}

.empty-state {
    text-align: center;
    padding: 80px 20px;
    color: #666;
}

.empty-state i {
    font-size: 5rem;
    color: #dee2e6;
    margin-bottom: 30px;
}

.empty-state h3 {
    font-size: 1.8rem;
    margin-bottom: 15px;
    color: #333;
}

.empty-state p {
    font-size: 1.1rem;
    line-height: 1.6;
}

@media (max-width: 768px) {
    .tests-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .page-title {
        font-size: 2rem;
        flex-direction: column;
        gap: 10px;
    }
    
    .test-card {
        padding: 25px 20px;
    }
    
    .page-content {
        padding: 20px;
        margin-bottom: 6rem;
    }
    
    .user-score-display {
        padding: 20px;
    }
    
    .user-score-display .score {
        font-size: 2rem;
    }
}



.test-card[data-lang="vi"]::before {
    content: "VI";
}

.test-card[data-lang="en"]::before {
    content: "EN";
}

/* Category Wrapper */
.category-wrapper {
    margin-bottom: 15px;
}

/* Category Header với collapse */
.icon-category-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 12px 15px;
    border-radius: 5px;
    margin: 0;
    font-weight: bold;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    user-select: none;
}

.icon-category-header:hover {
    background: linear-gradient(135deg, #7b8eeb 0%, #8757b3 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

/* Collapse Icon Animation */
.collapse-icon {
    transition: transform 0.3s ease;
    font-size: 12px;
}

.collapse-icon.rotated {
    transform: rotate(180deg);
}

/* Icon Grid spacing khi collapse */
.icon-grid {
    padding: 15px 10px 5px 10px;
    transition: all 0.3s ease;
}

/* Animation cho collapse */
.collapse {
    transition: height 0.3s ease;
}

.collapsing {
    transition: height 0.3s ease;
}

.test-card-wrapper {
    position: relative;
}

.status-badge {
    position: absolute;
    top: -10px;
    right: 20px;
    z-index: 10;
    /* ... giữ nguyên các style khác */
}

/* ✅ THÊM: Filter Tabs Styles */
.filter-tabs {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin: 30px 0 40px 0;
     flex-wrap: nowrap; /* ✅ Không cho wrap */
    flex-shrink: 0;
}

.filter-tab {
    display: flex;
    align-items: center;
    gap: 8px; /* Giảm khoảng cách giữa icon và text */
    padding: 0 16px; /* Giảm padding ngang */
    height: 44px; /* Giảm chiều cao */
    background: rgb(235, 235, 235);
    border: 2px solid #e9ecef;
    border-radius: 22px; /* Điều chỉnh border-radius cho phù hợp */
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    font-size: 0.9rem; /* Giảm font size */
    color: #495057;
    position: relative;
    overflow: hidden;
    white-space: nowrap;
}

.filter-tab:hover::before,
.filter-tab.active::before {
    opacity: 0.1;
}

.filter-tab:hover {
    border-color: #007DB3;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,125,179,0.2);
     background: linear-gradient(135deg, #007DB3 0%, #056C99 100%);
    color: white;
}

.filter-tab.active {
    background: linear-gradient(135deg, #007DB3 0%, #056C99 100%);
    color: white;
    border-color: #007DB3;
    box-shadow: 0 6px 20px rgba(0,125,179,0.3);
}

.filter-tab i,
.filter-tab span,
.filter-tab .badge {
    position: relative;
    z-index: 1;
}

.filter-tab .badge {
    background: rgba(255,255,255,0.2);
    padding: 2px 6px; /* Giảm padding */
    border-radius: 10px; /* Giảm border-radius */
    font-size: 0.75rem; /* Giảm font size */
    font-weight: bold;
    min-width: 10px; /* Giảm min-width */
    text-align: center;
}

.filter-tab.active .badge {
    background: rgba(255,255,255,0.3);
}

/* ✅ THÊM: Section Styles */
.test-section {
    margin-bottom: 60px;
    scroll-margin-top: 100px; /* Offset for sticky header */
}

.section-title {
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 1.8rem;
    color: #333;
    margin-bottom: 30px;
    padding-bottom: 15px;
    border-bottom: 3px solid #e9ecef;
    position: relative;
    justify-content: flex-start;
    text-transform: capitalize;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: -3px;
    left: 0;
    width: 100px;
    height: 3px;
    background: linear-gradient(135deg, #007DB3 0%, #056C99 100%);
}

.section-title.purchased::after {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
}

.section-title.unpurchased::after {
    background: linear-gradient(135deg, #FED750 0%, #FFB800 100%);
}

.section-title i {
    color: #007DB3;
}

.section-title.purchased i {
    color: #28a745;
    opacity: 1;
}

.section-title.unpurchased i {
    color: #FFB800;
    opacity: 1;
}

.count-badge {
    background: linear-gradient(135deg, #007DB3 0%, #056C99 100%);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: bold;
    margin-left: 40px;
}

.section-title.purchased .count-badge {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
}

.section-title.unpurchased .count-badge {
    background: linear-gradient(135deg, #FED750 0%, #FFB800 100%);
    color: #333;
}

/* ✅ RESPONSIVE */
@media (max-width: 768px) {
    .filter-tabs {
        flex-direction: column;
        gap: 10px;
    }
    
    .filter-tab {
        width: 100%;
        justify-content: center;
    }
    
    .section-title {
        font-size: 1.4rem;
        flex-wrap: wrap;
    }
    
    .count-badge {
        margin-left: 0;
    }
}
.search-filter-section {
    max-width: 1400px;
    margin: 30px auto 40px auto;
    padding: 0 15px;
}

.search-filter-container {
    display: flex;
    align-items: center; /* ✅ Center theo chiều dọc */
    justify-content: center;
    flex-wrap: nowrap; /* ✅ Không wrap */
    gap: 15px;
}

.search-wrapper {
    flex: 0 1 500px; /* Tăng từ 350px lên 450px */
    min-width: 300px; /* Tăng min-width lên 300px */
    position: relative;
    display: block;
}

.search-icon {
    position: absolute !important;
    left: 15px !important;
    top: 27px !important;
    transform: translateY(-50%) !important;
    color: #6c757d !important;
    z-index: 2;
    font-size: 1rem;
    pointer-events: none; /* ✅ THÊM: Icon không chặn click vào input */
        line-height: 1; /* ✅ THÊM: Đảm bảo icon không bị lệch dọc */
    display: flex; /* ✅ THÊM: Dùng flex để căn giữa hoàn hảo */
    align-items: center; /* ✅ THÊM */
    height: 20px; 
}

#test-search-input {
    width: 100%;
    padding: 15px 45px 15px 45px;
    border: 2px solid #e9ecef;
    border-radius: 25px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: white;
    color: #333;
    outline: none;
    line-height: 1.5;
    height: 52px; /* THÊM: Đồng bộ height với button */
    box-sizing: border-box; /* THÊM: Đảm bảo height bao gồm padding + border */
    box-shadow: 0 1px 6px rgba(32, 33, 36, 0.28);
}
#test-search-input::placeholder {
    color: #5f6368;
    line-height: 1.5;
}

#test-search-input:hover {
    box-shadow: 0 1px 6px rgba(32, 33, 36, 0.28);
    border-color: rgba(223, 225, 229, 0);
}

#test-search-input:focus {
    outline: none;
    border-color: rgba(223, 225, 229, 0);
    box-shadow: 0 1px 6px rgba(32, 33, 36, 0.28);
}


.search-clear-btn {
    position: absolute; /* ✅ THÊM: Position absolute */
    right: 15px;
    top: 27px;
    transform: translateY(-50%);
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    color: #6c757d;
    transition: all 0.3s;
    display: none; /* Mặc định ẩn */
    z-index: 2;
    border-radius: 50%;
}

.search-clear-btn:hover {
    color: #dc3545;
    background: rgba(220,53,69,0.1);
}

/* ✅ Filter Tabs Wrapper - Chứa các button */
.filter-tabs-wrapper {
    display: flex;
    flex-wrap: nowrap; /* ✅ Không wrap */
    flex-shrink: 1; /* ✅ Cho phép co lại khi cần */
    justify-content: space-between;
}


/* ✅ RESPONSIVE - Chỉ wrap khi < 900px */
@media (max-width: 900px) {
    .search-filter-container {
        flex-wrap: wrap;
        gap: 0;
    }
    
    .search-wrapper {
        flex: 1 1 100%;
        max-width: 100%;
        margin-bottom: 5px;
    }
    
    .filter-tabs-wrapper {
        flex: 1 1 100%;
        justify-content: center;
    }
}

/* ✅ RESPONSIVE - Mobile */
@media (max-width: 768px) {
    .search-filter-section {
        margin: 10px 10px;
    }
    
    #test-search-input {
        height: 48px;
        padding: 12px 40px;
        font-size: 0.95rem;
    }
    
    .filter-tabs-wrapper {
        width: 100%;
        gap: 15px;
        flex-wrap: nowrap; /* ← Không cho wrap để 2 nút nằm cùng hàng */
        justify-content: space-between; /* ← Chia đều 2 nút */
        padding: 0;
    }
    
    .filter-tab {
        flex: 1; /* Mỗi nút chiếm 1 phần bằng nhau */
        min-width: 0; /* Cho phép co lại khi cần */
        height: 42px;
        padding: 0 12px;
        font-size: 0.85rem;
        margin: 0;
    }
}

@media (max-width: 480px) {
    .filter-tab span:not(.badge) {
        display: none;
    }
    
    .filter-tab {
        padding: 0 12px;
        min-width: 80px;
    }
    
    .filter-tab i {
        font-size: 1.1rem;
    }
}

/* ========== HASHTAG SECTION ========== */
.hashtag-section {
    margin-top: 60px;
    padding-top: 40px;
    border-top: 2px solid #e9ecef;
}

.hashtag-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    justify-content: flex-start;
    max-width: 100%;
    margin: 0;
}

.hashtag-bubble {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 0px 10px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 2px solid #dee2e6;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    color: #495057;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.hashtag-bubble:hover {
    transform: translateY(-3px) scale(1.05);
    background: linear-gradient(135deg, #007DB3 0%, #056C99 100%);
    color: white;
    border-color: #007DB3;
    box-shadow: 0 6px 20px rgba(0,125,179,0.3);
}

.hashtag-bubble.active {
    background: linear-gradient(135deg, #007DB3 0%, #056C99 100%);
    color: white;
    border-color: #007DB3;
    box-shadow: 0 6px 20px rgba(0,125,179,0.4);
}

.hashtag-text {
    font-size: 0.8rem;
    white-space: nowrap;
    text-transform: capitalize;
}

.hashtag-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    padding: 0 8px;
    background: rgba(0,0,0,0.1);
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: bold;
}

.hashtag-bubble:hover .hashtag-count,
.hashtag-bubble.active .hashtag-count {
    background: rgba(255,255,255,0.3);
}

/* Animation khi filter */
.test-card.hashtag-filtered {
    animation: highlightCard 0.6s ease;
}

@keyframes highlightCard {
    0%, 100% { 
        transform: scale(1); 
        box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    }
    50% { 
        transform: scale(1.02); 
        box-shadow: 0 15px 40px rgba(0,125,179,0.3);
    }
}

/* Mobile responsive */
@media (max-width: 768px) {
    .hashtag-section {
        margin-top: 40px;
        padding-top: 30px;
    }
    
    .hashtag-grid {
        gap: 8px;
    }
    
    .hashtag-bubble {
        padding: 5px 10px;
        font-size: 0.4rem;
    }
    
    .hashtag-text {
        font-size: 0.9rem;
    }
    
    .hashtag-count {
        min-width: 20px;
        height: 20px;
        padding: 0 6px;
        font-size: 0.7rem;
    }
}
/* ✅ SỬA: Section title icon styles */
.section-title i {
    color: #007DB3;
}

.section-title.purchased .icon-with-badge .fa-shopping-cart {
    color: #28a745;
}

.section-title.purchased .icon-with-badge .badge-icon {
    color: #28a745;
    background: white;
}

.section-title.unpurchased .icon-with-badge .fa-shopping-cart {
    color: #FFB800;
}

.section-title.unpurchased .icon-with-badge .badge-icon {
    color: #dc3545;
    background: white;
}

/* ✅ Responsive cho section title */
@media (max-width: 768px) {
    .icon-with-badge .badge-icon {
        top: -4px;
        right: -4px;
        font-size: 0.5em;
        padding: 1px;
    }
}

/* ✅ THÊM: Icon giỏ hàng với badge */
.icon-with-badge {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.icon-with-badge .badge-icon {
    position: absolute;
    top: -6px;
    right: -6px;
    font-size: 0.55em;
    background: white;
    border-radius: 50%;
    padding: 2px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.cart-checked .badge-icon {
    color: #28a745;
}

.cart-crossed .badge-icon {
    color: #dc3545;
}

/* ✅ Màu icon khi active */
.filter-tab.active .cart-checked .badge-icon {
    background: rgba(255,255,255,0.9);
    color: #28a745;
}

.filter-tab.active .cart-crossed .badge-icon {
    background: rgba(255,255,255,0.9);
    color: #dc3545;
}