/* ====================================================================
   FILTROS EN ALL PROPERTIES - Panel colapsable que reutiliza filtros del mapa
   ==================================================================== */

/* Filtros ocultos por defecto (usado en map.html y all_properties) */
.filtros-ocultos-default {
    display: none !important;
}

/* Premium background sin inline styles */
.premium-background {
    min-height: 100vh;
    padding: 2rem 0;
}

/* Móvil: reducir padding top pero mantener separación del navbar */
@media (max-width: 767px) {
    .premium-background {
        padding: 0.8rem 0.4rem;
    }
}

/* ====================================================================
   HEADER LABEL - ALL PROPERTIES
   ==================================================================== */
.all-props-header-label {
    padding: 0.8rem 1rem;
    border-radius: 12px;
    margin-bottom: 0.75rem;
}

.all-props-header-title {
    font-size: 1.1rem;
    color: #fff !important;
}

.all-props-header-title i,
.all-props-header-title span {
    color: #fff !important;
}

/* Nocturno */
html[data-tema="nocturno"] .all-props-header-title,
html[data-tema="nocturno"] .all-props-header-title i,
html[data-tema="nocturno"] .all-props-header-title span {
    color: #fff !important;
}

/* Futurista */
html[data-tema="futurista"] .all-props-header-title,
html[data-tema="futurista"] .all-props-header-title i,
html[data-tema="futurista"] .all-props-header-title span {
    color: #00f7ff !important;
    text-shadow: 0 0 8px rgba(0, 247, 255, 0.4);
}

/* ====================================================================
   TOGGLE COMPRAR/ALQUILAR/HOSPEDAJE - PARIDAD LEGACY
   ==================================================================== */
.mapa-toggle-row {
    display: flex;
    width: 100%;
    align-items: stretch;
    background: linear-gradient(135deg, var(--tema-primario, #1e90ff) 0%, var(--tema-primario-oscuro, #4169e1) 100%);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(var(--tema-primario-rgb, 30, 144, 255), 0.3);
}

.mapa-toggle-row .mapa-toggle-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 0;
    min-width: auto;
    padding: 0.5rem 0.5rem 0.4rem;
    background: transparent;
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    transition: all 0.25s ease;
    position: relative;
}

.mapa-toggle-row .mapa-toggle-btn i {
    font-size: 1.2rem;
    transition: all 0.25s ease;
}

.mapa-toggle-row .mapa-toggle-label {
    font-size: 0.7rem;
    margin-top: 3px;
    font-weight: 600;
    opacity: 0.8;
}

.mapa-toggle-row .mapa-toggle-btn.active {
    color: #fff;
    background: rgba(255, 255, 255, 0.15);
}

.mapa-toggle-row .mapa-toggle-btn.active i {
    transform: scale(1.15);
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.8);
}

.mapa-toggle-row .mapa-toggle-btn.active::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: 3px;
    background: #fff;
    border-radius: 0;
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.6);
}

.mapa-toggle-row .mapa-toggle-btn:hover:not(.active) {
    color: rgba(255, 255, 255, 0.9);
    background: rgba(255, 255, 255, 0.1);
}

.mapa-toggle-row .mapa-toggle-btn:active {
    transform: scale(0.95);
}

/* Ajuste de escritorio usado en legacy */
@media (min-width: 768px) {
    .mapa-toggle-row {
        width: auto;
        margin-left: auto;
        border-radius: 12px;
        overflow: hidden;
    }

    .mapa-toggle-row .mapa-toggle-btn {
        min-width: 100px;
        padding: 0.6rem 1.5rem 0.5rem;
    }
}

/* Ajuste móvil usado en legacy */
@media (max-width: 576px) {
    .mapa-toggle-row {
        border-radius: 10px;
    }

    .mapa-toggle-row .mapa-toggle-btn {
        min-width: 80px;
        padding: 0.5rem 1rem 0.4rem;
    }

    .mapa-toggle-row .mapa-toggle-btn i {
        font-size: 1.1rem;
    }

    .mapa-toggle-row .mapa-toggle-label {
        font-size: 0.65rem;
    }
}

/* ====================================================================
   TOGGLE CONTADOR (Badge de propiedades inline con toggles)
   ==================================================================== */
.toggle-contador {
    cursor: default;
    pointer-events: none;
}

.toggle-contador #statsPropsCount {
    font-weight: 700;
}

.toggle-contador-label {
    font-size: 0.7rem !important;
}

/* Link perfil sin decoración */
.mapa-toggle-row a.mapa-toggle-btn {
    text-decoration: none;
}

