/* ──────────────────────────────────────────────────────────────────────────
   BUSCADOR DE APELLIDOS — Estilos
   Usa los design tokens de Ancestros Italianos (ancestros-italianos-tokens.css)
   El amarillo de "registros históricos" se mantiene como código semántico
   propio del buscador (no forma parte de la paleta general).
   ────────────────────────────────────────────────────────────────────────── */

/* Tokens locales del buscador */
.ba-wrap {
    --ba-historico-fondo:  #fffbeb;
    --ba-historico-borde:  #fcd34d;
    --ba-historico-borde-claro: #fde68a;
    --ba-historico-fondo-hover: #fef3c7;
    --ba-historico-texto:  #92400e;
    --ba-historico-texto-suave: #78350f;
    --ba-historico-texto-pill: #b45309;
}

.ba-wrap {
    max-width: 860px;
    margin: 0 auto;
    font-family: var(--ai-font);
    color: var(--ai-texto);
}

/* ── Caja envolvente del formulario (estilo unificado del sitio) ────────── */
.ba-form-caja {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    background: var(--ai-crema);
    border: 1px solid var(--ai-borde);
    border-left: var(--ai-borde-acento) solid var(--ai-verde-oscuro);
    border-radius: var(--ai-radio-medio);
    margin-bottom: 0.75rem;
}

.ba-form-label {
    font-size: var(--ai-fs-body);
    font-weight: 700;
    color: var(--ai-verde-oscuro);
    white-space: nowrap;
    flex-shrink: 0;
}

.ba-form-caja .ba-search-box {
    flex: 1;
    margin-bottom: 0;
    min-width: 0;
}

.ba-btn-buscar {
    display: inline-block;
    padding: 12px 26px;
    font-family: var(--ai-font);
    font-size: var(--ai-fs-boton);
    font-weight: 700;
    color: var(--ai-blanco);
    background: var(--ai-rojo);
    border: 1px solid var(--ai-rojo-oscuro);
    border-radius: var(--ai-radio-suave);
    cursor: pointer;
    transition: background 0.15s ease;
    flex-shrink: 0;
}

.ba-btn-buscar:hover {
    background: var(--ai-rojo-oscuro);
    color: var(--ai-blanco);
}

.ba-btn-buscar:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(200, 16, 46, 0.25);
}

@media (max-width: 600px) {
    .ba-form-caja {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    .ba-form-label { font-size: 17px; }
    .ba-btn-buscar { width: 100%; font-size: 17px; padding: 12px; }
}

.ba-search-box {
    position: relative;
    margin-bottom: 0.5rem;
}

.ba-input {
    width: 100%;
    font-size: 22px;
    font-family: var(--ai-font);
    padding: 16px 52px 16px 18px;
    border: 2px solid var(--ai-borde);
    border-radius: 10px;
    background: var(--ai-blanco);
    color: var(--ai-texto);
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
}

/* Cuando el input está dentro de la caja envolvente, ajustamos
   su tamaño/borde para que no compita visualmente con la caja */
.ba-form-caja .ba-input {
    font-size: var(--ai-fs-body);
    padding: 10px 38px 10px 14px;
    border: 1px solid var(--ai-borde);
}

.ba-input:focus {
    border-color: var(--ai-verde-medio);
    box-shadow: var(--ai-focus-ring);
}

.ba-icon {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--ai-texto-claro);
    pointer-events: none;
}

.ba-form-caja .ba-icon {
    right: 12px;
    width: 16px;
    height: 16px;
}

.ba-hint {
    font-size: 15px;
    color: var(--ai-texto-label);
    margin: 0 0 1.25rem;
    line-height: 1.6;
}

.ba-empty {
    font-size: 16px;
    color: var(--ai-texto-claro);
    text-align: center;
    padding: 2rem 0;
}

.ba-loading {
    font-size: 16px;
    color: var(--ai-texto-label);
    padding: 1rem 0;
    text-align: center;
}

.ba-sugerencias {
    border: 1px solid var(--ai-borde);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 1rem;
    background: var(--ai-blanco);
}

.ba-sug-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    font-size: 17px;
    cursor: pointer;
    border-bottom: 1px solid var(--ai-borde-detalle);
    transition: background 0.1s;
    color: var(--ai-texto);
}

