/* Merphi Combobox */

/* Keep layout stable if any overlay still toggles overflow. */
html {
  scrollbar-gutter: stable;
}

.merphi-combobox {
  position: relative;
  display: block;
  width: 100%;
  font-family: inherit;
}

.merphi-combobox-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  text-align: left;
  min-height: 44px;
  font: inherit;
  font-family: inherit;
}

.merphi-combobox-placeholder {
  color: #6b7280;
}

.merphi-combobox-portal {
  position: fixed;
  inset: 0;
  z-index: 1200;
  pointer-events: none;
}

.merphi-combobox-portal.mobile {
  pointer-events: auto;
}

.merphi-combobox-panel {
  pointer-events: auto;
  position: fixed;
  background: #fff;
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 12px;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.18);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  font-family: inherit;
}

.merphi-combobox-search {
  display: block;
  padding: 10px 12px 8px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
}

.merphi-combobox-search input {
  width: 100%;
  min-height: 40px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 8px;
  padding: 0 12px;
  font: inherit;
  font-family: inherit;
  font-size: 16px;
}

.merphi-combobox-list {
  overflow: auto;
  max-height: 260px;
  padding: 8px;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.merphi-combobox-option {
  width: 100%;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  text-align: left;
  border: 0;
  background: transparent;
  border-radius: 8px;
  padding: 10px 12px;
  min-height: 40px;
  cursor: pointer;
  font: inherit;
  font-family: inherit;
}

@media (pointer: coarse) {
  .merphi-combobox-option {
    min-height: 44px;
  }
}

body.merphi-combobox-body-lock {
  overflow: hidden;
  touch-action: none;
}

.merphi-combobox-option:hover,
.merphi-combobox-option.active,
.merphi-combobox-option.selected {
  background: #fff7f0;
}

.merphi-combobox-option-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.merphi-combobox-option-copy small {
  color: #6b7280;
}

.merphi-combobox-check {
  width: 1.1em;
  flex: 0 0 auto;
  color: #f96302;
}

.merphi-combobox-empty {
  padding: 18px 12px;
  color: #6b7280;
  text-align: center;
}

.merphi-combobox-panel-foot,
.merphi-combobox-sheet-foot {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding: 10px;
  border-top: 1px solid rgba(15, 23, 42, 0.08);
}

.merphi-combobox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
}

.merphi-combobox-sheet {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: calc(100dvh - 64px);
  background: #fff;
  border-radius: 16px 16px 0 0;
  display: flex;
  flex-direction: column;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.merphi-combobox-handle {
  width: 36px;
  height: 4px;
  border-radius: 999px;
  background: #d1d5db;
  margin: 10px auto 4px;
}

.merphi-combobox-sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
}

.merphi-combobox-sheet .merphi-combobox-list {
  max-height: none;
  flex: 1 1 auto;
}

.merphi-combobox-sheet .merphi-combobox-option {
  min-height: 48px;
}

/* Catalog floating menu portal */
.catalog-menu-portal {
  position: fixed;
  z-index: 1300;
  min-width: 180px;
  background: #fff;
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 12px;
  box-shadow: 0 16px 36px rgba(15, 23, 42, 0.18);
  padding: 6px;
}

.catalog-menu-portal button {
  width: 100%;
  display: block;
  text-align: left;
  border: 0;
  background: transparent;
  border-radius: 8px;
  padding: 10px 12px;
  min-height: 40px;
  cursor: pointer;
}

.catalog-menu-portal button:hover,
.catalog-menu-portal button:focus-visible {
  background: #fff7f0;
}

.catalog-menu-sheet {
  position: fixed;
  inset: 0;
  z-index: 1300;
}

.catalog-menu-sheet .catalog-menu-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
}

.catalog-menu-sheet .catalog-menu-sheet-panel {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  background: #fff;
  border-radius: 16px 16px 0 0;
  padding: 12px 12px calc(12px + env(safe-area-inset-bottom, 0px));
}

html.ui-v2 .catalog-surface.data-surface,
html.ui-v2 #catalog-surface.data-surface {
  overflow: visible;
}

/* Native <select> upgraded by MerphiSelect.upgrade: the select stays for forms, the trigger is what people see. */
.merphi-native-select-proxy {
  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;
  clip-path: inset(50%) !important;
  border: 0 !important;
  white-space: nowrap !important;
}

.merphi-select-upgrade {
  display: block;
  width: 100%;
  min-width: 0;
}

.sf-period-pick .merphi-select-upgrade {
  min-width: 130px;
}
