/* === VARIABLES & RESET === */
:root {
    /* Modo Claro (Por defecto) */
    --bg-body: #f4f7f6;
    --card-bg: #ffffff;
    --bg-surface: #ffffff;
    --text-main: #111827;
    --text-muted: #6b7280;
    --primary: #2563eb; /* Azul moderno de los ejemplos */
    --primary-hover: #1d4ed8;
    --border: #e5e7eb;
    --border-light: #e5e7eb;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --radius-md: 12px;
    --radius-lg: 24px;
    --transition: all 0.3s ease;
}

.dark-mode {
    /* Modo Oscuro */
    --bg-body: #0f172a;
    --card-bg: #1e293b;
    --bg-surface: #1e293b;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --primary: #3b82f6;
    --primary-hover: #60a5fa;
    --border: #334155;
    --border-light: #2e3f63;
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.5);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.5);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body {
    background-color: var(--bg-body);
    color: var(--text-main);
    transition: var(--transition);
    overflow-x: hidden;
}

a { text-decoration: none; color: inherit; }
ul { list-style: none; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.section-title {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--text-main);
}

.section-subtitle {
    font-size: 1rem;
    color: var(--text-muted);
    margin-bottom: 2rem;
}

/* === HEADER & NAVEGACIÓN === */
header {
    background-color: var(--bg-surface);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 70px;
}

.logo {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.desktop-nav { display: none; }
.desktop-nav ul { display: flex; gap: 24px; align-items: center; }
.desktop-nav a { font-weight: 500; transition: color 0.2s; color: var(--text-main); }
.desktop-nav a:hover { color: var(--primary); }

.icon-btn {
    color: var(--text-main);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: var(--transition);
}
.icon-btn:hover { background-color: var(--bg-body); }

.menu-toggle { display: block; }

/* Menú Móvil Lateral Derecho */
.mobile-menu {
    position: fixed;
    top: 0;
    right: -100%;
    width: 280px;
    /* Usamos dvh (dynamic viewport height) para móviles modernos con fallback a vh */
    height: 100vh;
    height: 100dvh;
    /* Permitimos scroll interno si los elementos superan el alto de la pantalla */
    overflow-y: auto; 
    background-color: var(--bg-surface);
    box-shadow: -5px 0 15px rgba(0,0,0,0.1);
    transition: right 0.3s ease;
    z-index: 200;
    /* Aumentamos el padding inferior a 40px para evitar que choque con el borde de la pantalla */
    padding: 80px 20px 40px; 
    display: flex;
    flex-direction: column;
    gap: 20px;
}        
.mobile-menu.active { right: 0; }
.close-menu {
    position: absolute;
    top: 20px;
    right: 20px;
}
.mobile-menu a {
    font-size: 1.2rem;
    font-weight: 600;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    display: block;
}

/* Contenedor del botón de modo oscuro */
.theme-toggle-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 40px; 
    padding-top: 20px;
    border-top: 1px solid var(--border);
    font-weight: 600;
}

/* === HERO CAROUSEL === */
.hero-section {
    position: relative;
    padding: 20px 0;
}
.hero-carousel {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    border-radius: var(--radius-lg);
    gap: 20px;
    scrollbar-width: none; /* Firefox */
}
.hero-carousel::-webkit-scrollbar { display: none; } /* Chrome */

.hero-slide {
    flex: 0 0 100%;
    scroll-snap-align: start;
    position: relative;
    height: 400px;
    border-radius: var(--radius-lg);
    overflow: hidden;
    display: flex;
    align-items: center;
    padding: 40px;
    background-color: var(--text-main); /* Fallback */
}
.hero-slide img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.6;
    z-index: 1;
}
.hero-content {
    position: relative;
    z-index: 2;
    color: #ffffff;
    max-width: 500px;
}
.hero-content h1 { font-size: 2.5rem; margin-bottom: 1rem; line-height: 1.2; }
.hero-content p { font-size: 1.1rem; margin-bottom: 2rem; opacity: 0.9; }
.btn-primary {
    background-color: var(--primary);
    color: #ffffff;
    padding: 12px 24px;
    border-radius: 30px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: background 0.3s;
}
.btn-primary:hover { background-color: var(--primary-hover); }

/* === BUSCADOR === */
.search-container {
    background-color: var(--bg-surface);
    padding: 20px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    margin-top: -40px;
    position: relative;
    z-index: 10;
    display: flex;
    flex-direction: column;
    gap: 15px;
    border: 1px solid var(--border);
}
.search-inputs {
    display: flex;
    flex-direction: column;
    gap: 15px;
}
.search-field {
    display: flex;
    align-items: center;
    gap: 10px;
    background-color: var(--bg-body);
    padding: 12px 16px;
    border-radius: 8px;
    flex: 1;
}
.search-field input, .search-field select {
    background: transparent;
    border: none;
    outline: none;
    width: 100%;
    color: var(--text-main);
    font-size: 1rem;
}

/* === INDICADORES ECONÓMICOS === */
.indicadores-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin: 40px 0;
}
.indicador-card {
    background-color: var(--bg-surface);
    padding: 20px;
    border-radius: var(--radius-md);
    text-align: center;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border);
}
.indicador-card h3 { font-size: 1rem; color: var(--text-muted); margin-bottom: 5px; }
.indicador-card .valor { font-size: 1.5rem; font-weight: 700; color: var(--primary); }

/* === HERRAMIENTAS DE ANÁLISIS === */
.herramientas-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 20px;
    margin-bottom: 60px;
}
.tool-card {
    background-color: var(--bg-surface);
    padding: 30px 20px;
    border-radius: var(--radius-lg);
    text-align: center;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border);
    transition: transform 0.3s;
    cursor: pointer;
}
.tool-card:hover { transform: translateY(-5px); }
.tool-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto 15px;
    color: var(--primary);
}
.tool-card h3 { font-size: 1.1rem; color: var(--text-main); }

/* === CAROUSELES DE PROPIEDADES (Venta, Arriendo, Destacados) === */
section.propiedades { margin-bottom: 60px; }
.carousel-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 20px;
}
.carousel-controls {
    display: flex;
    gap: 10px;
}
.carousel-btn {
    background-color: var(--bg-surface);
    border: 1px solid var(--border);
    color: var(--text-main);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-sm);
}
.carousel-btn:hover { background-color: var(--primary); color: white; border-color: var(--primary); }

.cards-wrapper {
    display: flex;
    gap: 20px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    padding-bottom: 20px; /* Para la sombra */
    scrollbar-width: none;
}
.cards-wrapper::-webkit-scrollbar { display: none; }

