/* ==========================================================================
   MOTOLECTRON - PREMIUM SELECT LIST (assets/js/core/moto-select.js)
   One shared menu replaces the native list of every <select> on desktop,
   admin and storefront alike. Token-only, so one rule set serves Light and
   Dark. DESIGN.md: a raised --moto-panel-soft surface with a fine border and
   the tight card shadow, no wide drop shadow, no blur.
   ========================================================================== */

.moto-select-menu {
  /* Reset the UA popover box (centred, inset 0, canvas colours). */
  position: fixed;
  inset: auto;
  margin: 0;
  display: none;
  flex-direction: column;
  box-sizing: border-box;
  min-width: 180px;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--moto-border-subtle, #2a2a2a);
  border-radius: 12px;
  background: var(--moto-panel-soft, #191919);
  color: var(--moto-text, #ffffff);
  box-shadow: var(--moto-card-shadow, 0 1px 2px rgba(0, 0, 0, 0.35), 0 10px 24px -14px rgba(0, 0, 0, 0.7));
  font-size: var(--moto-select-font-size, 0.875rem);
  line-height: 1.35;
  text-align: left;
  z-index: 2147483000; /* Only used where the popover top layer is missing. */
  transform-origin: top center;
  opacity: 1;
  transform: none;
  transition:
    opacity 140ms var(--ix-ease-out, ease-out),
    transform 200ms var(--ix-ease-out, ease-out),
    overlay 200ms allow-discrete,
    display 200ms allow-discrete;
}

/* Shown only while open (an author `display` would beat the UA rule that
   hides a closed popover). */
.moto-select-menu:popover-open,
.moto-select-menu:not([popover]):not([hidden]) {
  display: flex;
}

.moto-select-menu.is-up {
  transform-origin: bottom center;
}

/* Opens with a short drop and settle; closes with a quick fade. */
@starting-style {
  .moto-select-menu:popover-open {
    opacity: 0;
    transform: translateY(-4px) scale(0.98);
  }

  .moto-select-menu.is-up:popover-open {
    transform: translateY(4px) scale(0.98);
  }
}

.moto-select-menu[popover]:not(:popover-open) {
  opacity: 0;
  transform: scale(0.98);
  transition-duration: 110ms;
}

/* No search row: rows are picked with a click; typing jumps to a row. */
.moto-select-list {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  padding: 4px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--moto-border-hover, #555555) transparent;
}

/* The active row: one pill that glides from row to row. */
.moto-select-highlight {
  position: absolute;
  top: 0;
  left: 4px;
  right: 4px;
  border-radius: 8px;
  background: var(--moto-overlay-strong, rgba(255, 255, 255, 0.12));
  opacity: 0;
  pointer-events: none;
  transition:
    transform 180ms var(--ix-ease-out, ease-out),
    height 180ms var(--ix-ease-out, ease-out),
    opacity 120ms ease-out;
}

.moto-select-highlight.is-visible {
  opacity: 1;
}

.moto-select-highlight.is-instant {
  transition: none;
}

/* The list is as wide as its box (moto-select.js), so a row gives its text at
   least the room the box gives it: the text starts where the box's text does,
   and the check sits in the row's right padding instead of taking a column
   (Jemmy, 2026-11-13). Text that fits the box then fits the row unwrapped. */
.moto-select-option {
  position: relative; /* above the highlight */
  display: flex;
  align-items: center;
  min-height: 36px;
  padding: 8px 24px 8px 8px;
  border-radius: 8px;
  color: var(--moto-text-secondary, #d4d4d8);
  cursor: pointer;
  user-select: none;
  transition: color 160ms var(--ix-ease-out, ease-out);
}

.moto-select-option.is-grouped {
  padding-left: 16px;
}

.moto-select-option.is-active,
.moto-select-option[aria-selected="true"] {
  color: var(--moto-text, #ffffff);
}

/* The chosen row is marked by its check and brighter text, not by weight:
   bold text is wider, and wrapped in a list as narrow as its box. */

.moto-select-option[aria-disabled="true"] {
  color: var(--moto-text-dim, #71717a);
  cursor: not-allowed;
}

.moto-select-option-label {
  flex: 1 1 auto;
  min-width: 0;
  overflow-wrap: anywhere;
}

/* A grey glyph, not a coloured badge, marks the chosen row. */
.moto-select-check {
  position: absolute;
  top: 50%;
  right: 6px;
  display: inline-flex;
  width: 14px;
  height: 14px;
  translate: 0 -50%;
  color: var(--moto-text, #ffffff);
  opacity: 0;
  scale: 0.6;
  transition: opacity 160ms ease-out, scale 260ms var(--ix-spring, ease-out);
}

.moto-select-option[aria-selected="true"] .moto-select-check {
  opacity: 1;
  scale: 1;
}

.moto-select-check svg {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.moto-select-group-label {
  padding: 10px 10px 4px;
  color: var(--moto-muted, #a1a1aa);
  font-size: 0.72em;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.moto-select-empty {
  padding: 14px 12px;
  color: var(--moto-muted, #a1a1aa);
  font-size: 0.85em;
  text-align: center;
}

.moto-select-empty[hidden] {
  display: none;
}

/* The select whose list is open keeps its focus look while the mouse is
   in the list. */
select.is-menu-open {
  border-color: var(--moto-red, #ff1f1f);
}

@media (prefers-reduced-motion: reduce) {
  .moto-select-menu,
  .moto-select-highlight,
  .moto-select-check {
    transition-duration: 1ms;
  }

  @starting-style {
    .moto-select-menu:popover-open,
    .moto-select-menu.is-up:popover-open {
      transform: none;
    }
  }
}
