/* ══════════════════════════════════════════════
   Kleurstaal Aanvraag Systeem v2.0
   Mobile-first CSS — .ks- namespace
   ══════════════════════════════════════════════ */

:root {
    --ks-primary: #6B8F71;
    --ks-primary-dark: #5A7A63;
    --ks-primary-light: #E8F0EA;
    --ks-accent: #C4945A;
    --ks-accent-light: #F5EDE3;
    --ks-bg: #F4F4F1;
    --ks-surface: #FFF;
    --ks-text: #2D2D2D;
    --ks-muted: #6B6B6B;
    --ks-border: #E0E0DC;
    --ks-danger: #D9534F;
    --ks-danger-light: #FDEAEA;
    --ks-font-body: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    --ks-font-heading: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
    --ks-r-sm: 6px;
    --ks-r-md: 10px;
    --ks-r-lg: 16px;
    --ks-s-sm: 0 1px 3px rgba(0,0,0,.06);
    --ks-s-md: 0 4px 12px rgba(0,0,0,.08);
    --ks-s-lg: 0 8px 30px rgba(0,0,0,.12);
    --ks-s-xl: 0 16px 50px rgba(0,0,0,.16);
    --ks-ease: cubic-bezier(.4,0,.2,1);
    --ks-bounce: cubic-bezier(.34,1.56,.64,1);
}

/* ── Page Overview ── */
.ks-page { max-width: 1200px; margin: 0 auto; padding: 24px 16px 160px; }
.ks-page-header { text-align: center; margin-bottom: 28px; }
.ks-badge {
    display: inline-block; background: var(--ks-accent-light); color: var(--ks-accent);
    font-size: 11px; font-weight: 700; padding: 5px 14px; border-radius: 20px;
    margin-bottom: 12px; letter-spacing: .8px; text-transform: uppercase;
}
.ks-page-title {
    font-family: var(--ks-font-heading); font-size: clamp(24px, 5vw, 32px);
    font-weight: 700; color: var(--ks-primary-dark); margin: 0 0 4px;
}
.ks-page-subtitle { color: var(--ks-muted); font-size: 14px; margin: 0; }

/* ── Product Sections ── */
.ks-product-section { margin-bottom: 28px; }
.ks-product-section-title {
    font-family: var(--ks-font-heading); font-size: 20px; font-weight: 700;
    color: var(--ks-text); margin-bottom: 14px; padding-bottom: 10px;
    border-bottom: 2px solid var(--ks-primary-light);
}
.ks-product-variants { display: flex; flex-direction: column; gap: 14px; }
.ks-variant-card {
    background: var(--ks-surface); border-radius: var(--ks-r-lg);
    padding: 18px 20px; box-shadow: var(--ks-s-sm); border: 1px solid var(--ks-border);
    transition: .3s var(--ks-ease);
}
.ks-variant-card:hover { box-shadow: var(--ks-s-md); }
.ks-variant-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 12px; cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.ks-variant-header h4 { font-family: var(--ks-font-heading); font-size: 15px; font-weight: 600; color: var(--ks-text); margin: 0; }
.ks-count-tag { font-size: 12px; color: var(--ks-muted); background: var(--ks-bg); padding: 3px 10px; border-radius: 12px; }
.ks-variant-toggle {
    background: none; border: none; color: var(--ks-muted); cursor: pointer;
    transition: transform .3s; display: flex; padding: 4px;
}
.ks-variant-card.ks-collapsed .ks-variant-toggle { transform: rotate(-90deg); }
.ks-variant-card.ks-collapsed .ks-swatches { display: none; }

