/* ==================================== */
/* 1. CONTAINER & HEADER */
/* ==================================== */
.cwf-filter-container { 
    margin-bottom: 30px; 
    padding: 20px; 
    background: #ffffff; 
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05); /* Elegant shadow */
    border: 1px solid #f0f0f0;
}

.cwf-header { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    margin-bottom: 15px; 
    border-bottom: 1px solid #eee; 
    padding-bottom: 12px; 
}

.cwf-header h3 { 
    margin: 0; 
    /* Desktop size 23px !important */
    font-size: 23px !important; 
    font-weight: 700;
    color: #222;
    /* CHANGE: Capitalize */
    text-transform: capitalize !important;
    letter-spacing: 0.5px;
}

.cwf-global-reset { 
    font-size: 11px; 
    color: #999; 
    cursor: pointer; 
    font-weight: 600; 
    text-transform: uppercase;
    transition: color 0.2s;
}
.cwf-global-reset:hover {
    color: #d63638;
}

/* ==================================== */
/* 2. LIST & ITEMS */
/* ==================================== */
.cwf-category-list { 
    list-style: none; 
    padding: 0; 
    margin: 0; 
    max-height: 450px; 
    overflow-y: auto;
    
    /* Elegant Scrollbar for Webkit */
    scrollbar-width: thin;
    scrollbar-color: #ddd transparent;
}
.cwf-category-list::-webkit-scrollbar {
    width: 4px;
}
.cwf-category-list::-webkit-scrollbar-thumb {
    background-color: #ddd;
    border-radius: 4px;
}

.cwf-category-list li { 
    margin-bottom: 2px; 
    position: relative; 
    font-size: 14px;
    color: #444;
}

/* Flex Container for Row Items */
.cwf-item-row {
    display: flex;
    align-items: center;
    padding: 6px 0;
    transition: background 0.2s;
    border-radius: 4px;
}
.cwf-item-row:hover {
    background-color: #f9f9f9;
}

/* Hierarchy / Indentation */
.cwf-category-list ul { 
    display: none; 
    margin-left: 20px; /* Indentation for children */
    padding-left: 0;
    list-style: none;
    border-left: 1px solid #eee; /* Subtle guide line */
}

