/* ===================== VARIABLES ===================== */
:root {
    --primary: #292C65;
    --primary-rgb: 41, 44, 101;
    --secondary: #fbcc01;
    --secondary-dark: #ffd500b2;
    --light-bg: #141B2D;
    --accent: #25d366;
    --font-main: 'Segoe UI', Arial, sans-serif;
    --radius: 18px;
    --shadow: 0 4px 24px rgba(24,58,109,0.18);
    --shadow-hover: 0 8px 32px rgba(24,58,109,0.25);
    --transition: 0.25s cubic-bezier(.4,0,.2,1);
}

/* ===================== BASE ===================== */
html {
    font-size: 18px;
    scroll-behavior: smooth;
}
body {
    font-family: var(--font-main);
    color: #f5f5f5;
    margin: 0;
    padding: 0;
    min-height: 100vh;
    /* Necesario para posicionar el pseudo-elemento del fondo */
    position: relative;
    z-index: 1;
}
/* Se crea una capa para la imagen de fondo con transparencia */
body::before {
    content: "";
    position: fixed; /* Mantiene el fondo fijo al hacer scroll (efecto parallax) */
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url('../img/bg-inmobiliaria.jpg') center/cover no-repeat;
    /* Ajusta la transparencia aquí. 0.15 es 15% de opacidad. */
    opacity: 0.30;
    /* Coloca el fondo detrás del contenido */
    z-index: -1;
}
a {
    color: var(--secondary);
    text-decoration: none;
    transition: color var(--transition);
}
a:hover {
    color: var(--secondary-dark);
}

/* ===================== HEADER ===================== */
.main-header {
    width: 100%;
    position: sticky;
    top: 0;
    z-index: 1000;
    background-color: rgb(255, 255, 255); /* ajusta el alpha (0.0 - 1.0) según prefieras */
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    box-shadow: 0 2px 12px rgba(24,58,109,0.10);
    border-bottom: 3px solid #FFD700;
    font-family: "Lucida Bright", "Lucida Bright MT", "Lucida Serif", serif;
}
.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1300px;
    margin: 0 auto;
    padding: 0.7rem 2rem 0.7rem 1rem;
}
.header-logo-title {
    display: flex;
    align-items: center;
    gap: 1.2rem;
}
.logo-link {
    display: block;
}
.nav-logo {
    height: 60px;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 2px 8px rgba(24,58,109,0.10);
    display: block;
    transition: transform .3s;
}
.nav-logo:hover {
    transform: scale(1.07) rotate(-2deg);
}
.header-title {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.1rem;
}
.brand-main {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: 1px;
    line-height: 1;
    text-shadow: 0 2px 8px rgba(24,58,109,0.10);
}
.brand-main .plus {
    color: var(--secondary);
    font-size: 2.1rem;
    font-weight: 900;
    text-shadow: 0 2px 8px rgba(24,58,109,0.10);
}
.brand-sub, .brand-descriptor {
    font-size: 1.05rem;
    color: var(--primary);
    font-weight: 500;
    letter-spacing: 1px;
    margin-top: 0.1rem;
}
.nav-links {
    display: flex;
    gap: 1.2rem;
    align-items: center;
    margin-left: auto;
}
.nav-button {
    color: var(--primary);
    background: var(--secondary);
    padding: 0.7rem 1.4rem;
    border-radius: 30px;
    border: none;
    font-size: 1.05rem;
    cursor: pointer;
    text-decoration: none;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(24,58,109,0.07);
    transition: background var(--transition), color var(--transition), box-shadow var(--transition), transform var(--transition);
    position: relative;
    overflow: hidden;
}
.nav-button:hover,
.nav-button.active {
    background: #fff;
    color: var(--primary);
    box-shadow: 0 4px 16px rgba(24,58,109,0.13);
    transform: translateY(-2px) scale(1.04);
}
.nav-button:focus {
    outline: 2px solid var(--secondary-dark);
}
.nav-toggle {
    display: none; /* Oculto en escritorio */
    background: none;
    border: none;
    color: var(--primary);
    font-size: 1.8rem;
    cursor: pointer;
    padding: 10px;
    transition: transform 0.3s ease;
    z-index: 2147483646;
}

.nav-toggle:hover {
    transform: scale(1.1);
}

.nav-toggle:active {
    transform: scale(0.95);
}

/* Overlay para el menú móvil */
.nav-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
}