/* ── Swatches ── */
/* 2026-04-10: overflow visible + z-index context voor scale-hover zoom */
.ks-swatches { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; overflow: visible; }
.ks-variant-card, .ks-product-card, .ks-product-section { overflow: visible !important; }
.ks-swatch {
    position: relative; display: flex; flex-direction: column; align-items: center;
    cursor: pointer; transition: .25s var(--ks-ease); border-radius: var(--ks-r-sm);
    -webkit-tap-highlight-color: transparent;
}
.ks-swatch-img-wrap {
    position: relative; width: 100%; aspect-ratio: 1; border-radius: var(--ks-r-sm);
    border: 2px solid var(--ks-border); overflow: hidden;
    transition: transform .22s cubic-bezier(.34,1.56,.64,1), border-color .2s, box-shadow .2s;
    transform-origin: center center;
}
.ks-swatch img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ks-swatch img.ks-broken { display: none; }
.ks-swatch .ks-fallback {
    position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
    background: var(--ks-bg); font-size: 9px; color: var(--ks-muted); text-align: center;
    padding: 4px; line-height: 1.2; word-break: break-word;
}

/* Inline/floating preview elements — UIT, we gebruiken nu in-place scale */
.ks-swatch-preview, .ks-hover-zoom { display: none !important; }

/* Swatch hover/focus zoom — 2026-04-10 (SAVE43)
 * Zowel desktop (hover) als mobiel (via JS .ks-zoomed class bij tap).
 * !important omdat andere rules met hoge specificity kunnen winnen. */
.ks-swatch:hover,
.ks-swatch.ks-zoomed {
    z-index: 50 !important;
}
.ks-swatch:hover .ks-swatch-img-wrap,
.ks-swatch.ks-zoomed .ks-swatch-img-wrap {
    transform: scale(2.2) !important;
    border-color: var(--ks-primary) !important;
    box-shadow: 0 12px 32px rgba(0,0,0,.28), 0 0 0 1px rgba(107,143,113,.2) !important;
    z-index: 50 !important;
    position: relative !important;
}
.ks-swatch:hover .ks-swatch-label,
.ks-swatch.ks-zoomed .ks-swatch-label {
    color: var(--ks-primary-dark);
    font-weight: 600;
}

/* Swatch: touch feedback on mobile */
@media (hover: none) and (pointer: coarse) {
    .ks-swatch:active .ks-swatch-img-wrap { transform: scale(0.95); }
}

/* Swatch: selected */
.ks-swatch.ks-selected .ks-swatch-img-wrap {
    border-color: var(--ks-primary);
    box-shadow: 0 0 0 3px var(--ks-primary-light), 0 4px 12px rgba(107,143,113,.25);
}
.ks-swatch.ks-selected .ks-swatch-img-wrap::after {
    content: '\2713'; position: absolute; inset: 0; display: flex; align-items: center;
    justify-content: center; background: rgba(107,143,113,.55); color: #fff;
    font-size: 18px; font-weight: 700; backdrop-filter: blur(1px);
    animation: ks-checkIn .3s var(--ks-bounce); z-index: 1;
}
@keyframes ks-checkIn { from { transform: scale(0); } to { transform: scale(1); } }
.ks-swatch.ks-selected .ks-swatch-label { color: var(--ks-primary); font-weight: 600; }
.ks-swatch.ks-disabled { opacity: .3; cursor: not-allowed; pointer-events: none; }

/* Swatch label */
.ks-swatch-label {
    font-size: 11px; color: var(--ks-muted); text-align: center; margin-top: 4px;
    line-height: 1.2; width: 100%; overflow: hidden; text-overflow: ellipsis;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    word-break: break-word; transition: color .2s;
}

/* ── CTA Button ── */
.ks-cta-area { text-align: center; margin: 32px 0; }
.ks-cta-btn {
    display: inline-flex; align-items: center; gap: 10px;
    background: var(--ks-primary); color: #fff; padding: 14px 28px;
    border: none; border-radius: var(--ks-r-md); font-family: var(--ks-font-body);
    font-size: 15px; font-weight: 600; cursor: pointer; transition: .3s var(--ks-ease);
    box-shadow: var(--ks-s-sm);
}
.ks-cta-btn:hover:not(:disabled) { background: var(--ks-primary-dark); transform: translateY(-2px); box-shadow: var(--ks-s-lg); }
.ks-cta-btn:disabled { opacity: .5; cursor: not-allowed; }
.ks-cta-btn svg { width: 20px; height: 20px; }
.ks-badge-count { background: rgba(255,255,255,.25); padding: 2px 10px; border-radius: 12px; font-size: 13px; font-weight: 700; }

