/**
 * SIW Quick Search – Styling
 * 70% breedte overlay, 3 kolommen, responsive
 * @author Elmar van Sterk In Web
 */

/* ── Zoekbalk ── */
.siw-qs-wrapper {
    position: relative;
    width: 70%;
    max-width: 520px;
    margin: 0;
}

.siw-qs-input-wrap {
    display: flex;
    align-items: center;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    transition: border-color .2s, box-shadow .2s;
}

.siw-qs-input-wrap:focus-within {
    border-color: #1a1a1a;
    box-shadow: 0 0 0 2px rgba(26,26,26,.08);
}

.siw-qs-icon {
    padding: .5rem .25rem .5rem .75rem;
    color: #888;
    font-size: 1.25rem;
    flex-shrink: 0;
    display: flex;
    align-items: center;
}

.siw-qs-input {
    flex: 1;
    border: none;
    padding: .625rem .5rem;
    font-size: .9375rem;
    font-family: 'Manrope', sans-serif;
    outline: none;
    background: transparent;
    min-width: 0;
    -webkit-appearance: none;
    appearance: none;
}

.siw-qs-input::placeholder {
    color: #aaa;
}

.siw-qs-clear {
    display: none;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    padding: .5rem .625rem;
    cursor: pointer;
    color: #B61924;
    flex-shrink: 0;
    transition: color .15s;
}

.siw-qs-clear:hover {
    color: #8a1019;
}

.siw-qs-clear.is-visible {
    display: flex;
}

.siw-qs-clear .material-icons {
    font-size: 1.125rem;
}

/* ── Zoek-alles knop (verborgen op desktop) ── */
.siw-qs-submit {
    display: none;
    align-items: center;
    justify-content: center;
    background: #B61924;
    border: none;
    padding: .5rem .75rem;
    cursor: pointer;
    color: #fff;
    flex-shrink: 0;
    transition: background .15s;
}

.siw-qs-submit:hover {
    background: #8a1019;
}

.siw-qs-submit .material-icons {
    font-size: 1.25rem;
}

/* ── Back-knop (verborgen op desktop) ── */
.siw-qs-back {
    display: none;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    padding: .5rem;
    cursor: pointer;
    color: #B61924;
    flex-shrink: 0;
}

.siw-qs-back .material-icons {
    font-size: 1.25rem;
}

/* ── Overlay ── */
.siw-qs-overlay {
    display: flex;
    position: fixed;
    inset: 0;
    z-index: 1055;
    background: rgba(0, 0, 0, 0);
    justify-content: center;
    align-items: flex-start;
    padding-top: 90px;
    pointer-events: none;
    visibility: hidden;
    transition: background .25s, visibility .25s;
}

.siw-qs-overlay.is-open {
    background: rgba(0, 0, 0, .45);
    pointer-events: auto;
    visibility: visible;
}

/* ── Resultatenpaneel ── */
.siw-qs-results {
    width: 70%;
    max-height: 70vh;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, .18);
    overflow: hidden;
    transform: translateY(-12px);
    opacity: 0;
    transition: transform .25s ease, opacity .25s ease;
}

.siw-qs-overlay.is-open .siw-qs-results {
    transform: translateY(0);
    opacity: 1;
}

/* Scrollbar per kolom */
.siw-qs-column::-webkit-scrollbar {
    width: 5px;
}

.siw-qs-column::-webkit-scrollbar-track {
    background: transparent;
}

.siw-qs-column::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

.siw-qs-column {
    scrollbar-width: thin;
    scrollbar-color: #ccc transparent;
}

/* ── Kolommen ── */
.siw-qs-columns {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    height: 100%;
    max-height: 70vh;
}

.siw-qs-column {
    padding: 1.25rem;
    border-right: 1px solid #e0e0e0;
    overflow-y: auto;
    max-height: 70vh;
}

.siw-qs-column:last-child {
    border-right: none;
}

.siw-qs-col-title {
    font-size: .75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: #888;
    margin: 0 0 .75rem;
    padding-bottom: .5rem;
    border-bottom: 2px solid #1a1a1a;
}

/* ── Categorie/Merk lijsten met afbeeldingen ── */
.siw-qs-thumb-list {
    display: flex;
    flex-direction: column;
    gap: .25rem;
}

