/* ========================================================================
   JS Aanhangwagens — archive page (CPT 'aanhangwagens')
   Layout: filter sidebar (desktop) + offcanvas (mobile) + product grid
   ======================================================================== */

:root {
    --js-red: #d80000;
    --js-red-dark: #b80000;
    --js-black: #000;
    --js-text: #111;
    --js-text-muted: #555;
    --js-border: #e5e5e5;
    --js-bg: #fff;
    --js-bg-soft: #f8f8f8;
    --js-radius: 16px;
    --js-radius-sm: 10px;
    --js-shadow-hover: 0 8px 24px rgba(0, 0, 0, 0.08);
}

.js-archive {
    font-family: 'Outfit', system-ui, -apple-system, sans-serif;
    color: var(--js-text);
    background: var(--js-bg-soft);
    padding: 0 0 60px;
    min-height: 60vh;
    font-size: 16px;
    line-height: 1.5;
}
@media (max-width: 1023px) {
    .js-archive {
        padding: 120px 0 60px;
    }
}
/* Forceer 16px op ALLES binnen .js-archive */
.js-archive,
.js-archive *,
.js-archive *::before,
.js-archive *::after {
    font-size: 16px !important;
}
/* Specifieke uitzonderingen */
.js-archive .js-main .product-card__label {
    font-size: 12px !important;
    border-radius: 8px !important;
}

.js-archive-container {
    max-width: 1320px;
    margin: 0 auto;
    padding: 32px 24px;
    box-sizing: border-box;
}
@media (min-width: 1024px) {
    .js-archive-container {
        padding: 192px 24px;
    }
}

/* -------- Intro section -------- */
.js-archive-intro {
    margin-bottom: 28px;
}
.js-archive-intro h1 {
    font-size: 2.5rem;
    font-weight: 800;
    margin: 0 0 12px;
    color: var(--js-text);
    line-height: 1.2;
}
.js-archive-intro p {
    font-size: 1.125rem;
    line-height: 1.65;
    color: var(--js-text-muted);
    max-width: 760px;
    margin: 0;
}

/* -------- Mobile bar (count + filter toggle) -------- */
.js-archive-mobile-bar {
    display: none;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
    padding: 12px 0;
    border-bottom: 1px solid var(--js-border);
}
.js-archive-count-mobile {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--js-text);
}
.js-filter-toggle {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: var(--js-bg);
    border: 1px solid var(--js-border);
    padding: 10px 16px 10px 20px;
    border-radius: 999px;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    color: var(--js-text);
    font-family: inherit;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.js-filter-toggle:hover { border-color: var(--js-red); box-shadow: 0 2px 8px rgba(216, 0, 0, 0.15); }
.js-filter-toggle-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--js-red);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* -------- Layout grid -------- */
.js-archive-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 32px;
    align-items: start;
}

/* -------- Sidebar (desktop) -------- */
.js-sidebar {
    position: sticky;
    top: 100px;
    align-self: start;
}
.js-sidebar-inner {
    display: block;
}
.js-sidebar-header,
.js-sidebar-close,
.js-sidebar-actions {
    display: none;
}
.js-sidebar-backdrop {
    display: none;
}

/* -------- Main column -------- */
.js-main {
    min-width: 0; /* fix grid overflow */
}

/* -------- Toolbar -------- */
.js-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
    padding: 16px 20px;
    background: var(--js-bg);
    border: 1px solid var(--js-border);
    border-radius: var(--js-radius-sm);
}
.js-result-count {
    font-size: 1.05rem;
    font-weight: 600;
}
.js-sort {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 1rem;
}
.js-sort-label {
    color: var(--js-text-muted);
    font-weight: 500;
}
.js-sort select {
    appearance: none;
    -webkit-appearance: none;
    background: #fff url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>") no-repeat right 12px center;
    border: 1px solid var(--js-border);
    border-radius: 8px;
    padding: 10px 36px 10px 14px;
    font: inherit;
    font-size: 1rem;
    cursor: pointer;
    min-width: 200px;
    transition: border-color 0.2s ease;
}
.js-sort select:focus { outline: none; border-color: var(--js-red); }

/* -------- Product grid override (forceer 3 kolommen op desktop, 1 mobiel) -------- */
.js-main .product-grid {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 20px !important;
}
@media (max-width: 1100px) {
    .js-main .product-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}
@media (max-width: 700px) {
    .js-main .product-grid {
        grid-template-columns: 1fr !important;
    }
}

/* -------- Product card polish -------- */
.js-main .product-card {
    background: var(--js-bg) !important;
    border: 1px solid var(--js-border) !important;
    border-radius: var(--js-radius) !important;
    padding: 14px !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 10px !important;
    transition: box-shadow 0.2s ease, transform 0.05s ease;
    overflow: hidden;
}
.js-main .product-card:hover {
    box-shadow: var(--js-shadow-hover);
}

