/* Variables y Reseteo */
:root {
    --primary-color: #2c3e50;
    --accent-color: #e74c3c;
    --text-color: #333;
    --bg-color: #f4f4f4;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

html { scroll-behavior: smooth; }

/* Navegación */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fff;
    padding: 1rem 5%;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: fixed;
    width: 100%;
    z-index: 1000;
}

.logo {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary-color);
}

.logo span { color: var(--accent-color); }

.nav-links {
    list-style: none;
    display: flex;
}

.nav-links li { margin-left: 20px; }

.nav-links a {
    text-decoration: none;
    color: var(--primary-color);
    font-weight: 500;
    transition: color 0.3s;
}

.nav-links a:hover { color: var(--accent-color); }

.menu-toggle { display: none; cursor: pointer; }
.bar { display: block; width: 25px; height: 3px; margin: 5px auto; background-color: var(--primary-color); }

/* Hero Section */
.hero {
    height: 100vh;
    background: linear-gradient(rgba(44, 62, 80, 0.7), rgba(44, 62, 80, 0.7)), url('../assets/img/hero-bg.jpg') center/cover;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    color: #fff;
    padding: 0 20px;
}

.hero-content h1 { font-size: 3rem; margin-bottom: 15px; }
.hero-content p { font-size: 1.2rem; margin-bottom: 25px; }

/* Botones */
.btn {
    background: var(--accent-color);
    color: #fff;
    padding: 10px 20px;
    text-decoration: none;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
    transition: background 0.3s;
}

.btn:hover { background: #c0392b; }

.btn-outline {
    background: transparent;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
    padding: 8px 15px;
    border-radius: 5px;
    cursor: pointer;
    transition: 0.3s;
    width: max-content;
}

.btn-outline:hover { background: var(--primary-color); color: #fff; }

/* Propiedades */
.properties, .contact { padding: 80px 5%; text-align: center; }
.properties h2, .contact h2 { margin-bottom: 40px; color: var(--primary-color); }

.property-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
}

.property-card {
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    transition: transform 0.3s;
    display: flex;
    flex-direction: column;
}

.property-card:hover { transform: translateY(-10px); }

/* Carrusel de Imágenes y Formato 800x600 */
.carousel {
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    background-color: #e9ecef;
}

.carousel-item {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 0.8s ease-in-out;
}

.carousel-item.active {
    opacity: 1;
}

.static-img {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
}

/* Tipografía de la Tarjeta */
.property-info { 
    padding: 20px; 
    text-align: left; 
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.property-info h3 {
    font-size: 1.3rem;
    line-height: 1.2;
    margin-bottom: 5px;
    color: var(--primary-color);
}

.property-info .location {
    font-size: 0.9rem;
    font-weight: 600;
    color: #555;
    margin-bottom: 8px;
}

.property-info .description {
    font-size: 0.85rem;
    color: #666;
    line-height: 1.4;
    margin-bottom: 15px;
}

.price { 
    color: var(--accent-color); 
    font-size: 1.2rem; 
    font-weight: bold; 
    margin-bottom: 5px; 
}

.property-info .specs {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--primary-color);
    margin-bottom: 15px;
    padding-top: 10px;
    border-top: 1px solid #eee;
}

/* Contacto */
#contact-form {
    max-width: 600px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

#contact-form input, #contact-form textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-size: 1rem;
}

