/* =======================================================
   AC CUSTOM FILTERS - HLAVNÝ DIZAJN (SPOĽOČNÝ/DESKTOP)
   Firemné farby: #0d69ba (Modrá), #EFF6FF (Svetlomodrá), 
   #444 (Tmavosivá text), #999 (Svetlosivá), #e53e3e (Červená)
======================================================= */

/* --- Skrytie Phone --- */
.ac-mobile-reset-btn {
    display: none !important;
}

@media (min-width: 992px) {
    .ac-mobile-fs-menu,
    .ac-cat-mobile-overlay {
        display: none !important;
    }
}

.ac-mobile-action-bar, 
.ac-filter-mobile-header, 
.ac-filter-overlay,
.ac-mobile-toggle,
.ac-mobile-close {
    display: none;
}

/* --- Clear ---*/
#block-4 > p:first-child,
.widget_block > p:first-child,
.td-shop-sidebar p {
    display: none !important;
    margin: 0 !important;
    padding: 0 !important;
    height: 0 !important;
    visibility: hidden !important;
}

.woocommerce .woocommerce-result-count,
.woocommerce .woocommerce-ordering,
.woocommerce-pagination,
nav.woocommerce-pagination { 
    display: none !important; 
}

ul.products, .woocommerce .products {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
}

/* --- Loader ---*/

.ac-loader-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.7);
    z-index: 1000;
    display: none;
    justify-content: center; 
    align-items: flex-start; 
    padding-top: 80px;
}

.ac-loader-template{
    display: none;
}

/* --- SKUP FILTROV A ROZDELENIE --- */
.ac-filter-group {
    margin-bottom: 10px;
    border-bottom: 1px solid #eee;
    padding-bottom: 6px;
}
.ac-filter-title {
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #444;
}
.ac-toggle-icon {
    font-size: 10px;
    transition: transform 0.3s ease;
    color: #999;
}
.ac-filter-group.closed .ac-toggle-icon {
    transform: rotate(-90deg);
}
.ac-filter-group.closed .ac-filter-options {
    display: none;
}
.ac-filter-group.closed .ac-show-more-btn {
    display: none !important;
}

