/* ==========================================================================
   AstraCursus - controlli select (tema Aurora). Caricato dopo components.css.
   1) select nativo: fondo scuro esplicito + option leggibili (il popup nativo
      non eredita i colori del tema: prima era bianco su bianco).
   2) .sel: listbox accessibile costruito sopra il select nativo, che resta nel
      form come sorgente di verita'. Senza JS resta attivo il punto 1.
   ========================================================================== */

/* --- 1. select nativo: fallback sempre leggibile --- */
.field select {
  appearance: none;
  -webkit-appearance: none;
  color-scheme: dark;
  background-color: var(--surface-3, #13252f);
  color: var(--ink);
  padding-right: 42px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 6.5 8 10.5 12 6.5' fill='none' stroke='%23e9b47a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 15px center;
  background-size: 16px 16px;
}
.field select option,
.field select optgroup {
  background-color: #13252f;
  color: #f4f7f3;
}

/* --- 2. listbox personalizzato --- */
.sel { position: relative; }

/* Il controllo nativo resta nel form (valore, validazione, invio) ma non e'
   piu' visibile ne' raggiungibile da tastiera: il controllo e' .sel__btn. */
.sel .sel__native {
  position: absolute;
  top: 0;
  left: 0;
  width: 1px;
  height: 1px;
  min-height: 0;
  padding: 0;
  margin: 0;
  border: 0;
  opacity: 0;
  clip-path: inset(50%);
  overflow: hidden;
  pointer-events: none;
}

.sel__btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  font: inherit;
  text-align: left;
  color: var(--ink);
  background: var(--surface-3, #13252f);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-btn);
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}
.sel__btn:hover { border-color: var(--accent); }
.sel__btn[aria-expanded="true"] { border-color: var(--accent); }
.sel__btn:focus-visible { outline: var(--focus-ring) solid var(--focus); outline-offset: 1px; }
.field[data-invalid="true"] .sel__btn { border-color: var(--danger); }
.sel__btn[disabled] { opacity: 0.6; cursor: not-allowed; }
.sel__value { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sel__value[data-placeholder="true"] { color: var(--ink-muted); }
.sel__chevron {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  color: var(--accent);
  transition: transform 0.18s ease;
}
.sel__btn[aria-expanded="true"] .sel__chevron { transform: rotate(180deg); }

.sel__list {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 70;
  margin: 0;
  padding: 6px;
  list-style: none;
  background: var(--surface-3, #13252f);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-btn);
  box-shadow: var(--shadow);
  max-height: 320px;
  overflow: auto;
  overscroll-behavior: contain;
}
.sel__list[hidden] { display: none; }
.sel__opt {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--ink-muted);
  font-size: 0.9375rem;
  cursor: pointer;
}
.sel__opt:hover { background: rgba(255, 255, 255, 0.08); color: var(--ink); }
.sel__opt:focus-visible {
  outline: var(--focus-ring) solid var(--focus);
  outline-offset: -2px;
  color: var(--ink);
}
.sel__opt[aria-selected="true"] { color: var(--ink); font-weight: 600; }
.sel__opt-label { margin-inline-end: auto; }
.sel__check { width: 16px; height: 16px; flex: 0 0 auto; color: var(--accent); opacity: 0; }
.sel__opt[aria-selected="true"] .sel__check { opacity: 1; }