/* ==========================================================================
   IvSheetPicker — bottom-sheet picker
   ========================================================================== */

/* Verberg het echte select-element nadat de trigger-knop is ingevoegd. */
.iv-sp-hidden-select {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    margin: -1px !important;
    padding: 0 !important;
    overflow: hidden !important;
    clip: rect(0 0 0 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* Trigger-knop die het <select> vervangt */
.iv-sp-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-height: 40px;
    padding: 8px 12px;
    background: var(--bg-card, #fff);
    color: var(--text, #111);
    border: 1px solid var(--border, #d1d5db);
    border-radius: 8px;
    font: inherit;
    font-size: 14px;
    cursor: pointer;
    text-align: left;
    width: 100%;
    transition: border-color .15s, box-shadow .15s;
}

.iv-sp-trigger:hover { border-color: var(--accent, #2563eb); }
.iv-sp-trigger:focus-visible {
    outline: none;
    border-color: var(--accent, #2563eb);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .25);
}
.iv-sp-trigger.is-empty .iv-sp-trigger-label { color: var(--text-muted, #6b7280); }
.iv-sp-trigger-label {
    flex: 1 1 auto;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.iv-sp-trigger-chevron {
    display: inline-flex;
    color: var(--text-muted, #6b7280);
    flex: 0 0 auto;
}

/* Body lock */
html.iv-sp-locked, html.iv-sp-locked body {
    overflow: hidden !important;
    overscroll-behavior: contain;
}

/* Backdrop */
.iv-sp-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, .55);
    z-index: 9000;
    opacity: 0;
    transition: opacity .25s ease;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}
.iv-sp-backdrop.is-open { opacity: 1; }

/* Sheet — mobile: bottom sheet */
.iv-sp-sheet {
    position: relative;
    background: var(--bg-card, #fff);
    color: var(--text, #111);
    width: 100%;
    max-width: 640px;
    max-height: 90vh;
    border-top-left-radius: 18px;
    border-top-right-radius: 18px;
    box-shadow: 0 -8px 30px rgba(0, 0, 0, .25);
    transform: translateY(100%);
    transition: transform .25s cubic-bezier(.22, .61, .36, 1);
    display: flex;
    flex-direction: column;
    padding-bottom: env(safe-area-inset-bottom);
    outline: none;
}
.iv-sp-sheet.is-open { transform: translateY(0); }

.iv-sp-grip-wrap {
    display: flex;
    justify-content: center;
    padding: 8px 0 4px;
    cursor: grab;
    touch-action: none;
}
.iv-sp-grip {
    width: 36px;
    height: 4px;
    border-radius: 999px;
    background: var(--border, #d1d5db);
}

.iv-sp-title {
    font-size: 16px;
    font-weight: 600;
    padding: 8px 16px 12px;
    border-bottom: 1px solid var(--border, #e5e7eb);
}

.iv-sp-options {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    max-height: 60vh;
    padding: 4px 0 8px;
}

.iv-sp-option {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    min-height: 56px;
    padding: 14px 18px;
    background: transparent;
    border: 0;
    border-bottom: 1px solid var(--border-soft, #f1f5f9);
    color: inherit;
    font: inherit;
    font-size: 15px;
    text-align: left;
    cursor: pointer;
    transition: background-color .12s ease;
}
.iv-sp-option:last-child { border-bottom: 0; }
.iv-sp-option:hover { background: var(--bg-hover, rgba(37, 99, 235, .05)); }
.iv-sp-option:active { background: rgba(37, 99, 235, .12); }
.iv-sp-option:focus-visible {
    outline: none;
    background: rgba(37, 99, 235, .08);
    box-shadow: inset 0 0 0 2px var(--accent, #2563eb);
}

.iv-sp-ico {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    color: var(--text-muted, #6b7280);
    font-size: 16px;
}
.iv-sp-ico-empty { width: 0; height: 0; }

.iv-sp-label-wrap {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.iv-sp-label {
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.iv-sp-desc {
    margin-top: 2px;
    font-size: 12px;
    color: var(--text-muted, #6b7280);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.iv-sp-check {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    color: var(--accent, #2563eb);
    opacity: 0;
    transform: scale(.8);
    transition: opacity .15s ease, transform .15s ease;
}
.iv-sp-option.is-selected {
    color: var(--accent, #2563eb);
}
.iv-sp-option.is-selected .iv-sp-label { font-weight: 600; }
.iv-sp-option.is-selected .iv-sp-check {
    opacity: 1;
    transform: scale(1);
}
.iv-sp-option.is-selected .iv-sp-ico { color: var(--accent, #2563eb); }

/* Desktop: modal-style centered */
@media (min-width: 769px) {
    .iv-sp-backdrop {
        align-items: center;
    }
    .iv-sp-sheet {
        width: min(480px, 92vw);
        max-height: 80vh;
        border-radius: 14px;
        transform: translateY(20px) scale(.98);
        opacity: 0;
        transition: transform .2s ease, opacity .2s ease;
        box-shadow: 0 20px 60px rgba(0, 0, 0, .3);
    }
    .iv-sp-sheet.is-open {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
    .iv-sp-grip-wrap { display: none; }
    .iv-sp-title { padding: 16px 20px; }
    .iv-sp-options { max-height: 65vh; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .iv-sp-backdrop, .iv-sp-sheet { transition: none !important; }
}