.property-card {
    flex: 0 0 300px;
    scroll-snap-align: start;
    background-color: var(--bg-surface);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
}
.card-img {
    height: 200px;
    width: 100%;
    object-fit: cover;
}
.card-body { padding: 20px; display: flex; flex-direction: column; flex-grow: 1; }
.card-price { font-size: 1.25rem; font-weight: 700; color: var(--primary); margin-bottom: 5px; }
.card-title { font-size: 1.1rem; font-weight: 600; margin-bottom: 10px; color: var(--text-main); }
.card-location { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 15px; display: flex; align-items: center; gap: 5px; }
.card-features {
    display: flex;
    justify-content: space-between;
    border-top: 1px solid var(--border);
    padding-top: 15px;
    margin-top: auto;
    color: var(--text-muted);
    font-size: 0.9rem;
}
.feature { display: flex; align-items: center; gap: 5px; }

/* === PARTNERS === */
.partners-section { margin-bottom: 60px; text-align: center; }
.partners-grid {
    display: flex;
    justify-content: center;
    gap: 40px;
    flex-wrap: wrap;
    align-items: center;
    opacity: 0.6;
}
.partners-grid svg { width: 120px; height: auto; fill: var(--text-main); }

/* === FOOTER === */
footer {
    background-color: var(--bg-surface);
    border-top: 1px solid var(--border);
    padding: 40px 0 20px;
    margin-top: 60px;
}
.footer-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 30px;
    margin-bottom: 30px;
}
.footer-col h4 { font-size: 1.2rem; margin-bottom: 15px; color: var(--text-main); }
.footer-col ul { display: flex; flex-direction: column; gap: 10px; color: var(--text-muted); }
.footer-col a:hover { color: var(--primary); }
.footer-bottom {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* === RESPONSIVE DESKTOP === */
@media (min-width: 768px) {
    .desktop-nav { display: block; }
    .menu-toggle { display: none; }
    .search-inputs { flex-direction: row; }
    .search-btn { width: auto; padding: 0 40px; }
    .hero-slide { height: 500px; }
    .footer-grid { grid-template-columns: repeat(4, 1fr); }
}


/* =========================================================
   ESTILOS ADICIONALES: PÁGINA DE BÚSQUEDA 
   ========================================================= */

/* --- Cabecera de Búsqueda --- */
.search-page-header {
    margin: 40px 0 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}
.search-page-header .results-count {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-main);
}
.search-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}
.sort-by {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
    color: var(--text-muted);
}
.sort-by select {
    background-color: var(--bg-surface);
    color: var(--text-main);
    border: 1px solid var(--border);
    padding: 8px 12px;
    border-radius: 8px;
    outline: none;
    cursor: pointer;
}

/* --- Layout Principal de Búsqueda --- */
.search-layout {
    display: grid;
    grid-template-columns: 1fr; /* Móvil por defecto */
    gap: 30px;
    margin-bottom: 60px;
    align-items: start;
}

/* --- Sidebar de Filtros --- */
.filters-sidebar {
    background-color: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 90px; /* Se queda pegado al hacer scroll bajo el header */
}
.filter-header {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border);
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 10px;
}
.filter-group {
    margin-bottom: 20px;
}
.filter-group label {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-main);
}
.filter-input, .filter-select {
    width: 100%;
    padding: 12px;
    background-color: var(--bg-body);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-main);
    outline: none;
    transition: border-color 0.2s;
}
.filter-input:focus, .filter-select:focus {
    border-color: var(--primary);
}
.price-range {
    display: flex;
    gap: 10px;
    align-items: center;
}
.price-range span {
    color: var(--text-muted);
}

/* --- Grid de Resultados --- */
.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}
/* Sobrescribimos el flex del carousel para que funcione en grid */
.results-grid .property-card {
    flex: auto;
    scroll-snap-align: none;
    height: 100%; /* Para que todas las tarjetas tengan el mismo alto */
}

/* Ajuste general de la paginación */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 50px;
    flex-wrap: wrap;
}

/* Botón base (numéricos) */
.page-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 40px;
    min-width: 40px; /* Ancho base para números */
    padding: 0 12px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background-color: var(--bg-surface);
    color: var(--text-main);
    font-weight: 600;
    transition: var(--transition);
}

/* Botones Anterior y Siguiente (3 veces más anchos que el base) */
.page-btn.nav-wide {
    min-width: 120px; /* 40px * 3 = 120px */
    padding: 0 20px;
}

.page-btn:hover:not(:disabled) {
    border-color: var(--primary);
    color: var(--primary);
    background-color: rgba(37, 99, 235, 0.05);
}

.page-btn.active {
    background-color: var(--primary);
    color: #ffffff;
    border-color: var(--primary);
}

.page-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background-color: var(--bg-body);
}

/* --- Responsive Escritorio --- */
@media (min-width: 992px) {
    .search-layout {
        grid-template-columns: 280px 1fr; /* Sidebar + Grid */
    }
    .search-page-header {
        flex-direction: row;
        justify-content: space-between;
        align-items: flex-end;
    }
}


/* ==========================================
   ESTILOS PÁGINA DE BÚSQUEDA
   ========================================== */

.search-page-wrapper {
    display: grid;
    grid-template-columns: 1fr;
    gap: 30px;
    margin: 40px 0 80px;
}

/* En escritorio, barra lateral de 280px y el resto para resultados */
@media (min-width: 768px) {
    .search-page-wrapper {
        grid-template-columns: 280px 1fr;
    }
}

/* --- Barra Lateral de Filtros --- */
.filter-sidebar {
    background-color: var(--bg-surface);
    padding: 24px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    height: fit-content;
    position: sticky;
    top: 90px; /* Para que baje junto con el scroll en escritorio */
}

.filter-header {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 20px;
    color: var(--text-main);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.filter-group {
    margin-bottom: 20px;
}

.filter-label {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-main);
}

.form-input, .form-select {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background-color: var(--bg-body);
    color: var(--text-main);
    font-family: inherit;
    font-size: 0.95rem;
    outline: none;
    transition: var(--transition);
}

.form-input:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.filter-row {
    display: flex;
    gap: 10px;
}

/* Botón de filtros para móvil */
.mobile-filter-btn {
    width: 100%;
    margin-bottom: 20px;
    justify-content: center;
}
@media (min-width: 768px) {
    .mobile-filter-btn { display: none; }
}

/* Ocultar sidebar en móvil por defecto */
@media (max-width: 767px) {
    .filter-sidebar {
        display: none;
        position: static;
        margin-bottom: 30px;
    }
    .filter-sidebar.open {
        display: block;
    }
}

/* --- Área de Resultados --- */
.results-header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 15px;
}

.results-count {
    color: var(--text-muted);
    font-weight: 500;
}

.results-count span {
    color: var(--text-main);
    font-weight: 700;
}

.sort-select {
    padding: 10px 16px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background-color: var(--bg-surface);
    color: var(--text-main);
    cursor: pointer;
    outline: none;
}

/* Grilla de tarjetas (anula el carrusel para esta vista) */
.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
}