/* --- CHECKBOXY A RADIO --- */
.ac-filter-options {
    display: flex;
    flex-direction: column;
    margin-top: 6px;
}
.ac-custom-checkbox {
    display: flex;
    align-items: center;
    position: relative;
    cursor: pointer;
    font-size: 13px;
    color: #444;
    user-select: none;
    margin-bottom: 5px;
}
.ac-custom-checkbox input {
    position: absolute;
    opacity: 0; 
    cursor: pointer;
    height: 0;
    width: 0;
}
.ac-checkmark {
    height: 16px;
    width: 16px;
    background-color: #fff;
    border: 1px solid #999;
    border-radius: 4px;
    margin-right: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

/* Hover a kliknutie na checkbox */
.ac-custom-checkbox:hover input ~ .ac-checkmark {
    border-color: #0d69ba;
}
.ac-custom-checkbox input:checked ~ .ac-checkmark {
    background-color: #0d69ba;
    border-color: #0d69ba;
}
.ac-custom-checkbox input:checked ~ .ac-checkmark:after {
    content: "✓";
    color: white;
    font-size: 11px;
    font-weight: bold;
}

/* Zakliknutý checkbox prefarbí aj číslo na modro */
.ac-custom-checkbox input:checked ~ .ac-term-count {
    color: #0d69ba;
    font-weight: 700;
}

/* --- ZAŠEDNUTIE PRÁZDNYCH FILTROV --- */
.ac-custom-checkbox.is-empty-term {
    opacity: 0.4;
    pointer-events: none;
}

/* Rádio buttony */
.ac-custom-checkbox.ac-radio .ac-checkmark {
    border-radius: 50%;
}

.ac-term-count {
    font-size: 13px;
    color: #999;
    margin-left: 6px;
    font-weight: 500;
}


/* --- UNIFORM DESIGN PRE NATÍVNE SELECTY --- */
.ac-dropdown, 
.ac-sort-input {
    width: 100%;
    padding: 12px 40px 12px 15px !important; 
    font-family: 'Gilroy', sans-serif !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    color: #444 !important;
    background-color: #fff !important;
    border: 1px solid #ddd !important;
    border-radius: 8px !important;
    cursor: pointer !important;
    outline: none !important;
    transition: all 0.3s ease !important;
    margin-bottom: 5px;
    
    /* Vypnutie vzhľadu prehliadača */
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;

    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23999999' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 15px center !important;
    background-size: 16px !important;
}

/* Špecifický štýl pre Zoradenie */
.ac-sort-input {
    border-color: #0d69ba !important;
    color: #0d69ba !important;
    font-weight: 700 !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%230d69ba' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E") !important;
    margin-bottom: 0;
}

/* Hover a Focus stavy */
.ac-dropdown:hover, 
.ac-sort-input:hover,
.ac-dropdown:focus, 
.ac-sort-input:focus {
    border-color: #0d69ba !important;
    background-color: #fcfdfe !important;
    box-shadow: 0 0 0 3px rgba(13, 105, 186, 0.1) !important;
}

.ac-dropdown option, 
.ac-sort-input option {
    padding: 10px !important;
    background: #fff !important;
    color: #444 !important;
    font-family: 'Gilroy', sans-serif !important;
}

/* --- FARBY A OBRÁZKY --- */
.ac-color-options {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.ac-color-checkbox input, .ac-image-checkbox input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}
.ac-color-swatch { 
    display: block;
    width: 32px;
    height: 32px;
    border-radius: 4px;
    border: 2px solid transparent; 
    cursor: pointer;
    transition: all 0.2s; 
}
.ac-color-checkbox input:checked + .ac-color-swatch { 
    border-color: #0d69ba;
    transform: scale(1.1);
}
.ac-color-checkbox:hover .ac-color-swatch {
    transform: scale(1.05);
}

/* --- MRIEŽKA OBRÁZKOV (DESKTOP: 4 V RADE) --- */
.ac-image-options {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 8px !important;
}

.ac-image-checkbox {
    margin-bottom: 0 !important;
    width: 100%;
}

.ac-image-swatch { 
    display: block;
    width: 100% !important;
    height: auto !important;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    border-radius: 4px; 
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
    background: #fff;
}
.ac-image-checkbox input:checked + .ac-image-swatch { 
    border-color: #0d69ba;
    transform: scale(1.08);
}
.ac-image-checkbox:hover .ac-image-swatch {
    transform: scale(1.05);
}

/* --- SLIDER --- */
.ac-slider-wrapper {
    padding: 0 5px 5px 5px;
} 

.ac-slider-ui {
    position: relative;
    height: 6px;
    background: #e0e0e0;
    border-radius: 4px;
    margin: 8px 10px 5px;
} 

.ac-slider-values {
    display: flex;
    justify-content: space-between;
    margin-top: 8px;
    font-size: 13px;
    font-weight: bold;
    color: #444;
} 

.ac-slider-ui .ui-slider-range {
    position: absolute;
    height: 100%;
    background: #0d69ba; 
    border-radius: 4px;
}
.ac-slider-ui .ui-slider-handle {
    position: absolute;
    width: 18px;
    height: 18px;
    background: #fff;
    border: 3px solid #0d69ba;
    border-radius: 50%;
    top: -6px; 
    margin-left: -9px;
    cursor: grab;
    outline: none;
    transition: transform 0.1s;
}
.ac-slider-ui .ui-slider-handle:active {
    cursor: grabbing;
    transform: scale(1.2); 
}

/* =======================================================
   HORNÝ PANEL (AKTÍVNE ŠTÍTKY A ZORADENIE)
======================================================= */

/* --- HORNÝ PANEL (TLAČIDLÁ, ZORADENIE, POČÍTADLO) --- */
.ac-top-bar-wrapper { 
    display: flex; 
    align-items: center; 
    margin-bottom: 25px;
    flex-wrap: wrap; 
    width: 100%; 
}

.ac-active-filters-container {
    flex-grow: 1; 
    display: flex;
    align-items: center;
    flex-wrap: wrap; 
    max-width: 60%; 
    gap: 8px;
}

.ac-total-products {
    font-size: 13px;
    color: #444;
    white-space: nowrap;
    padding: 8px 10px;
    margin-left: auto;
}

.ac-total-count {
    color: #0d69ba;  
    font-weight: 700;
}

.ac-filter-tag {
    display: inline-flex;
    align-items: center;
    background-color: #EFF6FF; 
    border: 1px solid #0d69ba; 
    color: #0d69ba;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 13px;
    transition: all 0.2s;
}

.ac-sorting-wrapper {
    display: flex;
    align-items: center;
    margin-left: auto;
}

.ac-active-filters-box {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.ac-active-toggle-wrapper {
    display: none;
    margin-bottom: 25px;
}

.ac-filter-tag strong {
    margin-left: 4px;
    color: #0d69ba;
}
.ac-remove-tag {
    margin-left: 8px;
    cursor: pointer;
    font-weight: bold;
    font-size: 16px;
    color: #0d69ba;
    line-height: 1;
    transition: transform 0.2s;
}
.ac-filter-tag:hover {
    background-color: #0d69ba;
    color: #fff;
}
.ac-filter-tag:hover strong, .ac-filter-tag:hover .ac-remove-tag {
    color: #fff;
}
.ac-remove-tag:hover {
    transform: scale(1.2);
}
.ac-clear-all-tags {
    font-size: 13px;
    color: #e53e3e;
    text-decoration: underline;
    margin-left: 8px;
    font-weight: bold;
}
.ac-clear-all-tags:hover {
    opacity: 0.7;
}

/* =======================================================
   TLAČIDLÁ PRE ZOBRAZIŤ VIAC A AKTÍVNE FILTRE
======================================================= */

.ac-toggle-active-btn {
    background-color: #EFF6FF;
    color: #0d69ba;
    border: 1px dashed #0d69ba;
    padding: 10px 15px;
    font-size: 13px;
    font-weight: 700;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
    display: inline-block;
    width: 100%;
}
.ac-toggle-active-btn:hover {
    background-color: #0d69ba;
    color: #fff;
    border-style: solid;
}
.ac-toggle-active-btn.is-active {
    background-color: #0d69ba;
    color: #fff;
    border-style: solid;
    box-shadow: inset 0 3px 5px rgba(0,0,0,0.1);
}

.ac-advanced-toggle-btn {
    cursor: pointer;
    color: #0d69ba;
    font-weight: bold;
    margin-top: 15px;
    text-align: center;
    font-size: 14px;
}
.ac-advanced-filters-container {
    display: none;
    margin-top: 15px;
    border-top: 1px dashed #ccc;
    padding-top: 15px;
}

.ac-show-more-btn {
    font-size: 13px;
    color: #0d69ba;
    font-weight: 700;
    cursor: pointer;
    margin-top: 5px;
    margin-bottom: 5px;
    transition: color 0.2s;
    display: inline-block;
    user-select: none;
}
.ac-show-more-btn:hover {
    color: #e53e3e;
}

.ac-load-more-wrapper {
    text-align: center;
    margin: 40px 0;
    width: 100%;
    clear: both;
}
#ac-load-more-btn {
    background-color: #fff;
    color: #0d69ba;
    border: 2px solid #0d69ba;
    padding: 12px 35px;
    font-size: 16px;
    font-weight: 700;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
    display: inline-block;
}
#ac-load-more-btn:hover {
    background-color: #0d69ba;
    color: #fff;
}

