.test-actions {
    display: flex;
    gap: 6px;
    width: 100%;
    margin-top: 10px;
}

.btn-take-test {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0 14px;
    background-color: #0073aa;
    color: white;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 500;
    height: 44px;
    transition: background 0.2s ease;
}

.btn-take-test:hover {
    background-color: #005a8c;
}

/* Kích thước theo trạng thái */
.test-actions.completed .btn-take-test {
    flex: 0 0 50%;
}

.test-actions.completed .btn-group {
    flex: 0 0 50%;
}

.test-actions.not-completed .btn-take-test {
    flex: 0 0 75%;
}

.test-actions.not-completed .btn-group {
    flex: 0 0 25%;
}

/* Group chứa icon */
.btn-group {
    display: flex;
    gap: 6px;
    height: 44px;
}

.btn-icon {
    flex: 1;
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-icon:hover {
    background: #f5f5f5;
    transform: translateY(-1px);
}

.btn-icon svg {
    width: 20px;
    height: 20px;
    stroke: #333;
}

/* Overlay */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

/* Modal container */
.modal {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    width: 90%;
    max-width: 520px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: modalFadeIn 0.25s ease;
}

/* Header */
.modal-header {
    background: linear-gradient(135deg, #0073aa, #005a8c);
    color: white;
    padding: 14px 20px;
    font-size: 18px;
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-close {
    font-size: 22px;
    cursor: pointer;
    transition: 0.2s;
    user-select: none;
}

.modal-close:hover {
    transform: rotate(90deg);
}

/* Body */
.modal-body {
    padding: 20px;
    font-size: 15px;
    color: #333;
    line-height: 1.5;
    max-height: 60vh;
    overflow-y: auto;
}

/* Animation */
@keyframes modalFadeIn {
    from {
        transform: translateY(-20px) scale(0.98);
        opacity: 0;
    }

    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}


@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}



.horizontal-ad {
    margin: 20px 0;
    text-align: center;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    padding: 10px;
}

.horizontal-ad img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: auto;
    border-radius: 6px;
    transition: transform 0.3s ease;
}

.horizontal-ad img:hover {
    transform: scale(1.02);
}

@media (max-width: 768px) {
    .horizontal-ad {
        margin: 15px 0;
        padding: 5px;
    }
}

/* HTML: <div class="loader"></div> */
.loader {
    width: 50px;
    aspect-ratio: 1;
    display: grid;
    border: 4px solid #0000;
    border-radius: 50%;
    border-right-color: #25b09b;
    animation: l15 1s infinite linear;
}

.loader::before,
.loader::after {
    content: "";
    grid-area: 1/1;
    margin: 2px;
    border: inherit;
    border-radius: 50%;
    animation: l15 2s infinite;
}

.content {
    max-width: 1350px;
}

.loader::after {
    margin: 8px;
    animation-duration: 3s;
}

@keyframes l15 {
    100% {
        transform: rotate(1turn)
    }
}

.container-search {
    padding: 10px;
    display: flex;
    gap: 20px;
    align-items: flex-start;
    min-height: 100vh;
}

.content {
    flex: 1;
    min-width: 0;
}

.sidebar {
    width: 280px;
    background-color: #f8fafc;
    padding: 20px;
    border-radius: 12px;
    position: sticky;
    top: 20px;
    height: calc(100vh - 40px);
    overflow: auto;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.06);
    border: 1px solid #eef2f7;
    z-index: 5;
}

@media (max-width: 768px) {
    .container-search {
        flex-direction: column;
        width: 100%;
        height: 100%;
    }

    .sidebar {
        order: -1;
        width: 100%;
        height: 100%;
    }
}

.token-display {
    display: flex;
    gap: 20px;
    margin: 10px 0;
}

.token-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 14px;
}

.token-icon {
    width: 20px;
    height: 20px;
    object-fit: contain;
}

.post-type-navigation {
    padding: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    padding-bottom: 10px;
    scrollbar-width: thin;
    -ms-overflow-style: none;
}

/* Ẩn thanh cuộn trên Chrome, Safari */
.post-type-navigation::-webkit-scrollbar {
    height: 6px;
    /* Độ dày của thanh cuộn */
}

.post-type-navigation::-webkit-scrollbar-thumb {
    background-color: #bbb;
    border-radius: 5px;
}

.nav-button {
    padding: 8px 12px;
    border-radius: 5px;
    text-decoration: none;
    color: #333;
    background-color: #f1f1f1;
    transition: background-color 0.3s;
    flex-shrink: 0;
    /* Ngăn co lại */
    display: inline-block;
    /* Đảm bảo không bị thu nhỏ */
}

.nav-button.active {
    color: #fff;
    background-color: #0073aa;
}

.nav-button:hover {
    background-color: #ddd;
}

.test-library {
    max-width: 1200px;
    margin: auto;
    padding: 20px;
}

