/* ═══════════════════════════════════════════════════════════════════════════
   IMOVI+ · Sélecteur (listes déroulantes de tout le site)
   Fichier : assets/css/selecteur.css · comportement : assets/js/selecteur.js
   ─────────────────────────────────────────────────────────────────────────────
   La liste native reste le champ (sa taille, sa bordure et ses couleurs sont
   celles de la page qui l'accueille) ; on lui retire la flèche du navigateur
   et on ouvre à sa place une liste dessinée : recherche dès 8 choix, groupes,
   coche, clavier complet. Au téléphone, la liste monte depuis le bas.
   Couleurs du monde IMOVI+ : encre, ivoire, sable ; accent cuivre (orange
   foncé dans l'administration, via --isel-accent).
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
  --isel-accent: #8E561F;
  --isel-encre: #1A1612;
  --isel-texte-2: #5E5850;
  --isel-surface: #FFFFFF;
  --isel-survol: #F6F0E7;
  --isel-actif: #EFE6D8;
  --isel-ligne: rgba(26, 22, 18, .10);
  --isel-police: 'Instrument Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

/* ── Le champ ─────────────────────────────────────────────────────────────── */
select.isel {
  -webkit-appearance: none !important; -moz-appearance: none !important; appearance: none !important;
  background-repeat: no-repeat !important;
  background-position: right 14px center !important;
  background-size: 12px 8px !important;
  padding-right: 40px !important;
  cursor: pointer;
  text-overflow: ellipsis;
  transition: border-color .18s, box-shadow .18s, background-color .18s;
}
select.isel::-ms-expand { display: none; }
select.isel:disabled { cursor: not-allowed; opacity: .6; }
select.isel.isel-ouvert {
  border-color: var(--isel-accent) !important;
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--isel-accent) 16%, transparent) !important;
  outline: none;
}
select.isel.isel-attente { color: var(--isel-texte-2) !important; }

/* ── La liste ─────────────────────────────────────────────────────────────── */
.isel-panneau {
  position: fixed; z-index: 2147483000; box-sizing: border-box;
  display: flex; flex-direction: column; min-width: 220px; overflow: hidden;
  background: var(--isel-surface); color: var(--isel-encre); font: 400 15px/1.35 var(--isel-police);
  border: 1px solid var(--isel-ligne); border-radius: 14px;
  box-shadow: 0 2px 6px rgba(26, 22, 18, .06), 0 22px 48px -18px rgba(26, 22, 18, .38);
  transform-origin: top center;
  animation: isel-ouverture .16s cubic-bezier(.22, .61, .36, 1);
}
.isel-panneau.isel-dessus { transform-origin: bottom center; }
.isel-panneau *, .isel-panneau *::before, .isel-panneau *::after { box-sizing: border-box; }
@keyframes isel-ouverture { from { opacity: 0; transform: translateY(-4px) scale(.985); } to { opacity: 1; transform: none; } }
.isel-panneau.isel-dessus { animation-name: isel-ouverture-dessus; }
@keyframes isel-ouverture-dessus { from { opacity: 0; transform: translateY(4px) scale(.985); } to { opacity: 1; transform: none; } }