.results-grid .property-card {
    /* Quitamos los valores del carrusel */
    flex: auto;
    scroll-snap-align: none;
    height: 100%;
}

/* --- Paginación --- */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 50px;
    flex-wrap: wrap;
}

.page-btn {
    padding: 10px 16px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background-color: var(--bg-surface);
    color: var(--text-main);
    font-weight: 600;
    transition: var(--transition);
}

.page-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.page-btn.active {
    background-color: var(--primary);
    color: #ffffff;
    border-color: var(--primary);
}

.page-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    border-color: var(--border);
    color: var(--text-muted);
}





/* ==========================================
   ESTILOS PÁGINA DE DETALLE DE PROPIEDAD
   ========================================== */

/* Buscador Compacto Superior */
.compact-search-bar {
    background-color: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    padding: 15px 0;
    margin-bottom: 20px;
}
.compact-search-bar .search-inputs {
    flex-direction: row;
    gap: 10px;
    align-items: center;
}
.compact-search-bar .search-field {
    padding: 8px 12px;
    background-color: var(--bg-body);
}
@media (max-width: 768px) {
    .compact-search-bar { display: none; } /* Ocultar en móvil para dar prioridad al contenido */
}

/* Breadcrumb */
.breadcrumb {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 20px;
}
.breadcrumb a { transition: var(--transition); }
.breadcrumb a:hover { color: var(--primary); }

/* Galería de Propiedad (Estilo Hero) */
.property-gallery-container {
    position: relative;
    border-radius: var(--radius-lg);
    overflow: hidden;
    height: 400px;
    margin-bottom: 30px;
    cursor: pointer;
    background-color: var(--border);
}
@media (min-width: 768px) {
    .property-gallery-container { height: 500px; }
}
.property-gallery-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}
.property-gallery-container:hover img { transform: scale(1.02); }

.photo-badge {
    position: absolute;
    bottom: 20px;
    right: 20px;
    background-color: rgba(15, 23, 42, 0.7);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    backdrop-filter: blur(4px);
    z-index: 10;
}

/* Layout Principal: Contenido + Sidebar */
.property-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 40px;
    margin-bottom: 60px;
}
@media (min-width: 992px) {
    .property-layout {
        grid-template-columns: 1fr 350px; /* Columna principal + Sidebar sticky */
    }
}

/* Detalles de la Propiedad (Columna Izquierda) */
.property-title { font-size: 2rem; font-weight: 800; margin-bottom: 10px; color: var(--text-main); line-height: 1.2;}
.property-location { font-size: 1.1rem; color: var(--text-muted); margin-bottom: 30px; display: flex; align-items: center; gap: 5px; }
.property-section { margin-bottom: 40px; padding-bottom: 40px; border-bottom: 1px solid var(--border); }
.property-section:last-child { border-bottom: none; }
.property-description { font-size: 1.05rem; line-height: 1.6; color: var(--text-muted); }

/* Amenities Grid */
.amenities-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 20px;
    margin-top: 20px;
}
.amenity-item {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-main);
    font-weight: 500;
}
.amenity-item svg {
    color: var(--primary);
    width: 20px;
    height: 20px;
    /* Importante para iconos de trazo plano */
    fill: none; 
}

/* Sidebar Sticky (Columna Derecha) */
.sticky-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 30px;
    box-shadow: var(--shadow-lg);
    position: sticky;
    top: 90px;
}
.badge-status {
    display: inline-block;
    padding: 4px 12px;
    background-color: rgba(37, 99, 235, 0.1);
    color: var(--primary);
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 700;
    margin-bottom: 15px;
}
.card-price-large { font-size: 2.5rem; font-weight: 800; color: var(--primary); margin-bottom: 5px; }
.card-publish-date { font-size: 0.9rem; color: var(--text-muted); margin-bottom: 25px; }

.specs-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin-bottom: 30px;
    text-align: center;
}
.spec-item {
    background-color: var(--bg-body);
    padding: 15px 10px;
    border-radius: var(--radius-md);
}
.spec-value { font-size: 1.2rem; font-weight: 700; color: var(--text-main); margin-bottom: 5px; }
.spec-label { font-size: 0.8rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px;}

.action-buttons { display: flex; flex-direction: column; gap: 15px; }
.btn-whatsapp {
    background-color: #25D366; color: white; padding: 14px; border-radius: 8px; font-weight: 600; font-size: 1.1rem;
    display: flex; justify-content: center; align-items: center; gap: 10px; transition: background 0.3s;
}
.btn-whatsapp:hover { background-color: #1EBE5D; }
.btn-email {
    background-color: transparent; color: var(--text-main); padding: 14px; border-radius: 8px; font-weight: 600; border: 1px solid var(--border);
    display: flex; justify-content: center; align-items: center; gap: 10px; transition: var(--transition);
}
.btn-email:hover { background-color: var(--bg-body); border-color: var(--text-main); }

/* Lightbox Modal para fotos */
.lightbox-modal {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background-color: rgba(0,0,0,0.95); z-index: 9999;
    display: flex; flex-direction: column; justify-content: center; align-items: center;
    opacity: 0; pointer-events: none; transition: opacity 0.3s ease;
}
.lightbox-modal.active { opacity: 1; pointer-events: auto; }

.lightbox-close {
    position: absolute; top: 20px; right: 20px;
    background: none; border: none; color: white; cursor: pointer;
    padding: 10px; background-color: rgba(255,255,255,0.1); border-radius: 50%;
}
.lightbox-close:hover { background-color: rgba(255,255,255,0.2); }

.lightbox-content {
    position: relative; width: 90%; max-width: 1000px; height: 70vh;
    display: flex; justify-content: center; align-items: center;
}
.lightbox-content img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 8px; }

.lightbox-nav {
    position: absolute; top: 50%; transform: translateY(-50%);
    background: rgba(255,255,255,0.1); color: white; border: none;
    width: 50px; height: 50px; border-radius: 50%; display: flex; justify-content: center; align-items: center; cursor: pointer; transition: background 0.3s;
}
.lightbox-nav:hover { background: rgba(255,255,255,0.3); }
.lightbox-prev { left: -60px; }
.lightbox-next { right: -60px; }
@media (max-width: 768px) {
    .lightbox-prev { left: 10px; }
    .lightbox-next { right: 10px; }
}

.lightbox-counter {
    position: absolute; bottom: -40px; color: white; font-weight: 600; font-size: 1.1rem;
}
/* Estilos para el Mapa */
.map-container {
    width: 100%;
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--border);
    background-color: var(--bg-body);
}

.map-container iframe {
    filter: grayscale(0.2); /* Opcional: le da un toque más moderno */
    transition: var(--transition);
}

.dark-mode .map-container iframe {
    filter: invert(90%) hue-rotate(180deg) brightness(95%) contrast(90%);
}



/* ==========================================
   ESTILOS FORMULARIO DE PUBLICACIÓN
   ========================================== */