/* --- LOTTIE LOADER --- */
#ac-global-loader {
    position: fixed; 
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.7); 
    z-index: 999999; 
    display: none; 
    align-items: center;
    justify-content: center;
}

.ac-loader-content {
    text-align: center;
}

.ac-cat-header {
    white-space: nowrap; 
    min-width: max-content;
}

.ac-filter-offcanvas {
    width: 100%;
    flex: 0 0 100% !important;
    padding: 16px 24px;
}

.ac-filter-wrapper {
    width: 100%;
    padding: 0;
    margin: 0;
    box-sizing: border-box;
}

/* =======================================================
   RESPONZIVITA - ČISTO PHONE ÚPRAVY 
======================================================= */

@media (max-width: 992px) {
    .ac-mobile-toggle {
    pointer-events: auto !important;
    z-index: 9999 !important;
}

    /* Safari */
    .ac-remove-tag, 
    .ac-clear-all-tags, 
    .ac-reset-filter-btn {
    cursor: pointer !important;
    touch-action: manipulation !important;
    -webkit-tap-highlight-color: transparent;
}

    .ac-loader-overlay {
        display: none !important;
    }
    /*  OFF-CANVAS PANEL  */
    .ac-filter-offcanvas { 
        position: fixed;
        top: 0;
        left: -100%;
        width: 320px;
        max-width: 85%;
        height: 100vh; 
        background: #fff;
        z-index: 99999;
        overflow-y: auto;
        transition: left 0.3s ease;
        padding: 0 !important;
    }

.ac-filter-offcanvas.is-open {
    left: 0 !important;
    transform: translateX(0) !important;
    visibility: visible !important;
    display: block !important;
    z-index: 999999 !important;
}

/* Tmavý overlay */
.ac-filter-overlay.is-open {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    z-index: 999998 !important;
}
    
    .ac-filter-overlay { 
        display: block;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100vh; 
        background: rgba(0,0,0,0.7) !important;
        z-index: 99998;
        opacity: 0;
        visibility: hidden; 
        transition: opacity 0.3s ease, visibility 0.3s ease;
    }

    /* MOBILNÁ HLAVIČKA V PANELI */
    .ac-filter-mobile-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 15px 20px;
        background: #0d69ba;
        border-bottom: 2px solid #f0f0f0;
        font-weight: 800;
        font-size: 18px;
        color: #fff;
    }
    .ac-mobile-close { 
        display: block;
        position: static !important;
        font-size: 35px !important; 
        cursor: pointer;
        color: #fff;
        line-height: 1; 
    }

    /* ŠEDÉ NADPISY SEKCIÍ */
    .ac-filter-group {
        border-bottom: 1px solid #eee;
        padding-bottom: 0;
        margin-bottom: 0;
    }

    .ac-filter-title { 
        background: #f8f9fa; 
        padding: 15px 20px; 
        font-size: 16px; 
        font-weight: 800;
        text-transform: uppercase; 
        border-bottom: 1px solid #eee; 
        color: #333; 
    }
    .ac-filter-options {
        padding: 15px 20px;
    }

    /* MRIEŽKA OBRÁZKOV (MOBIL: 4 V RADE) */
    .ac-image-options {
        grid-template-columns: repeat(4, 1fr) !important;
        gap: 8px !important;
    }

    /* Väčšie medzery pre checkboxy na mobile */
    .ac-custom-checkbox {
        margin-bottom: 12px;
        padding: 2px 0;
    }
    .ac-advanced-toggle-btn {
     margin-bottom: 25px;
}
    .ac-show-more-btn {
        text-align: left;
        margin-left: 0;
        padding-left: 0;
        font-size: 14px;
        margin-top: 10px;
    }

