/**
 * Mobiele bottom sheet voor selects met .eq-select (enquête).
 * Desktop (>640px): geen overlay; nativeselect blijft zichtbaar.
 */

/* --- Wrapper / trigger ---------------------------------------------------- */
.eq-sheet-select-root {
    position: relative;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

@media (min-width: 641px) {
    .eq-sheet-select-trigger {
        display: none !important;
    }

    .eq-sheet-select-root select.eq-select {
        position: relative !important;
        width: 100% !important;
        height: auto !important;
        clip: auto !important;
        opacity: 1 !important;
        margin: 0 !important;
    }

    /*
     * Overlay must never sit above the page on desktop. If matchMedia or JS state is wrong
     * after a resize, stale --visible could block clicks (e.g. Volgende on enquête start).
     */
    .eq-mselect-overlay {
        display: none !important;
        pointer-events: none !important;
        visibility: hidden !important;
    }

    body.eq-mselect-sheet-open {
        overflow: visible !important;
        overscroll-behavior: auto !important;
    }
}

@media (max-width: 640px) {
    .eq-sheet-select-root select.eq-sheet-select-root__native {
        position: absolute !important;
        width: 1px !important;
        height: 1px !important;
        padding: 0 !important;
        margin: -1px !important;
        overflow: hidden !important;
        clip: rect(0, 0, 0, 0) !important;
        clip-path: inset(50%) !important;
        border: 0 !important;
        white-space: nowrap !important;
        opacity: 0 !important;
        pointer-events: none !important;
        top: 0;
        left: 0;
    }

    button.eq-sheet-select-trigger.eq-select {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 0.5rem;
        width: 100%;
        max-width: 100%;
        min-height: 48px;
        padding: 13px 40px 13px 14px;
        margin: 0;
        font-family: 'Roboto', sans-serif;
        font-size: 1rem;
        line-height: 1.35;
        color: #1c2063;
        text-align: left;
        cursor: pointer;
        background-color: #fafbfd;
        border: 2px solid rgba(232, 101, 26, 0.28);
        border-radius: 10px;
        box-shadow: 0 1px 3px rgba(28, 32, 99, 0.06);
        box-sizing: border-box;
        overflow: hidden;
        -webkit-tap-highlight-color: transparent;
        touch-action: manipulation;
        appearance: none;
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%233F6399' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
        background-repeat: no-repeat;
        background-position: right 14px center;
        transition:
            border-color 0.2s ease,
            box-shadow 0.2s ease,
            background-color 0.2s ease;
    }

    button.eq-sheet-select-trigger.eq-select:active {
        background-color: #fff;
    }

    button.eq-sheet-select-trigger.eq-select:focus-visible {
        outline: none;
        border-color: #e8651a;
        box-shadow: 0 0 0 3px rgba(232, 101, 26, 0.22);
    }

    button.eq-sheet-select-trigger.eq-select--placeholder {
        color: #5a7199;
    }

    .eq-sheet-select-trigger__text {
        flex: 1 1 auto;
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
}

/* --- Overlay ------------------------------------------------------------ */
.eq-mselect-overlay {
    position: fixed;
    inset: 0;
    z-index: 1100;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    visibility: hidden;
    pointer-events: none;
}

.eq-mselect-overlay--visible {
    visibility: visible;
    pointer-events: auto;
}

.eq-mselect-overlay.eq-mselect-overlay--open {
    visibility: visible;
    pointer-events: auto;
}

.eq-mselect-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(28, 32, 99, 0.48);
    opacity: 0;
    transition: opacity 0.22s ease;
}

.eq-mselect-overlay--open .eq-mselect-backdrop {
    opacity: 1;
}

.eq-mselect-sheet {
    position: relative;
    flex: 0 1 auto;
    max-height: min(88vh, 720px);
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 0 env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
    box-sizing: border-box;
    background: #fff;
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -8px 32px rgba(28, 32, 99, 0.16);
    transform: translateY(105%);
    transition: transform 0.28s cubic-bezier(0.32, 0.72, 0, 1);
    overflow: hidden;
    outline: none;
}

.eq-mselect-overlay--open .eq-mselect-sheet {
    transform: translateY(0);
}

.eq-mselect-header {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    padding: 10px 12px 12px;
    border-bottom: 1px solid rgba(63, 99, 153, 0.12);
    flex-shrink: 0;
}

.eq-mselect-close {
    align-self: flex-end;
    min-height: 44px;
    padding: 0 14px;
    margin: 0 -6px 0 0;
    font-family: 'Roboto', sans-serif;
    font-size: 0.95rem;
    font-weight: 600;
    color: #3f6399;
    background: transparent;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.eq-mselect-close:active {
    color: #e8651a;
}

.eq-mselect-title {
    margin: 0;
    padding: 0 4px 2px;
    font-size: 1.06rem;
    font-weight: 700;
    line-height: 1.35;
    color: #3f6399;
    word-wrap: break-word;
    overflow-wrap: anywhere;
    hyphens: auto;
}

.eq-mselect-list-scroll {
    max-height: min(58vh, 480px);
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

.eq-mselect-list {
    list-style: none;
    margin: 0;
    padding: 6px 0 16px;
    box-sizing: border-box;
    width: 100%;
}

.eq-mselect-option {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 48px;
    padding: 13px 16px;
    margin: 0;
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    border: none;
    background: #fff;
    font-family: 'Roboto', sans-serif;
    font-size: 1.02rem;
    line-height: 1.4;
    text-align: left;
    color: #1c2063;
    cursor: pointer;
    border-radius: 0;
    transition: background 0.12s ease;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.eq-mselect-option + .eq-mselect-option {
    border-top: 1px solid rgba(63, 99, 153, 0.08);
}

.eq-mselect-option[disabled],
.eq-mselect-option--muted {
    color: #8e9fba;
    cursor: default;
}

.eq-mselect-option:not([disabled]):hover,
.eq-mselect-option:not([disabled]):focus-visible {
    outline: none;
    background: rgba(232, 101, 26, 0.08);
}

.eq-mselect-option--selected:not([disabled]) {
    background: rgba(232, 101, 26, 0.12);
    font-weight: 600;
}

.eq-mselect-option-icon {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.92rem;
    color: #e8651a;
    opacity: 0;
}

.eq-mselect-option--selected .eq-mselect-option-icon {
    opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
    .eq-mselect-backdrop,
    .eq-mselect-sheet,
    .eq-mselect-option {
        transition: none !important;
    }
}

body.eq-mselect-sheet-open {
    overflow: hidden;
    overscroll-behavior: none;
}
