/* --------------------------------------------------------------
   Auenag Custom Filters – Frontend Styles (Clean Version)
   Jouw originele layout + vaste containers voor image pills
-------------------------------------------------------------- */

/* --------------------------------------------------------------
   Global Variables
-------------------------------------------------------------- */
:root {
    --fac-img-size: 80px; /* fallback, groter dan origineel */
    --fac-img-size-mobile: 40px;

    --fac-pill-size-desktop: 36px;
    --fac-pill-size-mobile: 28px;

    --fac-hover-bg: rgba(0,0,0,0.06);

    --fac-gap: 8px;
    --fac-radius: 999px;
    --fac-border-width: 1px;
    --fac-primary: currentColor;
}

/* --------------------------------------------------------------
   Wrapper
-------------------------------------------------------------- */
.fac-wrapper {
    margin-bottom: 20px;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

/* --------------------------------------------------------------
   Desktop Filters
-------------------------------------------------------------- */
.fac-filters-inner {
    display: block;
}

/* --------------------------------------------------------------
   Mobile Toggle Button
-------------------------------------------------------------- */
.fac-mobile-toggle {
    display: none;
    margin-bottom: 10px;
}

.fac-mobile-toggle button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    border-radius: var(--fac-radius);
    border: none;
    background: var(--fac-primary);
    color: #fff;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
}

/* --------------------------------------------------------------
   Mobile Slide-in Panel
-------------------------------------------------------------- */
.fac-mobile-panel-overlay {
    display: none;
}

.fac-mobile-panel {
    position: fixed;
    top: 0;
    right: -100%;
    width: 85%;
    max-width: 360px;
    height: 100%;
    background: #fff;
    box-shadow: -2px 0 10px rgba(0,0,0,0.15);
    z-index: 9999;
    padding: 16px;
    overflow-y: auto;
    transition: right 0.3s ease-in-out;
}

.fac-mobile-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.fac-mobile-panel-close {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
}

.fac-mobile-panel-overlay.active {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.35);
    z-index: 9998;
}

.fac-mobile-panel.active {
    right: 0;
    display: block !important;
    visibility: visible !important;
}

.fac-mobile-panel.active .fac-filters-inner {
    display: block !important;
    min-height: 200px;
    opacity: 1 !important;
}

/* --------------------------------------------------------------
   Filter Groups
-------------------------------------------------------------- */
.fac-attr-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 16px;
    border: none !important;
}

.fac-attr-label {
    font-weight: 600;
    font-size: 14px;
    text-transform: uppercase;
    margin: 0;
}

/* --------------------------------------------------------------
   Pills & Tiles
-------------------------------------------------------------- */
.fac-subcat-tiles,
.fac-attr-pills {
    display: flex;
    flex-wrap: wrap;
    gap: var(--fac-gap);
    margin-bottom: 12px;
    border: none !important;
}

.fac-pill,
.fac-tile {
    border-radius: var(--fac-radius);
    padding: calc(var(--fac-pill-size-desktop) / 6)
             calc(var(--fac-pill-size-desktop) / 4);
    border: var(--fac-border-width) solid var(--fac-primary);
    color: var(--fac-primary);
    background: transparent;
    cursor: pointer;
    font-size: calc(var(--fac-pill-size-desktop) / 3);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: calc(var(--fac-pill-size-desktop) / 8);
    text-align: center;
    transition: all 0.15s ease-out;
}

/* --------------------------------------------------------------
   DESKTOP: Image Pills — Schalend op basis van img size
-------------------------------------------------------------- */
@media (min-width: 768px) {

    /* Force 5 per rij voor attribute pills met afbeelding */
    .fac-attr-pills .fac-pill.has-image {
        flex: 0 0 calc(20% - var(--fac-gap));
        max-width: calc(20% - var(--fac-gap));
        height: auto;
        padding: 8px 0;
        gap: 6px;
        overflow: hidden;
        box-sizing: border-box;
    }

    /* Afbeelding schaalt mee met container */
    .fac-pill.has-image img {
        width: var(--fac-img-size);
        max-width: 100%;
        height: auto;
        object-fit: contain;
        display: block;
    }

    /* Tekst onder icon */
    .fac-pill.has-image span {
        font-size: 12px;
        line-height: 1.2;
        width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        display: flex;
        justify-content: center;
        align-items: center;
        padding: 0 4px;
        box-sizing: border-box;
    }

    /* Voor subcat tiles, als je ook 5 per rij wilt (optioneel, nu niet geforceerd) */
    /* .fac-subcat-tiles .fac-tile.has-image {
        flex: 0 0 calc(20% - var(--fac-gap));
        max-width: calc(20% - var(--fac-gap));
        height: auto;
        padding: 8px 0;
        gap: 6px;
        overflow: hidden;
        box-sizing: border-box;
    } */

    /* .fac-tile.has-image img {
        width: var(--fac-img-size);
        max-width: 100%;
        height: auto;
        object-fit: contain;
        display: block;
    } */
}

/* --------------------------------------------------------------
   Hover States
-------------------------------------------------------------- */
.fac-pill:hover,
.fac-tile:hover {
    background: var(--fac-hover-bg);
    transform: translateY(-2px);
}

.fac-pill.has-image:hover,
.fac-tile.has-image:hover {
    transform: scale(1.04);
}

.fac-pill.active,
.fac-tile.active {
    background: var(--fac-primary);
    color: #fff;
}

/* --------------------------------------------------------------
   Actions
-------------------------------------------------------------- */
.fac-mobile-actions,
.fac-desktop-actions {
    margin-top: 16px;
    display: flex;
    gap: 10px;
}

.fac-apply-button,
.fac-reset-button {
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
}

.fac-apply-button {
    background: var(--fac-primary);
    color: #fff;
    border: none;
}

.fac-reset-button {
    background: transparent;
    border: 1px solid #ccc;
    color: #333;
}

/* --------------------------------------------------------------
   MOBILE (modal blijft 100% zoals nu, vaste sizes)
-------------------------------------------------------------- */
@media (max-width: 767px) {

    .fac-pill,
    .fac-tile {
        padding: calc(var(--fac-pill-size-mobile) / 6)
                 calc(var(--fac-pill-size-mobile) / 4);
        font-size: calc(var(--fac-pill-size-mobile) / 3);
    }

    .fac-pill.has-image,
    .fac-tile.has-image {
        width: 64px;
        height: 64px;
    }

    .fac-pill.has-image img,
    .fac-tile.has-image img {
        width: var(--fac-img-size-mobile);
        height: var(--fac-img-size-mobile);
    }

    .fac-filters-inner[data-desktop="true"] {
        display: none;
    }

    .fac-mobile-toggle {
        display: flex;
        justify-content: center;
    }

    .fac-desktop-actions {
        display: none;
    }
}