.ba-sug-item:last-child { border-bottom: none; }
.ba-sug-item:hover { background: var(--ai-crema); }

.ba-sug-count {
    font-size: 15px;
    color: var(--ai-texto-claro);
    white-space: nowrap;
    margin-left: 12px;
}

.ba-sug-variante {
    font-size: 12px;
    background: var(--ai-crema);
    color: var(--ai-verde-oscuro);
    padding: 2px 8px;
    border-radius: 20px;
    margin-left: 8px;
    border: 1px solid var(--ai-borde-detalle);
}

.ba-resultado {
    border: 1px solid var(--ai-borde);
    border-radius: 10px;
    padding: 1.5rem;
    background: var(--ai-blanco);
    margin-bottom: 0.75rem;
}

.ba-apellido-titulo {
    font-size: 30px;
    font-weight: bold;
    color: var(--ai-verde-oscuro);
    margin: 0 0 6px;
    line-height: var(--ai-lh-titulo);
}

.ba-total {
    font-size: 16px;
    color: var(--ai-texto-label);
    margin: 0 0 1.25rem;
}

.ba-total strong {
    font-size: 26px;
    font-weight: bold;
    color: var(--ai-verde-oscuro);
}

.ba-prov-titulo {
    font-size: 12px;
    font-weight: 700;
    color: var(--ai-texto-label);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 12px;
}

.ba-prov-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 9px;
}