.isel-tete { display: none; }
.isel-recherche { position: relative; flex-shrink: 0; padding: 8px; border-bottom: 1px solid var(--isel-ligne); background: var(--isel-surface); }
.isel-recherche svg { position: absolute; left: 20px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--isel-texte-2); pointer-events: none; }
.isel-recherche input {
  width: 100%; min-height: 40px; margin: 0; padding: 0 12px 0 36px; border: 1px solid var(--isel-ligne); border-radius: 10px;
  background: #FAF6F0; color: var(--isel-encre); font: 500 15px/1 var(--isel-police); -webkit-appearance: none; appearance: none;
}
.isel-recherche input::placeholder { color: #6F6960; opacity: 1; }
.isel-recherche input:focus { outline: none; border-color: var(--isel-accent); background: #fff; box-shadow: 0 0 0 3px color-mix(in srgb, var(--isel-accent) 16%, transparent); }
.isel-recherche input::-webkit-search-cancel-button { cursor: pointer; }

.isel-liste {
  list-style: none; margin: 0; padding: 6px; overflow-y: auto; overscroll-behavior: contain; outline: none;
  scrollbar-width: thin; scrollbar-color: #CDBFAC transparent;
}
.isel-liste::-webkit-scrollbar { width: 8px; }
.isel-liste::-webkit-scrollbar-thumb { background: #CDBFAC; border-radius: 8px; border: 2px solid #fff; }
.isel-groupe { padding: 10px 10px 4px; font-size: 12.5px; font-weight: 700; color: var(--isel-texte-2); }
.isel-groupe:first-child { padding-top: 4px; }
.isel-option {
  display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 8px 10px; border-radius: 9px;
  cursor: pointer; user-select: none; color: var(--isel-encre);
}
.isel-option.dans-groupe { padding-left: 18px; }
.isel-option span { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.isel-option mark { background: color-mix(in srgb, var(--isel-accent) 18%, transparent); color: inherit; border-radius: 3px; padding: 0 1px; }
.isel-option svg { flex-shrink: 0; width: 16px; height: 16px; color: var(--isel-accent); visibility: hidden; }
.isel-option:hover { background: var(--isel-survol); }
.isel-option.isel-courant { background: var(--isel-actif); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--isel-accent) 35%, transparent); }
.isel-option[aria-selected="true"] { font-weight: 600; }
.isel-option[aria-selected="true"] svg { visibility: visible; }
.isel-option.isel-vide-choix { color: var(--isel-texte-2); }
.isel-option[aria-disabled="true"] { color: #9A928A; cursor: not-allowed; background: none; box-shadow: none; }
.isel-rien { margin: 0; padding: 18px 14px; text-align: center; color: var(--isel-texte-2); font-size: 14px; }
.isel-rien[hidden] { display: none; }

@media (pointer: coarse) { .isel-option { min-height: 46px; } }
@media (prefers-reduced-motion: reduce) { .isel-panneau, .isel-feuille { animation: none !important; } }

/* ── Au téléphone : la liste monte depuis le bas ────────────────────────── */
.isel-voile { position: fixed; inset: 0; z-index: 2147482999; background: rgba(26, 22, 18, .48); animation: isel-voile .2s ease; }
@keyframes isel-voile { from { opacity: 0; } to { opacity: 1; } }
.isel-panneau.isel-feuille {
  left: 0 !important; right: 0; top: auto !important; bottom: 0; width: 100% !important; max-width: none; min-width: 0;
  max-height: min(82dvh, 640px) !important; border-radius: 22px 22px 0 0; border-bottom: 0;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  animation: isel-montee .26s cubic-bezier(.22, .61, .36, 1);
}
@keyframes isel-montee { from { transform: translateY(100%); } to { transform: none; } }
.isel-feuille .isel-tete { display: flex; align-items: center; gap: 12px; padding: 14px 12px 10px 18px; border-bottom: 1px solid var(--isel-ligne); }
.isel-feuille .isel-tete::before { content: ''; position: absolute; top: 7px; left: 50%; width: 38px; height: 4px; margin-left: -19px; border-radius: 4px; background: #D9CFC1; }
.isel-feuille .isel-titre { flex: 1; margin: 0; font: 600 16px/1.3 var(--isel-police); color: var(--isel-encre); }
.isel-fermer { width: 44px; height: 44px; border: 0; border-radius: 50%; background: #F3ECE1; color: var(--isel-encre); cursor: pointer; display: grid; place-items: center; }
.isel-fermer svg { width: 16px; height: 16px; }
.isel-feuille .isel-recherche { padding: 10px 12px; }
.isel-feuille .isel-recherche svg { left: 24px; }
.isel-feuille .isel-recherche input { min-height: 46px; font-size: 16px; }
.isel-feuille .isel-liste { padding: 6px 10px 14px; }
.isel-feuille .isel-option { min-height: 50px; font-size: 16px; }