/* Open state */
.cwf-category-list li.open > ul { 
    display: block; 
    animation: fadeIn 0.3s ease;
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ==================================== */
/* 3. CUSTOM TOGGLE & CHECKBOXES */
/* ==================================== */

/* Toggle Icon (Chevron) */
.cwf-toggle, .cwf-no-toggle { 
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px; 
    height: 24px;
    margin-right: 5px;
    cursor: pointer;
    flex-shrink: 0;
}
.cwf-toggle::before {
    content: '';
    display: block;
    width: 6px;
    height: 6px;
    border-right: 2px solid #888;
    border-bottom: 2px solid #888;
    transform: rotate(-45deg);
    transition: transform 0.2s ease;
}
/* Rotate when open */
.cwf-category-list li.open > .cwf-item-row > .cwf-toggle::before {
    transform: rotate(45deg);
    border-color: #333;
}

/* Labels */
.cwf-category-list label {
    display: flex;
    align-items: center;
    cursor: pointer;
    flex-grow: 1;
    user-select: none;
}

/* Hide Default Checkbox */
.cwf-category-list input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

/* Custom Checkbox Box */
.cwf-category-list label::before {
    content: '';
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 1px solid #ccc;
    border-radius: 3px;
    background: #fff;
    margin-right: 8px;
    flex-shrink: 0;
    transition: all 0.2s;
}

/* Checked State */
.cwf-category-list input[type="checkbox"]:checked + span {
    font-weight: 700;
    color: #000;
}
.cwf-category-list input[type="checkbox"]:checked ~ .cwf-count {
    font-weight: 700;
}

/* Custom Checkmark */
.cwf-category-list label:has(input:checked)::before,
.cwf-category-list input:checked + label::before /* Fallback */ {
    background-color: #333; /* Main Brand Color */
    border-color: #333;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white' width='14px' height='14px'%3E%3Cpath d='M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
}

.cwf-count {
    font-size: 0.85em;
    color: #999;
    margin-left: 5px;
}

/* Local Clear Button (X) */
.cwf-local-reset { 
    font-size: 16px; 
    line-height: 1;
    color: #bbb; 
    cursor: pointer; 
    margin-left: 8px; 
    padding: 0 5px;
    display: none; 
}
.cwf-local-reset:hover {
    color: #d63638;
}
.cwf-item-row:hover .cwf-local-reset { 
    display: block; 
}

/* ==================================== */
/* 4. PAGINATION STYLES */
/* ==================================== */
.cwf-loader { 
    opacity: 0.5; 
    pointer-events: none; 
    transition: opacity 0.3s ease; 
}

.woocommerce-pagination, .elementor-pagination {
    text-align: center; 
    margin-top: 30px;
}
.woocommerce-pagination ul.page-numbers, 
.elementor-pagination ul.page-numbers {
    display: inline-flex; 
    list-style: none;
    padding: 0;
    border: none !important; 
    gap: 5px;
}
.woocommerce-pagination ul.page-numbers li,
.elementor-pagination ul.page-numbers li {
    margin: 0 5px;
    border: none !important; /* Ensure li border is removed */
}
.woocommerce-pagination ul.page-numbers li a, 
.woocommerce-pagination ul.page-numbers li span,
.elementor-pagination ul.page-numbers li a,
.elementor-pagination ul.page-numbers li span {
    display: flex;
    align-items: center;
    justify-content: center;
    
    /* CRITICAL: REMOVE ALL BORDERS AND OUTLINES */
    border: none !important; 
    outline: none !important;
    background: transparent !important; 

    /* DESKTOP STYLES (20px, 32px, 700) */
    font-size: 20px !important; 
    line-height: 32px !important; 
    font-weight: 700 !important; 
    padding: 0 10px !important;

    color: #555; 
    text-decoration: none;
    transition: all 0.2s ease;
    min-width: 32px !important; 
    border-radius: 4px; 
}
.woocommerce-pagination ul.page-numbers li a:hover {
    color: #333 !important;
}
.woocommerce-pagination ul.page-numbers li span.current {
    /* CHANGE: Active color to #fdb716 */
    color: #fdb716 !important;
    font-weight: 700 !important;
    border-bottom: none !important; 
    background: transparent !important; 
}


/* =================================== */
/* MEDIA QUERIES (RESPONSIVE STYLES) */
/* =================================== */

/* TABLET (max 1024px) */
@media (max-width: 1024px) {
    /* NEW: Container slight padding adjustment */
    .cwf-filter-container { 
        padding: 18px; 
    }
    
    /* Heading size reduction for tablet (20px) */
    .cwf-header h3 { 
        font-size: 20px !important; 
    }
    
    /* Reduce scroll height for tablet */
    .cwf-category-list {
        max-height: 350px; 
    }
    
    /* Pagination Tablet Styles (18px, 28px) */
    .woocommerce-pagination ul.page-numbers li a, 
    .woocommerce-pagination ul.page-numbers li span {
        font-size: 18px !important; 
        line-height: 28px !important;
        padding: 4px 8px !important;
        min-width: 28px !important;
    }
}

/* MOBILE (max 767px) */
@media (max-width: 767px) {
    /* NEW: Adjust container padding and margin on mobile */
    .cwf-filter-container { 
        padding: 15px; 
        margin-bottom: 20px;
    }

    /* Heading size reduction for mobile (18px) */
    .cwf-header h3 { 
        font-size: 18px !important; 
    }
    
    /* NEW: Reduce header spacing on mobile */
    .cwf-header {
        margin-bottom: 10px;
        padding-bottom: 8px;
    }
    
    /* Further reduce scroll height for mobile */
    .cwf-category-list {
        max-height: 250px; /* Reduced to save vertical space */
    }
    
    /* Responsive list spacing and indentation */
    .cwf-category-list li {
        margin-bottom: 10px; /* Tighter spacing for mobile density */
    }
    .cwf-category-list ul { 
        margin-left: 8px; /* Reduced indentation */
        padding-left: 3px; 
    }
    .cwf-level-3, 
    .cwf-level-3 ul {
        margin-left: 8px; 
    }

    /* NEW: Increase touch target size for toggle icons on mobile */
    .cwf-toggle, .cwf-no-toggle { 
        width: 30px; /* Larger hit area */
        height: 30px; /* Larger hit area */
    }

    /* Pagination Mobile Styles (16px, 24px) */
    .woocommerce-pagination ul.page-numbers li a, 
    .woocommerce-pagination ul.page-numbers li span {
        font-size: 16px !important; 
        line-height: 24px !important;
        padding: 3px 6px !important;
        margin: 0 2px !important;
        min-width: 24px !important;
    }
}