/* ============================================
   CoCo Dakar 2026 — Composant Recherche Pays
   Mobile-first · Ultra Premium
   ============================================ */

/* ── WRAPPER ── */
.country-select-wrapper {
  position: relative;
  width: 100%;
}

/* ── BOÎTE DE SAISIE VISIBLE ── */
.country-input-box {
  display: flex;
  align-items: center;
  width: 100%;
  padding: .82rem 1rem;
  border: 1.5px solid #e5e7eb;
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  transition: border-color .22s ease, box-shadow .22s ease;
  gap: .55rem;
  min-height: 52px; /* touch target généreux */
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.country-input-box:focus-within,
.country-input-box.open {
  border-color: #c8a96e;
  box-shadow: 0 0 0 3.5px rgba(200,169,110,.18);
}
.country-input-box.error-border {
  border-color: #c0392b;
  box-shadow: 0 0 0 3px rgba(192,57,43,.14);
}

.country-flag {
  font-size: 1.3rem;
  line-height: 1;
  flex-shrink: 0;
}
.country-input-text {
  flex: 1;
  border: none;
  outline: none;
  font-family: 'Inter', -apple-system, sans-serif;
  font-size: 1rem; /* 16px — évite zoom iOS */
  color: #1f2937;
  background: transparent;
  cursor: text;
  min-width: 0;
  -webkit-appearance: none;
}
.country-input-text::placeholder { color: #9ca3af; }

.country-chevron {
  color: #9ca3af;
  font-size: .8rem;
  transition: transform .22s ease;
  flex-shrink: 0;
}
.country-input-box.open .country-chevron { transform: rotate(180deg); }

.country-clear {
  color: #9ca3af;
  font-size: .85rem;
  cursor: pointer;
  flex-shrink: 0;
  display: none;
  padding: 5px 6px;
  border-radius: 50%;
  transition: color .2s, background .2s;
  touch-action: manipulation;
  min-width: 30px;
  min-height: 30px;
  align-items: center;
  justify-content: center;
}
.country-clear:hover   { color: #c0392b; background: rgba(192,57,43,.08); }
.country-clear:active  { background: rgba(192,57,43,.15); }
.country-clear.visible { display: flex; }

/* ── DROPDOWN ── */
.country-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0; right: 0;
  background: #fff;
  border: 1.5px solid #e5e7eb;
  border-radius: 14px;
  box-shadow: 0 12px 40px rgba(0,0,0,.16), 0 4px 12px rgba(0,0,0,.08);
  z-index: 999;
  display: none;
  overflow: hidden;
  max-height: 360px;
  flex-direction: column;
}
.country-dropdown.open { display: flex; }

/* ── BARRE DE RECHERCHE INTERNE ── */
.country-search-bar {
  padding: .7rem .9rem;
  border-bottom: 1px solid #f3f4f6;
  background: #f9fafb;
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-shrink: 0;
}
.country-search-bar i { color: #c8a96e; font-size: .85rem; }
.country-search-input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-family: 'Inter', -apple-system, sans-serif;
  font-size: 1rem; /* 16px — évite zoom iOS */
  color: #1f2937;
  -webkit-appearance: none;
}
.country-search-input::placeholder { color: #9ca3af; }

/* ── COMPTEUR ── */
.country-count {
  font-size: .72rem;
  color: #9ca3af;
  font-weight: 600;
  padding: .28rem .9rem;
  background: #f9fafb;
  border-bottom: 1px solid #f3f4f6;
  flex-shrink: 0;
  letter-spacing: .02em;
}

/* ── LISTE SCROLLABLE ── */
.country-list {
  overflow-y: auto;
  flex: 1;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}
.country-list::-webkit-scrollbar { width: 4px; }
.country-list::-webkit-scrollbar-thumb {
  background: #e5e7eb;
  border-radius: 10px;
}
.country-list::-webkit-scrollbar-thumb:hover { background: #c8a96e; }

/* ── LABEL RÉGION ── */
.country-group-label {
  padding: .45rem .9rem .22rem;
  font-size: .68rem;
  font-weight: 800;
  color: #9ca3af;
  text-transform: uppercase;
  letter-spacing: .08em;
  background: #f9fafb;
  border-bottom: 1px solid #f3f4f6;
  position: sticky;
  top: 0;
  z-index: 1;
}

/* ── OPTION PAYS ── */
.country-option {
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: .7rem .9rem;
  cursor: pointer;
  font-size: .92rem;
  color: #1f2937;
  transition: background .15s ease;
  border-bottom: 1px solid #f9fafb;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  min-height: 48px; /* touch target */
}
.country-option:hover  { background: rgba(200,169,110,.07); }
.country-option:active { background: rgba(200,169,110,.14); }
.country-option.selected {
  background: rgba(200,169,110,.12);
  font-weight: 700;
  color: #a8894e;
}
.country-option .opt-flag {
  font-size: 1.2rem;
  min-width: 26px;
  text-align: center;
  line-height: 1;
}
.country-option .opt-name { flex: 1; line-height: 1.3; }
.country-option.selected .opt-check {
  color: #c8a96e;
  font-size: .8rem;
}

/* ── AUCUN RÉSULTAT ── */
.country-no-result {
  text-align: center;
  padding: 2rem 1.5rem;
  color: #9ca3af;
  font-size: .88rem;
  line-height: 1.5;
}
.country-no-result i {
  display: block;
  font-size: 1.8rem;
  margin-bottom: .5rem;
  color: #d1d5db;
}

/* ── SELECT CACHÉ ── */
#pays { display: none; }

/* ══════════════════════════════════════════
   TABLET (≥ 640px)
══════════════════════════════════════════ */
@media (min-width: 640px) {
  .country-dropdown {
    max-height: 400px;
  }
  .country-option {
    min-height: 44px;
    padding: .6rem .9rem;
  }
}