.nav-overlay.show {
    display: block;
}

/* Indicador de scroll para el hero */
.hero-scroll-indicator {
    position: absolute;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    color: white;
    z-index: 10;
    animation: fadeInOut 2s infinite;
}

.hero-scroll-indicator span {
    display: block;
    width: 24px;
    height: 24px;
    border: 2px solid var(--secondary);
    border-radius: 50%;
    margin: 0 auto 0.5rem;
    position: relative;
}

.hero-scroll-indicator span::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 6px;
    height: 6px;
    background: var(--secondary);
    border-radius: 50%;
}

.hero-scroll-indicator p {
    font-size: 0.9rem;
    margin: 0;
    color: var(--secondary);
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

@keyframes fadeInOut {
    0%, 100% { opacity: 0.5; transform: translateX(-50%) translateY(0); }
    50% { opacity: 1; transform: translateX(-50%) translateY(-10px); }
}

/* ===================== HERO ===================== */
.hero-section {
    min-height: 100vh;
    background: transparent;
    position: relative;
    overflow-y: auto;
    overflow-x: hidden;
    scroll-snap-type: y mandatory;
    -webkit-overflow-scrolling: touch;
}

.hero-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(2, 1fr);
    width: 100%;
    gap: 1rem;
    padding: 1rem;
}

.hero-item {
    position: relative;
    overflow: hidden;
    min-height: calc(50vh - 1rem);
    scroll-snap-align: start;
    border-radius: 1rem;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    transition: transform 0.3s ease;
}

.hero-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: absolute;
    top: 0;
    left: 0;
    transition: transform 0.5s ease;
}

.hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 2rem;
    box-sizing: border-box;
    opacity: 1;
    transition: background-color 0.3s ease;
}

.hero-item:hover {
    transform: translateY(-5px);
}

.hero-item:hover .hero-image {
    transform: scale(1.1);
}

.hero-item:hover .hero-overlay {
    background: rgba(0, 0, 0, 0.8);
}

.hero-overlay h2 {
    font-size: 1.8rem;
    margin-bottom: 1rem;
    color: var(--secondary);
    text-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.hero-overlay p {
    font-size: 1.1rem;
    line-height: 1.6;
    margin: 0;
    max-width: 90%;
}

/* ===================== FOOTER ===================== */
footer {
    background: var(--primary);
    color: #fff;
    padding: 2.5rem 0 1rem 0;
    font-size: 1.1rem;
}
.footer-container {
    max-width: 1100px;
    margin: 0 auto;
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
    justify-content: space-between;
    align-items: flex-start;
    padding: 0 1.5rem;
}
.footer-section {
    flex: 1 1 200px;
    min-width: 200px;
    margin-bottom: 1rem;
}
.footer-section h4 {
    font-family: var(--font-main);
    margin-bottom: 0.8rem;
    color: var(--secondary-dark);
    text-align: center;
    font-size: 1.2rem;
}
.footer-section ul {
    list-style: none;
    padding: 0;
    text-align: center;
}
.footer-section ul li {
    margin-bottom: 0.5rem;
}
.footer-section ul li a {
    color: #fff;
    text-decoration: none;
    transition: color 0.2s;
}
.footer-section ul li a:hover {
    color: var(--secondary);
}
.social-links {
    margin-top: 0.5rem;
    text-align: center;
}
.social-links a {
    display: inline-block;
    margin-right: 10px;
    color: #fff;
    font-size: 1.7em;
    transition: color 0.2s, transform 0.2s;
}
.social-links a:hover {
    color: var(--accent);
    transform: scale(1.15) rotate(-5deg);
}
.footer-bottom {
    text-align: center;
    margin-top: 2rem;
    color: #fff;
    font-size: 1rem;
    opacity: 0.8;
}

/* ===================== BOTÓN FLOTANTE WHATSAPP ===================== */
.whatsapp-float {
    position: fixed !important;
    width: 65px;
    height: 65px;
    bottom: 30px;
    left: 30px;
    background: #25d366;
    color: #fff;
    border-radius: 50%;
    text-align: center;
    font-size: 2.5rem;
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.6);
    z-index: 2147483647;
    display: flex !important;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    opacity: 1;
    border: 2px solid rgba(255, 255, 255, 0.9);
    pointer-events: auto !important;
    transform: none !important;
    visibility: visible !important;
}
.whatsapp-float:hover {
    background: #1ebe57;
    box-shadow: 0 4px 16px rgba(0,0,0,0.25);
}
/* Estilos base para el botón de WhatsApp */
.whatsapp-float {
    animation: floatIn 0.5s ease forwards;
    -webkit-tap-highlight-color: transparent; /* Elimina el highlight al tocar en móviles */
    will-change: transform; /* Optimiza las animaciones */
    backface-visibility: hidden; /* Mejora el rendimiento en móviles */
}

