/* Buscador de ubicación (región / provincia / distrito) del formulario de /contacto/.
   Lo usa mysite/static/js/contacto-ubicacion.js. Reutiliza .form-input de site.css
   para que el campo se vea igual que el resto del formulario. */

.ubi {
    position: relative;
}

/* Ruta ya elegida cuando la ubicación pide precisar (ej.: Áncash › Huaraz) */
.ubi-ruta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 0.5rem;
}

.ubi-ruta[hidden] {
    display: none;
}

.ubi-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.2rem 0.35rem 0.2rem 0.75rem;
    background: #e3f3e9;
    border: 1px solid #bfe3cf;
    border-radius: 999px;
    color: #0a5c3e;
    font-size: 0.85rem;
    font-weight: 600;
    line-height: 1.3;
}

.ubi-chip-quitar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: inherit;
    font-size: 1.05rem;
    line-height: 1;
    cursor: pointer;
}

.ubi-chip-quitar:hover,
.ubi-chip-quitar:focus-visible {
    background: rgba(10, 92, 62, 0.14);
    outline: none;
}

.ubi-campo {
    position: relative;
}

.ubi-icono {
    position: absolute;
    left: 1rem;
    top: 50%;
    width: 18px;
    height: 18px;
    transform: translateY(-50%);
    color: var(--muted, #5f6b7a);
    pointer-events: none;
}

.form-input.ubi-input {
    padding-left: 2.75rem;
    padding-right: 2.75rem;
    text-overflow: ellipsis;
}

.form-input.ubi-input.is-ok {
    border-color: var(--brand-green, #2da44e);
}

.form-input.ubi-input.is-invalid {
    border-color: #c62828;
    box-shadow: 0 0 0 3px rgba(198, 40, 40, 0.1);
}

.ubi-limpiar {
    position: absolute;
    right: 0.4rem;
    top: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    transform: translateY(-50%);
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--muted, #5f6b7a);
    font-size: 1.3rem;
    line-height: 1;
    cursor: pointer;
}

.ubi-limpiar[hidden] {
    display: none;
}

.ubi-limpiar:hover,
.ubi-limpiar:focus-visible {
    background: #eef1f4;
    color: #212529;
    outline: none;
}

/* Desplegable de coincidencias */
.ubi-lista {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 4px);
    z-index: 40;
    margin: 0;
    padding: 0.35rem;
    list-style: none;
    background: #fff;
    border: 1px solid var(--line, #e6e8eb);
    border-radius: calc(var(--radius, 14px) * 0.7);
    box-shadow: 0 12px 28px rgba(11, 30, 22, 0.16);
    max-height: min(340px, 52vh);
    overflow-y: auto;
    overscroll-behavior: contain;
}

.ubi-lista[hidden] {
    display: none;
}

.ubi-opcion {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    min-height: 44px;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    cursor: pointer;
}

.ubi-opcion:hover,
.ubi-opcion[aria-selected="true"] {
    background: #eaf5ee;
}

.ubi-op-texto {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.ubi-op-etiqueta {
    color: #212529;
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.3;
    overflow-wrap: anywhere;
}

.ubi-op-detalle {
    color: #5f6b7a;
    font-size: 0.8rem;
    line-height: 1.3;
}

.ubi-mark {
    background: transparent;
    color: #0a5c3e;
    font-weight: 800;
    padding: 0;
}

.ubi-op-mas {
    flex: none;
    color: #0a5c3e;
    font-size: 0.75rem;
    font-weight: 700;
    white-space: nowrap;
}

.ubi-vacio {
    padding: 0.9rem 0.75rem;
    color: #5f6b7a;
    font-size: 0.9rem;
    line-height: 1.4;
}

.ubi-ayuda {
    min-height: 1.2em;
    margin: 0.45rem 0 0;
    color: #5f6b7a;
    font-size: 0.82rem;
    line-height: 1.4;
}

.ubi-ayuda--ok {
    color: #1e6b3e;
}

.ubi-ayuda--error {
    color: #b3261e;
}

@media (max-width: 600px) {
    .ubi-lista {
        max-height: min(280px, 42vh);
    }
}

/* Solo para lectores de pantalla (anuncia la cantidad de resultados) */
.ubi-sr {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
