/* ============================================================
   SELECT2 — Thème Avy D'Livré
   Compatible : home.css (ambre/vert) + client_livraison.css (vert)
   Remplace entièrement le style par défaut de Select2
   Import après select2.min.css
============================================================ */

/* ── Conteneur principal ── */
.select2-container {
  width: 100% !important;
  font-family: 'Nunito', 'Plus Jakarta Sans', sans-serif;
}

/* ── Champ de saisie (bouton fermé) ── */
.select2-container--default .select2-selection--single {
  height: auto;
  padding: 10px 38px 10px 14px;
  border: 1.5px solid #EAE6DF;
  border-radius: 12px;
  background: #FAFAF7;
  font-size: 0.93rem;
  font-weight: 600;
  color: #1A1714;
  transition: border-color 0.18s, box-shadow 0.18s;
  display: flex;
  align-items: center;
  cursor: pointer;
  outline: none;
}

/* Flèche personnalisée */
.select2-container--default .select2-selection--single .select2-selection__arrow {
  height: 100%;
  top: 0;
  right: 10px;
  width: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.select2-container--default .select2-selection--single .select2-selection__arrow b {
  border-color: #9E9590 transparent transparent transparent;
  border-width: 5px 4px 0 4px;
  border-style: solid;
  margin-top: 0;
  transition: transform 0.2s ease;
}

/* Flèche rotée quand ouvert */
.select2-container--default.select2-container--open
  .select2-selection--single
  .select2-selection__arrow b {
  border-color: transparent transparent #9E9590 transparent;
  border-width: 0 4px 5px 4px;
}

/* Texte du placeholder */
.select2-container--default
  .select2-selection--single
  .select2-selection__placeholder {
  color: #9E9590;
  font-weight: 500;
}

/* Texte de la valeur sélectionnée */
.select2-container--default
  .select2-selection--single
  .select2-selection__rendered {
  color: #1A1714;
  padding: 0;
  line-height: 1.4;
}

/* ── Focus / ouvert ── */
.select2-container--default.select2-container--open
  .select2-selection--single,
.select2-container--default.select2-container--focus
  .select2-selection--single {
  border-color: #2E9E5B;
  box-shadow: 0 0 0 3px rgba(46, 158, 91, 0.12);
  background: #fff;
  outline: none;
}

/* ── Dropdown wrapper ── */
.select2-dropdown {
  border: 1.5px solid #EAE6DF;
  border-radius: 12px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.10), 0 2px 8px rgba(0, 0, 0, 0.05);
  background: #fff;
  overflow: hidden;
  margin-top: 4px;
  z-index: 9999;
}

/* ── Champ de recherche dans le dropdown ── */
.select2-container--default .select2-search--dropdown {
  padding: 10px 10px 6px;
  background: #fff;
}

.select2-container--default .select2-search--dropdown .select2-search__field {
  width: 100%;
  padding: 9px 12px 9px 34px;
  border: 1.5px solid #EAE6DF;
  border-radius: 8px;
  font-family: 'Nunito', sans-serif;
  font-size: 0.88rem;
  font-weight: 600;
  color: #1A1714;
  background: #FAFAF7;
  outline: none;
  transition: border-color 0.18s, box-shadow 0.18s;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%239E9590' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.35-4.35'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 10px center;
}

.select2-container--default
  .select2-search--dropdown
  .select2-search__field:focus {
  border-color: #2E9E5B;
  box-shadow: 0 0 0 3px rgba(46, 158, 91, 0.10);
  background-color: #fff;
}

.select2-container--default
  .select2-search--dropdown
  .select2-search__field::placeholder {
  color: #9E9590;
  font-weight: 500;
}

/* ── Liste des options ── */
.select2-results__options {
  padding: 4px 6px 8px;
  max-height: 240px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #EAE6DF transparent;
}

.select2-results__options::-webkit-scrollbar {
  width: 4px;
}

