/*
 * LayerProductOverview — catalog/listing-page met filter-aside.
 * Mobile: filter klapt onder de results.
 */

@import url('variables/webshop.css') layer(site);

/* Cascade-laag `site` — het waarom staat in base.css. */
@layer site {
.layer__product-overview {
    padding-block: var(--space-5);
}

.product-overview__head {
    max-width: var(--content-max);
    margin-inline: auto;
    padding-inline: var(--gutter);
    margin-bottom: var(--space-4);
}

.product-overview__title {
    font-size: var(--fs-h1);
    line-height: var(--line-tight);
    margin: 0;
}

.product-overview__body {
    max-width: var(--content-max);
    margin-inline: auto;
    padding-inline: var(--gutter);
    display: grid;
    grid-template-columns: var(--ws-filter-aside-w) 1fr;
    gap: var(--space-5);
}

@media (max-width: 64rem) {
    .product-overview__body {
        grid-template-columns: 1fr;
    }
    /* Filter onder de resultaten, met duidelijke scheiding. */
    .product-overview__filter {
        order: 2;
        border-top: 1px solid color-mix(in srgb, currentColor 12%, transparent);
        padding-top: var(--space-4);
    }
}

@media (max-width: 48rem) {
    .layer__product-overview { padding-block: var(--space-4); }
    .product-overview__grid { gap: var(--space-3); }
    .product-overview__title { font-size: clamp(1.5rem, 7vw, var(--fs-h1)); }
}

/* ── Categorie-nav ────────────────────────────────────────── */

.product-category-nav {
    margin-bottom: var(--space-4);
}

.product-category-nav__list,
.product-category-nav__sub {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.product-category-nav__sub {
    padding-left: var(--space-3);
    margin-top: 2px;
    display: none;
}

.product-category-nav__item.is-open > .product-category-nav__sub {
    display: flex;
}

.product-category-nav__link {
    display: block;
    padding: 0.35rem 0.5rem;
    border-radius: var(--radius-sm, 0.4rem);
    color: inherit;
    text-decoration: none;
    font-size: 0.9rem;
    transition: background 0.15s ease, color 0.15s ease;
    line-height: 1.3;
}

.product-category-nav__link:hover {
    background: color-mix(in srgb, var(--color-primary, #0066cc) 8%, transparent);
    color: var(--color-primary, #0066cc);
}

.product-category-nav__link.is-active {
    background: color-mix(in srgb, var(--color-primary, #0066cc) 12%, transparent);
    color: var(--color-primary, #0066cc);
    font-weight: 600;
}

.product-category-nav__item.has-children > .product-category-nav__link::after {
    content: '';
    display: inline-block;
    width: 0.5em;
    height: 0.5em;
    border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    transform: rotate(-45deg) translateY(-1px);
    margin-left: 0.5em;
    opacity: 0.5;
    vertical-align: middle;
    transition: transform 0.2s ease;
}

.product-category-nav__item.has-children.is-open > .product-category-nav__link::after {
    transform: rotate(45deg) translateY(-2px);
}

/* ── Actieve-filter chips ─────────────────────────────────── */

.product-overview__chips {
    max-width: var(--content-max);
    margin: 0 auto var(--space-4);
    padding-inline: var(--gutter);
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    align-items: center;
}

.product-overview__chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: color-mix(in srgb, var(--color-primary, #c8902a) 12%, transparent);
    color: inherit;
    text-decoration: none;
    border-radius: 999px;
    padding: 0.3rem 0.7rem 0.3rem 0.85rem;
    font-size: 0.85rem;
    line-height: 1;
    transition: background-color .15s ease;
}

.product-overview__chip:hover {
    background: color-mix(in srgb, var(--color-primary, #c8902a) 22%, transparent);
}

.product-overview__chip-x {
    display: inline-grid;
    place-items: center;
    width: 1.1rem;
    height: 1.1rem;
    border-radius: 50%;
    background: color-mix(in srgb, currentColor 18%, transparent);
    font-size: 0.95rem;
    line-height: 1;
}

.product-overview__chip--reset {
    background: transparent;
    color: color-mix(in srgb, currentColor 70%, transparent);
    text-decoration: underline;
    padding-inline: 0.4rem;
}

.product-overview__chip--reset:hover {
    background: transparent;
    color: var(--color-primary, #c8902a);
}

/* ── Filter aside ─────────────────────────────────────────── */

.product-overview__filter-title {
    font-size: var(--fs-h3);
    margin: 0 0 var(--space-3);
}

/* Bewust NIET sticky: de filter-aside scrollt gewoon met de pagina mee. Bij
   langere filter-sets (kleur/maat) voelde een sticky-kolom rommelig, zelfs met
   eigen scrollbalk. Rustiger om 'm normaal in de grid-kolom te laten staan. */

.product-overview__filter-form {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.product-overview__facet {
    border: 0;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.product-overview__facet legend {
    font-weight: 600;
    font-size: 0.95rem;
    padding: 0;
    margin-bottom: var(--space-1);
}

.product-overview__facet-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.product-overview__facet-list label {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    cursor: pointer;
}

/* Facet-telling (drilldown): aantal producten dat de optie zou opleveren. */
.product-overview__facet-list .facet-count {
    margin-left: auto;
    font-size: 0.8em;
    color: color-mix(in srgb, currentColor 55%, transparent);
    font-variant-numeric: tabular-nums;
}

/* Kleur-swatch (bolletje) vóór een kleur-optie. Alleen attribuut-waarden met
   een hex-kleur krijgen 'm; maat/type tonen niets. Flex-child in het label,
   dus niet laten krimpen. De gap op het label verzorgt de tussenruimte. */
.product-overview__facet-list .facet-swatch {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 1px solid rgba(0, 0, 0, .2);
    vertical-align: middle;
    flex: 0 0 auto;
}

/* Lege optie (telling 0, niet zelf geselecteerd): gedimd + niet klikbaar. */
.product-overview__facet-list label.is-empty {
    opacity: 0.45;
    cursor: not-allowed;
}

.product-overview__price-row {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: var(--space-2);
}

/* Van/tot naast elkaar: beide helften even breed, en `min-width:0` zodat de
   number-input mag krimpen in plaats van de rij open te duwen. */
.product-overview__price-row > .product-overview__price-input {
    flex: 1 1 0;
    min-width: 0;
    width: auto;
}

/* Uniforme input-styling — gedeelde tokens met `.form-input` (forms.css)
   zodat search, price-fields én contact-form-velden visueel matchen. */
.product-overview__search,
.product-overview__price-input {
    display: flex;
    align-items: center;
    width: 100%;
    background: var(--form-input-bg, var(--color-bg, #fff));
    color: var(--color-fg, inherit);
    border: 1.5px solid var(--form-input-border, color-mix(in srgb, currentColor 16%, transparent));
    border-radius: var(--form-radius, var(--radius-md, 0.6rem));
    font: inherit;
    transition: border-color .15s ease, box-shadow .15s ease;
}

.product-overview__search:focus,
.product-overview__price-input:focus-within {
    outline: 0;
    border-color: var(--form-input-border-active, var(--color-primary, #c8902a));
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-primary, #c8902a) 18%, transparent);
}

/* Search: ingebouwde SVG-lupe links via currentColor, themable. */
.product-overview__search {
    padding: 0.7rem 0.9rem 0.7rem 2.6rem;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' opacity='0.55'><circle cx='11' cy='11' r='7'/><path d='m20 20-3.5-3.5'/></svg>");
    background-repeat: no-repeat;
    background-position: 0.85rem center;
    background-size: 1rem 1rem;
}
.product-overview__search::placeholder {
    color: color-mix(in srgb, currentColor 50%, transparent);
}

/* Dropdown-facet — alléén de NATIVE <select> (mobiel / zonder JS). Op desktop
   upgradet custom-select.js 'm naar `.select-display` (eigen styling + arrow);
   die widget erft toevallig deze class, dus scope hier op `select.` zodat we de
   widget niet dubbel stylen (dubbele chevron). Zelfde hoogte/border als de inputs;
   eigen chevron via currentColor (themable). */
select.product-overview__select {
    appearance: none;
    -webkit-appearance: none;
    width: 100%;
    padding: 0.7rem 2.4rem 0.7rem 0.9rem;
    cursor: pointer;
    background-color: var(--form-input-bg, var(--color-bg, #fff));
    color: var(--color-fg, inherit);
    border: 1.5px solid var(--form-input-border, color-mix(in srgb, currentColor 16%, transparent));
    border-radius: var(--form-radius, var(--radius-md, 0.6rem));
    font: inherit;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='m6 9 6 6 6-6'/></svg>");
    background-repeat: no-repeat;
    background-position: right 0.85rem center;
    background-size: 1rem 1rem;
    transition: border-color .15s ease, box-shadow .15s ease;
}

select.product-overview__select:focus {
    outline: 0;
    border-color: var(--form-input-border-active, var(--color-primary, #c8902a));
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-primary, #c8902a) 18%, transparent);
}

/* Price: label + input binnen één container; padding op de container zodat
   het focus-ring om beide loopt. */
.product-overview__price-input {
    padding: 0 0.9rem;
    gap: 0.4rem;
}

.product-overview__price-input__label {
    display: inline-flex;
    align-items: center;
    font-size: 0.9rem;
    color: color-mix(in srgb, currentColor 55%, transparent);
    white-space: nowrap;
}

.product-overview__price-row input {
    flex: 1;
    min-width: 0;
    width: 100%;
    border: 0;
    background: transparent;
    color: inherit;
    padding: 0.7rem 0;
    font: inherit;
    outline: 0;
    /* Verwijder de spin-buttons voor een rustiger beeld. */
    appearance: textfield;
    -moz-appearance: textfield;
}
.product-overview__price-row input::-webkit-outer-spin-button,
.product-overview__price-row input::-webkit-inner-spin-button {
    appearance: none;
    -webkit-appearance: none;
    margin: 0;
}
.product-overview__price-row input::placeholder {
    color: color-mix(in srgb, currentColor 45%, transparent);
}

.product-overview__filter-clear {
    text-align: center;
    color: color-mix(in srgb, currentColor 70%, transparent);
    font-size: 0.9rem;
}

/* ── Main / toolbar ───────────────────────────────────────── */

.product-overview__main {
    min-width: 0;
}

.product-overview__toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-3);
    flex-wrap: wrap;
    gap: var(--space-2);
}

.product-overview__count {
    color: color-mix(in srgb, currentColor 70%, transparent);
    font-size: 0.9rem;
}

.product-overview__sort-label {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    font-size: 0.9rem;
}

/* Alleen de native select stylen — custom-select kopieert de class naar de
   display-widget, die z'n eigen styling uit custom-select.css haalt. */
select.product-overview__sort {
    border: var(--ws-input-border);
    border-radius: var(--ws-input-radius);
    padding: 0.4rem 0.6rem;
    font: inherit;
    background: transparent;
}

/* ── Grid ─────────────────────────────────────────────────── */

.product-overview__grid {
    display: grid;
    /* min(48%, …): op smalle schermen 2 kaarten naast elkaar, daarboven auto-fill. */
    grid-template-columns: repeat(auto-fill, minmax(min(48%, var(--ws-grid-min-card)), 1fr));
    gap: var(--space-4);
}

.product-overview__empty {
    padding: var(--space-6) var(--space-4);
    text-align: center;
    color: color-mix(in srgb, currentColor 60%, transparent);
}

/* ── Card ─────────────────────────────────────────────────── */

/* Kaart-styling staat in product-card.css. Die wordt door ProductCardRenderer
   zelf aangemeld (StyleRegistry → <head>) op élke pagina die kaarten toont —
   dus geen @import hier nodig. */

/* ── Pagination ───────────────────────────────────────────── */

.product-overview__pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    margin-top: var(--space-5);
    padding-top: var(--space-3);
    border-top: 1px solid color-mix(in srgb, currentColor 10%, transparent);
}

/* F423: product-filter.js zet het native hidden-attribuut zodra infinite scroll actief
   wordt. Zonder deze regel wint `display: flex` hierboven het van de browser-default
   `[hidden]{display:none}` en blijft de nav zichtbaar ondanks hidden=true. */
.product-overview__pagination[hidden] {
    display: none;
}

.product-overview__pagination .pagination__current {
    color: color-mix(in srgb, currentColor 65%, transparent);
    font-size: 0.9rem;
}

/* Fetch-swap (filteren/sorteren zonder full reload): subtiele dim tijdens laden. */
.product-overview__main.is-loading {
    opacity: 0.55;
    transition: opacity 0.15s ease;
    pointer-events: none;
}

/* ── Infinite scroll (F423) ───────────────────────────────── */

.product-overview__sentinel {
    height: 1px;
}

.product-overview__sr-status {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.product-card--enter {
    opacity: 0;
    transform: translateY(1rem);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.product-card--enter-active {
    opacity: 1;
    transform: none;
}

@media (prefers-reduced-motion: reduce) {
    .product-card--enter,
    .product-card--enter-active {
        transition: none;
        transform: none;
    }
}

/* F484: filters stonden op mobiel na alle producten (order:2 hierboven), onbereikbaar
   zonder door de hele lijst te scrollen. Vaste "Filters"-knop onderin opent het bestaande
   filterpaneel als paneel van onderaf. Progressive enhancement: public/js/custom/custom.js
   zet .has-filter-toggle op <body> zodra het script draait — zonder JS blijven knop/
   backdrop/sluitknop verborgen en is de aside gewoon de inline versie van hiervoor. */
.product-overview__filter-toggle,
.product-overview__filter-backdrop,
.product-overview__filter-close {
    display: none;
}

@media (max-width: 64rem) {
    body.has-filter-toggle .product-overview__filter-toggle {
        display: inline-flex;
        align-items: center;
        gap: .4rem;
        position: fixed;
        left: 50%;
        bottom: max(1rem, env(safe-area-inset-bottom));
        transform: translateX(-50%);
        z-index: 60;
        padding: .75rem 1.5rem;
        border: 0;
        border-radius: 999px;
        background: var(--color-primary);
        color: var(--color-primary-fg);
        font: inherit;
        font-weight: 600;
        box-shadow: 0 4px 16px rgba(0, 0, 0, .2);
        cursor: pointer;
    }

    /* z-index boven .site-header (100) en het zoek-overlay-paar (199/200) --
       maar onder de cookie-balk (1000) en het mobiele hoofdmenu (9999), die
       terecht altijd winnen als ze allebei open zouden staan. */
    body.has-filter-toggle .product-overview__filter-backdrop:not([hidden]) {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, .4);
        z-index: 299;
    }

    body.has-filter-toggle .product-overview__filter {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 300;
        max-height: 85vh;
        overflow-y: auto;
        background: var(--color-bg);
        border-radius: 1rem 1rem 0 0;
        box-shadow: 0 -8px 24px rgba(0, 0, 0, .2);
        padding: var(--space-4);
        padding-bottom: max(var(--space-4), env(safe-area-inset-bottom));
        transform: translateY(100%);
        transition: transform .25s ease;
    }
    body.has-filter-toggle .product-overview__filter.is-open {
        transform: translateY(0);
    }

    body.has-filter-toggle .product-overview__filter-close {
        display: block;
        position: sticky;
        top: 0;
        margin-left: auto;
        width: 2.25rem;
        height: 2.25rem;
        border: 0;
        border-radius: 50%;
        background: color-mix(in srgb, currentColor 8%, transparent);
        font-size: 1.25rem;
        line-height: 1;
        cursor: pointer;
    }
}

@media (prefers-reduced-motion: reduce) {
    body.has-filter-toggle .product-overview__filter {
        transition: none;
    }
}

}
