/* ==========================================================================
   CSS MODULAR: LAYOUT Y ESTRUCTURA (layout.css)
   ========================================================================== */

/* --- HEADER CONTINUO (ALTA TRANSPARENCIA CON EFECTO GLASSMORPHISM) --- */
.main-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: var(--header-height);
    /* Alta transparencia (30%) sobre el color verde limón pastel (#E7E89D) */
    background: rgba(231, 232, 157, 0.3);
    /* Desenfoque del fondo vital para no perder legibilidad con tanta transparencia */
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 1000;
    display: flex;
    align-items: center;
    transition: all 0.6s cubic-bezier(0.16, 1, 0.3, 1);
    border-bottom: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: none;
}

/* Estado al hacer Scroll: Un poco más de color para el contraste sobre otras secciones */
.main-header.scrolled {
    top: 0;
    left: 0;
    transform: none;
    width: 100%;
    max-width: none;
    border-radius: 0;
    height: 85px;
    /* Transparencia media (65%) al hacer scroll */
    background: rgba(231, 232, 157, 0.65);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    box-shadow: 0 10px 30px rgba(20, 71, 115, 0.06);
    border: none;
}

.nav-container {
    width: 100%;
    max-width: 1200px;
    padding: 0 30px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}

/* --- LOGO RESPONSIVO CON ROTACIÓN 3D OPTIMIZADA --- */
.logo-wrapper {
    display: flex;
    align-items: center;
    height: 80px;
    flex: 0 0 auto;
    text-decoration: none;
    perspective: 1000px; /* Prepara el espacio tridimensional para que la rotación se vea real */
    transition: all 0.5s ease;
}

.logo-text {
    height: 75px !important; /* Incrementado de 60px a 75px para darle mayor protagonismo visual */
    width: auto !important;
    max-width: 100%;
    object-fit: contain;
    display: block;
    backface-visibility: hidden; /* Evita parpadeos o textos borrosos durante el renderizado 3D */
    -webkit-font-smoothing: subpixel-antialiased;
    transition: transform 0.8s cubic-bezier(0.2, 0.8, 0.2, 1), height 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Animación: Rotación completa sobre su eje Y al pasar el cursor */
.logo-wrapper:hover .logo-text {
    transform: rotateY(360deg) scale(1.04);
}

/* Comportamiento del Logo durante el estado Scrolled */
.main-header.scrolled .logo-text {
    height: 58px !important; /* Disminución fluida controlada por CSS transition */
}

/* --- NAVEGACIÓN DESKTOP --- */
.nav-menu {
    display: flex;
    list-style: none;
    gap: 5px;
    align-items: center;
}

.nav-menu li {
    position: relative;
}

.nav-menu a {
    position: relative;
    display: inline-block;
    white-space: nowrap;
    text-decoration: none;
    color: var(--primary-blue);
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 10px 12px;
    border-radius: 50px;
    z-index: 1;
    transition: color 0.3s ease, transform 0.2s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.nav-menu a::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    width: 0;
    height: 100%;
    background-color: var(--secondary-purple);
    border-radius: 50px;
    transform: translateX(-50%);
    transition: width 0.4s cubic-bezier(0.16, 1, 0.3, 1), background-color 0.3s ease, box-shadow 0.3s ease;
    z-index: -1;
}

.nav-menu a:hover {
    color: var(--white);
}

.nav-menu a:hover::before {
    width: 100%;
}

.nav-menu a:active {
    transform: scale(0.92);
}

.nav-menu a:active::before {
    background-color: var(--primary-blue);
    box-shadow: inset 0 4px 8px rgba(0, 0, 0, 0.3);
}

/* Botón CTA del menú */
.btn-cta {
    background-color: var(--accent-orange) !important;
    color: var(--white) !important;
    padding: 10px 20px !important;
    border-radius: 50px !important;
    box-shadow: 0 4px 15px rgba(246, 138, 48, 0.3);
    transition: all 0.3s ease !important;
    margin-left: 5px;
}

.btn-cta::before {
    display: none !important;
}

.btn-cta:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(246, 138, 48, 0.5);
}

.btn-cta:active {
    transform: scale(0.95);
    box-shadow: inset 0 3px 6px rgba(0, 0, 0, 0.2);
}