.select2-results__options::-webkit-scrollbar-track {
  background: transparent;
}

.select2-results__options::-webkit-scrollbar-thumb {
  background: #EAE6DF;
  border-radius: 4px;
}

/* ── Option individuelle ── */
.select2-results__option {
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  color: #1A1714;
  cursor: pointer;
  transition: background 0.14s;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Option au survol */
.select2-container--default
  .select2-results__option--highlighted[aria-selected] {
  background: #E8F7EE;
  color: #1F7A42;
}

/* Option sélectionnée */
.select2-container--default
  .select2-results__option[aria-selected="true"] {
  background: #E8F7EE;
  color: #1F7A42;
  font-weight: 700;
  position: relative;
}

.select2-container--default
  .select2-results__option[aria-selected="true"]::after {
  content: '';
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #2E9E5B;
  margin-left: auto;
  flex-shrink: 0;
}

/* Option désactivée (placeholder vide) */
.select2-results__option[aria-disabled="true"] {
  color: #9E9590;
  font-weight: 500;
  display: none; /* cacher l'option vide dans la liste */
}

/* ── Message "aucun résultat" ── */
.select2-results__message,
.select2-container--default
  .select2-results__option--highlighted.select2-results__option--load-more {
  color: #9E9590;
  font-size: 0.85rem;
  font-style: italic;
  text-align: center;
  padding: 12px;
}

/* ════════════════════════════════════════
   VARIANTE : client_livraison
   (sur fond crème plus chaud, wizard)
════════════════════════════════════════ */
.wizard-body .select2-container--default .select2-selection--single,
.new-livraisons-panel .select2-container--default .select2-selection--single {
  background: #F7F3EE;
  border-color: #E5DDD5;
}

.wizard-body .select2-container--default.select2-container--open
  .select2-selection--single,
.wizard-body .select2-container--default.select2-container--focus
  .select2-selection--single {
  border-color: #4CAF50;
  box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.12);
}

.wizard-body .select2-container--default
  .select2-results__option--highlighted[aria-selected],
.new-livraisons-panel .select2-container--default
  .select2-results__option--highlighted[aria-selected] {
  background: #E8F5E9;
  color: #2E7A2F;
}

.wizard-body .select2-container--default
  .select2-results__option[aria-selected="true"],
.new-livraisons-panel .select2-container--default
  .select2-results__option[aria-selected="true"] {
  background: #E8F5E9;
  color: #2E7A2F;
}

.wizard-body .select2-container--default
  .select2-results__option[aria-selected="true"]::after,
.new-livraisons-panel .select2-container--default
  .select2-results__option[aria-selected="true"]::after {
  background: #4CAF50;
}

/* ── Champ avec icône emoji (calc-field-wrap) ── */
.calc-field-wrap .select2-container--default .select2-selection--single {
  padding-left: 38px;
}

/* ════════════════════════════════════════
   RESPONSIVE MOBILE
════════════════════════════════════════ */
@media (max-width: 640px) {
  .select2-dropdown {
    border-radius: 10px;
  }

  .select2-results__options {
    max-height: 200px;
  }

  .select2-container--default
    .select2-search--dropdown
    .select2-search__field {
    font-size: 16px; /* évite le zoom auto iOS */
    padding: 10px 12px 10px 34px;
  }

  .select2-container--default .select2-selection--single {
    padding: 11px 36px 11px 14px;
    font-size: 16px; /* évite zoom iOS aussi */
  }
}

/* ── Focus visible accessibilité ── */
.select2-container--default.select2-container--focus
  .select2-selection--single {
  outline: none;
}

.select2-container--focus .select2-selection--single,
.select2-container--open .select2-selection--single {
  outline: none;
}

/* Fix : Select2 avec la classe .invalid (validation wizard) */
.invalid + .select2-container--default .select2-selection--single,
.select2-container.select2-container--invalid .select2-selection--single {
  border-color: #DC2626;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.10);
}