/*
 * F2 — Localizador: mapa + search-overlay (shell en informes-app-shell.css).
 */

.vh-locator-map-stage {
    position: relative;
}

.vh-locator-map {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.vh-locator-search-overlay {
    position: absolute;
    top: 12px;
    left: 12px;
    right: 12px;
    z-index: 15;
    background: #ffffff;
    border-radius: 14px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.18);
    padding: 10px 12px;
    max-height: calc(100% - 24px);
    overflow-y: auto;
}

/* Menú catastro (absoluto): no recortar con el scroll del card */
.vh-locator-search-overlay.is-rc-open,
.vh-locator-search-overlay:has(.vh-rc-select__trigger[aria-expanded="true"]) {
    overflow: visible;
}

/* `display:` del panel de unidades anula el UA [hidden]; forzar ocultación. */
.vh-locator-search-overlay [hidden] {
    display: none !important;
}

.vh-locator-search-seg {
    display: flex;
    gap: 2px;
    padding: 3px;
    margin-bottom: 10px;
    border-radius: 999px;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
}

.vh-locator-search-seg button {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    min-height: 2.15rem;
    padding: 0.35rem 0.55rem;
    border: none;
    border-radius: 999px;
    background: transparent;
    color: #4b5563;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}

.vh-locator-search-seg button i {
    font-size: 0.95rem;
}

.vh-locator-search-seg button.is-active {
    background: #ffffff;
    color: var(--vh-primary, #3454b4);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

.vh-locator-search-form {
    margin: 0;
}

.vh-locator-search-field {
    position: relative;
}

.vh-locator-search-icon {
    position: absolute;
    left: 11px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 15px;
    color: #9ca3af;
    pointer-events: none;
}

.vh-locator-addr-input {
    width: 100%;
    box-sizing: border-box;
    padding: 11px 12px 11px 34px;
    border: 1.5px solid #e5e7eb;
    border-radius: 10px;
    font-size: 16px;
    color: #111827;
    background: #ffffff;
    outline: none;
    transition: border-color 0.15s ease;
}

.vh-locator-addr-input:focus {
    border-color: var(--vh-primary, #3454b4);
    box-shadow: 0 0 0 3px rgba(52, 84, 180, 0.15);
}

/* F14 — selector de catastro (modo refcat), espejo visual de PisoAdvisor rc-select */
.vh-rc-select {
    position: relative;
    margin-bottom: 8px;
}

.vh-rc-select__label-top {
    display: block;
    margin: 0 2px 6px;
    font-size: 12px;
    font-weight: 600;
    color: #6b7280;
}

.vh-rc-select__trigger {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 12px;
    box-sizing: border-box;
    border: 1.5px solid #e5e7eb;
    border-radius: 10px;
    background: #ffffff;
    color: #111827;
    font-size: 16px;
    font-family: inherit;
    text-align: left;
    cursor: pointer;
}

.vh-rc-select__trigger[aria-expanded="true"] {
    border-color: var(--vh-primary, #3454b4);
}

.vh-rc-select__trigger.is-placeholder {
    color: #9ca3af;
}

.vh-rc-select__ic {
    font-size: 17px;
    color: #6b7280;
    flex-shrink: 0;
}

.vh-rc-select__text {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.vh-rc-select__chev {
    font-size: 16px;
    color: #9ca3af;
    flex-shrink: 0;
    transition: transform 0.15s ease;
}

.vh-rc-select__trigger[aria-expanded="true"] .vh-rc-select__chev {
    transform: rotate(180deg);
}

.vh-rc-select__menu {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    z-index: 110;
    list-style: none;
    margin: 0;
    padding: 4px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.vh-rc-select__opt {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px;
    border-radius: 8px;
    font-size: 14px;
    color: #374151;
    cursor: pointer;
}

.vh-rc-select__opt small {
    color: #9ca3af;
    font-size: 12px;
    font-weight: 600;
}

.vh-rc-select__opt:hover {
    background: #f3f4f6;
}

.vh-rc-select__opt.is-active {
    color: var(--vh-primary, #3454b4);
    font-weight: 600;
}

.vh-rc-select__opt .ti-check {
    margin-left: auto;
    font-size: 16px;
    color: var(--vh-primary, #3454b4);
    opacity: 0;
}

.vh-rc-select__opt.is-active .ti-check {
    opacity: 1;
}

.vh-rc-fields {
    margin-top: 8px;
}

.vh-rc-muni {
    margin-bottom: 8px;
}

.vh-rc-muni__select {
    appearance: none;
    cursor: pointer;
    padding-right: 2rem;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%239CA3AF' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
}

.vh-rc-help {
    margin: 6px 2px 0;
    font-size: 11px;
    color: #9ca3af;
}

.vh-rc-submit {
    margin-top: 12px;
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 10px;
    background: var(--vh-primary, #3454b4);
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
}

.vh-rc-submit:disabled {
    background: #d1d5db;
    color: #ffffff;
    cursor: default;
}

.vh-locator-map-hint {
    margin: 6px 0 0;
    font-size: 11px;
    color: #9ca3af;
    text-align: center;
}

.vh-locator-map-hint i {
    font-size: 11px;
    vertical-align: -1px;
    margin-right: 3px;
}

.vh-locator-loading {
    margin-top: 0.65rem;
    font-size: 0.82rem;
    color: #6b7280;
    text-align: center;
}

.vh-locator-loading__fallback {
    margin: 0;
}

/* Active-stage loader (units): una sola fila; CSS autocontenido (preparing.css no carga en locator). */
.vh-locator-units-active {
    text-align: left;
    margin-top: 0.15rem;
}

.vh-locator-units-active__row {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.vh-locator-units-active__stage {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.82rem;
    font-weight: 600;
    color: #374151;
}

.vh-locator-units-active__slot {
    position: relative;
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.vh-locator-units-active__icon {
    position: absolute;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    line-height: 1;
}

.vh-locator-units-active__stage[data-state='loading'] .vh-locator-units-active__icon--loading,
.vh-locator-units-active__stage[data-state='error'] .vh-locator-units-active__icon--error {
    display: inline-flex;
}

.vh-locator-units-active__stage[data-state='loading'] .vh-locator-units-active__icon--loading {
    color: var(--vh-primary, #3454b4);
}

.vh-locator-units-active__stage[data-state='loading'] .vh-locator-units-active__icon--loading i {
    display: inline-block;
    animation: vh-locator-units-spin 0.8s linear infinite;
}

.vh-locator-units-active__stage[data-state='error'] .vh-locator-units-active__icon--error {
    color: #dc2626;
}

.vh-locator-units-active__stage[data-state='error'] {
    color: #991b1b;
}

.vh-locator-units-active__label {
    flex: 1;
    min-width: 0;
    line-height: 1.35;
}

@keyframes vh-locator-units-spin {
    to {
        transform: rotate(360deg);
    }
}

.vh-locator-units-active__fail {
    margin-top: 0.55rem;
    padding: 0.55rem 0.65rem;
    border-radius: 0.5rem;
    background: #fef2f2;
    color: #991b1b;
    font-size: 0.8rem;
}

.vh-locator-units-active__fail-msg {
    margin: 0 0 0.45rem;
}

.vh-locator-units-active__retry {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2rem;
    padding: 0.3rem 0.75rem;
    border: 1px solid #fecaca;
    border-radius: 0.45rem;
    background: #fff;
    color: #991b1b;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
}

.vh-locator-units-active__retry:hover {
    background: #fff7f7;
}

.vh-locator-hint {
    margin-top: 0.65rem;
    padding: 0.55rem 0.65rem;
    border-radius: 0.5rem;
    background: #eff6ff;
    color: #1e3a8a;
    font-size: 0.8rem;
}

.vh-locator-error {
    margin-top: 0.65rem;
    padding: 0.55rem 0.65rem;
    border-radius: 0.5rem;
    background: #fef2f2;
    color: #991b1b;
    font-size: 0.8rem;
}

.vh-locator-results {
    list-style: none;
    margin: 0.65rem 0 0;
    padding: 0;
    border: 1px solid #e5e7eb;
    border-radius: 0.6rem;
    overflow: hidden;
    max-height: 220px;
    overflow-y: auto;
}

.vh-locator-result-item {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.65rem 0.75rem;
    border-bottom: 1px solid #e5e7eb;
    cursor: pointer;
    font-size: 0.85rem;
    color: #111827;
}

.vh-locator-result-item:last-child {
    border-bottom: none;
}

.vh-locator-result-item:hover,
.vh-locator-result-item:focus,
.vh-locator-result-item.is-active {
    background: #f5f7fd;
    outline: none;
}

.vh-locator-selected {
    margin-top: 0.75rem;
    padding: 0.85rem;
    border-radius: 0.6rem;
    background: #f5f7fd;
    border: 1px solid #dbe3fb;
}

.vh-locator-selected-prefix {
    font-size: 0.75rem;
    color: #6b7280;
    margin: 0;
}

.vh-locator-selected-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: #111827;
    margin: 0.2rem 0 0.6rem;
}

.vh-locator-notice {
    font-size: 0.78rem;
    color: #92400e;
    background: #fffbeb;
    padding: 0.5rem 0.6rem;
    border-radius: 0.4rem;
    margin: 0 0 0.6rem;
}

.vh-locator-confirm-button {
    display: inline-block;
    padding: 0.55rem 1rem;
    border-radius: 0.5rem;
    background: var(--vh-primary, #3454b4);
    color: #ffffff !important;
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
}

.vh-locator-confirm-button:hover {
    opacity: 0.92;
}

.vh-locator-map-controls {
    position: absolute;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 22px);
    left: 10px;
    z-index: 12;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.vh-locator-map-control {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: #ffffff;
    color: #374151;
    border: 1px solid #d1d5db;
    box-shadow: 0 1px 5px rgba(0, 0, 0, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
}

.vh-locator-map-control i {
    font-size: 18px;
}

.vh-locator-map-control:hover {
    background: #f3f4f6;
}

.vh-locator-map-control[aria-pressed="true"] {
    background: var(--vh-primary, #3454b4);
    color: #ffffff;
    border-color: var(--vh-primary, #3454b4);
}

.vh-locator-map-stage .maplibregl-ctrl-top-right {
    top: auto;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 22px);
    right: 10px;
}

.vh-locator-map-stage .maplibregl-ctrl-bottom-right {
    bottom: 4px;
    right: 4px;
}

/* Sin AttributionControl MapLibre (compact «i»); créditos fijos paridad PA Leaflet */
.vh-locator-map-stage .maplibregl-ctrl-attrib {
    display: none !important;
}

.vh-locator-map-credit {
    position: absolute;
    left: 0;
    bottom: 0;
    z-index: 2;
    max-width: min(70vw, 280px);
    padding: 0 4px;
    font-size: 8px;
    line-height: 1.5;
    font-weight: 500;
    color: #6b7280;
    background: rgba(255, 255, 255, 0.65);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.vh-locator-map-credit a {
    color: #4b5563;
    text-decoration: underline;
    text-underline-offset: 1px;
    pointer-events: auto;
}

@media (min-width: 768px) {
    .vh-locator-map-credit {
        font-size: 9px;
        padding: 0 5px;
        line-height: 1.6;
        max-width: min(50vw, 360px);
    }
}

@media (min-width: 768px) {
    .vh-locator-search-overlay {
        left: 50%;
        right: auto;
        top: 16px;
        transform: translateX(-50%);
        width: calc(100% - 24px);
        max-width: 540px;
    }
}

@media (min-width: 1024px) {
    .vh-locator-search-overlay {
        max-width: 600px;
        width: calc(100% - 48px);
    }
}

/* —— Panel de fincas (estilo PisoAdvisor: 3 columnas, tipografía compacta) —— */
.vh-locator-search-overlay.is-units {
    max-width: min(760px, calc(100% - 24px));
    padding: 12px 12px 10px;
}

.vh-locator-search-overlay.is-units [data-vh-locator-search-phase] {
    display: none;
}

.vh-locator-units-panel {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 0;
    font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

.vh-locator-address-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 10px;
    border: 1px solid #86efac;
    border-radius: 8px;
    background: #f0fdf4;
}

.vh-locator-address-main {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    min-width: 0;
    flex: 1;
}

.vh-locator-address-pin {
    flex-shrink: 0;
    font-size: 15px;
    color: #2563eb;
    line-height: 1;
    margin-top: 2px;
}

.vh-locator-address-copy {
    min-width: 0;
    flex: 1;
}

.vh-locator-address-text {
    margin: 0;
    font-size: 13px;
    font-weight: 700;
    color: #111827;
    line-height: 1.3;
    word-break: break-word;
}

.vh-locator-address-cadastre {
    margin: 2px 0 0;
    font-size: 11px;
    font-weight: 500;
    color: #6b7280;
    line-height: 1.3;
    word-break: break-word;
}

.vh-locator-change-btn {
    flex-shrink: 0;
    border: none;
    background: transparent;
    color: #2563eb;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    padding: 0;
    line-height: 1.2;
}

.vh-locator-change-btn:hover {
    text-decoration: underline;
}

.vh-locator-catastro-kicker {
    margin: 2px 0 0;
    font-size: 12px;
    font-weight: 500;
    color: #9ca3af;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.vh-locator-catastro-kicker i {
    font-size: 13px;
}

.vh-locator-units-heading {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: #1f2937;
    line-height: 1.3;
}

.vh-locator-units-filter-wrap {
    position: relative;
}

.vh-locator-units-filter-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 14px;
    color: #9ca3af;
    pointer-events: none;
}

.vh-locator-units-filter {
    width: 100%;
    box-sizing: border-box;
    padding: 8px 10px 8px 32px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 13px;
    color: #111827;
    background: #fff;
    outline: none;
}

.vh-locator-units-filter::placeholder {
    color: #9ca3af;
}

.vh-locator-units-filter:focus {
    border-color: #93c5fd;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.12);
}

.vh-locator-units-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    max-height: min(48vh, 380px);
    overflow-y: auto;
    padding: 1px 2px 2px 1px;
    scrollbar-width: thin;
}

@media (min-width: 480px) {
    .vh-locator-units-grid:not(.is-single) {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 640px) {
    .vh-locator-units-grid:not(.is-single) {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

.vh-locator-units-grid.is-single {
    grid-template-columns: 1fr;
    max-height: none;
    overflow: visible;
    padding: 0;
}

.vh-locator-unit-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    width: 100%;
    min-width: 0;
    text-align: left;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #f9fafb;
    padding: 8px 9px;
    cursor: pointer;
    transition: border-color 0.12s ease, background 0.12s ease, box-shadow 0.12s ease;
}

.vh-locator-unit-card:hover {
    border-color: #bfdbfe;
    background: #f3f4f6;
}

.vh-locator-unit-card.is-selected {
    border-color: #2563eb;
    background: #eff6ff;
    box-shadow: 0 0 0 1px #2563eb;
}

/* Una sola finca: recuadro verde a ancho completo (alineado con referente PA). */
.vh-locator-unit-card.is-single-pick,
.vh-locator-unit-card.is-single-pick.is-selected,
.vh-locator-unit-card.is-single-pick:hover {
    border-color: #86efac;
    background: #f0fdf4;
    box-shadow: none;
    padding: 12px 14px;
    cursor: default;
}

.vh-locator-unit-single-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    width: 100%;
    min-width: 0;
}

.vh-locator-unit-check {
    flex-shrink: 0;
    margin-top: 1px;
    font-size: 18px;
    color: #16a34a;
    line-height: 1;
}

.vh-locator-unit-single-body {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    flex: 1;
}

.vh-locator-unit-card.is-single-pick .vh-locator-unit-title {
    font-size: 13px;
    font-weight: 600;
    color: #166534;
    line-height: 1.35;
}

.vh-locator-unit-title-main {
    font-weight: 700;
    color: #14532d;
}

.vh-locator-unit-meta-inline {
    font-weight: 500;
    color: #6b7280;
}

.vh-locator-unit-card.is-single-pick .vh-locator-unit-ref {
    color: #6b7280;
    font-size: 12px;
}

.vh-locator-unit-title {
    display: block;
    width: 100%;
    font-size: 12px;
    font-weight: 700;
    color: #111827;
    line-height: 1.3;
    white-space: normal;
    overflow: visible;
    text-overflow: unset;
}

.vh-locator-unit-meta {
    display: block;
    width: 100%;
    font-size: 11px;
    font-weight: 400;
    color: #6b7280;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.vh-locator-unit-ref {
    display: block;
    width: 100%;
    margin-top: 1px;
    font-size: 10px;
    font-weight: 400;
    color: #9ca3af;
    line-height: 1.25;
    word-break: break-all;
    font-family: ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

.vh-locator-analyze-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 2px;
    padding: 11px 14px;
    border-radius: 8px;
    background: #2563eb;
    color: #ffffff !important;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    box-shadow: none;
}

.vh-locator-units-ctas {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    gap: 8px;
    margin-top: 2px;
}

.vh-locator-units-ctas .vh-locator-analyze-button,
.vh-locator-units-ctas .vh-locator-cadastre-details-button {
    flex: 1 1 0;
    margin-top: 0;
    min-width: 0;
}

.vh-locator-cadastre-details-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 11px 14px;
    border-radius: 8px;
    border: 1px solid #cbd5e1;
    background: #ffffff;
    color: #0f172a !important;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    box-shadow: none;
}

.vh-locator-cadastre-details-button i {
    font-size: 15px;
}

.vh-locator-cadastre-details-button.is-disabled,
.vh-locator-cadastre-details-button[aria-disabled='true'] {
    background: #f3f4f6;
    border-color: #e5e7eb;
    color: #9ca3af !important;
    pointer-events: none;
    cursor: not-allowed;
}

.vh-locator-cadastre-details-button:not(.is-disabled):hover {
    background: #f8fafc;
    border-color: #94a3b8;
}

@media (max-width: 640px) {
    .vh-locator-units-ctas {
        flex-direction: column;
    }
}

.vh-locator-selected .vh-locator-analyze-button {
    margin-top: 10px;
    width: 100%;
}

.vh-locator-analyze-button i {
    font-size: 15px;
}

.vh-locator-analyze-button.is-disabled,
.vh-locator-analyze-button[aria-disabled='true'] {
    background: #d1d5db;
    color: #ffffff !important;
    pointer-events: none;
    cursor: not-allowed;
    box-shadow: none;
}

.vh-locator-analyze-button:not(.is-disabled):hover {
    background: #1d4ed8;
}