/* Icono especial de WhatsApp en menú */
.nav-wsp-icon {
    font-size: 1.6rem !important;
    color: var(--primary-blue) !important;
    padding: 5px 8px !important;
    display: flex;
    align-items: center;
    margin-left: 0;
}

.nav-wsp-icon::before {
    display: none !important;
}

.nav-wsp-icon:hover {
    color: var(--accent-orange) !important;
    transform: scale(1.1) !important;
}

/* --- FOOTER REDISEÑADO --- */
.main-footer {
    background-color: var(--primary-blue);
    color: var(--white);
    padding: 50px 10% 0;
    position: relative;
    z-index: 10;
}

.footer-content {
    display: grid;
    grid-template-columns: 1.5fr 1fr 1fr;
    gap: 40px;
    max-width: 1200px;
    margin: 0 auto;
    padding-bottom: 40px;
}

.footer-column h4 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 20px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--soft-pink);
}

.footer-logo-img {
    height: 70px;
    margin-bottom: 20px;
    filter: brightness(0) invert(1);
    display: block;
}

.footer-description {
    font-size: 0.95rem;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.8);
}

.footer-link {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--white);
    text-decoration: none;
    margin-bottom: 15px;
    font-size: 1rem;
    transition: color 0.3s ease;
}

.footer-link i {
    color: var(--accent-orange);
    font-size: 1.2rem;
}

.footer-link:hover {
    color: var(--accent-orange);
}

.social-links {
    display: flex;
    gap: 20px;
}

.social-links a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 45px;
    height: 45px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    color: var(--white);
    font-size: 1.4rem;
    text-decoration: none;
    transition: all 0.3s ease;
}

.social-links a:hover {
    background: var(--accent-orange);
    transform: translateY(-5px);
}

.footer-bottom {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding: 25px 0;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.6);
}

.footer-bottom-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ubicom-credit a {
    color: var(--soft-pink);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s;
}

.ubicom-credit a:hover {
    color: var(--accent-orange);
}

/* --- WHATSAPP FLOTANTE --- */
.whatsapp-float {
    position: fixed;
    bottom: 40px;
    right: 40px;
    background-color: var(--accent-orange);
    color: var(--white);
    width: 65px;
    height: 65px;
    border-radius: 50px;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 10px 25px rgba(246, 138, 48, 0.4);
    z-index: 1000;
    transition: all 0.3s ease;
    text-decoration: none;
}

.whatsapp-float:hover {
    transform: translateY(-5px) scale(1.05);
    box-shadow: 0 15px 30px rgba(246, 138, 48, 0.6);
    color: white;
}

.whatsapp-icon {
    font-size: 35px;
}