/* Efecto hover para dispositivos que lo soportan */
@media (hover: hover) {
    .whatsapp-float:hover {
        background: #1ebe57;
        box-shadow: 0 6px 16px rgba(37, 211, 102, 0.6);
        transform: scale(1.08);
        opacity: 1;
    }
}

/* Efecto activo para dispositivos táctiles */
.whatsapp-float:active {
    background: #1ebe57;
    transform: scale(0.95);
    opacity: 1;
}

/* Animación de entrada */
@keyframes floatIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 0.95;
        transform: translateY(0);
    }
}

/* Ajustes específicos para móviles */
@media (max-width: 600px) {
    .whatsapp-float {
        width: 55px;
        height: 55px;
        font-size: 2.2rem;
        bottom: 20px !important;
        left: 20px !important;
        box-shadow: 0 4px 16px rgba(37, 211, 102, 0.7);
        opacity: 1;
        border: 2px solid rgba(255, 255, 255, 1);
        position: fixed !important;
        visibility: visible !important;
        display: flex !important;
        transform: none !important;
    }
}

/* Asegura que el botón permanezca visible y fijo durante el scroll */
@media screen and (max-width: 600px) and (min-height: 0px) {
    body {
        position: relative;
    }
    
    .whatsapp-float {
        position: fixed !important;
        bottom: 20px !important;
        left: 20px !important;
        visibility: visible !important;
        z-index: 2147483647 !important;
        transform: none !important;
        -webkit-transform: none !important;
        -webkit-backface-visibility: visible !important;
        backface-visibility: visible !important;
    }
}

/* Previene que el botón se oculte en iOS durante el scroll */
@supports (-webkit-overflow-scrolling: touch) {
    .whatsapp-float {
        position: fixed !important;
        transform: none !important;
        -webkit-transform: none !important;
    }
}

/* ===================== RESPONSIVE ===================== */
@media (max-width: 900px) {
    html {
        font-size: 16px;
    }
    .nav-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
        position: relative;
        margin-right: 10px;
    }
    .nav-links {
        position: fixed;
        top: 0;
        left: -100%; /* Cambiado a left para deslizar desde la izquierda */
        width: 280px; /* Ancho fijo para el menú */
        height: 100vh;
        background: #ffffff;
        box-shadow: 2px 0 12px rgba(0,0,0,0.1);
        flex-direction: column;
        justify-content: flex-start;
        align-items: flex-start;
        gap: 0;
        transition: left 0.3s ease-in-out;
        padding-top: 80px;
    }
    .nav-links.show-menu {
        left: 0; /* Desliza desde la izquierda */
    }
    .nav-button {
        font-size: 1.2rem;
        width: 100%;
        padding: 15px 25px;
        border-radius: 0;
        background: transparent;
        color: var(--primary);
        text-align: left;
        border-bottom: 1px solid rgba(0,0,0,0.05);
    }
    .nav-button:hover,
    .nav-button.active {
        background: rgba(41,44,101,0.05);
        transform: none;
        box-shadow: none;
    }
    .hero-section {
        height: auto;
        padding: 2rem 1rem;
    }
    .hero-grid {
        grid-template-columns: repeat(2, 1fr); /* 2x2 en tablets */
    }
    .footer-container {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
}

@media (max-width: 600px) {
    .hero-section {
        padding: 1rem 0.5rem;
    }
    
    .hero-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
        padding: 0.5rem;
    }
    
    .hero-item {
        height: 250px;
        width: 100%;
        margin-bottom: 1rem;
    }
    
    .hero-image {
        height: 100%;
        object-fit: cover;
    }
    
    .hero-overlay {
        background: rgba(0, 0, 0, 0.7);
        padding: 1.5rem;
    }
    
    .hero-overlay h2 {
        font-size: 1.4rem;
        margin-bottom: 0.75rem;
    }
    
    .hero-overlay p {
        font-size: 0.95rem;
        line-height: 1.5;
    }
}