.siw-qs-thumb-item {
    display: flex;
    align-items: center;
    gap: .625rem;
    padding: .375rem .5rem;
    border-radius: 6px;
    text-decoration: none;
    color: #1a1a1a;
    transition: background .15s;
}

.siw-qs-thumb-item:hover {
    background: #f5f5f7;
}

.siw-qs-thumb-img {
    width: 36px;
    height: 36px;
    object-fit: contain;
    border-radius: 4px;
    flex-shrink: 0;
    background: #f5f5f7;
}

.siw-qs-thumb-name {
    font-size: .875rem;
    font-weight: 500;
    min-width: 0;
}

/* ── Categorie/Merk lijsten (legacy tekst) ── */
.siw-qs-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.siw-qs-list li {
    margin-bottom: .25rem;
}

.siw-qs-list a {
    color: #1a1a1a;
    text-decoration: none;
    font-size: .875rem;
    padding: .375rem .5rem;
    border-radius: 6px;
    display: block;
    transition: background .15s;
}

.siw-qs-list a:hover {
    background: #f5f5f7;
}

/* ── Productitems ── */
.siw-qs-product-list {
    display: flex;
    flex-direction: column;
    gap: .375rem;
}

.siw-qs-product {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .5rem;
    border-radius: 6px;
    text-decoration: none;
    color: #1a1a1a;
    transition: background .15s;
}

.siw-qs-product:hover {
    background: #f5f5f7;
}

.siw-qs-product-img {
    width: 48px;
    height: 48px;
    object-fit: contain;
    border-radius: 4px;
    flex-shrink: 0;
    background: #f5f5f7;
}

.siw-qs-no-img {
    background: #fff;
}

.siw-qs-product-info {
    display: flex;
    flex-direction: column;
    gap: .125rem;
    min-width: 0;
}

.siw-qs-product-name {
    font-size: .875rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.siw-qs-product-ref {
    font-size: .75rem;
    color: #999;
}

.siw-qs-product-price {
    font-size: .875rem;
    font-weight: 700;
    color: #B61924;
}

/* ── Bekijk alle link ── */
.siw-qs-col-products {
    display: flex;
    flex-direction: column;
}

.siw-qs-col-products .siw-qs-product-list {
    flex: 1;
}

.siw-qs-view-all {
    display: block;
    margin-top: auto;
    padding-top: .5rem;
    border-top: 1px solid #e0e0e0;
    font-size: .75rem;
    color: #B61924;
    text-decoration: none;
    text-align: right;
    transition: color .15s;
}

.siw-qs-view-all:hover {
    color: #8a1019;
}

/* ── Geen resultaten ── */
.siw-qs-no-results {
    padding: 2.5rem 1.5rem;
    text-align: center;
    color: #666;
    font-size: .9375rem;
}

.siw-qs-empty {
    color: #aaa;
    font-size: .8125rem;
    font-style: italic;
    margin: .5rem 0 0;
}

/* ── Loading ── */
.siw-qs-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .625rem;
    padding: 2.5rem;
    color: #888;
    font-size: .9375rem;
}

.siw-qs-spinner {
    width: 18px;
    height: 18px;
    border: 2px solid #e0e0e0;
    border-top-color: #1a1a1a;
    border-radius: 50%;
    animation: siw-qs-spin .6s linear infinite;
}

@keyframes siw-qs-spin {
    to { transform: rotate(360deg); }
}

/* ── Highlight ── */
.siw-qs-results mark {
    background: #fff3cd;
    color: inherit;
    padding: 0 1px;
    border-radius: 2px;
}

/* ── Responsive: Tablet ── */
@media (max-width: 1024px) {
    .siw-qs-results {
        width: 96%;
    }
}