.filtros-wrapper-all {
    display: none;
    position: relative;
    margin-bottom: 1rem;
    animation: filtroSlideDown 0.3s ease-out;
    z-index: 10000;
    overflow: visible !important;
}

.filtros-wrapper-all.activo {
    display: block;
    overflow: visible !important;
}

/* Forzar que la tarjeta de filtros sea visible cuando el wrapper está activo */
.filtros-wrapper-all.activo .filtros-card {
    display: block !important;
    overflow: visible !important;
    position: relative;
    z-index: 10001;
}

/* Asegurar que los contenedores permitan el dropdown */
.filtros-wrapper-all .filtros-card,
.filtros-wrapper-all .card-body,
.filtros-wrapper-all .filtros-row,
.filtros-wrapper-all .row {
    overflow: visible !important;
}

/* Contenedor del dropdown de tipos */
.filtros-wrapper-all #filtroTipoPropiedadContainer,
#filtroTipoPropiedadContainer {
    position: relative;
    z-index: 99999 !important;
    overflow: visible !important;
}

/* Asegurar que el grid de propiedades esté DEBAJO del dropdown */
#gridPropiedades {
    position: relative;
    z-index: 1;
}

@keyframes filtroSlideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Ocultar elementos exclusivos del mapa */
.filtros-wrapper-all .premium-header,
.filtros-wrapper-all .map-container-card,
.filtros-wrapper-all .stat-card,
.filtros-wrapper-all .stats-row,
.filtros-wrapper-all .mapa-header-mobile,
.filtros-wrapper-all .footer-spacer {
    display: none !important;
}