.ba-prov-nombre {
    font-size: 15px;
    color: var(--ai-texto);
    width: 190px;
    flex-shrink: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ba-prov-barra-wrap {
    flex: 1;
    height: 8px;
    background: var(--ai-borde-detalle);
    border-radius: 4px;
    overflow: hidden;
}

.ba-prov-barra {
    height: 100%;
    background: var(--ai-verde-medio);
    border-radius: 4px;
    transition: width 0.5s ease;
}

.ba-prov-cant {
    font-size: 14px;
    color: var(--ai-texto-label);
    min-width: 55px;
    text-align: right;
}

.ba-variantes {
    background: var(--ai-crema);
    border: 1px solid var(--ai-borde-detalle);
    border-radius: 8px;
    padding: 1rem 1.1rem;
    margin-top: 1rem;
}

.ba-variantes-titulo {
    font-size: 12px;
    font-weight: 700;
    color: var(--ai-texto-label);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
}

.ba-variantes-desc {
    font-size: 14px;
    color: var(--ai-texto-label);
    margin-bottom: 12px;
    line-height: 1.6;
}

.ba-variante-pill {
    display: inline-block;
    font-size: 15px;
    padding: 6px 16px;
    border-radius: var(--ai-radio-pill);
    border: 1px solid var(--ai-borde);
    background: var(--ai-blanco);
    color: var(--ai-texto);
    margin: 4px 5px 4px 0;
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.ba-variante-pill:hover {
    border-color: var(--ai-verde-medio);
    color: var(--ai-verde-oscuro);
    background: var(--ai-blanco);
}

.ba-variante-pill .ba-pill-cant {
    font-size: 13px;
    color: var(--ai-texto-claro);
    margin-left: 4px;
}

@media (max-width: 480px) {
    .ba-input { font-size: 20px; }
    .ba-prov-nombre { width: 130px; font-size: 14px; }
    .ba-apellido-titulo { font-size: 26px; }
    .ba-sug-item { font-size: 16px; }
}

/* ── Mapa de Argentina ────────────────────────────────────────────────── */
.ba-mapa {
    height: 460px;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 1.25rem;
    border: 1px solid var(--ai-borde);
}

@media (max-width: 480px) {
    .ba-mapa { height: 340px; }
}

@media (max-width: 480px) {
    .ba-mapa { height: 260px; }
}

/* ── Top localidades ──────────────────────────────────────────────────── */

.ba-localidades {
    border: 1px solid var(--ai-borde);
    border-radius: 10px;
    padding: 1.25rem 1.5rem;
    background: var(--ai-blanco);
    margin-bottom: 0.75rem;
}

.ba-localidades-titulo {
    font-size: 12px;
    font-weight: 700;
    color: var(--ai-texto-label);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 12px;
}

.ba-loc-tabla {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.ba-loc-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ba-loc-rank {
    font-size: 13px;
    color: var(--ai-texto-claro);
    width: 20px;
    text-align: right;
    flex-shrink: 0;
}

.ba-loc-info {
    width: 220px;
    flex-shrink: 0;
    min-width: 0;
}

.ba-loc-nombre {
    display: block;
    font-size: 15px;
    color: var(--ai-texto);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ba-loc-prov {
    display: block;
    font-size: 12px;
    color: var(--ai-texto-claro);
}

.ba-loc-barra-wrap {
    flex: 1;
    height: 6px;
    background: var(--ai-borde-detalle);
    border-radius: 3px;
    overflow: hidden;
}

.ba-loc-barra {
    height: 100%;
    background: var(--ai-verde-medio);
    border-radius: 3px;
    transition: width 0.4s ease;
}

.ba-loc-cant {
    font-size: 13px;
    color: var(--ai-texto-label);
    min-width: 50px;
    text-align: right;
    flex-shrink: 0;
}

@media (max-width: 480px) {
    .ba-loc-info { width: 140px; }
    .ba-loc-nombre { font-size: 14px; }
}

/* ── Leyenda del mapa GeoJSON ─────────────────────────────────────────── */

.ba-mapa-leyenda {
    background: rgba(255,255,255,0.92);
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 11px;
    line-height: 1.4;
    box-shadow: 0 1px 6px rgba(0,0,0,0.12);
    min-width: 110px;
}

.ba-leyenda-titulo {
    font-weight: 700;
    color: var(--ai-texto);
    margin-bottom: 5px;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.ba-leyenda-row {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-bottom: 2px;
    color: var(--ai-texto-label);
}

.ba-leyenda-row span {
    display: inline-block;
    width: 14px;
    height: 10px;
    border-radius: 2px;
    border: 1px solid rgba(0,0,0,0.1);
    flex-shrink: 0;
}

/* ── Provincias clicables ─────────────────────────────────────────────── */

.ba-prov-hint {
    font-weight: 400;
    font-size: 11px;
    color: var(--ai-texto-claro);
    text-transform: none;
    letter-spacing: 0;
}

.ba-prov-clicable {
    cursor: pointer;
    border-radius: 6px;
    padding: 4px 6px;
    margin: 0 -6px 5px;
    transition: background 0.15s;
    position: relative;
}

.ba-prov-clicable:hover {
    background: var(--ai-hover-tabla);
}

.ba-prov-ver {
    font-size: 11px;
    color: var(--ai-verde-medio);
    opacity: 0;
    transition: opacity 0.15s;
    white-space: nowrap;
    margin-left: 6px;
    flex-shrink: 0;
}

.ba-prov-clicable:hover .ba-prov-ver {
    opacity: 1;
}

/* ── Modal de localidades ─────────────────────────────────────────────── */

.ba-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
}

.ba-modal {
    background: var(--ai-blanco);
    border-radius: 12px;
    width: 100%;
    max-width: 520px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0,0,0,0.25);
    overflow: hidden;
    font-family: var(--ai-font);
    color: var(--ai-texto);
}

.ba-modal-header {
    padding: 18px 20px 16px;
    border-bottom: 1px solid var(--ai-borde);
    display: flex;
    flex-direction: column;
    gap: 2px;
    position: relative;
}

.ba-modal-titulo {
    font-size: 20px;
    font-weight: bold;
    color: var(--ai-verde-oscuro);
    padding-right: 32px;
}

.ba-modal-subtitulo {
    font-size: 14px;
    color: var(--ai-texto-label);
}

.ba-modal-cerrar {
    position: absolute;
    top: 14px;
    right: 16px;
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: var(--ai-texto-claro);
    line-height: 1;
    padding: 4px;
}

.ba-modal-cerrar:hover { color: var(--ai-rojo); }

.ba-modal-body {
    overflow-y: auto;
    padding: 14px 20px 20px;
}

.ba-modal-body .ba-loc-row {
    padding: 7px 0;
    border-bottom: 1px solid var(--ai-borde-detalle);
}

.ba-modal-body .ba-loc-row:last-child { border-bottom: none; }

@media (max-width: 480px) {
    .ba-modal { max-height: 90vh; }
    .ba-modal-titulo { font-size: 17px; }
}

/* ── Badges de fuentes ────────────────────────────────────────────────── */

.ba-fuentes {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 14px;
}

.ba-badge {
    font-size: 12px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: var(--ai-radio-pill);
    letter-spacing: 0.03em;
    cursor: default;
}

.ba-badge-on {
    background: var(--ai-crema);
    color: var(--ai-verde-oscuro);
    border: 1px solid var(--ai-borde-detalle);
}

.ba-badge-off {
    background: var(--ai-borde-detalle);
    color: var(--ai-texto-claro);
    border: 1px solid var(--ai-borde);
}

.ba-aviso-migracion {
    font-size: 13px;
    color: var(--ba-historico-texto);
    background: var(--ba-historico-fondo);
    border: 1px solid var(--ba-historico-borde);
    border-radius: 8px;
    padding: 10px 14px;
    margin-bottom: 14px;
    line-height: 1.5;
}

/* ── Alteraciones históricas ──────────────────────────────────────────── */

.ba-alteraciones {
    background: var(--ba-historico-fondo);
    border: 1px solid var(--ba-historico-borde);
    border-radius: 10px;
    padding: 1.1rem 1.3rem;
    margin-bottom: 0.75rem;
}

.ba-alt-titulo {
    font-size: 12px;
    font-weight: 700;
    color: var(--ba-historico-texto);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
}

.ba-alt-desc {
    font-size: 14px;
    color: var(--ba-historico-texto-suave);
    margin-bottom: 12px;
    line-height: 1.6;
}

.ba-alt-pill {
    display: inline-block;
    font-size: 15px;
    padding: 6px 14px;
    border-radius: var(--ai-radio-pill);
    border: 1px solid var(--ba-historico-borde);
    background: var(--ai-blanco);
    color: var(--ba-historico-texto);
    margin: 4px 5px 4px 0;
    cursor: default;
}

.ba-pill-hist {
    font-size: 11px;
    color: var(--ba-historico-texto-pill);
    margin-left: 5px;
    font-style: italic;
}

.ba-alt-nota {
    font-size: 13px;
    color: var(--ba-historico-texto);
    margin: 10px 0 0;
    line-height: 1.5;
}

/* ── Aviso migración sobre sugerencias ────────────────────────────────── */
.ba-aviso-variantes {
    margin-bottom: 10px;
}
.ba-aviso-cargando {
    font-size: 13px;
    color: var(--ai-texto-claro);
    font-style: italic;
}

/* ── Sugerencias: separador y pills de apellidos históricos ───────────── */
.ba-sug-separador {
    padding: 10px 14px 6px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--ba-historico-texto);
    background: var(--ba-historico-fondo);
    border-top: 1px solid var(--ba-historico-borde-claro);
    border-bottom: 1px solid var(--ba-historico-borde-claro);
}
.ba-sug-historico {
    background: var(--ba-historico-fondo);
}
.ba-sug-historico:hover {
    background: var(--ba-historico-fondo-hover);
}
.ba-sug-hist-badge {
    display: inline-block;
    margin-left: 8px;
    padding: 2px 7px;
    font-size: 11px;
    font-style: italic;
    color: var(--ba-historico-texto);
    background: var(--ba-historico-fondo-hover);
    border: 1px solid var(--ba-historico-borde-claro);
    border-radius: 10px;
    vertical-align: middle;
}
.ba-sug-historico .ba-sug-count {
    color: var(--ba-historico-texto);
    font-size: 12px;
    font-style: italic;
}

/* ── Modal sin datos de localidades ───────────────────────────────────── */
.ba-modal-sin-datos {
    padding: 30px 20px;
    text-align: center;
    color: var(--ai-texto-label);
}
.ba-modal-sin-datos p {
    margin: 0 0 10px;
    font-size: 15px;
}
.ba-modal-sin-datos-hint {
    font-size: 13px !important;
    color: var(--ai-texto-claro) !important;
    max-width: 420px;
    margin: 10px auto 0 !important;
    line-height: 1.5;
}