/* --- RESPONSIVE DE LAYOUT (HEADER Y FOOTER) --- */
@media (max-width: 992px) {
    .footer-content {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 768px) {
    .nav-container {
        padding: 0 20px;
    }

    .main-header.scrolled {
        width: 100%;
        top: 0px;
    }

    /* Panel Toggle (Mantiene estrictamente tu diseño original de tres barras) */
    .menu-toggle {
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: flex-end;
        gap: 6px;
        width: 45px;
        height: 45px;
        background: transparent;
        border-radius: 50%;
        cursor: pointer;
        z-index: 1001;
        padding-right: 10px;
        transition: background 0.3s ease;
    }

    .menu-toggle .bar {
        height: 2px;
        background-color: var(--primary-blue);
        border-radius: 2px;
        transition: all 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    }

    .menu-toggle .bar:nth-child(1) {
        width: 20px;
    }

    .menu-toggle .bar:nth-child(2) {
        width: 14px;
    }

    .menu-toggle .bar:nth-child(3) {
        width: 20px;
    }

    .menu-toggle.active .bar:nth-child(1) {
        transform: translateY(8px) rotate(45deg);
        width: 24px;
    }

    .menu-toggle.active .bar:nth-child(2) {
        opacity: 0;
        transform: translateX(10px);
    }

    .menu-toggle.active .bar:nth-child(3) {
        transform: translateY(-8px) rotate(-45deg);
        width: 24px;
    }

    .menu-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100dvh;
        background: rgba(20, 71, 115, 0.4);
        backdrop-filter: blur(5px);
        -webkit-backdrop-filter: blur(5px);
        z-index: 998;
        opacity: 0;
        visibility: hidden;
        transition: all 0.4s ease;
    }

    .menu-overlay.active {
        opacity: 1;
        visibility: visible;
    }

    /* --- TARJETA LATERAL COMPACTADA Y CENTRADA --- */
    .nav-menu {
        position: fixed;
        top: 15px;
        right: -100%;
        left: auto;
        width: 80%;
        max-width: 300px;
        height: auto;
        max-height: calc(100dvh - 30px);
        
        /* Efecto Cristal Glassmorphism Premium */
        background: rgba(255, 255, 255, 0.85);
        backdrop-filter: blur(25px);
        -webkit-backdrop-filter: blur(25px);
        border: 1px solid rgba(255, 255, 255, 0.45);
        border-radius: 24px;
        
        flex-direction: column;
        justify-content: flex-start;
        /* REQUERIMIENTO CUMPLIDO: Cambiado de flex-start a center para alinear todas las opciones al centro geométrico horizontal */
        align-items: center; 
        padding: 75px 40px 40px;
        transition: right 0.5s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 999;
        box-shadow: -10px 15px 40px rgba(20, 71, 115, 0.08);
        overflow-y: auto;
    }

    .nav-menu.active {
        right: 15px;
    }

    .nav-menu li {
        margin: 0 0 14px 0;
        width: 100%;
        opacity: 0;
        transform: translateX(30px);
        transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
        /* REQUERIMIENTO CUMPLIDO: Asegura la simetría de las cajas de lista al centrar */
        display: flex;
        justify-content: center;
    }

    .nav-menu.active li {
        opacity: 1;
        transform: translateX(0);
    }

    .nav-menu.active li:nth-child(1) { transition-delay: 0.1s; }
    .nav-menu.active li:nth-child(2) { transition-delay: 0.15s; }
    .nav-menu.active li:nth-child(3) { transition-delay: 0.2s; }
    .nav-menu.active li:nth-child(4) { transition-delay: 0.25s; }
    .nav-menu.active li:nth-child(5) {
        transition-delay: 0.3s;
        margin-top: 10px;
    }
    .nav-menu.active li:nth-child(6) { transition-delay: 0.35s; }

    .nav-menu a {
        font-size: 1.2rem;
        text-transform: none;
        display: block;
        padding: 6px 0;
        color: var(--primary-blue);
        /* REQUERIMIENTO CUMPLIDO: Forzar centrado del texto interno */
        text-align: center; 
    }

    .nav-menu a::before {
        display: none;
    }

    .nav-menu a.btn-cta {
        text-align: center;
        padding: 14px 0 !important;
        width: 100%;
        font-size: 1.05rem;
        margin-left: 0;
    }

    /* REQUERIMIENTO CUMPLIDO: Estilos optimizados y exclusivos para hacer el logo de WhatsApp más grande y centrado */
    .nav-menu .nav-wsp-icon {
        display: flex !important;
        justify-content: center;
        align-items: center;
        font-size: 2.1rem !important; /* Incrementado un 30% para darle jerarquía visual imponente */
        color: #25D366 !important; /* Verde corporativo de WhatsApp */
        padding: 10px 0 !important;
        width: auto;
        margin: 5px auto 0 auto;
        transition: transform 0.3s ease !important;
    }

    .nav-menu .nav-wsp-icon:hover {
        transform: scale(1.1) !important;
    }

    /* Logo Mobile un 25% más grande en DM (pasa de 52px a 65px) */
    .logo-text {
        height: 65px !important;
    }

    .main-header.scrolled .logo-text {
        height: 50px !important;
    }

    /* Efecto de rotación 3D habilitado en hover/touch para mobile */
    .logo-wrapper:hover .logo-text,
    .logo-wrapper:active .logo-text {
        transform: rotateY(360deg) scale(1.04);
    }

    .main-footer {
        padding: 60px 20px 0;
    }

    .footer-content {
        grid-template-columns: 1fr;
        text-align: center;
        gap: 30px;
    }

    .footer-logo-img {
        margin: 0 auto 20px;
    }

    .footer-link {
        justify-content: center;
    }

    .social-links {
        justify-content: center;
    }

    .footer-bottom-container {
        flex-direction: column;
        gap: 10px;
    }

    /* Mantiene prioridad absoluta del logo de WhatsApp flotante inferior derecho */
    .whatsapp-float {
        bottom: 20px;
        right: 20px;
        width: 55px;
        height: 55px;
        z-index: 2000 !important;
    }

    .whatsapp-icon {
        font-size: 30px;
    }
}