/* Botón cerrar filtros (X) */
.btn-cerrar-filtros-all {
    position: absolute;
    top: 0.5rem;
    right: 0.6rem;
    background: none;
    border: none;
    font-size: 1.3rem;
    color: var(--tema-texto-silenciado, #6c757d);
    cursor: pointer;
    padding: 0.2rem 0.5rem;
    border-radius: 50%;
    transition: all 0.2s;
    z-index: 10;
    line-height: 1;
}

.btn-cerrar-filtros-all:hover {
    background: rgba(0,0,0,0.08);
    color: var(--tema-texto-primario, #333);
}

/* Botón filtros en header */
.btn-filtros-header {
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.3);
    color: white;
    padding: 0.4rem 1rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn-filtros-header:hover {
    background: rgba(255,255,255,0.25);
    color: white;
    transform: translateY(-1px);
}

.btn-filtros-header.activo {
    background: rgba(255,255,255,0.9);
    color: var(--tema-texto-invertido, #333);
}

.btn-filtros-header .badge-filtros {
    background: var(--tema-peligro, #ff6b6b);
    color: white;
    border-radius: 50%;
    font-size: 0.65rem;
    padding: 0.15rem 0.4rem;
    margin-left: 0.3rem;
    display: none;
}

/* Contador y mensaje sin resultados */
.filtros-resultado-count {
    font-size: 0.78rem;
    color: var(--tema-texto-silenciado, #6c757d);
    text-align: center;
    padding: 0.3rem 0;
}

.filtros-resultado-count strong {
    color: var(--color-primario, var(--tema-primario, #0d6efd));
}

.no-results-msg {
    display: none;
    text-align: center;
    padding: 3rem 1rem;
}

.no-results-msg i {
    font-size: 3rem;
    color: var(--tema-texto-silenciado, #dee2e6);
    margin-bottom: 1rem;
}

.no-results-msg h5 { color: var(--tema-texto-silenciado, #6c757d); }
.no-results-msg p { color: var(--tema-texto-terciario, #adb5bd); }

/* Tema futurista */
html[data-tema="futurista"] .btn-cerrar-filtros-all {
    color: rgba(0, 247, 255, 0.7);
}

html[data-tema="futurista"] .btn-cerrar-filtros-all:hover {
    background: rgba(0, 247, 255, 0.1);
    color: #00f7ff;
}

html[data-tema="futurista"] .btn-filtros-header.activo {
    background: rgba(0, 247, 255, 0.2);
    color: #00f7ff;
    border-color: rgba(0, 247, 255, 0.5);
}

/* ====================================================================
   DROPDOWN MULTI-SELECT DE TIPOS DE PROPIEDAD
   ==================================================================== */
.property-type-multiselect {
    position: relative;
    z-index: 99999 !important;
}

.property-type-multiselect .dropdown-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    text-align: left;
    background-color: var(--tema-fondo-tarjeta, #fff);
    color: var(--tema-texto-primario, #333);
    position: relative;
    z-index: 99999 !important;
}

.property-type-multiselect .dropdown-toggle::after {
    margin-left: auto;
}

.property-type-multiselect .dropdown-menu {
    max-height: 300px;
    overflow-y: auto;
    min-width: 220px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.25);
    border-radius: 8px;
    z-index: 999999 !important;
    position: absolute !important;
    top: 100% !important;
    left: 0 !important;
    transform: none !important;
}

.property-type-multiselect .dropdown-menu.show {
    display: block !important;
    z-index: 999999 !important;
}

.property-type-multiselect .form-check {
    padding: 0.35rem 0.5rem;
    margin: 0;
    border-radius: 4px;
    transition: background-color 0.15s;
}

.property-type-multiselect .form-check:hover {
    background-color: rgba(var(--tema-primario-rgb), 0.08);
}

.property-type-multiselect .form-check-input {
    cursor: pointer;
}

.property-type-multiselect .form-check-label {
    cursor: pointer;
    font-size: 0.9rem;
    width: 100%;
}

/* Estilo cuando hay tipos seleccionados */
.property-type-multiselect .dropdown-toggle:has(+ .dropdown-menu .property-type-check:checked) {
    border-color: var(--tema-primario);
    background-color: rgba(var(--tema-primario-rgb), 0.05);
}

#propertyTypeLabel {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: calc(100% - 20px);
}

/* Tema nocturno */
html[data-tema="nocturno"] .property-type-multiselect .dropdown-toggle {
    background-color: var(--tema-fondo-tarjeta, #1a1a2e);
    border-color: var(--tema-borde-color, #333);
    color: var(--tema-texto-primario, #eee);
}

html[data-tema="nocturno"] .property-type-multiselect .dropdown-menu {
    background-color: var(--tema-fondo-tarjeta, #1a1a2e);
    border-color: var(--tema-borde-color, #333);
}

html[data-tema="nocturno"] .property-type-multiselect .form-check:hover {
    background-color: rgba(255,255,255,0.1);
}

html[data-tema="nocturno"] .property-type-multiselect .form-check-label {
    color: var(--tema-texto-secundario, #ddd);
}

/* Tema futurista */
html[data-tema="futurista"] .property-type-multiselect .dropdown-toggle {
    background-color: rgba(0, 247, 255, 0.05);
    border-color: rgba(0, 247, 255, 0.3);
    color: #00f7ff;
}

html[data-tema="futurista"] .property-type-multiselect .dropdown-menu {
    background-color: #0a0a1a;
    border-color: rgba(0, 247, 255, 0.3);
}

html[data-tema="futurista"] .property-type-multiselect .form-check:hover {
    background-color: rgba(0, 247, 255, 0.1);
}

html[data-tema="futurista"] .property-type-multiselect .form-check-label {
    color: rgba(0, 247, 255, 0.8);
}

/* Tema natural */
html[data-tema="natural"] .property-type-multiselect .dropdown-toggle {
    background-color: rgba(0, 0, 0, 0.4);
    border-color: rgba(255, 255, 255, 0.2);
    color: #ffffff;
}

html[data-tema="natural"] .property-type-multiselect .dropdown-menu {
    background-color: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border-color: rgba(255, 255, 255, 0.15);
}

html[data-tema="natural"] .property-type-multiselect .form-check:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

html[data-tema="natural"] .property-type-multiselect .form-check-label {
    color: rgba(255, 255, 255, 0.85);
}

html[data-tema="natural"] .btn-cerrar-filtros-all {
    color: rgba(255, 255, 255, 0.6);
}

html[data-tema="natural"] .btn-cerrar-filtros-all:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

html[data-tema="natural"] .btn-filtros-header.activo {
    background: rgba(76, 175, 80, 0.3);
    color: #ffffff;
    border-color: rgba(76, 175, 80, 0.5);
}

/* Nocturno tema overrides adicionales */
html[data-tema="nocturno"] .btn-cerrar-filtros-all {
    color: rgba(79, 195, 247, 0.7);
}

html[data-tema="nocturno"] .btn-cerrar-filtros-all:hover {
    background: rgba(79, 195, 247, 0.1);
    color: #4fc3f7;
}

html[data-tema="nocturno"] .btn-filtros-header.activo {
    background: rgba(26, 115, 232, 0.3);
    color: #ffffff;
    border-color: rgba(26, 115, 232, 0.5);
}
