/* Selector de prefijo telefónico (public/scripts/telefono-prefijo.js). Panel y web pública: usa los tokens --sw-* si existen (la web tiene tema oscuro) y colores del panel si no. */
.sw-tel { position: relative; display: block; --sw-tel-acento: var(--sw-primario, var(--bs-primary, #666cff)); }
.sw-tel[hidden], .sw-tel:has(> .sw-tel__entrada[hidden]), .sw-tel:has(> .sw-tel__entrada[style*="display:none"]), .sw-tel:has(> .sw-tel__entrada[style*="display: none"]) { display: none; }
/* Hueco inicial para el botón; el script lo ajusta a su ancho real (+34 no ocupa lo mismo que +1268). */
.sw-tel .sw-tel__entrada { padding-left: 6.25rem !important; }
/* Etiqueta flotante sobre el borde del campo: por encima del botón. */
.sw-tel--flotante > label { z-index: 6; }

/* Botón del prefijo: un segmento dentro del campo, encajado por el script en la caja del input. */
.sw-tel__boton {
  position: absolute; top: 1px; bottom: 1px; left: 1px; z-index: 5;
  display: inline-flex; align-items: center; gap: 7px; margin: 0; padding: 0 9px 0 11px;
  border: 0; border-radius: calc(var(--sw-tel-radio, 6px) - 1px) 0 0 calc(var(--sw-tel-radio, 6px) - 1px);
  background: var(--sw-fondo, #f6f6f8); box-shadow: inset -1px 0 0 var(--sw-borde, #e3e2e6);
  color: var(--sw-texto, #4b465c); font: inherit; font-size: .875rem; font-weight: 500; line-height: 1;
  cursor: pointer; white-space: nowrap; -webkit-tap-highlight-color: transparent;
  transition: background-color .15s, box-shadow .15s, color .15s;
}
.sw-tel__boton:hover:not(:disabled) { background: #ededf1; background: color-mix(in srgb, var(--sw-fondo, #f6f6f8), var(--sw-texto, #4b465c) 8%); }
.sw-tel:focus-within .sw-tel__boton, .sw-tel__boton[aria-expanded="true"] { box-shadow: inset -1px 0 0 var(--sw-tel-acento); }
.sw-tel__boton[aria-expanded="true"] { color: var(--sw-tel-acento); }
.sw-tel__boton:focus-visible { outline: 2px solid var(--sw-tel-acento); outline-offset: -2px; }
.sw-tel__boton:disabled { cursor: not-allowed; opacity: .65; }
.sw-tel__hueco-bandera { display: inline-flex; }
.sw-tel__bandera { display: block; flex: none; width: 20px; height: 15px; border-radius: 3px; object-fit: cover; background: var(--sw-borde, #e3e2e6); box-shadow: 0 0 0 1px rgba(0, 0, 0, .12); }
.sw-tel__bandera--emoji, .sw-tel__bandera--mundo { width: auto; height: auto; background: none; box-shadow: none; font-size: 1.05rem; line-height: 1; font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif; }
.sw-tel__codigo { font-variant-numeric: tabular-nums; letter-spacing: .01em; }
.sw-tel__flecha { width: 10px; height: 10px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; opacity: .55; transition: transform .2s, opacity .15s; }
.sw-tel__boton[aria-expanded="true"] .sw-tel__flecha { transform: rotate(180deg); opacity: .9; }

/* Desplegable de países */
.sw-tel__panel {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 2000; display: flex; flex-direction: column;
  width: min(340px, 92vw); max-height: 340px; overflow: hidden;
  border: 1px solid var(--sw-borde, #e6e6e8); border-radius: 12px; background: var(--sw-blanco, #fff); color: var(--sw-texto, #4b465c);
  box-shadow: 0 18px 44px rgba(23, 36, 61, .18), 0 2px 8px rgba(23, 36, 61, .08);
  text-align: left; font-size: .875rem; font-weight: 400;
  transform-origin: top left; animation: sw-tel-abrir .14s cubic-bezier(.2, .8, .2, 1);
}
.sw-tel__panel[hidden] { display: none; }
.sw-tel__panel--arriba { top: auto; bottom: calc(100% + 6px); transform-origin: bottom left; animation-name: sw-tel-abrir-arriba; }
@keyframes sw-tel-abrir { from { opacity: 0; transform: translateY(-4px) scale(.98); } }
@keyframes sw-tel-abrir-arriba { from { opacity: 0; transform: translateY(4px) scale(.98); } }
.sw-tel__busqueda { position: relative; flex: none; border-bottom: 1px solid var(--sw-borde, #e6e6e8); transition: box-shadow .15s; }
.sw-tel__busqueda:focus-within { box-shadow: inset 0 -2px 0 var(--sw-tel-acento); }
.sw-tel__lupa { position: absolute; left: 13px; top: 50%; width: 16px; height: 16px; margin-top: -8px; fill: none; stroke: var(--sw-texto-secundario, #8a8d93); stroke-width: 1.6; stroke-linecap: round; pointer-events: none; }
.sw-tel__buscar { width: 100%; padding: 12px 12px 12px 37px; border: 0; background: transparent; color: inherit; font: inherit; outline: none; }
.sw-tel__buscar::placeholder { color: var(--sw-texto-secundario, #8a8d93); }
.sw-tel__lista { margin: 0; padding: 6px; overflow-y: auto; list-style: none; overscroll-behavior: contain; scroll-padding: 6px; }
.sw-tel__lista li { position: relative; display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; cursor: pointer; }
.sw-tel__lista li.sw-tel__activo { background: var(--sw-fondo, #f3f3f6); }
.sw-tel__lista li[aria-selected="true"] { color: var(--sw-tel-acento); font-weight: 600; }
.sw-tel__lista li[aria-selected="true"]::after {
  content: ""; flex: none; width: 14px; height: 14px; background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3 8.5l3.2 3L13 4.5' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3 8.5l3.2 3L13 4.5' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
}
/* España, primera sin búsqueda, separada del resto */
.sw-tel__lista li.sw-tel__destacado { margin-bottom: 9px; }
.sw-tel__lista li.sw-tel__destacado::before { content: ""; position: absolute; left: 4px; right: 4px; bottom: -5px; border-bottom: 1px solid var(--sw-borde, #e6e6e8); }
.sw-tel__nombre { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sw-tel__prefijo { color: var(--sw-texto-secundario, #7a8499); font-variant-numeric: tabular-nums; }
.sw-tel__lista li[aria-selected="true"] .sw-tel__prefijo { color: inherit; opacity: .8; }
.sw-tel__lista .sw-tel__vacio { justify-content: center; color: var(--sw-texto-secundario, #7a8499); cursor: default; }

@media (prefers-reduced-motion: reduce) {
  .sw-tel__panel { animation: none; }
  .sw-tel__flecha, .sw-tel__boton { transition: none; }
}