.publish-grid {
    display: flex;
    flex-direction: column;
    gap: 30px;
    max-width: 800px;
    margin: 0 auto;
}

.form-card {
    background-color: var(--bg-surface);
    padding: 30px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

.form-section-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 25px;
    color: var(--primary);
    border-bottom: 1px solid var(--border);
    padding-bottom: 10px;
}

/* Checkboxes para Amenities */
.amenities-selection-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.9rem;
}

.checkbox-item:hover {
    background-color: var(--bg-body);
}

.checkbox-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
}

/* Zona de Carga de Archivos */
.upload-area {
    border: 2px dashed var(--border);
    padding: 40px;
    border-radius: var(--radius-md);
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    color: var(--text-muted);
}

.upload-area:hover {
    border-color: var(--primary);
    background-color: rgba(37, 99, 235, 0.05);
}

.upload-area span {
    color: var(--primary);
    font-weight: 600;
}

.preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 10px;
    margin-top: 20px;
}

.preview-img {
    width: 100%;
    height: 100px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid var(--border);
}

.btn-publish-submit {
    padding: 18px;
    font-size: 1.2rem;
    justify-content: center;
    box-shadow: var(--shadow-lg);
}



/* ==========================================
   ESTILOS PANTALLA DE PERFIL
   ========================================== */

.profile-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 30px;
    margin: 40px auto;
}

@media (min-width: 992px) {
    .profile-layout {
        grid-template-columns: 300px 1fr; /* Sidebar + Contenido */
    }
}

/* Sidebar de Perfil */
.profile-sidebar {
    background-color: var(--bg-surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    overflow: hidden;
    height: fit-content;
}

.user-info-card {
    padding: 30px 20px;
    text-align: center;
    background-color: var(--bg-body);
    border-bottom: 1px solid var(--border);
}

.profile-avatar {
    position: relative;
    width: 100px;
    height: 100px;
    margin: 0 auto 15px;
}

.profile-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--primary);
}

.user-badge-pro {
    position: absolute;
    bottom: 0;
    right: 0;
    background-color: var(--primary);
    color: white;
    font-size: 0.7rem;
    font-weight: 800;
    padding: 4px 8px;
    border-radius: 10px;
    border: 2px solid var(--bg-surface);
}

.user-name { font-size: 1.2rem; font-weight: 700; margin-bottom: 5px; }
.user-type { font-size: 0.85rem; color: var(--text-muted); font-weight: 500; }

/* Navegación Sidebar */
.sidebar-nav { padding: 10px 0; }

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-muted);
    transition: var(--transition);
    border-left: 3px solid transparent;
}

.nav-item svg { width: 20px; height: 20px; opacity: 0.7; }

.nav-item:hover, .nav-item.active {
    color: var(--primary);
    background-color: rgba(37, 99, 235, 0.05);
    border-left-color: var(--primary);
}

.nav-item.active svg { opacity: 1; }

.nav-divider {
    height: 1px;
    background-color: var(--border);
    margin: 10px 20px;
}

