/* ── Option list always stacks ── */

/* OverlayScrollbars turns .select-options into its host and forces the host to
   flex-direction:row (to lay out viewport + scrollbars). That row overrides our
   Tailwind `flex-col`, so whenever the OS-injected block viewport wrapper is
   absent — e.g. after an Idiomorph re-render destroys/re-creates OS — the options
   become direct flex-row children and render side-by-side. Force column
   unconditionally: OS scrollbars are position:absolute (out of flow), so the
   single in-flow viewport stacks identically with column or row. */
.select-options {
  flex-direction: column !important;
}

/* ── Select mobile backdrop ── */

.select-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 9998;
  animation: select-fade-in 0.2s ease;
}

@keyframes select-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

body.select-mobile-open {
  overflow: hidden;
}

/* ── Mobile bottom sheet ── */

@media (max-width: 639px) {
  .select-sheet {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    top: auto !important;
    width: 100% !important;
    max-width: 100% !important;
    border-radius: 20px 20px 0 0 !important;
    margin: 0 !important;
    padding: 0 0 calc(16px + env(safe-area-inset-bottom)) !important;
    box-sizing: border-box !important;
    z-index: 9999 !important;
    height: 50vh !important;
    max-height: 50vh !important;
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column !important;
    animation: select-slide-up 0.25s ease-out;
  }

  @keyframes select-slide-up {
    from { transform: translateY(100%); }
    to   { transform: translateY(0); }
  }

  .select-sheet-handle {
    width: 40px;
    height: 4px;
    background: #e5e7eb;
    border-radius: 2px;
    margin: 12px auto 0;
  }

  .select-sheet-header {
    flex-shrink: 0;
    padding: 8px 16px 12px;
    border-bottom: 1px solid #e5e7eb;
  }

  .select-sheet-title {
    font-size: 15px;
    font-weight: 600;
    color: #191A1C;
    margin-top: 10px;
  }

  .select-sheet-body {
    flex: 1;
    overflow: hidden;
    min-height: 0;
  }

  .select-sheet .select-options {
    max-height: none !important;
    flex: 1;
    overflow-y: auto;
    padding: 8px 12px;
    -webkit-overflow-scrolling: touch;
  }

  .select-sheet [data-select-target="option"] {
    min-height: 48px;
    padding: 14px 12px;
    font-size: 15px;
  }
}