.js-main .product-card__image {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    aspect-ratio: 4 / 3;
    background: var(--js-bg-soft);
}
.js-main .product-card__image img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    display: block;
}
.js-main .product-card__label {
    position: absolute;
    top: 12px;
    left: 12px;
    background: var(--js-red);
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    padding: 5px 12px;
    border-radius: 999px;
    z-index: 1;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    box-shadow: 0 2px 6px rgba(216, 0, 0, 0.25);
}

.js-main .product-card__body {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

.js-main .product-card__title {
    font-size: 1.2rem;
    font-weight: 700;
    line-height: 1.35;
    color: var(--js-text);
    margin: 10px 0 0 !important;
    /* Line clamp 2 lines */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.js-main .product-card__desc {
    font-size: 1rem;
    line-height: 1.55;
    color: var(--js-text-muted);
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.js-main .product-card__divider {
    border: none;
    border-top: 1px solid var(--js-border);
    margin: 4px 0 0;
}

.js-main .product-card__specs-toggle .toggle-specs-btn {
    background: transparent;
    border: none;
    padding: 4px 0;
    color: var(--js-red);
    cursor: pointer;
    font-weight: 600;
    font-size: 0.95rem;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: inherit;
}
.js-main .product-card__specs-toggle .toggle-specs-btn::after {
    content: '';
    width: 7px;
    height: 7px;
    border-right: 2px solid var(--js-red);
    border-bottom: 2px solid var(--js-red);
    transform: rotate(45deg);
    transition: transform 0.2s ease;
    margin-top: -3px;
}
.js-main .product-card__specs-toggle .toggle-specs-btn.open::after {
    transform: rotate(-135deg);
    margin-top: 3px;
}

.js-main .product-card__specs-list {
    list-style: none;
    padding: 0;
    margin: 0;
    overflow: hidden;
    max-height: 0;
    transition: max-height 0.3s ease;
}
.js-main .product-card__specs-list.open {
    margin-top: 6px;
}
.js-main .product-card__specs-list li {
    font-size: 0.95rem;
    line-height: 1.55;
    color: var(--js-text);
    padding: 5px 0;
    border-bottom: 1px dashed #f0f0f0;
}
.js-main .product-card__specs-list li:last-child { border-bottom: none; }

.js-main .product-card__price {
    margin: 8px 0 4px !important;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.js-main .product-card__price-row {
    display: flex;
    align-items: baseline;
    gap: 6px;
    flex-wrap: wrap;
}
.js-main .product-card__price-prefix {
    font-size: 0.875rem !important;
    font-weight: 500;
    color: var(--js-text-muted);
}
.js-main .product-card__price-excl {
    font-size: 16px !important;
    font-weight: 800;
    color: var(--js-text);
    line-height: 1.1;
}
.js-main .product-card__price-suffix {
    font-size: 0.8125rem !important;
    color: var(--js-text-muted);
    font-weight: 500;
}
.js-main .product-card__price-incl {
    font-size: 0.875rem !important;
    color: var(--js-text-muted);
    font-weight: 500;
}
.js-main .product-card__price-aanvraag {
    font-size: 1rem !important;
    font-weight: 600;
    color: var(--js-text);
}

.js-main .button-bekijken {
    background: var(--js-black);
    color: #fff !important;
    border-radius: var(--js-radius-sm);
    width: 100%;
    text-align: center;
    padding: 14px 16px;
    display: block;
    font-weight: 600;
    font-size: 1rem;
    text-decoration: none;
    transition: background-color 0.2s ease;
    box-sizing: border-box;
    margin-top: auto;
}
.js-main .button-bekijken:hover { background: var(--js-red); }

/* -------- Empty state -------- */
.js-empty-state {
    background: var(--js-bg);
    border: 1px dashed var(--js-border);
    border-radius: var(--js-radius);
    padding: 60px 30px;
    text-align: center;
    margin-top: 20px;
}
.js-empty-icon {
    margin-bottom: 16px;
}
.js-empty-state h3 {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0 0 10px;
}
.js-empty-state p {
    font-size: 1.05rem;
    color: var(--js-text-muted);
    margin: 0 0 24px;
    max-width: 480px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.55;
}

/* -------- Buttons -------- */
.js-btn {
    background: var(--js-bg);
    color: var(--js-text);
    border: 1px solid var(--js-border);
    border-radius: var(--js-radius-sm);
    padding: 14px 24px;
    font: inherit;
    font-weight: 600;
    font-size: 1.05rem;
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}
.js-btn:hover { border-color: var(--js-text); }
.js-btn-primary {
    background: var(--js-black);
    color: #fff;
    border-color: var(--js-black);
}
.js-btn-primary:hover { background: var(--js-red); border-color: var(--js-red); }
.js-btn-secondary {
    background: #fff;
    color: var(--js-text);
    border-color: var(--js-border);
}
.js-btn-secondary:hover { border-color: var(--js-red); color: var(--js-red); }

/* -------- Load more button -------- */
#load-more {
    background: #fff;
    color: var(--js-black);
    border: 1px solid var(--js-black);
    border-radius: 999px;
    padding: 14px 36px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
    font-size: 1rem;
}
#load-more:hover { background: var(--js-black); color: #fff; }
.button-load-more-container {
    display: flex;
    justify-content: center;
    margin-top: 24px;
    width: 100%;
}

/* ========================================================================
   RESPONSIVE — Tablet & Mobile
   ======================================================================== */

@media (max-width: 1023px) {
    .js-archive-mobile-bar { display: flex; }

    .js-archive-layout {
        grid-template-columns: 1fr;
        gap: 0;
    }

    /* Hide desktop toolbar (mobile uses mobile-bar instead) */
    .js-toolbar {
        background: transparent;
        border: none;
        padding: 0 0 16px;
        flex-wrap: wrap;
    }
    .js-result-count { display: none; }

    /* Sidebar becomes offcanvas */
    .js-sidebar {
        position: fixed;
        inset: 0;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        z-index: 99999;
        pointer-events: none;
        align-self: auto;
    }
    .js-sidebar.is-open { pointer-events: auto; }
    .js-sidebar-backdrop {
        display: block;
        position: absolute;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        opacity: 0;
        transition: opacity 0.25s ease;
    }
    .js-sidebar.is-open .js-sidebar-backdrop { opacity: 1; }
    .js-sidebar-inner {
        position: absolute;
        top: 0;
        left: 0;
        width: 88%;
        max-width: 420px;
        height: 100%;
        background: #fff;
        display: flex;
        flex-direction: column;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        overflow: hidden;
    }
    .js-sidebar.is-open .js-sidebar-inner { transform: translateX(0); }
    .js-sidebar-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 16px 20px;
        background: var(--js-red);
        color: #fff;
        font-weight: 800;
        font-size: 1.2rem;
        letter-spacing: 0.04em;
        text-transform: uppercase;
        flex-shrink: 0;
    }
    .js-sidebar-close {
        background: transparent;
        border: none;
        color: #fff;
        cursor: pointer;
        padding: 4px;
        display: inline-flex;
    }
    .js-sidebar-body {
        flex: 1;
        overflow-y: auto;
        padding: 16px;
        display: flex;
        flex-direction: column;
    }
    .js-sidebar-actions {
        display: flex;
        gap: 10px;
        padding-top: 16px;
        margin-top: auto;
        position: sticky;
        bottom: 0;
        background: #fff;
        padding-bottom: 4px;
    }
    .js-sidebar-actions .js-btn { flex: 1; }

    /* Hide the inline mobile filter toggle/drawer from the widget itself (we use the archive's) */
    .pf-toggle, .pf-backdrop { display: none !important; }
    .pf-drawer {
        position: static !important;
        width: 100% !important;
        max-width: none !important;
        height: auto !important;
        transform: none !important;
        overflow: visible !important;
    }
    .pf-drawer-header { display: none !important; }
    .pf-drawer-body { padding: 0 !important; }

    body.js-sidebar-open { overflow: hidden; }
}

/* Smaller mobile tweaks */
@media (max-width: 640px) {
    .js-archive-container { padding: 20px 16px; }
    .js-archive-intro h1 { font-size: 2rem; }
    .js-archive-intro p { font-size: 1.05rem; }
    .js-main .product-card__title { font-size: 1.25rem; }
    .js-main .product-card__desc { font-size: 1rem; }
    .js-main .product-card__price { font-size: 2rem; }
    .js-main .product-card__image { aspect-ratio: 16 / 11; }
    .js-main .button-bekijken { font-size: 1.05rem; padding: 16px; }
    .js-toolbar { padding: 0 0 12px; }
}

/* ========================================================================
   Hide the widget's internal mobile drawer wrapper on desktop
   (sidebar replaces it; widget only renders content)
   ======================================================================== */
@media (min-width: 1024px) {
    .js-sidebar .pf-toggle { display: none !important; }
    .js-sidebar .pf-drawer-header { display: none !important; }
    .js-sidebar .pf-backdrop { display: none !important; }
    .js-sidebar .pf-drawer {
        position: static !important;
        width: 100% !important;
        max-width: none !important;
        transform: none !important;
        height: auto !important;
        overflow: visible !important;
    }
    .js-sidebar .pf-drawer-body { padding: 0 !important; }
}
