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

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

.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__all {
    display: block;
    padding: 0.4rem 0;
    font-weight: 600;
    color: inherit;
    text-decoration: none;
    font-size: 0.95rem;
    border-bottom: 1px solid color-mix(in srgb, currentColor 10%, transparent);
    margin-bottom: var(--space-2);
}

.product-category-nav__all.is-active {
    color: var(--color-primary, #0066cc);
}

.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: column;
    gap: var(--space-2);
}

/* 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);
}

.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;
}