/* ── Inline Button (shortcode) ── */
.ks-inline-btn {
    display: inline-flex; align-items: center; gap: 8px;
    background: var(--ks-primary); color: #fff; padding: 12px 24px;
    border-radius: var(--ks-r-md); text-decoration: none; font-family: var(--ks-font-body);
    font-size: 14px; font-weight: 600; transition: .3s var(--ks-ease);
}
.ks-inline-btn:hover { background: var(--ks-primary-dark); color: #fff; transform: translateY(-1px); }
.ks-inline-btn svg { width: 18px; height: 18px; }
.ks-inline-badge { background: rgba(255,255,255,.25); padding: 1px 8px; border-radius: 10px; font-size: 12px; }
.ks-inline-badge:empty { display: none; }

/* ── Floating Widget (desktop) ── */
.ks-widget {
    position: fixed; bottom: 24px; right: 24px; width: 330px;
    background: var(--ks-surface); border-radius: var(--ks-r-lg);
    box-shadow: var(--ks-s-xl); z-index: 9998;
    transform: translateY(calc(100% + 40px)); opacity: 0;
    transition: transform .5s var(--ks-bounce), opacity .4s; overflow: hidden;
}
.ks-widget.ks-visible { transform: translateY(0); opacity: 1; }
.ks-widget.ks-collapsed .ks-widget-body { max-height: 0; padding: 0 16px; opacity: 0; overflow: hidden; }
.ks-widget-head {
    background: var(--ks-primary); color: #fff; padding: 14px 18px;
    display: flex; justify-content: space-between; align-items: center; cursor: pointer;
}
.ks-widget-head-left { display: flex; align-items: center; gap: 10px; }
.ks-widget-head-left svg { width: 18px; height: 18px; opacity: .85; }
.ks-widget-title { font-weight: 600; font-size: 14px; }
.ks-widget-badge { background: rgba(255,255,255,.25); padding: 2px 10px; border-radius: 12px; font-size: 12px; font-weight: 700; }
.ks-widget-toggle { background: none; border: none; color: #fff; cursor: pointer; display: flex; transition: transform .3s; }
.ks-widget.ks-collapsed .ks-widget-toggle { transform: rotate(180deg); }
.ks-widget-body { padding: 14px 16px; max-height: 350px; overflow-y: auto; transition: max-height .4s, padding .4s, opacity .3s; opacity: 1; }
.ks-widget-item {
    display: flex; align-items: center; gap: 10px; padding: 8px 10px; margin-bottom: 6px;
    background: var(--ks-bg); border-radius: var(--ks-r-sm); animation: ks-itemIn .35s var(--ks-bounce);
}
@keyframes ks-itemIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }
.ks-widget-item:hover { background: var(--ks-primary-light); }
.ks-widget-item-img { width: 38px; height: 38px; border-radius: 5px; flex-shrink: 0; border: 1px solid var(--ks-border); object-fit: cover; }
.ks-widget-item-info { flex: 1; min-width: 0; }
.ks-widget-item-name { font-size: 13px; font-weight: 600; color: var(--ks-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ks-widget-item-product { font-size: 11px; color: var(--ks-primary); font-weight: 500; }
.ks-widget-item-rm {
    background: none; border: none; color: var(--ks-muted); cursor: pointer; padding: 5px;
    border-radius: 4px; display: flex; transition: .2s;
}
.ks-widget-item-rm:hover { background: var(--ks-danger-light); color: var(--ks-danger); }
.ks-widget-item-rm svg { width: 15px; height: 15px; }
.ks-widget-cta {
    display: block; width: 100%; padding: 12px; margin-top: 10px;
    background: var(--ks-primary); color: #fff; border: none; border-radius: var(--ks-r-sm);
    font-family: var(--ks-font-body); font-size: 14px; font-weight: 600;
    cursor: pointer; text-align: center; transition: .25s;
}
.ks-widget-cta:hover { background: var(--ks-primary-dark); }

/* ── Mobile Sticky Bar ── */
.ks-mobile-bar {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 9997;
    background: var(--ks-primary); color: #fff; padding: 12px 16px;
    justify-content: space-between; align-items: center;
    transform: translateY(100%); transition: transform .4s var(--ks-bounce);
    padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    box-shadow: 0 -4px 20px rgba(0,0,0,.15);
}
.ks-mobile-bar.ks-visible { transform: translateY(0); }
.ks-mobile-bar-text { font-size: 14px; font-weight: 500; }
.ks-mobile-bar-btn {
    background: #fff; color: var(--ks-primary-dark); border: none; padding: 10px 20px;
    border-radius: var(--ks-r-sm); font-family: var(--ks-font-body); font-size: 14px;
    font-weight: 600; cursor: pointer;
}

/* ── Modal ── */
.ks-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,.45); backdrop-filter: blur(5px);
    z-index: 99999; display: none; align-items: flex-end; justify-content: center;
    overflow-y: auto;
}
.ks-overlay.ks-active { display: flex; }
.ks-modal {
    background: var(--ks-surface); width: 100%; max-height: 95vh;
    border-radius: var(--ks-r-lg) var(--ks-r-lg) 0 0; box-shadow: var(--ks-s-xl);
    animation: ks-modalSlide .4s var(--ks-bounce); overflow-y: auto;
    -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
}
@keyframes ks-modalSlide { from { transform: translateY(100%); } to { transform: translateY(0); } }
.ks-modal-head { padding: 24px 20px 0; display: flex; justify-content: space-between; align-items: flex-start; }
.ks-modal-head h2 { font-family: var(--ks-font-heading); font-size: 20px; font-weight: 700; margin: 0; }
.ks-modal-head p { font-size: 13px; color: var(--ks-muted); margin: 2px 0 0; }
.ks-modal-x { background: none; border: none; color: var(--ks-muted); cursor: pointer; padding: 6px; border-radius: var(--ks-r-sm); display: flex; transition: .2s; }
.ks-modal-x:hover { background: var(--ks-bg); color: var(--ks-text); }
.ks-modal-x svg { width: 22px; height: 22px; }

/* Review section */
.ks-review { padding: 20px 20px; }
.ks-review-title {
    font-family: var(--ks-font-heading); font-size: 14px; font-weight: 600;
    color: var(--ks-muted); text-transform: uppercase; letter-spacing: .5px;
    margin-bottom: 12px; display: flex; align-items: center; gap: 8px;
}
.ks-ct { background: var(--ks-primary); color: #fff; font-size: 12px; padding: 1px 9px; border-radius: 10px; font-family: var(--ks-font-body); }
.ks-review-item {
    display: flex; align-items: center; gap: 12px; padding: 10px 12px;
    background: var(--ks-bg); border-radius: var(--ks-r-md); margin-bottom: 8px;
    border: 1px solid transparent; transition: .25s;
    animation: ks-revIn .4s var(--ks-bounce) backwards;
}
.ks-review-item:nth-child(2) { animation-delay: .05s; }
.ks-review-item:nth-child(3) { animation-delay: .1s; }
.ks-review-item:nth-child(4) { animation-delay: .15s; }
.ks-review-item:nth-child(5) { animation-delay: .2s; }
@keyframes ks-revIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.ks-review-item:hover { border-color: var(--ks-border); background: var(--ks-primary-light); }
.ks-review-img { width: 48px; height: 48px; border-radius: var(--ks-r-sm); flex-shrink: 0; border: 1px solid var(--ks-border); object-fit: cover; }
.ks-review-info { flex: 1; min-width: 0; }
.ks-review-name { font-size: 14px; font-weight: 600; }
.ks-review-product { font-size: 12px; color: var(--ks-primary); font-weight: 500; margin-top: 1px; }
.ks-review-rm {
    background: none; border: 1px solid var(--ks-border); color: var(--ks-muted);
    cursor: pointer; padding: 6px 10px; border-radius: var(--ks-r-sm);
    display: flex; align-items: center; gap: 5px; font-size: 12px;
    font-family: var(--ks-font-body); font-weight: 500; transition: .2s;
}
.ks-review-rm:hover { background: var(--ks-danger-light); border-color: var(--ks-danger); color: var(--ks-danger); }
.ks-review-rm svg { width: 14px; height: 14px; }
.ks-review-empty { text-align: center; padding: 24px 16px; color: var(--ks-muted); font-size: 14px; }
.ks-review-empty svg { width: 36px; height: 36px; color: var(--ks-border); display: block; margin: 0 auto 8px; }

/* Modal divider */
.ks-modal-div { height: 1px; background: var(--ks-border); margin: 0 20px; }

/* Form */
.ks-modal-form { padding: 20px 20px 28px; }
.ks-form-title {
    font-family: var(--ks-font-heading); font-size: 15px; font-weight: 600;
    margin-bottom: 14px; display: flex; align-items: center; gap: 8px;
}
.ks-form-title svg { width: 18px; height: 18px; color: var(--ks-primary); }
.ks-f-row { display: flex; flex-direction: column; gap: 10px; margin-bottom: 10px; }
.ks-f-field { flex: 1; }
.ks-f-field input, .ks-f-field textarea {
    width: 100%; padding: 13px 14px; border: 1.5px solid var(--ks-border);
    border-radius: var(--ks-r-sm); font-family: var(--ks-font-body);
    font-size: 16px; /* Prevents iOS zoom */ color: var(--ks-text);
    background: var(--ks-surface); transition: .2s; outline: none; box-sizing: border-box;
}
.ks-f-field input:focus, .ks-f-field textarea:focus { border-color: var(--ks-primary); box-shadow: 0 0 0 3px var(--ks-primary-light); }
.ks-f-field input::placeholder, .ks-f-field textarea::placeholder { color: #aaa; }
.ks-f-field textarea { min-height: 70px; resize: vertical; }
.ks-f-field.ks-err input, .ks-f-field.ks-err textarea { border-color: var(--ks-danger); box-shadow: 0 0 0 3px var(--ks-danger-light); animation: ks-shake .4s; }
@keyframes ks-shake { 0%,100% { transform: translateX(0); } 20%,60% { transform: translateX(-4px); } 40%,80% { transform: translateX(4px); } }
.ks-f-submit {
    width: 100%; padding: 16px; margin-top: 8px;
    background: var(--ks-primary); color: #fff; border: none; border-radius: var(--ks-r-md);
    font-family: var(--ks-font-body); font-size: 16px; font-weight: 600;
    cursor: pointer; transition: .3s; display: flex; align-items: center; justify-content: center; gap: 8px;
}
.ks-f-submit:hover:not(:disabled) { background: var(--ks-primary-dark); transform: translateY(-1px); box-shadow: var(--ks-s-md); }
.ks-f-submit:disabled { opacity: .55; cursor: not-allowed; }
.ks-f-submit svg { width: 18px; height: 18px; }
.ks-f-note { text-align: center; font-size: 12px; color: var(--ks-muted); margin-top: 14px; }

/* Success */
.ks-success { text-align: center; padding: 48px 24px; }
.ks-success-ring {
    width: 80px; height: 80px; border-radius: 50%; background: var(--ks-primary-light);
    display: flex; align-items: center; justify-content: center; margin: 0 auto 20px;
    animation: ks-popIn .5s var(--ks-bounce);
}
@keyframes ks-popIn { from { transform: scale(0) rotate(-20deg); } to { transform: scale(1) rotate(0); } }
.ks-success-ring svg { width: 38px; height: 38px; color: var(--ks-primary); }
.ks-success h2 { font-family: var(--ks-font-heading); font-size: 22px; font-weight: 700; margin: 0 0 8px; }
.ks-success p { color: var(--ks-muted); font-size: 14px; max-width: 340px; margin: 0 auto 24px; line-height: 1.6; }
.ks-success-btn {
    padding: 13px 36px; background: var(--ks-primary); color: #fff; border: none;
    border-radius: var(--ks-r-md); font-family: var(--ks-font-body); font-size: 15px;
    font-weight: 600; cursor: pointer; transition: .25s;
}
.ks-success-btn:hover { background: var(--ks-primary-dark); }

/* Toast */
.ks-toast {
    position: fixed; top: 24px; left: 50%; background: var(--ks-text); color: #fff;
    padding: 13px 22px; border-radius: var(--ks-r-md); font-size: 14px; font-weight: 500;
    box-shadow: var(--ks-s-lg); z-index: 100001; display: flex; align-items: center; gap: 10px;
    transform: translateX(-50%) translateY(-120%); opacity: 0;
    transition: .4s var(--ks-bounce); max-width: calc(100vw - 32px); white-space: nowrap;
}
.ks-toast.ks-show { transform: translateX(-50%) translateY(0); opacity: 1; }
.ks-toast svg { width: 18px; height: 18px; flex-shrink: 0; }
.ks-toast-ok { background: var(--ks-primary-dark); }
.ks-toast-warn { background: var(--ks-accent); }
.ks-toast-err { background: var(--ks-danger); }

/* Scrollbar */
.ks-widget-body::-webkit-scrollbar, .ks-review::-webkit-scrollbar { width: 4px; }
.ks-widget-body::-webkit-scrollbar-track, .ks-review::-webkit-scrollbar-track { background: transparent; }
.ks-widget-body::-webkit-scrollbar-thumb, .ks-review::-webkit-scrollbar-thumb { background: var(--ks-border); border-radius: 4px; }

/* Spinner */
@keyframes ks-spin { to { transform: rotate(360deg); } }
.ks-spin { animation: ks-spin .8s linear infinite; }

/* ══════════════════════════════════════════════
   RESPONSIVE — Mobile first, then scale up
   ══════════════════════════════════════════════ */

/* Mobile: hide desktop widget, show mobile bar */
.ks-widget { display: none; }
.ks-mobile-bar { display: flex; }

/* Tablet (480px+) */
@media (min-width: 480px) {
    .ks-swatches { grid-template-columns: repeat(4, 1fr); }
    .ks-f-row { flex-direction: row; }
    .ks-f-field.ks-sm { flex: 0 0 120px; }
}

/* Tablet landscape (768px+) */
@media (min-width: 768px) {
    .ks-page { padding: 40px 20px 140px; }
    .ks-swatches { grid-template-columns: repeat(5, 1fr); gap: 12px; }
    .ks-variant-card { padding: 22px 26px; }

    /* Show desktop widget, hide mobile bar */
    .ks-widget { display: block; }
    .ks-mobile-bar { display: none !important; }

    /* Modal: centered card instead of bottom sheet */
    .ks-overlay { align-items: flex-start; justify-content: center; padding: 40px 20px; overflow-y: auto; }
    .ks-modal { max-width: 640px; border-radius: var(--ks-r-lg); max-height: none; }
    @keyframes ks-modalSlide { from { opacity: 0; transform: translateY(-30px) scale(.96); } to { opacity: 1; transform: translateY(0) scale(1); } }

    .ks-modal-head, .ks-review, .ks-modal-form { padding-left: 32px; padding-right: 32px; }
    .ks-modal-div { margin-left: 32px; margin-right: 32px; }
}

/* Desktop (1024px+) */
@media (min-width: 1024px) {
    .ks-swatches { grid-template-columns: repeat(6, 1fr); }
    .ks-swatch-label { font-size: 10px; }
}

/* Large desktop (1200px+) */
@media (min-width: 1200px) {
    .ks-swatches { grid-template-columns: repeat(8, 1fr); }
}