/* ============================================================
   Mobile Bottom-Sheet Modal Select
   Replaces native OS picker and inline dropdowns across all
   mobileviews with a consistent, touch-friendly bottom sheet.
   ============================================================ */

/* ---------- Overlay backdrop ---------- */
.msl-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0);
    z-index: 9000;
    pointer-events: none;
    transition: background 0.28s ease;
}
.msl-overlay.is-open {
    background: rgba(15, 23, 42, 0.45);
    pointer-events: all;
}

/* ---------- Sheet panel ---------- */
.msl-sheet {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9001;
    background: #f8f9fb;
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -4px 40px rgba(15, 23, 42, 0.18);
    transform: translateY(100%);
    transition: transform 0.32s cubic-bezier(0.32, 0.72, 0, 1),
                bottom 0.18s ease,
                max-height 0.18s ease,
                border-radius 0.18s ease;
    display: flex;
    flex-direction: column;
    max-height: 80vh;
    /* safe area for iOS home indicator */
    padding-bottom: env(safe-area-inset-bottom, 0px);
}
.msl-sheet.is-open {
    transform: translateY(0);
}
/* When virtual keyboard is open — fill available viewport */
.msl-sheet.is-keyboard {
    border-radius: 12px 12px 0 0;
    padding-bottom: 0;
}

/* ---------- Drag handle ---------- */
.msl-sheet__handle {
    flex-shrink: 0;
    display: flex;
    justify-content: center;
    padding: 10px 0 4px;
}
.msl-sheet__handle::before {
    content: '';
    display: block;
    width: 36px;
    height: 4px;
    border-radius: 2px;
    background: #d1d5db;
}

/* ---------- Header ---------- */
.msl-sheet__header {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 18px 10px;
    border-bottom: 1px solid #f3f4f6;
}
.msl-sheet__title {
    font-size: 15px;
    font-weight: 700;
    color: #111827;
    letter-spacing: -0.01em;
}
.msl-sheet__close {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: none;
    background: #f3f4f6;
    color: #6b7280;
    font-size: 17px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.15s;
}
.msl-sheet__close:active { background: #e5e7eb; }

/* ---------- Search ---------- */
.msl-sheet__search-wrap {
    flex-shrink: 0;
    padding: 10px 16px 6px;
    position: sticky;
    top: 0;
    background: #f8f9fb;
    z-index: 1;
}
.msl-sheet__search {
    width: 100%;
    height: 40px;
    padding: 0 12px 0 36px;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    font-size: 14px;
    background: #f9fafb url("data:image/svg+xml,%3Csvg width='16' height='16' viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Ccircle cx='6.5' cy='6.5' r='5' stroke='%239CA3AF' stroke-width='1.5'/%3E%3Cpath d='M10.5 10.5L14 14' stroke='%239CA3AF' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat 10px center;
    color: #111827;
    outline: none;
    box-sizing: border-box;
    transition: border-color 0.18s, box-shadow 0.18s;
}
.msl-sheet__search:focus {
    border-color: #0c1f54;
    box-shadow: 0 0 0 3px rgba(12, 31, 84, 0.1);
}
.msl-sheet__search::placeholder { color: #9ca3af; }

/* ---------- Option list ---------- */
.msl-sheet__list {
    flex: 1;
    overflow-y: auto;
    padding: 6px 8px 8px;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

/* ---------- Option row ---------- */
.msl-sheet__option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 10px;
    border-radius: 10px;
    font-size: 14px;
    color: #1f2937;
    cursor: pointer;
    transition: background 0.12s;
    -webkit-tap-highlight-color: transparent;
    position: relative;
}
.msl-sheet__option:active { background: #f3f4f6; }
.msl-sheet__option.is-hovered { background: #f9fafb; }

/* Flag image inside option (language items) */
.msl-sheet__option img {
    width: 20px;
    height: 14px;
    border-radius: 2px;
    flex-shrink: 0;
    display: block;
}

.msl-sheet__option.is-selected {
    color: #0c1f54;
    font-weight: 600;
    background: #e6ecf7;
}

/* Disabled state */
.msl-sheet__option.is-disabled {
    color: #9ca3af;
    cursor: not-allowed;
    pointer-events: none;
}

/* Empty / no-results message */
.msl-sheet__empty {
    padding: 24px 12px;
    text-align: center;
    font-size: 13px;
    color: #9ca3af;
    display: none;
}

/* ---------- Prevent body scroll while sheet open ---------- */
body.msl-no-scroll {
    overflow: hidden;
    /* keep layout stable when scrollbar disappears */
    width: 100%;
    position: fixed;
}