.nav-item.logout { color: #ef4444; }
.nav-item.logout:hover { background-color: rgba(239, 68, 68, 0.05); border-left-color: #ef4444; }

/* Ajustes de contenido */
.profile-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
}



/* Estilos específicos para selección de tipo de usuario en Registro */
.checkbox-item input[type="radio"]:checked + span,
.checkbox-item:has(input[type="radio"]:checked) {
    background-color: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* Efecto suave para el separador "O regístrate con" */
.form-card form p span {
    background-color: var(--bg-surface);
}


/* Estilos para Tarjetas de Blog */
.blog-card {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.blog-category {
    display: inline-block;
    color: var(--primary);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 10px;
}

.blog-card .card-title {
    font-size: 1.2rem;
    line-height: 1.4;
    margin-bottom: 12px;
}

.card-text {
    font-size: 0.95rem;
    color: var(--text-muted);
    line-height: 1.5;
    margin-bottom: 20px;
    /* Limitamos a 3 líneas de texto para uniformidad */
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.blog-link {
    color: var(--primary);
    font-weight: 600;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: auto;
}

.blog-link:after {
    content: '→';
    transition: transform 0.2s;
}

.blog-link:hover:after {
    transform: translateX(4px);
}


/* ==========================================
   ESTILOS PÁGINA DE ARTÍCULO (BLOG)
   ========================================== */

.article-main-wrapper {
    max-width: 800px; /* Ancho optimizado para lectura */
    margin: 40px auto 100px;
}

.article-header {
    margin-bottom: 30px;
}

.article-title {
    font-size: 2.5rem;
    font-weight: 800;
    line-height: 1.2;
    margin: 15px 0 25px;
    color: var(--text-main);
}

.article-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.author-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.author-img {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    object-fit: cover;
}

.author-name {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text-main);
}

.publish-date {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.share-buttons {
    display: flex;
    gap: 10px;
}

.article-hero-image {
    width: 100%;
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: 40px;
}

.article-hero-image img {
    width: 100%;
    height: auto;
    display: block;
}

.article-content p {
    font-size: 1.15rem;
    line-height: 1.8;
    color: var(--text-muted);
    margin-bottom: 25px;
}

.article-content blockquote {
    font-size: 1.4rem;
    font-style: italic;
    color: var(--primary);
    border-left: 4px solid var(--primary);
    padding-left: 30px;
    margin: 40px 0;
    line-height: 1.5;
    font-weight: 500;
}

@media (max-width: 768px) {
    .article-title { font-size: 2rem; }
    .article-main-wrapper { padding: 0 20px; }
}


/* ==========================================
   ESTILOS PÁGINA DE ARTÍCULO BLOG
   ========================================== */

.blog-post-container {
    max-width: 100%;
    margin: 40px auto;
    padding: 40px;
    background-color: var(--bg-surface);
    border: 1px solid var(--border); /* Borde sutil para enmarcar el texto */
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

/* 80% de ancho en pantallas grandes */
@media (min-width: 1024px) {
    .blog-post-container {
        max-width: 80%;
    }
}

.post-header {
    text-align: center;
    margin-bottom: 40px;
}

.post-meta {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 20px;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.post-title {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--text-main);
    line-height: 1.2;
    margin-bottom: 20px;
}

.post-summary {
    font-size: 1.2rem;
    color: var(--text-muted);
    max-width: 800px;
    margin: 0 auto;
    font-style: italic;
}

.post-main-image {
    width: 100%;
    height: 450px;
    border-radius: var(--radius-md);
    overflow: hidden;
    margin-bottom: 40px;
}

.post-main-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.post-content {
    max-width: 800px;
    margin: 0 auto;
}

.post-content p {
    font-size: 1.1rem;
    line-height: 1.8;
    color: var(--text-muted);
    margin-bottom: 25px;
}

.post-content blockquote {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--primary);
    border-left: 4px solid var(--primary);
    padding-left: 30px;
    margin: 40px 0;
    line-height: 1.4;
}

.post-figure {
    margin: 40px 0;
    text-align: center;
}

.post-figure img {
    max-width: 100%;
    border-radius: var(--radius-md);
}

.post-figure figcaption {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-top: 10px;
}

.share-container {
    margin-top: 60px;
    padding-top: 30px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.share-buttons {
    display: flex;
    gap: 10px;
}


/* ==========================================
   ESTILOS PÁGINA DE POST (BLOG)
   ========================================== */

.post-page-container {
    max-width: 1200px;
    margin: 40px auto 80px;
    padding: 0 20px;
}

.post-main-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    /* 80% de ancho en pantallas grandes */
    width: 100%;
}

@media (min-width: 992px) {
    .post-main-card {
        width: 85%;
        margin: 0 auto;
    }
}

.post-header {
    padding: 60px 40px 30px;
    text-align: center;
}

.post-title {
    font-size: 2.5rem;
    font-weight: 800;
    line-height: 1.2;
    margin: 15px 0 25px;
    color: var(--text-main);
}

.post-meta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.meta-avatar {
    width: 45px;
    height: 45px;
    border-radius: 50%;
}

.meta-info {
    text-align: left;
    display: flex;
    flex-direction: column;
}

.meta-info strong { font-size: 0.95rem; color: var(--text-main); }
.meta-info span { font-size: 0.85rem; color: var(--text-muted); }

.post-featured-image {
    width: 100%;
    height: 500px;
    padding: 0 40px;
}

.post-featured-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: var(--radius-md);
}

/* Cuerpo de la Publicación */
.post-content {
    padding: 40px 60px;
    max-width: 800px;
    margin: 0 auto;
}

@media (max-width: 768px) {
    .post-header, .post-content { padding: 30px 20px; }
    .post-featured-image { height: 300px; padding: 0 20px; }
}

.post-summary {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-main);
    line-height: 1.6;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--primary);
}

.post-content p {
    font-size: 1.1rem;
    line-height: 1.8;
    color: var(--text-muted);
    margin-bottom: 25px;
}

.post-content blockquote {
    font-style: italic;
    font-size: 1.4rem;
    color: var(--primary);
    border-left: 5px solid var(--primary);
    padding-left: 30px;
    margin: 40px 0;
    line-height: 1.4;
}

.post-inline-image {
    margin: 40px 0;
    text-align: center;
}

.post-inline-image img {
    width: 100%;
    border-radius: var(--radius-md);
}

.post-inline-image figcaption {
    margin-top: 10px;
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* Compartir */
.post-share-section {
    padding: 40px 60px;
    background-color: var(--bg-body);
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.share-buttons {
    display: flex;
    gap: 10px;
}

.share-btn {
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    color: white;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: filter 0.3s;
}

.share-btn.whatsapp { background-color: #25D366; }
.share-btn.linkedin { background-color: #0077B5; }
.share-btn.twitter { background-color: #000000; }

.share-btn:hover { filter: brightness(1.1); }


/* Buscador específico del Blog */
.blog-search-bar {
    background-color: var(--bg-surface);
    padding: 30px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border);
    margin-top: 40px;
    margin-bottom: 60px;
}

.blog-search-bar .search-inputs {
    flex-direction: row;
    align-items: center;
    gap: 15px;
}

/* Ajuste de scroll para herramientas en formato carrusel */
#tools-carousel .tool-card {
    transition: transform 0.3s ease, border-color 0.3s ease;
}

#tools-carousel .tool-card:hover {
    border-color: var(--primary);
    transform: translateY(-5px);
}


/* Listado de secciones en barra de búsqueda */
.search-quick-links {
    margin-top: 15px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.quick-links-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.quick-links-items {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 5px; /* Espacio para el scroll en móvil */
    scrollbar-width: none; /* Ocultar scroll en Firefox */
}

.quick-links-items::-webkit-scrollbar {
    display: none; /* Ocultar scroll en Chrome/Safari */
}

.quick-link-tag {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background-color: var(--bg-body);
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
    transition: var(--transition);
    white-space: nowrap;
}

.quick-link-tag svg {
    color: var(--text-muted);
    transition: var(--transition);
}

.quick-link-tag:hover {
    background-color: var(--primary);
    color: white;
    border-color: var(--primary);
}

.quick-link-tag:hover svg {
    color: white;
}

/* Ajuste responsivo */
@media (max-width: 768px) {
    .search-quick-links {
        flex-direction: column;
        align-items: flex-start;
    }
    .quick-links-items {
        width: 100%;
    }
}

/* ==========================================
   ESTILOS HERRAMIENTA: SIMULADOR HIPOTECARIO
   ========================================== */

.simulator-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 30px;
    margin: 40px auto 80px;
}

@media (min-width: 992px) {
    .simulator-layout {
        grid-template-columns: 320px 1fr;
    }
}

/* Barra de Indicadores (UF, IPC) */
.indicators-bar {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.ind-pill {
    background-color: var(--bg-surface);
    border: 1px solid var(--border);
    padding: 10px 15px;
    border-radius: 30px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
}

.ind-pill input {
    border: none;
    background: transparent;
    color: var(--primary);
    font-weight: 700;
    width: 80px;
    outline: none;
    font-size: 1rem;
}

/* Barra de herramientas de resultados */
.results-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

/* Switch de Moneda (CLP / UF) */
.currency-toggle {
    display: flex;
    background: var(--bg-body);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
}
.currency-toggle label { cursor: pointer; }
.currency-toggle input { display: none; }
.currency-toggle span {
    display: inline-block;
    padding: 8px 16px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    transition: var(--transition);
}
.currency-toggle input:checked + span {
    background-color: var(--primary);
    color: white;
}

/* Tarjeta Principal de Resultados */
.main-kpi-card {
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    color: white;
    padding: 40px 30px;
    border-radius: var(--radius-lg);
    text-align: center;
    margin-bottom: 30px;
    box-shadow: var(--shadow-lg);
}

.kpi-title {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    opacity: 0.8;
    margin-bottom: 15px;
    font-weight: 600;
}

.kpi-value {
    font-size: 3rem;
    font-weight: 800;
    line-height: 1;
}

.kpi-sub {
    font-size: 1.1rem;
    opacity: 0.8;
    margin-top: 10px;
    font-weight: 500;
}

/* Grilla de Métricas Secundarias */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.metric-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border);
    padding: 20px;
    border-radius: var(--radius-md);
    text-align: center;
}

.metric-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 8px;
    font-weight: 600;
}

.metric-card .met-val {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-main);
}

/* Tablas de Amortización */
.data-table-container {
    background-color: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    margin-bottom: 30px;
    overflow: hidden;
}

.table-title {
    padding: 20px;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-main);
    border-bottom: 1px solid var(--border);
    background-color: rgba(0,0,0,0.02);
}

