/* =========================================
   1. CONFIGURACIÓN GENERAL Y RESET
   ========================================= */
html, body {
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    color: #333;
    background-color: #f9f9f9;
    /* Esto es la barrera mágica que evita que la página se desborde a los lados en el celular */
    overflow-x: hidden; 
    max-width: 100vw;
    box-sizing: border-box;
}

*, *:before, *:after {
    box-sizing: inherit;
}

/* =========================================
   2. ENCABEZADO Y NAVEGACIÓN
   ========================================= */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 10%;
    background: #fff;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: relative;
    z-index: 100;
}

header .logo {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: 1px;
}

nav ul {
    list-style: none;
    display: flex;
    gap: 25px;
    margin: 0;
    padding: 0;
}

/* =========================================
   3. BOTONES Y TARJETAS
   ========================================= */
.btn-primario {
    background: #FFD700;
    color: #1a1a1a;
    padding: 15px 40px;
    text-decoration: none;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-radius: 4px;
    display: inline-block;
    transition: background 0.3s;
}

.btn-primario:hover {
    background: #e6c200;
}

.servicio-card {
    background: #fff;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 10px 20px rgba(0,0,0,0.05);
    transition: transform 0.3s;
}

.servicio-card:hover {
    transform: translateY(-10px);
}

/* =========================================
   4. SLIDER ANTES Y DESPUÉS
   ========================================= */
.comparador-container {
    position: relative;
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
    overflow: hidden;
    border-radius: 10px;
    box-shadow: 0 15px 30px rgba(0,0,0,0.2);
    aspect-ratio: 16/9;
}

.comparador-container > img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
}

.capa-superior {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    overflow: hidden;
    border-right: 4px solid #FFD700;
    z-index: 2;
}

.capa-superior img {
    width: 900px; /* Tamaño máximo del contenedor en computadora */
    height: 100%;
    object-fit: cover;
}

.label-texto {
    position: absolute;
    bottom: 20px;
    padding: 8px 15px;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    font-weight: bold;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-size: 0.9rem;
    pointer-events: none;
}

.label-antes {
    left: 20px;
    z-index: 3;
}

.label-despues {
    right: 20px;
    z-index: 1;
}

.slider-control {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: ew-resize;
    z-index: 10;
}

/* =========================================
   5. BOTÓN FLOTANTE DE WHATSAPP (ESCRITORIO)
   ========================================= */
.btn-whatsapp {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: #25D366;
    color: white;
    border-radius: 50px;
    width: 60px;
    height: 60px;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    z-index: 1000;
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    overflow: hidden;
    text-decoration: none;
    padding-left: 12px;
}

.btn-whatsapp svg {
    flex-shrink: 0;
}

.whatsapp-texto {
    max-width: 0;
    opacity: 0;
    white-space: nowrap;
    font-weight: bold;
    font-family: 'Segoe UI', sans-serif;
    font-size: 1.1rem;
    transition: all 0.4s ease;
    margin-left: 0;
}

/* Efecto de expansión al pasar el ratón (solo en PC) */
.btn-whatsapp:hover {
    width: 210px;
    box-shadow: 0 6px 15px rgba(0,0,0,0.5);
}

.btn-whatsapp:hover .whatsapp-texto {
    max-width: 150px;
    opacity: 1;
    margin-left: 10px;
}

/* =========================================
   6. RESPONSIVO: MÓVILES Y TABLETS
   ========================================= */
@media screen and (max-width: 768px) {
    
    /* Encabezado y Menú */
    header {
        flex-direction: column !important;
        padding: 15px 5% !important;
        text-align: center;
    }
    
    header .logo {
        margin-bottom: 15px !important;
    }

    nav ul {
        flex-direction: column !important;
        width: 100%;
        gap: 15px !important;
    }

    nav ul li {
        width: 100%;
        border-bottom: 1px solid #eee;
        padding-bottom: 10px;
    }

    nav ul li:last-child {
        border-bottom: none;
        padding-top: 10px;
    }

    /* Textos del Hero */
    .hero h2 {
        font-size: 2.2rem !important;
        line-height: 1.2 !important;
    }

    .hero p {
        font-size: 1rem !important;
        padding: 0 10px;
    }

    /* Márgenes */
    section, main {
        padding: 50px 5% !important;
    }

    /* Tarjetas y Slider en celular */
    main > div[style*="display: flex"] {
        flex-direction: column !important;
        text-align: center !important;
        gap: 20px !important;
    }
    
    .servicio-card, .comparador-container {
        margin-bottom: 20px !important;
    }

    /* Corrección de la imagen del slider en móviles */
    .capa-superior img {
        width: 100vw !important; /* Se adapta a la pantalla y no rompe los bordes */
    }

    /* Footer en una columna */
    footer > div:first-child {
        grid-template-columns: 1fr !important;
        text-align: center !important;
        gap: 30px !important;
    }
    
    /* BLOQUEO ESTRICTO DEL BOTÓN WHATSAPP EN CELULARES */
    .btn-whatsapp {
        right: 20px !important; /* Separado del borde derecho */
        bottom: 20px !important; /* Separado del borde inferior */
        width: 60px !important;
        min-width: 60px !important;
        max-width: 60px !important;
        height: 60px !important;
        border-radius: 50% !important; /* Obliga a que sea un círculo perfecto */
        padding: 0 !important;
        justify-content: center !important; /* Centra el logo */
    }

    /* Bloqueo total de la animación al tocar la pantalla */
    .btn-whatsapp:hover, 
    .btn-whatsapp:active, 
    .btn-whatsapp:focus {
        width: 60px !important;
        min-width: 60px !important;
        max-width: 60px !important;
        transform: none !important; 
    }

    /* Desaparecemos el texto en celulares */
    .whatsapp-texto {
        display: none !important;
        width: 0 !important;
        opacity: 0 !important;
        margin: 0 !important;
    }
}