/* =========================================
   1. Widget & Container Basics
   ========================================= */
#awcf-filter-container {
    box-sizing: border-box;
    width: 100%;
}

.awcf-filter-group {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e0e0e0;
}

.awcf-filter-group:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

/* =========================================
   2. Toggle Headers
   ========================================= */
.awcf-filter-toggle {
    background-color: #213979; /* Default Fallback */
    padding: 12px 15px;
    color: #fff !important;
    border-radius: 5px;
    font-size: 16px !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    cursor: pointer;
    user-select: none;
    width: 100%;
    box-sizing: border-box;
    transition: opacity 0.2s ease;
}

.awcf-filter-toggle:hover {
    opacity: 0.9;
}

.awcf-filter-toggle h4 {
    margin: 0 !important;
    padding: 0 !important;
    font-size: inherit; 
    color: inherit !important;
    flex-grow: 1;
    border: none;
    font-weight: 600;
    background: none !important; /* Remove theme backgrounds */
}

.awcf-toggle-indicator {
    font-size: 20px;
    font-weight: bold;
    line-height: 1;
    color: inherit !important;
    margin-left: 10px;
}

/* =========================================
   3. Input & Search Styling
   ========================================= */
#awcf-search {
    width: 100%;
    padding: 10px 12px;
    margin-top: 15px; 
    border: 1px solid #ddd;
    border-radius: 4px;
    box-sizing: border-box;
    font-size: 14px;
    line-height: 1.4;
    background-color: #fff;
    color: #333;
}

#awcf-search:focus {
    border-color: #213979;
    outline: none;
}

/* =========================================
   4. Generic List Styles
   ========================================= */
ul.awcf-checkbox-list {
    list-style: none;
    margin: 15px 0 0 0 !important;
    padding: 0;
    max-height: 400px;
    overflow-y: auto;
    scrollbar-width: thin;
}

ul.awcf-checkbox-list li {
    margin-bottom: 8px;
}

/* =========================================
   5. DISPLAY MODE: TEXT (Standard)
   ========================================= */
.awcf-mode-text .awcf-item-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 2px 0;
}

.awcf-mode-text label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-weight: normal;
    font-size: 15px;
    color: #333;
    width: 100%;
}

.awcf-mode-text input[type="checkbox"] {
    margin-right: 10px;
    min-width: 18px;
    min-height: 18px;
}

/* =========================================
   6. DISPLAY MODE: IMAGE & BOTH (Grid)
   ========================================= */
.awcf-mode-image, 
.awcf-mode-both {
    display: grid !important;
    grid-template-columns: repeat(var(--awcf-cols-desk, 4), 1fr) !important; 
    gap: 10px !important;
    width: 100% !important;
    box-sizing: border-box !important;
    margin-top: 15px !important;
}

.awcf-mode-image li, 
.awcf-mode-both li {
    margin: 0 !important;
    padding: 0 !important;
    width: auto !important; 
    float: none !important; 
    border: none !important;
    background: transparent !important;
}

.awcf-mode-image .awcf-item-row,
.awcf-mode-both .awcf-item-row {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    width: 100%;
}

.awcf-mode-image input[type="checkbox"],
.awcf-mode-both input[type="checkbox"] {
    display: none; 
}

.awcf-mode-image label,
.awcf-mode-both label {
    cursor: pointer;
    display: block;
    width: 100%;
    margin: 0 !important;
}

.awcf-term-image {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    border: 2px solid #eee;
    border-radius: 5px;
    transition: all 0.2s ease;
    display: block;
}

.awcf-mode-image label:hover .awcf-term-image,
.awcf-mode-both label:hover .awcf-term-image {
    border-color: #bbb;
}

.awcf-mode-image input:checked + .awcf-term-image,
.awcf-mode-image input:checked + span .awcf-term-image,
.awcf-mode-both input:checked + .awcf-term-image,
.awcf-mode-both input:checked + span .awcf-term-image {
    border-color: #213979;
    box-shadow: 0 0 0 2px #213979 inset;
    opacity: 0.8;
}