/* --- MOBILNÉ USPORIADANIE HORNEJ LIŠTY (Tlačidlá 50/50) --- */
    .ac-top-bar-wrapper { 
        display: flex;
        flex-direction: row; 
        flex-wrap: wrap; 
        gap: 15px 10px; 
        align-items: center;
        width: 100%;
    }
    
    /* 1. Riadok: Tlačidlo Filtrovať (50%) */
    .ac-mobile-toggle { 
        flex: 1 1 calc(50% - 5px); 
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 8px 5px; 
        background-color: #0d69ba; 
        color: #fff; 
        border: 1px solid #0d69ba;
        border-radius: 8px;
        font-size: 14px;
        font-weight: 700;
        cursor: pointer;
        gap: 6px;
    }
    .ac-mobile-toggle svg { 
        width: 16px; 
        height: 16px; 
        stroke: #fff;
    }
    
    .ac-sorting-wrapper { 
        flex: 1 1 calc(50% - 5px); 
        width: auto;
    }
    .ac-sort-input { 
        padding: 8px 25px 8px 8px;
        font-size: 13px;
        background-color: #0d69ba; 
        color: #fff; 
        border: 1px solid #0d69ba;
        background-position: right 8px center;
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    }
    
    /* 2. Riadok: Zobrazené produkty (Centrované pod tlačidlami) */
    .ac-total-products { 
        flex: 1 1 100%;
        padding: 0; 
        font-size: 14px; 
        text-align: center; 
        order: 3;
    }

    /* 3. Riadok: Aktívne filtre na mobile spadnú úplne dole pod text */
    .ac-active-filters-container {
        flex: 1 1 100%;
        max-width: 100%;
        order: 4; 
        margin-top: 15px; 
        margin-bottom: 5px; 
    }
    
    body {
        padding-bottom: 0 !important;
    }

    /* Skryť desktopové "Zobraziť použité filtre" na mobile */
    .ac-toggle-active-btn {
        display: none !important;
    }
    
    /* Vystredenie a odsadenie obalu na mobile */
    .ac-active-toggle-wrapper {
        padding: 0 20px;
        margin-top: 15px;
        margin-bottom: 15px;
    }
    
    /* Dizajn tlačidla Resetovať filtre na mobile */
    .ac-mobile-reset-btn {
        display: inline-block !important;
        width: 100%;
        background-color: #fff;
        color: #e53e3e;
        border: 1px solid #e53e3e;
        padding: 6px 15px;
        font-size: 15px;
        font-weight: 800;
        border-radius: 8px;
        text-align: center;
        text-decoration: none;
        margin: 0 auto;
    }
    .ac-mobile-reset-btn:active {
        background-color: #e53e3e;
        color: #fff;
    }
}