/* Footer */
footer { background: var(--primary-color); color: #fff; text-align: center; padding: 20px; }

/* Responsive */
@media (max-width: 768px) {
    .nav-links {
        display: none;
        flex-direction: column;
        position: absolute;
        top: 60px;
        left: 0;
        width: 100%;
        background: #fff;
        text-align: center;
        padding: 20px 0;
        box-shadow: 0 5px 10px rgba(0,0,0,0.1);
    }
    .nav-links.active { display: flex; }
    .nav-links li { margin: 10px 0; }
    .menu-toggle { display: block; }
}
/* Slider Horizontal de Propiedades */
.slider-wrapper {
position: relative;
    display: flex;
    align-items: center;
    max-width: 800px; /* Contenedor más estrecho para centrar una sola propiedad */
    margin: 0 auto;
    padding: 0 50px; /* Espacio para que las flechas no tapen la imagen */
}
.property-slider {
   display: flex;
    gap: 0; /* Quitamos el espacio entre tarjetas para un salto exacto */
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    padding-bottom: 20px;
    width: 100%;
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* Ocultar la barra de scroll nativa para un diseño más limpio */
.property-slider::-webkit-scrollbar {
    display: none;
}
.property-slider {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.slider-card {
  min-width: 100%; /* Cada tarjeta ocupa exactamente el 100% de la vista */
    flex: 0 0 100%;
    scroll-snap-align: center; /* Centra perfectamente la tarjeta al detenerse */
    padding: 0 10px; /* Margen interior ligero para separar visualmente */
    box-sizing: border-box;
}

/* Flechas del Slider */
.slider-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 1.2rem;
    cursor: pointer;
    position: absolute;
    z-index: 10;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
    transition: background 0.3s;
}

.slider-btn:hover {
    background: var(--accent-color);
}

.left-btn { left: 0; }
.right-btn { right: 0; }

/* Ocultar flechas en celulares (deslizarán con el dedo) */
@media (max-width: 768px) {
    .slider-btn { display: none; }
    .slider-wrapper { padding: 0 10px; }
}
/* Pantalla de Carga (Preloader) */
#preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #ffffff;
    z-index: 9999; /* Asegura que esté por encima de todo */
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 0.6s ease-out, visibility 0.6s ease-out;
}

.loader-content {
    text-align: center;
    color: var(--primary-color);
}

/* Animación de dibujado de la casa */
.house-icon {
    width: 80px;
    height: 80px;
    stroke: var(--accent-color);
    stroke-dasharray: 100;
    stroke-dashoffset: 100;
    animation: drawHouse 2s ease-in-out infinite alternate;
}

@keyframes drawHouse {
    0% { stroke-dashoffset: 100; fill: transparent; }
    50% { stroke-dashoffset: 0; fill: transparent; }
    100% { stroke-dashoffset: 0; fill: rgba(231, 76, 60, 0.1); }
}

/* Animación del texto */
.loading-text {
    margin-top: 15px;
    font-size: 1.2rem;
    font-weight: 600;
    letter-spacing: 1px;
    animation: pulseText 1.5s infinite;
}

@keyframes pulseText {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

/* Clase que JavaScript agregará para ocultar la pantalla */
.preloader-hidden {
    opacity: 0;
    visibility: hidden;
}

/* --- VENTANA MODAL (Estilo Inmuebles24) --- */
.modal-overlay {
    display: none; /* Oculto por defecto */
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background-color: rgba(0,0,0,0.8);
    z-index: 2000;
    overflow-y: auto;
    backdrop-filter: blur(5px);
}

.modal-content {
    background-color: #fff;
    margin: 40px auto;
    width: 90%;
    max-width: 1200px;
    border-radius: 12px;
    position: relative;
    padding: 30px;
    box-shadow: 0 15px 30px rgba(0,0,0,0.3);
}

.close-modal {
    position: absolute;
    top: 10px; 
    right: 20px;
    font-size: 35px; /* Un poco más grande para facilitar el clic */
    font-weight: bold;
    color: #666; 
    cursor: pointer;
    transition: 0.3s;
    z-index: 50; /* Fuerza a la X a estar por encima de cualquier otro elemento */
}
.close-modal:hover { color: #e74c3c; }

/* Layout en 2 columnas */
.modal-body {
    display: flex; gap: 40px; margin-top: 10px;
}
.modal-left { flex: 1; }
.modal-right { width: 350px; }

/* Galería Asimétrica */

.modal-gallery {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 10px; 
    margin-bottom: 25px; 
    height: 400px;
    overflow: hidden;
}

.modal-gallery img {
    width: 100%; 
    height: 100%; 
    max-height: 100%;
    min-height: 0; /* SOLUCIÓN: Obliga a la foto a respetar el límite de la cuadrícula */
    object-fit: cover; 
    border-radius: 8px;
    display: block;
}

.modal-gallery-side {
    display: grid; 
    grid-template-rows: 1fr 1fr; 
    gap: 10px;
    height: 100%;
    overflow: hidden;
}
/* Textos e Íconos */
.modal-location { color: #7f8c8d; font-size: 0.95rem; margin-bottom: 5px; }
.modal-title { color: #2c3e50; font-size: 1.8rem; margin-bottom: 15px; }
.modal-price { color: #e74c3c; font-size: 1.6rem; margin-bottom: 30px; }

.modal-icons {
    display: flex; justify-content: space-between;
    border-top: 1px solid #eee; border-bottom: 1px solid #eee;
    padding: 20px 0; margin-bottom: 30px; text-align: center;
}
.icon-box span { font-weight: bold; font-size: 1.1rem; color: #2c3e50; }
.icon-box small { color: #7f8c8d; }

.modal-description h4 { color: #2c3e50; margin-bottom: 15px; font-size: 1.2rem; }
.modal-description p { color: #555; line-height: 1.6; white-space: pre-line; }

/* Formulario Fijo (Sticky) */
.contact-box-sticky {
    position: sticky; 
    top: 40px; /* Al hacer scroll, se detendrá más abajo */
    margin-top: 35px; /* Empuja el formulario hacia abajo para liberar la X */
    background: #f8f9fa; 
    padding: 25px;
    border-radius: 12px; 
    border: 1px solid #e0e0e0;
}
.contact-box-sticky h3 { font-size: 1.2rem; margin-bottom: 10px; color: #333; }
.anunciante-info { margin-bottom: 20px; color: #555; font-size: 0.9rem; }
#modal-form input, #modal-form textarea {
    width: 100%; padding: 12px; margin-bottom: 15px;
    border: 1px solid #ccc; border-radius: 6px; font-family: inherit;
}
.btn-wa {
    width: 100%; background: #25D366; color: white;
    padding: 15px; border: none; border-radius: 6px;
    font-size: 1rem; font-weight: bold; cursor: pointer; transition: 0.3s;
}
.btn-wa:hover { background: #1ebe57; }

/* Responsive para celulares */
@media (max-width: 900px) {
    .modal-body { flex-direction: column; }
    .modal-right { width: 100%; }
    .modal-gallery { grid-template-columns: 1fr; grid-template-rows: auto; height: auto; }
    .modal-gallery-side { display: none; } /* Oculta secundarias en móvil para ahorrar espacio */
    .img-main { height: 250px; }
    .modal-icons { flex-wrap: wrap; gap: 15px; justify-content: center; }
    .icon-box { width: 45%; }
}
/* --- VISOR DE FOTOS EN PANTALLA COMPLETA (LIGHTBOX) --- */
.lightbox-overlay {
    display: none; /* Oculto por defecto */
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background-color: rgba(0,0,0,0.95);
    z-index: 3000; /* Siempre por encima del modal blanco */
    justify-content: center;
    align-items: center;
    flex-direction: column;
}

.lightbox-img {
    max-width: 90%;
    max-height: 85vh;
    object-fit: contain; /* Ajusta la foto completa sin recortarla */
    border-radius: 4px;
    user-select: none;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
}

.close-lightbox {
    position: absolute;
    top: 20px; right: 30px;
    color: white; font-size: 40px; cursor: pointer;
    transition: color 0.3s;
}
.close-lightbox:hover { color: #e74c3c; }

.lb-btn {
    position: absolute; top: 50%;
    transform: translateY(-50%);
    background: rgba(255,255,255,0.1);
    color: white; border: none; font-size: 30px;
    padding: 15px 20px; cursor: pointer;
    border-radius: 5px;
    transition: 0.3s;
}
.lb-btn:hover { background: rgba(255,255,255,0.4); }
.lb-prev { left: 20px; }
.lb-next { right: 20px; }

.lightbox-counter {
    color: white; margin-top: 15px; font-size: 1.1rem; letter-spacing: 2px;
}

/* Indicador de que las fotos del modal son cliqueables */
.modal-gallery img { cursor: pointer; transition: opacity 0.2s; }
.modal-gallery img:hover { opacity: 0.8; }