/* ==========================================================================
   Custom WooCommerce AJAX Product Filters
   ========================================================================== */

/* --- Container chính --- */
.woo-ajax-filter-container {
    padding: 0;

    input[type=checkbox],
    input[type=radio] {
        margin: 0;
    }
}


/* --- Nhóm bộ lọc --- */
.filter-group {
    margin-bottom: 0;
    padding-bottom: 14px;
    padding-top: 14px;
}

.filter-group+.filter-group {
    border-top: 1px solid #eee;
}

.filter-group:not(+ .filter-group) {
    padding-bottom: 0;
}

.filter-group:last-of-type {
    border-bottom: none;
    margin-bottom: 10px;
}

.filter-group__title {
    font-size: 15px;
    font-weight: 700;
    margin: 0 0 10px;
    letter-spacing: 0.03em;
    color: #222;
}

.filter-group__list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 215px;
    overflow-y: auto;

    &::-webkit-scrollbar {
        width: 5px;
    }

    &::-webkit-scrollbar-track {
        background: #F5F5F5;
        border-radius: 10px;
    }

    &::-webkit-scrollbar-thumb {
        background: #8C8C8C;
        border-radius: 10px;
    }

    &::-webkit-scrollbar-thumb:hover {
        background: #F5F5F5;
    }
}

/* --- Mỗi mục lọc --- */
.filter-item {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 6px;
    transition: background-color 0.2s ease, color 0.2s ease;
    user-select: none;
}

.filter-item:hover {
    background-color: #f5f5f5;
}

.filter-item.is-active {
    background-color: #a5d6a729;
    color: var(--primary-color);
    font-weight: 600;
}

/* --- Radio button tùy chỉnh --- */
.filter-radio {
    appearance: none;
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    min-width: 16px;
    border: 2px solid #bbb;
    border-radius: 50%;
    position: relative;
    cursor: pointer;
    transition: border-color 0.2s ease;
}

.filter-radio:checked {
    border-color: var(--primary-color);
}

.filter-radio:checked::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background-color: var(--primary-color);
}

/* --- Nhãn --- */
.filter-label {
    font-size: 14px;
    line-height: 1.4;
    color: #444;
}

.filter-item.is-active .filter-label {
    color: var(--primary-color);
}

/* --- Nút Tìm kiếm --- */
.btn-search-filter {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    background-color: #28a745;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    justify-content: center;
    margin-bottom: 8px;
}

.btn-search-filter:hover {
    background-color: #218838;
}

.btn-search-filter i {
    font-size: 13px;
}

/* --- Nút Reset --- */
.btn-reset-filter {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    background-color: #d9534f;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    justify-content: center;
    margin: 0;
}

.btn-reset-filter:hover {
    background-color: #c9302c;
}

.btn-reset-filter i {
    font-size: 13px;
}

/* --- Loading spinner --- */
.product-loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: #888;
    font-size: 14px;
    gap: 14px;
}

.cwf-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid #e0e0e0;
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: cwf-spin 0.7s linear infinite;
}

@keyframes cwf-spin {
    to {
        transform: rotate(360deg);
    }
}

.cwf-loading {
    opacity: 0.5;
    pointer-events: none;
    position: relative;
    min-height: 200px;
}

/* --- Kết quả --- */
.cwf-result-count {
    font-size: 14px;
    color: #666;
    margin: 0 0 16px;
}

.cwf-result-count strong {
    color: #222;
}

/* --- Không có kết quả --- */
.cwf-no-results {
    text-align: center;
    padding: 15px;
    color: #888;
    font-size: 15px;
}

/* --- Phân trang --- */
.cwf-pagination {
    margin-top: 24px;
    text-align: center;
}

.cwf-pagination ul {
    list-style: none;
    display: flex;
    justify-content: center;
    padding: 0;
    margin: 0;
}

.cwf-pagination li {
    display: inline-block;
}

.cwf-pagination a,
.cwf-pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    font-size: 14px;
    border-radius: 6px;
    border: 1px solid #ddd;
    color: #333;
    text-decoration: none;
    transition: all 0.2s ease;
}

.cwf-pagination a:hover {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: #fff;
}

.cwf-pagination .current {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: #fff;
    font-weight: 700;
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 768px) {
    .filter-group__title {
        font-size: 14px;
    }

    .filter-item {
        padding: 5px 8px;
    }

    .filter-label {
        font-size: 13px;
    }

    .cwf-pagination a,
    .cwf-pagination span {
        min-width: 32px;
        height: 32px;
        font-size: 13px;
    }
}