.dark-mode .table-title { background-color: rgba(255,255,255,0.02); }

.scrollable-table {
    max-height: 400px;
    overflow-y: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.data-table th, .data-table td {
    padding: 15px 20px;
    border-bottom: 1px solid var(--border);
    font-size: 0.8rem;
}

.data-table th {
    background-color: var(--bg-body);
    font-weight: 600;
    color: var(--text-muted);
    position: sticky;
    top: 0;
    z-index: 10;
}

.data-table td { color: var(--text-main); }
.data-table tr:hover td { background-color: rgba(37, 99, 235, 0.03); }
.data-table tr:last-child td { border-bottom: none; }




/* ==========================================
   ESTILOS HERRAMIENTA: EVALUADOR RENTABILIDAD
   ========================================== */

/* Layout específico que previene desbordamiento horizontal */
.rentabilidad-layout {
    display: flex;
    flex-direction: column;
    gap: 30px;
    margin: 40px auto 80px;
    width: 100%;
}

@media (min-width: 992px) {
    .rentabilidad-layout {
        display: grid;
        /* El formulario toma 350px, los resultados toman el resto. minmax previene desbordes */
        grid-template-columns: 350px minmax(0, 1fr); 
    }
}

.rentabilidad-layout > * {
    min-width: 0; /* CRÍTICO: Evita que el contenedor crezca más allá de la pantalla en móviles */
}

/* Estilos de formulario compactos */
.section-label {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--primary);
    margin: 25px 0 15px;
    padding-bottom: 5px;
    border-bottom: 1px solid var(--border);
}

.form-card > .section-label:first-child { margin-top: 0; }

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.form-grid .full { grid-column: 1 / -1; }

.form-grid label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 5px;
}

.form-grid input[type="number"] {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background-color: var(--bg-body);
    color: var(--text-main);
    outline: none;
    font-family: inherit;
    min-width: 0; /* Previene desborde horizontal */
}

.form-grid input[type="tel"] {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background-color: var(--bg-body);
    color: var(--text-main);
    outline: none;
    font-family: inherit;
    min-width: 0; /* Previene desborde horizontal */
}



/* El Input Group solicitado */
.input-group {
    display: flex;
    border: 1px solid var(--border);
    border-radius: 8px;
    background-color: var(--bg-body);
    overflow: hidden;
}

.input-group input {
    flex: 1;
    min-width: 0; /* Fundamental para pantallas pequeñas */
    border: none !important;
    border-radius: 0 !important;
}

.input-group select {
    width: 65px;
    flex-shrink: 0;
    border: none;
    border-left: 1px solid var(--border);
    background: var(--bg-surface);
    color: var(--text-main);
    padding: 0 5px;
    outline: none;
    font-size: 0.8rem;
    font-family: inherit;
    cursor: pointer;
}

/* Grilla de KPIs de Rentabilidad */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.kpi-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border);
    padding: 15px;
    border-radius: var(--radius-md);
    text-align: center;
    position: relative;
    box-shadow: var(--shadow-sm);
}

.kpi-card .kpi-title {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-muted);
    display: block;
    margin-bottom: 8px;
    text-transform: uppercase;
}

.kpi-card .kpi-value {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--primary);
}

.kpi-card .kpi-sub {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 5px;
}

/* Tooltips */
.tooltip-text {
    display: none;
}
.kpi-card:hover .tooltip-text {
    display: block;
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--text-main);
    color: var(--bg-surface);
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.75rem;
    width: 200px;
    z-index: 100;
    box-shadow: var(--shadow-lg);
    pointer-events: none;
    margin-bottom: 5px;
}

/* Control de Tabla: Permite Scroll Horizontal SOLO aquí */
.table-scroll {
    overflow-x: auto;
    width: 100%;
    -webkit-overflow-scrolling: touch;
    display: block;
}

/* Estilos de bordes para KPIs finales */
.border-top-secondary { border-top: 3px solid #10b981; }
.border-top-accent { border-top: 3px solid #f59e0b; }


/* ==========================================
   ESTILOS HERRAMIENTA: COMPARADOR PROYECTOS
   ========================================== */

/* Contenedor principal: hasta 85% de ancho en escritorio */
.comparador-wrapper {
    width: 100%;
    max-width: 85%;
    margin: 40px auto 80px;
    padding: 0 20px;
}

@media (max-width: 1200px) {
    .comparador-wrapper {
        max-width: 100%;
    }
}

/* Barra superior de configuración global */
.config-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 20px;
    background-color: var(--bg-surface);
    padding: 20px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    margin-bottom: 30px;
    box-shadow: var(--shadow-sm);
}

.config-item {
    display: flex;
    align-items: center;
    gap: 10px;
}

.config-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-muted);
    white-space: nowrap;
}

.config-input {
    width: 100px;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background-color: var(--bg-body);
    color: var(--text-main);
    font-weight: 700;
    outline: none;
    transition: var(--transition);
    min-width: 0; /* Previene desbordamiento */
    
    /* CORRECCIONES PARA SAFARI / iOS */
    -webkit-appearance: none;
    appearance: none;
    font-family: inherit;
    font-size: 16px; /* Evita que el iPhone haga zoom al hacer tap */
    margin: 0;
}

.config-input:focus {
    border-color: var(--primary);
}

/* Opcional: Ocultar las flechas nativas del input number en Safari/Chrome para un look más limpio */
.config-input::-webkit-outer-spin-button,
.config-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}


@media (max-width: 768px) {
    .config-bar {
        flex-direction: column; /* Apila los elementos verticalmente */
        align-items: stretch; /* Hace que ocupen todo el ancho disponible */
        gap: 15px;
    }

    .config-item {
        width: 100%;
        justify-content: space-between; /* Separa el label (izquierda) del input (derecha) */
    }

    .config-input {
        width: 120px; /* Un poco más de espacio para facilitar el "tap" con el dedo */
        text-align: right; /* Alinea los números a la derecha dentro de la caja */
    }
}

/* Grilla de los 3 proyectos (Evita desborde horizontal) */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.project-card {
    min-width: 0; /* CRÍTICO: Previene el desborde en móviles */
    padding: 25px 20px;
}

.project-card .filter-label {
    font-size: 0.8rem;
}

/* Estilos de la Tabla de Comparación generada por JS */
.data-table .section-header td {
    background-color: var(--bg-body);
    font-weight: 700;
    color: var(--primary);
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 1px;
    padding-top: 30px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--border);
}

.data-table td.bg-winner {
    background-color: rgba(34, 197, 94, 0.05);
    border-left: 3px solid #22c55e;
}

.dark-mode .data-table td.bg-winner {
    background-color: rgba(34, 197, 94, 0.1);
}

.td-content {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: flex-start;
}

