/* IPCH Country Switcher — compacto para barra superior */
.ipch-cs {
  --ipch-cs-size: 22px;
  --ipch-cs-option: 28px;
  --ipch-cs-red: #b1080e;
  --ipch-cs-ink: #1a1a1a;
  --ipch-cs-muted: #6b7280;
  --ipch-cs-border: rgba(0, 0, 0, 0.08);
  --ipch-cs-shadow: 0 10px 28px rgba(17, 24, 39, 0.14);
  position: relative;
  display: inline-flex;
  align-items: center;
  vertical-align: middle;
  z-index: 10050;
  font-family: inherit;
  line-height: 1;
}

.ipch-cs__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin: 0;
  padding: 3px 5px 3px 3px;
  border: 1px solid var(--ipch-cs-border);
  border-radius: 999px;
  background: #fff;
  color: var(--ipch-cs-muted);
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  transition: border-color 0.18s ease, box-shadow 0.18s ease, color 0.18s ease;
}

.ipch-cs__btn:hover,
.ipch-cs__btn:focus-visible,
.ipch-cs.is-open .ipch-cs__btn {
  border-color: rgba(177, 8, 14, 0.28);
  color: var(--ipch-cs-red);
  box-shadow: 0 2px 8px rgba(177, 8, 14, 0.12);
  outline: none;
}

.ipch-cs__flag {
  display: inline-flex;
  width: var(--ipch-cs-size);
  height: var(--ipch-cs-size);
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
  background: #f3f4f6;
}

.ipch-cs__flag img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.ipch-cs__chevron {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.18s ease;
}

.ipch-cs.is-open .ipch-cs__chevron {
  transform: rotate(180deg);
}

.ipch-cs__menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  left: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  margin: 0;
  padding: 8px;
  list-style: none;
  min-width: 44px;
  background: #fff;
  border: 1px solid var(--ipch-cs-border);
  border-radius: 16px;
  box-shadow: var(--ipch-cs-shadow);
  z-index: 10060;
}

.ipch-cs__menu[hidden] {
  display: none !important;
}

.ipch-cs__menu li {
  margin: 0;
  padding: 0;
  list-style: none;
}

.ipch-cs__option {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--ipch-cs-option);
  height: var(--ipch-cs-option);
  border-radius: 50%;
  text-decoration: none !important;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.06);
}

.ipch-cs__option .ipch-cs__flag {
  width: var(--ipch-cs-option);
  height: var(--ipch-cs-option);
}

.ipch-cs__option:hover,
.ipch-cs__option:focus-visible {
  transform: translateY(-1px) scale(1.06);
  box-shadow: 0 4px 12px rgba(177, 8, 14, 0.18);
  outline: none;
}

.ipch-cs__option.is-current {
  box-shadow: 0 0 0 2px #fff, 0 0 0 3.5px var(--ipch-cs-red);
}

/* Accesibilidad: texto solo para lectores de pantalla */
.ipch-cs .screen-reader-text {
  border: 0;
  clip: rect(1px, 1px, 1px, 1px);
  clip-path: inset(50%);
  height: 1px;
  margin: -1px;
  overflow: hidden;
  padding: 0;
  position: absolute;
  width: 1px;
  word-wrap: normal !important;
}

/* Cabeceras estrechas / móvil */
@media (max-width: 767px) {
  .ipch-cs {
    --ipch-cs-size: 20px;
    --ipch-cs-option: 26px;
  }

  .ipch-cs__btn {
    padding: 2px 4px 2px 2px;
  }

  .ipch-cs__menu {
    right: 0;
    left: auto;
    padding: 7px;
    gap: 5px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ipch-cs__btn,
  .ipch-cs__chevron,
  .ipch-cs__option {
    transition: none;
  }
}