.awcf-term-label {
    font-size: 12px;
    margin-top: 5px;
    display: block;
    line-height: 1.2;
    word-break: break-word;
}

.awcf-mode-image .awcf-term-label {
    display: none;
}

/* =========================================
   7. RESPONSIVE GRID LOGIC
   ========================================= */

/* Tablet (Max 980px) */
@media only screen and (max-width: 980px) {
    .awcf-filter-group .awcf-checkbox-list, 
    .awcf-filter-group .awcf-search-input,
    .awcf-filter-group .awcf-price-slider-wrapper { 
        display: none; 
    }
    
    .awcf-filter-toggle { 
        visibility: visible !important; 
        opacity: 1 !important; 
    }

    .awcf-mode-image, 
    .awcf-mode-both {
        display: grid !important;
        grid-template-columns: repeat(var(--awcf-cols-tab, 4), 1fr) !important;
    }
}

/* Mobile (Max 480px) */
@media only screen and (max-width: 480px) {
    .awcf-mode-image, 
    .awcf-mode-both {
        grid-template-columns: repeat(var(--awcf-cols-mob, 3), 1fr) !important;
    }
}

/* =========================================
   8. Misc UI (Pills, Load More)
   ========================================= */
.awcf-child-toggle {
    cursor: pointer;
    font-weight: bold;
    font-size: 18px;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    background: rgba(0,0,0,0.03);
    border-radius: 50%;
    margin-left: 5px;
}

ul.awcf-child-list {
    list-style: none;
    padding-left: 15px;
    margin: 5px 0 10px 0;
    border-left: 2px solid #f0f0f0;
    width: 100%;
}

#awcf-active-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 15px;
}

.awcf-pill {
    background-color: #f0f0f0;
    color: #333;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 13px;
    display: inline-flex;
    align-items: center;
    border: 1px solid #ddd;
}

.awcf-pill-remove {
    margin-left: 8px;
    cursor: pointer;
    font-weight: bold;
    color: #999;
    font-size: 16px;
    line-height: 1;
}

.awcf-pill-remove:hover {
    color: #d32f2f;
}

#awcf-load-more-container {
    text-align: center;
    padding: 20px 0;
    clear: both;
}

.awcf-load-more.disabled {
    pointer-events: none;
    opacity: 0.7;
}

ul.products.loading-products {
    position: relative;
    opacity: 0.6;
    pointer-events: none;
}

/* =========================================
   9. PRICE SLIDER
   ========================================= */
.awcf-price-slider-wrapper {
    padding: 10px 5px;
}

.awcf-price-slider-ui {
    margin-bottom: 15px;
    height: 6px;
    background: #e0e0e0;
    border: none;
    border-radius: 3px;
    position: relative;
}

.awcf-price-slider-ui .ui-slider-range {
    background: #213979;
    border-radius: 3px;
}

.awcf-price-slider-ui .ui-slider-handle {
    background: #fff;
    border: 2px solid #213979;
    width: 16px;
    height: 16px;
    top: -6px;
    border-radius: 50%;
    cursor: pointer;
    outline: none;
}

.awcf-price-inputs {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    color: #666;
}

.awcf-price-currency {
    font-weight: bold;
    margin-right: 2px;
}

.awcf-price-display {
    font-weight: 600;
    color: #333;
}

/* =========================================
   10. THEME OVERRIDE (Fix Rogue Icons)
   ========================================= */
/* Remove any ::before or ::after added by the theme to the H4 tag */
.awcf-filter-toggle h4::before,
.awcf-filter-toggle h4::after {
    display: none !important;
    content: none !important;
}

/* Remove any ::before/::after on the container if treated as a widget */
#awcf-filter-container::before,
#awcf-filter-container::after {
    display: none !important;
    content: none !important;
}

/* Kill specific toggle classes themes often use */
#awcf-filter-container > span.toggle,
#awcf-filter-container > i.toggle {
    display: none !important;
}

/* Reset padding if theme pushes content down */
#awcf-filter-container {
    padding-top: 0 !important;
    margin-top: 0 !important;
}