/* selector.css — lista desplegable propia para los <select> (ver selector.js).
   El <select> nativo sigue siendo el "botón" (lo estiliza styles.css como un input);
   acá solo: (1) se le sacan los eventos de puntero para que el sistema nunca abra su popup,
   y (2) el popover / hoja de opciones. */

/* (1) Solo cuando selector.js cargó (html.sel-js), para no dejar selects inutilizables si el JS falla. */
html.sel-js select:not([multiple]):not([size]):not([data-nativo]):not(.sin-selector),
html.sel-js select[size="0"]:not([multiple]):not([data-nativo]):not(.sin-selector),
html.sel-js select[size="1"]:not([multiple]):not([data-nativo]):not(.sin-selector){
  pointer-events: none;
}
/* Mientras su lista está abierta, el select se ve "enfocado". */
select.sel-abierto{
  border-color: var(--accent-vivido) !important;
}

/* (2) Capa */
.sel-raiz{
  position: fixed; inset: 0; z-index: 1000;
  pointer-events: none;
  font-family: inherit;
  -webkit-tap-highlight-color: transparent;
}
.sel-raiz.sel-visible{ pointer-events: auto; }
.sel-fondo{ position: absolute; inset: 0; }

.sel-panel{
  position: fixed;
  background: var(--bg-panel);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow:
    0 1px 2px rgba(0,0,0,calc(0.10 * var(--shadow-strength, 1))),
    0 10px 28px rgba(0,0,0,calc(0.22 * var(--shadow-strength, 1)));
  overflow: hidden;
  box-sizing: border-box;
}

.sel-lista{
  overflow-y: auto; overscroll-behavior: contain;
  padding: 4px;
  outline: none;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}

.sel-op{
  display: flex; align-items: center; gap: 10px;
  min-height: 40px; padding: 0 10px 0 12px;
  border-radius: 8px;
  font-size: 0.92rem; font-weight: 500; line-height: 1.25;
  color: var(--text);
  cursor: pointer;
  user-select: none; -webkit-user-select: none;
}
.sel-op-en-grupo{ padding-left: 12px; }
.sel-op-txt{ flex: 1; min-width: 0; padding: 9px 0; overflow-wrap: anywhere; }
.sel-op-check{ flex: 0 0 auto; width: 16px; height: 16px; display: flex; visibility: hidden; }
.sel-op-check svg{
  width: 16px; height: 16px; fill: none; stroke: currentColor;
  stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round;
}
.sel-op.sel-activo{ background: var(--bg-panel-2); }
.sel-op[aria-selected="true"]{ color: var(--accent); font-weight: 600; }
.sel-op[aria-selected="true"] .sel-op-check{ visibility: visible; }
.sel-op[aria-disabled="true"]{ color: var(--text-dim); opacity: 0.55; cursor: default; }
.sel-op[aria-disabled="true"].sel-activo{ background: transparent; }

.sel-grupo{
  padding: 10px 12px 4px;
  font-size: 0.74rem; font-weight: 500; color: var(--text-dim);
  user-select: none; -webkit-user-select: none;
}
.sel-grupo:first-child{ padding-top: 6px; }
.sel-op + .sel-grupo{ margin-top: 4px; border-top: 1px solid var(--line); padding-top: 10px; }
.sel-vacio{ padding: 12px; font-size: 0.86rem; color: var(--text-dim); }

/* Con el dedo no hay "foco" que mostrar: solo el check en la elegida y feedback al tocar. */
.sel-tactil .sel-op.sel-activo{ background: transparent; }
.sel-tactil .sel-op:active{ background: var(--bg-panel-2); }

/* Popover (compu) */
.sel-pop .sel-panel{
  opacity: 0; transform: translateY(-4px);
  transition: opacity .12s ease, transform .12s ease;
}
.sel-pop .sel-panel.sel-arriba{ transform: translateY(4px); }
.sel-pop.sel-visible .sel-panel{ opacity: 1; transform: none; }

/* Hoja desde abajo (celular) */
.sel-hoja .sel-fondo{
  background: rgba(0,0,0,0.42);
  opacity: 0; transition: opacity .2s ease;
}
.sel-hoja.sel-visible .sel-fondo{ opacity: 1; }
.sel-hoja .sel-panel{
  left: 0; right: 0; bottom: 0;
  max-height: min(72vh, 560px);
  display: flex; flex-direction: column;
  border-radius: 16px 16px 0 0;
  border-bottom: 0;
  box-shadow: 0 -6px 24px rgba(0,0,0,calc(0.18 * var(--shadow-strength, 1)));
  padding-bottom: calc(8px + var(--safe-bottom, env(safe-area-inset-bottom, 0px)));
  transform: translateY(100%);
  transition: transform .22s cubic-bezier(.2,.8,.2,1);
}
.sel-hoja.sel-visible .sel-panel{ transform: none; }
.sel-hoja.sel-saliendo .sel-panel{ transition-duration: .16s; }
.sel-asa{
  flex: 0 0 auto; width: 36px; height: 4px; border-radius: 2px;
  background: var(--line); margin: 8px auto 4px;
}
.sel-titulo{
  flex: 0 0 auto;
  padding: 8px 20px 10px;
  font-size: 1rem; font-weight: 600; color: var(--text);
  border-bottom: 1px solid var(--line);
}
.sel-hoja .sel-lista{ flex: 1 1 auto; min-height: 0; padding: 6px 8px; }
.sel-hoja .sel-op{ min-height: 48px; padding: 0 14px; font-size: 1rem; border-radius: 10px; }
.sel-hoja .sel-op-check, .sel-hoja .sel-op-check svg{ width: 18px; height: 18px; }
.sel-hoja .sel-grupo{ padding-left: 14px; }

@media (prefers-reduced-motion: reduce){
  .sel-pop .sel-panel, .sel-hoja .sel-panel, .sel-hoja .sel-fondo{ transition: none; }
}