.search-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
    background: #ffffff;
    border: 1px solid #eef2f7;
    border-radius: 12px;
    padding: 14px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
}

.search-input {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #dde3ea;
    border-radius: 10px;
    outline: none;
    transition: border-color .2s ease, box-shadow .2s ease;
}

.search-input:focus {
    border-color: #0073aa;
    box-shadow: 0 0 0 4px rgba(0, 115, 170, .08);
}

.filters-bar {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
}

.test-type-option {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.filter-group-label {
    font-size: 12px;
    font-weight: 600;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-right: 4px;
    white-space: nowrap;
    flex-basis: 100%;
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #f3f6f9;
    border: 1px solid #e5ebf2;
    padding: 6px 10px;
    border-radius: 999px;
    cursor: pointer;
    user-select: none;
}

.chip input {
    accent-color: #0073aa;
}

.chip span {
    font-size: 13px;
    color: #334155;
}

.sort-group {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 8px;
}

.sort-label {
    font-size: 13px;
    color: #64748b;
}

.sort-select {
    padding: 8px 10px;
    border: 1px solid #dde3ea;
    border-radius: 10px;
    background: #fff;
}

.btn-filter-submit {
    align-self: flex-start;
    padding: 10px 16px;
    background: linear-gradient(135deg, #0073aa, #005a8c);
    color: #fff;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: transform .15s ease, box-shadow .2s ease;
    box-shadow: 0 6px 16px rgba(0, 115, 170, 0.18);
}

.btn-filter-submit:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 20px rgba(0, 115, 170, 0.22);
}

/* Test grid */
.test-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 20px;
}

.test-item {
    position: relative;
    background: #fff;
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 6px 24px rgba(2, 8, 20, 0.06);
    transition: transform 0.2s, box-shadow 0.2s;
}

.test-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 28px rgba(2, 8, 20, 0.1);
}

.test-item h2 {
    font-size: 18px;
    margin: 10px 0;
}

.test-meta p {
    margin: 5px 0;
    color: #666;
    font-size: 14px;
}

.test-tags span {
    display: inline-block;
    margin: 5px 5px 0 0;
    background-color: #eef0f3;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 13px;
}

.detail-button {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 10px;
    padding: 8px 14px;
    background-color: #0073aa;
    color: white;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 500;
    min-height: 40px;
    /* đảm bảo chiều cao nút */
    text-align: center;
}

.detail-button:hover {
    background-color: #005a8c;
}



.pagination {
    margin-top: 20px;
    text-align: center;
}

.pagination a {
    padding: 5px 10px;
    color: #0073aa;
    text-decoration: none;
    margin: 0 5px;
}

.pagination a:hover {
    background-color: #0073aa;
    color: white;
    border-radius: 4px;
}

.post-id {
    position: absolute;
    top: 10px;
    left: 10px;
    background-color: #f1f1f1;
    padding: 5px 10px;
    border-radius: 3px;
    font-size: 12px;
    font-weight: bold;
    color: #333;
}


.custom-number {
    position: absolute;
    top: 10px;
    right: 10px;
    background-color: #0073aa;
    color: white;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: bold;
}


.icon_tests {
    width: 20px;
    height: 20px;
    vertical-align: middle;
}

.completed-icon {
    position: absolute;
    top: 10px;
    left: 10px;
    background-color: #fff;
    color: #63E6BE;
    padding: 5px;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    font-size: 16px;
}

.price-icon {
    position: absolute;
    top: 10px;
    right: 10px;
    background-color: #fff;
    color: #63E6BE;
    padding: 5px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    font-size: 16px;
}


/* Ensure sticky works well with very tall content */
.content .test-library {
    min-height: 50vh;
}

/* Responsive adjustments */
@media (max-width: 1024px) {
    .sidebar {
        top: 12px;
        max-height: calc(100vh - 24px);
    }
}

@media (max-width: 768px) {
    .container-search {
        flex-direction: column;
        width: 100%;
        height: auto;
        display: block;
    }

    .sidebar {
        order: -1;
        width: 100%;
        height: auto;
        max-height: none;
        position: static;
    }

    .filters-bar {
        flex-direction: column;
        align-items: flex-start;
    }

    .sort-group {
        margin-left: 0;
    }
}

/* Mobile hardening for narrow screens */
img,
video {
    max-width: 100%;
    height: auto;
}

.test-grid>* {
    min-width: 0;
}

@media (max-width: 600px) {
    .test-grid {
        grid-template-columns: 1fr;
    }

    .test-item {
        padding: 16px;
    }

    .btn-take-test {
        height: 42px;
    }

    .btn-group {
        height: 42px;
    }

    .test-actions.completed .btn-take-test,
    .test-actions.completed .btn-group,
    .test-actions.not-completed .btn-take-test,
    .test-actions.not-completed .btn-group {
        flex: 1 1 auto;
    }
}