/* Insignias de Podio */
.podium {
    font-size: 0.75rem;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 12px;
    display: inline-block;
    white-space: nowrap;
}

.podium-1 { background-color: #fef08a; color: #854d0e; } /* Oro */
.podium-2 { background-color: #e2e8f0; color: #475569; } /* Plata */
.podium-3 { background-color: #fed7aa; color: #9a3412; } /* Bronce */

.dark-mode .podium-1 { background-color: rgba(234, 179, 8, 0.2); color: #fde047; }
.dark-mode .podium-2 { background-color: rgba(148, 163, 184, 0.2); color: #cbd5e1; }
.dark-mode .podium-3 { background-color: rgba(249, 115, 22, 0.2); color: #fdba74; }



/* ==========================================
   ESTILOS PÁGINA: HERRAMIENTAS DE ANÁLISIS
   ========================================== */

/* Panel del Pulso de Mercado */
.market-pulse-wrapper {
    background-color: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 30px;
    margin-bottom: 50px;
    box-shadow: var(--shadow-sm);
}

.pulse-category-title {
    font-size: 0.85rem;
    font-weight: 800;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 1px;
    margin: 25px 0 15px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 8px;
}

.pulse-category-title:first-child { margin-top: 0; }

.pulse-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 15px;
}

.pulse-card {
    background-color: var(--bg-body);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 15px;
    display: flex;
    flex-direction: column;
    transition: var(--transition);
}

.pulse-card:hover {
    border-color: var(--primary);
}

.pulse-name { font-size: 0.85rem; font-weight: 700; color: var(--text-main); }
.pulse-value { font-size: 1.3rem; font-weight: 800; color: var(--primary); margin: 5px 0 2px; }
.pulse-sub { font-size: 0.75rem; color: var(--text-muted); }

/* Grilla de Herramientas */
.tools-page-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 30px;
    margin-bottom: 80px;
}

.tool-card-pro {
    display: flex;
    flex-direction: column;
    height: 100%;
    text-decoration: none;
    transition: transform 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

.tool-card-pro:hover {
    border-color: var(--primary);
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.tool-header-flex {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
}

.tool-icon-box {
    width: 50px;
    height: 50px;
    background-color: rgba(37, 99, 235, 0.1);
    color: var(--primary);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.tool-card-pro:hover .tool-icon-box {
    background-color: var(--primary);
    color: white;
}

.tool-header-flex h2 {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--text-main);
}

.tool-tags {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 15px;
}

.tool-tag {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    padding: 4px 10px;
    border-radius: 20px;
    background-color: var(--bg-body);
    color: var(--text-muted);
    border: 1px solid var(--border);
}

.tool-desc {
    font-size: 0.95rem;
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: 25px;
    flex-grow: 1;
}   


/* ==========================================
   ESTILOS HERRAMIENTA: PLANIFICADOR TRIBUTARIO
   ========================================== */

/* Contenedor principal al 75% en escritorio */
.planificador-wrapper {
    width: 100%;
    max-width: 75%;
    margin: 40px auto 80px;
    padding: 0 20px;
}

@media (max-width: 1200px) {
    .planificador-wrapper { max-width: 95%; }
}

/* Layout responsivo que previene desborde */
.planificador-layout {
    display: flex;
    flex-direction: column;
    gap: 30px;
    width: 100%;
}

@media (min-width: 992px) {
    .planificador-layout {
        display: grid;
        grid-template-columns: minmax(0, 1fr) 380px; /* Columna derecha fija, izquierda fluida */
        align-items: start;
    }
}

.planificador-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 20px;
}



.planificador-layout > * {
    min-width: 0; /* CRÍTICO: Previene que el grid rompa el ancho en móviles */
}

/* Indicadores y Alertas debajo de los inputs */
.tax-indicator {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 6px;
    display: block;
    line-height: 1.4;
}

.tax-indicator.text-success { color: #10b981; font-weight: 600; }
.tax-indicator.text-muted { opacity: 0.8; }

.limit-alert {
    font-size: 0.75rem;
    color: #ef4444; /* Rojo peligro */
    display: none; /* Controlado por JS */
    margin-top: 4px;
    font-weight: 600;
}

/* Caja de Resultados Flotante */
.result-box {
    background-color: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 25px;
    position: sticky;
    top: 90px;
    box-shadow: var(--shadow-lg);
}

.result-box-header {
    background-color: var(--primary);
    color: white;
    margin: -25px -25px 20px -25px;
    padding: 15px 25px;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    font-weight: 700;
    font-size: 1.1rem;
    text-align: center;
}

.result-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    font-size: 0.9rem;
    color: var(--text-muted);
    gap: 15px;
}

.result-row strong {
    color: var(--text-main);
    font-weight: 700;
    white-space: nowrap;
}

/* Clases utilitarias inyectadas por el HTML/JS original */
.text-danger, .text-danger strong { color: #ef4444 !important; }
.text-success, .text-success strong { color: #10b981 !important; }
.text-primary, .text-primary strong { color: var(--primary) !important; }

hr.result-divider {
    border: 0;
    border-top: 1px solid var(--border);
    margin: 15px 0;
}

.res-final-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
}

.res-final-row h4 {
    font-size: 1.2rem;
    margin: 0;
    color: var(--text-main);
    font-weight: 800;
}

#res-final {
    font-size: 1.6rem;
    font-weight: 900;
}

/* Clases Dinámicas inyectadas por JS para el resultado */
.text-dev { color: #10b981 !important; }
.text-pay { color: #ef4444 !important; }

.badge {
    font-size: 0.7rem;
    font-weight: 800;
    padding: 6px 12px;
    border-radius: 6px;
    color: white;
    display: inline-block;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.bg-danger { background-color: #ef4444; }
.bg-success { background-color: #10b981; }
.bg-secondary { background-color: #64748b; }



/* ==========================================
   ESTILOS PÁGINA: BÚSQUEDA Y FILTROS
   ========================================== */

/* Layout principal: Sidebar + Resultados */
.search-layout {
    display: flex;
    flex-direction: column;
    gap: 30px;
    margin-bottom: 80px;
}

@media (min-width: 992px) {
    .search-layout {
        display: grid;
        grid-template-columns: 280px minmax(0, 1fr);
        align-items: start;
    }
}

/* Barra de búsqueda superior */
.top-search-bar {
    background-color: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    padding: 30px 0;
    margin-bottom: 30px;
    box-shadow: var(--shadow-sm);
}

.top-search-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
    align-items: end;
}

@media (min-width: 768px) {
    .top-search-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 992px) {
    .top-search-grid { grid-template-columns: 1.5fr 1.5fr 2fr auto; }
}

/* Autocompletado */
.results-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background-color: var(--bg-surface);
    border: 1px solid var(--border);
    border-top: none;
    border-radius: 0 0 var(--radius-md) var(--radius-md);
    z-index: 1050;
    display: none;
    box-shadow: var(--shadow-md);
    overflow: hidden;
}

.result-item {
    padding: 10px 15px;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
    color: var(--text-main);
    transition: var(--transition);
}

.result-item:last-child { border-bottom: none; }
.result-item:hover { background-color: var(--bg-body); color: var(--primary); }
.result-item .small { font-size: 0.85rem; font-weight: 700; }
.result-item .text-muted { font-size: 0.75rem; color: var(--text-muted); display: block; }

/* Sidebar de Filtros */
.sidebar-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 10px;
}

.sidebar-uf {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
}

/* Pills de filtros activos */
#activeFiltersPills {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 15px;
}

.filter-pill, .sort-pill {
    background-color: rgba(37, 99, 235, 0.1);
    color: var(--primary);
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    text-decoration: none;
    border: 1px solid rgba(37, 99, 235, 0.2);
    transition: var(--transition);
}

.filter-pill:hover, .sort-pill:hover {
    background-color: var(--primary);
    color: white;
}

/* Secciones de filtros */
.filter-section {
    padding: 15px 0;
    border-bottom: 1px solid var(--border);
}
.filter-section:last-child { border-bottom: none; padding-bottom: 0; }

.filter-section-title {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.filter-badge {
    background-color: var(--primary);
    color: white;
    font-size: 0.6rem;
    padding: 2px 6px;
    border-radius: 10px;
}

.btn-sidebar-apply {
    width: 100%;
    padding: 6px;
    margin-top: 5px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--primary);
    background: transparent;
    border: 1px solid var(--primary);
    border-radius: 6px;
    cursor: pointer;
    transition: var(--transition);
}
.btn-sidebar-apply:hover { background-color: var(--primary); color: white; }

/* Cabecera de resultados */
.results-header-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--bg-surface);
    padding: 15px 20px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    margin-bottom: 20px;
}

.results-header-info h2 { font-size: 1rem; color: var(--text-main); }
.results-header-info span { color: var(--text-muted); font-size: 0.85rem; }

/* Estado vacío */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    background-color: var(--bg-surface);
    border: 2px dashed var(--border);
    border-radius: var(--radius-lg);
}

/* Adaptación de la paginación de Laravel Bootstrap 5 */
.pagination {
    display: flex;
    justify-content: center;
    list-style: none;
    padding: 0;
    gap: 5px;
    margin-top: 40px;
}

.pagination .page-item .page-link {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 35px;
    height: 35px;
    padding: 0 10px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background-color: var(--bg-surface);
    color: var(--text-main);
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    transition: var(--transition);
}

.pagination .page-item:not(.disabled) .page-link:hover {
    border-color: var(--primary);
    color: var(--primary);
    background-color: rgba(37, 99, 235, 0.05);
}

.pagination .page-item.active .page-link {
    background-color: var(--primary);
    color: white;
    border-color: var(--primary);
}

.pagination .page-item.disabled .page-link {
    opacity: 0.5;
    cursor: not-allowed;
    background-color: var(--bg-body);
}

/* Estado de carga */
body.filtering { opacity: 0.6; pointer-events: none; transition: opacity 0.2s; }

/* Sobrescritura para asegurar que el fondo cambie en modo oscuro */
html[data-theme="dark"] .form-card, 
body.dark-mode .form-card, 
.dark .form-card {
    background-color: var(--card-bg) !important;
}

/* ==========================================
   ESTILOS HERRAMIENTA: EVALUADOR AIRBNB
   ========================================== */

/* Layout específico que previene desbordamiento horizontal */
.airbnb-layout {
    display: flex;
    flex-direction: column;
    gap: 30px;
    width: 100%;
}

@media (min-width: 992px) {
    .airbnb-layout {
        display: grid;
        grid-template-columns: 350px minmax(0, 1fr); 
        align-items: start;
    }
}

.airbnb-layout > * {
    min-width: 0; /* CRÍTICO: Previene el desborde horizontal en móviles */
}

/* Colores temáticos Airbnb */
.color-airbnb { color: #ff385c; }
.bg-airbnb { background-color: #ff385c; color: white; border-color: #ff385c; }
.bg-airbnb:hover { background-color: #e21b4d; border-color: #e21b4d; }

.border-top-airbnb { border-top: 4px solid #ff385c; }
.border-top-danger { border-top: 4px solid #ef4444; }

/* Estilos de Tabla de Desglose */
.table-breakdown {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    min-width: 500px; /* Para forzar scroll en móviles muy pequeños */
}

.table-breakdown td {
    padding: 12px 20px;
    border-bottom: 1px solid var(--border);
    font-size: 0.95rem;
    color: var(--text-main);
}

.table-breakdown td:last-child {
    text-align: right;
    font-family: monospace;
    font-size: 1.05rem;
}

.table-breakdown tr:hover td { background-color: rgba(37, 99, 235, 0.03); }

/* Filas especiales */
.tax-row td { color: #ef4444; }
.total-row td { font-weight: 700; background-color: rgba(0,0,0,0.02); }
.dark-mode .total-row td { background-color: rgba(255,255,255,0.02); }
.profit-row td { font-weight: 800; font-size: 1.15rem; border-bottom: none; }

/* ==========================================
   ESTILOS HERRAMIENTA: EVALUADOR FLIPPING
   ========================================== */

/* Layout principal */
.flipping-layout {
    display: flex;
    flex-direction: column;
    gap: 30px;
    width: 100%;
}

@media (min-width: 992px) {
    .flipping-layout {
        display: grid;
        grid-template-columns: 350px minmax(0, 1fr); 
        align-items: start;
    }
}

.flipping-layout > * {
    min-width: 0; /* CRÍTICO: Previene el desborde horizontal en móviles */
}

/* Tarjeta Destacada MAO (Regla del 70%) */
.mao-card {
    background-color: var(--bg-body);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 25px;
    margin-bottom: 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    box-shadow: var(--shadow-sm);
}

.mao-status {
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: 700;
    font-size: 0.95rem;
    text-align: center;
}

/* Grilla para las Tablas de Resumen */
.summary-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

@media (min-width: 1200px) {
    .summary-grid {
        grid-template-columns: 1fr 1fr;
    }
}

.summary-grid .table-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-main);
    background-color: var(--bg-body);
    padding: 15px 20px;
    border-bottom: 1px solid var(--border);
}

/* Grilla de 3 columnas para formularios */
    .grid-amenities-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 15px; }
    
    /* Grilla de 4 columnas para la vista pública */
    .grid-amenities-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 15px; }

    /* Adaptación para pantallas más pequeñas (Tablets y Celulares) */
    @media (max-width: 991px) {
        .grid-amenities-3, .grid-amenities-4 { grid-template-columns: repeat(2, 1fr); }
    }
    @media (max-width: 480px) {
        .grid-amenities-3, .grid-amenities-4 { grid-template-columns: 1fr; }
    }