/* ── Responsive: Tablet ── */
@media (min-width: 768px) and (max-width: 1024px) {
    .siw-qs-wrapper {
        width: 100%;
        max-width: none;
    }

    /* Verberg lege kolommen op tablet */
    .siw-qs-column.siw-qs-col-empty {
        display: none;
    }

    /* Categorieën en merken altijd 25%, producten pakt de rest */
    .siw-qs-columns {
        grid-template-columns: 1fr;
    }

    .siw-qs-col-categories:not(.siw-qs-col-empty),
    .siw-qs-col-brands:not(.siw-qs-col-empty) {
        width: 25%;
    }

    .siw-qs-columns {
        display: flex;
    }

    .siw-qs-col-products {
        flex: 1;
        min-width: 0;
    }

    .siw-qs-col-categories:not(.siw-qs-col-empty),
    .siw-qs-col-brands:not(.siw-qs-col-empty) {
        flex: 0 0 25%;
        max-width: 25%;
    }

    .siw-qs-column {
        padding: .875rem;
    }

    .siw-qs-product-name {
        font-size: .8125rem;
    }

    .siw-qs-product-img {
        width: 40px;
        height: 40px;
    }

    .siw-qs-product {
        gap: .5rem;
    }

    .siw-qs-list a {
        font-size: .8125rem;
        padding: .25rem .375rem;
    }

    .siw-qs-input {
        font-size: .875rem;
        padding: .5rem .375rem;
    }

    .siw-qs-icon {
        font-size: 1.125rem;
        padding: .375rem .25rem .375rem .5rem;
    }
}

/* ── Mobiele zoekbalk container ── */
.siw-qs-mobile-bar {
    display: none;
    padding: .5rem 15px;
}

@media (max-width: 767px) {
    .siw-qs-mobile-bar {
        display: block;
    }
}

/* ── Responsive: Mobiel (basis) ── */
@media (max-width: 767px) {
    .siw-qs-wrapper {
        width: 100%;
        max-width: none;
        padding: 0;
    }

    .siw-qs-input-wrap {
        border-radius: 6px;
    }

    .siw-qs-input {
        font-size: 1rem;
        padding: .5rem .375rem;
    }

    .siw-qs-icon {
        font-size: 1.125rem;
        padding: .375rem .25rem .375rem .5rem;
    }
}

/* ── Mobiel: Fullscreen zoekmodus ── */
body.siw-qs-fullscreen {
    overflow: hidden;
}

body.siw-qs-fullscreen .siw-qs-mobile-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1060;
    background: #fff;
    padding: .625rem 10px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, .1);
}

body.siw-qs-fullscreen .siw-qs-back {
    display: flex;
}

body.siw-qs-fullscreen .siw-qs-icon {
    display: none;
}

body.siw-qs-fullscreen .siw-qs-submit {
    display: flex;
}

body.siw-qs-fullscreen .siw-qs-input-wrap {
    border: none;
    box-shadow: none;
    border-radius: 0;
}

body.siw-qs-fullscreen .siw-qs-input-wrap:focus-within {
    box-shadow: none;
}

body.siw-qs-fullscreen .siw-qs-overlay {
    display: block;
    position: fixed;
    top: 52px;
    left: 0;
    right: 0;
    bottom: 0;
    background: #f5f5f7;
    padding: 0;
    z-index: 1059;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    pointer-events: auto;
    visibility: visible;
    transition: none;
}

body.siw-qs-fullscreen .siw-qs-overlay.is-open {
    background: #f5f5f7;
}

body.siw-qs-fullscreen .siw-qs-results {
    width: 100%;
    max-height: none;
    border-radius: 0;
    box-shadow: none;
    transform: none;
    opacity: 1;
    overflow: visible;
}

body.siw-qs-fullscreen .siw-qs-columns {
    grid-template-columns: 1fr;
}

body.siw-qs-fullscreen .siw-qs-column {
    border-right: none;
    border-bottom: 1px solid #e0e0e0;
    padding: .75rem;
    overflow: hidden;
    background: #fff;
}

body.siw-qs-fullscreen .siw-qs-column:last-child {
    border-bottom: none;
}

body.siw-qs-fullscreen .siw-qs-product-name {
    font-size: .8125rem;
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

body.siw-qs-fullscreen .siw-qs-product-img {
    width: 40px;
    height: 40px;
}

body.siw-qs-fullscreen .siw-qs-product {
    gap: .5rem;
    padding: .375rem;
}

body.siw-qs-fullscreen .siw-qs-product-ref {
    font-size: .6875rem;
}

body.siw-qs-fullscreen .siw-qs-product-price {
    font-size: .8125rem;
}

body.siw-qs-fullscreen .siw-qs-loading {
    background: #fff;
}

body.siw-qs-fullscreen .siw-qs-no-results {
    background: #fff;
}
