/*
 * WPOS dropdown, 2026 (assets/js/wpos-select-2026.js). The button keeps the select's own classes,
 * so each page's input style sizes it; this file adds the chevron, states and the list.
 * Selectors are doubled with #wpos-app so they win over the panel layer's !important rules.
 */
.wsel { display: contents; }

/* The native select stays in place for the form and the browser's "please choose" message, unseen. */
.wsel-native,
#wpos-app .wsel-native {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  min-width: 0 !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

button.wsel-trigger,
#wpos-app button.wsel-trigger {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 10px !important;
  text-align: left !important;
  text-transform: none !important;
  cursor: pointer;
  background-image: none !important;
  -webkit-appearance: none;
  appearance: none;
}

button.wsel-trigger[hidden],
#wpos-app button.wsel-trigger[hidden] { display: none !important; }

.wsel-value {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

button.wsel-trigger.is-placeholder .wsel-value,
#wpos-app button.wsel-trigger.is-placeholder .wsel-value { color: #8A817A !important; }

button.wsel-trigger > svg,
#wpos-app button.wsel-trigger > svg {
  flex: none;
  width: 18px !important;
  height: 18px !important;
  fill: none !important;
  stroke: #6B635C;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform .2s cubic-bezier(.22, 1, .36, 1);
}

button.wsel-trigger.is-open,
#wpos-app button.wsel-trigger.is-open {
  border-color: #231F20 !important;
  box-shadow: 0 0 0 3px #FFCE00 !important;
}

button.wsel-trigger.is-open > svg,
#wpos-app button.wsel-trigger.is-open > svg { stroke: #231F20; transform: rotate(180deg); }

button.wsel-trigger:disabled,
#wpos-app button.wsel-trigger:disabled { color: #A9A09A !important; background-color: #F7F2E6 !important; cursor: not-allowed; }

button.wsel-trigger:disabled > svg { stroke: #D9CFBA; }

button.wsel-trigger.is-invalid,
#wpos-app button.wsel-trigger.is-invalid { border-color: #C41E25 !important; }

/* ---------- List ---------- */
.wsel-pop,
#wpos-app .wsel-pop {
  --wsel-ink: #231F20;
  position: fixed;
  z-index: 10050;
  display: none;
  flex-direction: column;
  overflow: hidden;
  border: 2px solid var(--wsel-ink);
  border-radius: 14px;
  color: var(--wsel-ink);
  background: #FFFFFF !important;
  box-shadow: 5px 5px 0 var(--wsel-ink) !important;
  font-family: "D-DIN", "DIN Alternate", "Bahnschrift", "Arial Narrow", system-ui, sans-serif;
  text-align: left;
}

.wsel-pop.is-open,
#wpos-app .wsel-pop.is-open { display: flex; animation: wsel-in .16s cubic-bezier(.22, 1, .36, 1); }
.wsel-pop.is-up.is-open,
#wpos-app .wsel-pop.is-up.is-open { animation-name: wsel-in-up; }

@keyframes wsel-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
@keyframes wsel-in-up { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.wsel-search {
  display: flex;
  flex: none;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid #E4DACB;
  background: #FBF6EA !important;
}

.wsel-search svg {
  flex: none;
  width: 18px;
  height: 18px;
  fill: none;
  stroke: #6B635C;
  stroke-width: 2;
  stroke-linecap: round;
}

.wsel-search input,
#wpos-app .wsel-search input {
  flex: 1 1 auto;
  width: auto !important;
  min-width: 0;
  min-height: 0 !important;
  margin: 0 !important;
  padding: 4px 0 !important;
  border: 0 !important;
  outline: 0 !important;
  color: #231F20 !important;
  background: transparent !important;
  box-shadow: none !important;
  font: inherit;
  font-size: 15px !important;
}

.wsel-list {
  flex: 1 1 auto;
  min-height: 0;
  margin: 0 !important;
  padding: 6px !important;
  overflow-y: auto;
  overscroll-behavior: contain;
  list-style: none !important;
  outline: none;
}

.wsel-list [role="option"] {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 40px;
  margin: 0;
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 14.5px;
  line-height: 1.3;
  cursor: pointer;
}

.wsel-list [role="option"] svg {
  flex: none;
  width: 16px;
  height: 16px;
  fill: none;
  stroke: #231F20;
  stroke-width: 2.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0;
}

.wsel-list .is-active { background: #F3EAD3 !important; }
.wsel-list .is-selected { font-weight: 700; background: #FFF3B8 !important; }
.wsel-list .is-selected.is-active { background: #FFCE00 !important; }
.wsel-list .is-selected svg { opacity: 1; }
.wsel-list [aria-disabled="true"] { color: #A9A09A; cursor: not-allowed; background: none !important; }

.wsel-list mark {
  padding: 0;
  color: inherit;
  background: none !important;
  font-weight: 700;
  text-decoration: underline;
  text-decoration-color: #FFCE00;
  text-decoration-thickness: 3px;
  text-underline-offset: 2px;
}

.wsel-group {
  padding: 10px 10px 4px;
  color: #6B635C;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.wsel-empty {
  padding: 16px 10px;
  color: #6B635C;
  font-size: 14px;
  text-align: center;
}

/* Phones: the list slides up from the bottom of the screen. */
.wsel-pop.is-sheet,
#wpos-app .wsel-pop.is-sheet {
  top: auto;
  right: 0;
  bottom: 0;
  left: 0;
  max-height: 72vh;
  padding-bottom: env(safe-area-inset-bottom);
  border-width: 2px 0 0;
  border-radius: 18px 18px 0 0;
  box-shadow: none !important;
}

.wsel-pop.is-sheet.is-open,
#wpos-app .wsel-pop.is-sheet.is-open { animation: wsel-sheet .22s cubic-bezier(.22, 1, .36, 1); }

@keyframes wsel-sheet { from { transform: translateY(100%); } to { transform: none; } }

.wsel-pop.is-sheet .wsel-list [role="option"] { min-height: 48px; font-size: 16px; }
.wsel-pop.is-sheet .wsel-search input { font-size: 16px !important; }

html.wsel-sheet-open body::before {
  position: fixed;
  z-index: 10049;
  inset: 0;
  content: "";
  background: rgba(35, 31, 32, .45);
}

@media (prefers-reduced-motion: reduce) {
  .wsel-pop.is-open,
  #wpos-app .wsel-pop.is-open { animation: none; }
  button.wsel-trigger > svg { transition: none; }
}
