/* ===================================
   Pro Hamburger Menu - Frontend Styles
   =================================== */

/* Variables CSS (definidas dinámicamente en PHP) */
:root {
    --phm-menu-width: 300px;
    --phm-overlay-color: #000000;
    --phm-overlay-opacity: 0.5;
    --phm-menu-bg: #ffffff;
    --phm-text-color: #333333;
    --phm-hover-color: #007bff;
    --phm-hamburger-color: #333333;
    --phm-animation-speed: 300ms;
    --phm-z-hamburger: 1000;
    --phm-z-overlay: 999;
    --phm-z-menu: 1001;
}

/* Reset básico */
.phm-hamburger,
.phm-menu,
.phm-overlay {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* ===================================
   Botón Hamburguesa
   =================================== */
.phm-hamburger {
    position: fixed;
    z-index: var(--phm-z-hamburger);
    width: 50px;
    height: 50px;
    background-color: rgba(255, 255, 255, 0.95);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    transition: all var(--phm-animation-speed) ease;
}

.phm-hamburger:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

.phm-hamburger:active {
    transform: scale(0.95);
}

.phm-hamburger span {
    display: block;
    width: 28px;
    height: 3px;
    background-color: var(--phm-hamburger-color);
    border-radius: 2px;
    transition: all var(--phm-animation-speed) ease;
}

/* Animación del botón cuando el menú está abierto */
.phm-hamburger.active span:nth-child(1) {
    transform: translateY(9px) rotate(45deg);
}

.phm-hamburger.active span:nth-child(2) {
    opacity: 0;
    transform: translateX(-20px);
}

.phm-hamburger.active span:nth-child(3) {
    transform: translateY(-9px) rotate(-45deg);
}

/* ===================================
   Overlay (fondo oscuro)
   =================================== */
.phm-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--phm-overlay-color);
    opacity: 0;
    visibility: hidden;
    z-index: var(--phm-z-overlay);
    transition: all var(--phm-animation-speed) ease;
    cursor: pointer;
}

.phm-overlay.active {
    opacity: var(--phm-overlay-opacity);
    visibility: visible;
}

/* ===================================
   Menú Principal
   =================================== */
.phm-menu {
    position: fixed;
    top: 0;
    width: var(--phm-menu-width);
    height: 100vh;
    background-color: var(--phm-menu-bg);
    z-index: var(--phm-z-menu);
    transition: transform var(--phm-animation-speed) cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
    overflow-x: hidden;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.3);
}

/* Menú a la IZQUIERDA por defecto */
.phm-menu-left,
.phm-menu[style*="left: 0"] {
    left: 0 !important;
    right: auto !important;
    transform: translateX(-100%);
}

.phm-menu-left.active,
.phm-menu[style*="left: 0"].active {
    transform: translateX(0);
}

/* Menú a la DERECHA */
.phm-menu-right,
.phm-menu[style*="right: 0"] {
    right: 0 !important;
    left: auto !important;
    transform: translateX(100%);
}

.phm-menu-right.active,
.phm-menu[style*="right: 0"].active {
    transform: translateX(0);
}

/* Scrollbar personalizado */
.phm-menu::-webkit-scrollbar {
    width: 6px;
}

.phm-menu::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
}

.phm-menu::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
}

.phm-menu::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3);
}

/* ===================================
   Header del Menú
   =================================== */
.phm-menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.02), transparent);
}

/* Logo del menú */
.phm-menu-logo {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: flex-start;
}

.phm-menu-logo img {
    height: auto;
    display: block;
    transition: transform 0.3s ease;
}

.phm-menu-logo img:hover {
    transform: scale(1.05);
}

.phm-close {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--phm-text-color);
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.phm-close:hover {
    background-color: rgba(0, 0, 0, 0.1);
    transform: rotate(90deg);
}

.phm-close:active {
    transform: rotate(90deg) scale(0.9);
}

/* ===================================
   ✅ REDES SOCIALES (CON COLORES DE MARCA)
   =================================== */
.phm-social-icons {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 12px;
    padding: 20px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.01), transparent);
}

.phm-social-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    color: #ffffff !important; /* Iconos siempre blancos */
    text-decoration: none;
    font-size: 18px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    opacity: 1 !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.phm-social-icon svg,
.phm-social-icon i {
    color: #ffffff !important; /* Asegurar que los iconos sean blancos */
    fill: #ffffff !important;
    transition: all 0.2s ease;
}

/* Colores de fondo para cada red social - usando las clases del PHP */
.phm-social-icon.phm-facebook {
    background-color: #1877f2 !important; /* Facebook */
}

.phm-social-icon.phm-instagram {
    background: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%) !important; /* Instagram */
}

.phm-social-icon.phm-twitter {
    background-color: #1DA1F2 !important; /* Twitter */
}

.phm-social-icon.phm-linkedin {
    background-color: #0A66C2 !important; /* LinkedIn */
}

.phm-social-icon.phm-youtube {
    background-color: #FF0000 !important; /* YouTube */
}

.phm-social-icon.phm-whatsapp {
    background-color: #25D366 !important; /* WhatsApp */
}

.phm-social-icon.phm-tiktok {
    background-color: #000000 !important; /* TikTok */
}

.phm-social-icon.phm-pinterest {
    background-color: #E60023 !important; /* Pinterest */
}

/* Hover sutil - solo elevación ligera, SIN cambio de color */
.phm-social-icon:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

/* Al hacer clic */
.phm-social-icon:active {
    transform: translateY(0px) scale(0.95);
}

/* Animación de entrada para los iconos sociales */
@keyframes socialIconFadeIn {
    from {
        opacity: 0;
        transform: scale(0.8) translateY(-5px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Los iconos son visibles por defecto */
.phm-social-icon {
    opacity: 1;
}

/* Animación SOLO cuando el menú se abre (opcional/mejora progresiva) */
.phm-menu.active .phm-social-icon {
    animation: socialIconFadeIn 0.4s ease-out forwards;
}

.phm-menu.active .phm-social-icon:nth-child(1) { animation-delay: 0.05s; }
.phm-menu.active .phm-social-icon:nth-child(2) { animation-delay: 0.1s; }
.phm-menu.active .phm-social-icon:nth-child(3) { animation-delay: 0.15s; }
.phm-menu.active .phm-social-icon:nth-child(4) { animation-delay: 0.2s; }
.phm-menu.active .phm-social-icon:nth-child(5) { animation-delay: 0.25s; }
.phm-menu.active .phm-social-icon:nth-child(6) { animation-delay: 0.3s; }
.phm-menu.active .phm-social-icon:nth-child(7) { animation-delay: 0.35s; }
.phm-menu.active .phm-social-icon:nth-child(8) { animation-delay: 0.4s; }

/* ===================================
   Contenido del Menú
   =================================== */
.phm-menu-content {
    padding: 20px 0;
}

.phm-no-menu {
    padding: 20px;
    text-align: center;
    color: var(--phm-text-color);
    opacity: 0.6;
}

/* ===================================
   Lista del Menú
   =================================== */
.phm-menu-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.phm-menu-item {
    position: relative;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.phm-menu-item:last-child {
    border-bottom: none;
}

.phm-menu-link {
    display: flex;
    align-items: center;
    padding: 16px 25px;
    color: var(--phm-text-color);
    text-decoration: none;
    font-size: 16px;
    font-weight: 500;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

/* Efecto de hover deslizante */
.phm-menu-link::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 4px;
    height: 100%;
    background-color: var(--phm-hover-color);
    transform: translateX(-4px);
    transition: transform 0.3s ease;
}

.phm-menu-link:hover::before {
    transform: translateX(0);
}

.phm-menu-link:hover {
    background-color: rgba(0, 0, 0, 0.03);
    color: var(--phm-hover-color);
    padding-left: 30px;
}

.phm-menu-link:active {
    background-color: rgba(0, 0, 0, 0.05);
}

/* Iconos del menú */
.phm-menu-link i.fas {
    margin-right: 15px;
    font-size: 18px;
    width: 20px;
    text-align: center;
    transition: transform 0.3s ease;
}

.phm-menu-link:hover i.fas {
    transform: scale(1.2);
}

.phm-menu-link span {
    flex: 1;
}

/* Indicador de submenú */
.phm-submenu-indicator {
    margin-left: auto;
    margin-right: 0 !important;
    font-size: 12px !important;
    transition: transform 0.3s ease;
    width: auto !important;
}

.phm-menu-item.active > .phm-menu-link .phm-submenu-indicator {
    transform: rotate(180deg);
}

/* ===================================
   Submenús
   =================================== */
.phm-menu-list .sub-menu {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 0;
    overflow: hidden;
    background-color: rgba(0, 0, 0, 0.02);
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.phm-menu-item.active > .sub-menu {
    max-height: 1000px;
}

.sub-menu .phm-menu-item {
    border-bottom: 1px solid rgba(0, 0, 0, 0.03);
}

.sub-menu .phm-menu-link {
    padding-left: 50px;
    font-size: 15px;
    font-weight: 400;
}

.sub-menu .phm-menu-link::before {
    width: 3px;
}

.sub-menu .phm-menu-link:hover {
    padding-left: 55px;
}

/* Submenús de tercer nivel */
.sub-menu .sub-menu .phm-menu-link {
    padding-left: 70px;
    font-size: 14px;
}

.sub-menu .sub-menu .phm-menu-link:hover {
    padding-left: 75px;
}

/* ===================================
   Animaciones de entrada
   =================================== */
@keyframes fadeInMenu {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.phm-menu.active .phm-menu-item {
    animation: fadeInMenu 0.4s ease forwards;
    opacity: 0;
}

.phm-menu.active .phm-menu-item:nth-child(1) { animation-delay: 0.05s; }
.phm-menu.active .phm-menu-item:nth-child(2) { animation-delay: 0.1s; }
.phm-menu.active .phm-menu-item:nth-child(3) { animation-delay: 0.15s; }
.phm-menu.active .phm-menu-item:nth-child(4) { animation-delay: 0.2s; }
.phm-menu.active .phm-menu-item:nth-child(5) { animation-delay: 0.25s; }
.phm-menu.active .phm-menu-item:nth-child(6) { animation-delay: 0.3s; }
.phm-menu.active .phm-menu-item:nth-child(7) { animation-delay: 0.35s; }
.phm-menu.active .phm-menu-item:nth-child(8) { animation-delay: 0.4s; }

/* ===================================
   Responsive
   =================================== */
@media (max-width: 768px) {
    .phm-menu {
        width: 85vw;
        max-width: 320px;
    }
    
    .phm-hamburger {
        width: 45px;
        height: 45px;
    }
    
    .phm-social-icons {
        gap: 10px;
        padding: 15px;
    }
    
    .phm-social-icon {
        width: 36px;
        height: 36px;
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    .phm-menu {
        width: 90vw;
    }
    
    .phm-menu-link {
        padding: 14px 20px;
        font-size: 15px;
    }
    
    .sub-menu .phm-menu-link {
        padding-left: 40px;
    }
    
    .phm-social-icons {
        gap: 8px;
        padding: 12px;
    }
    
    .phm-social-icon {
        width: 34px;
        height: 34px;
        font-size: 15px;
    }
}

/* ===================================
   Prevención de scroll en body
   =================================== */
body.phm-menu-open {
    overflow: hidden;
}

/* ===================================
   Accesibilidad
   =================================== */
.phm-hamburger:focus,
.phm-close:focus,
.phm-menu-link:focus,
.phm-social-icon:focus {
    outline: 2px solid var(--phm-hover-color);
    outline-offset: 2px;
}

/* Modo de alto contraste */
@media (prefers-contrast: high) {
    .phm-menu-link {
        font-weight: 600;
    }
    
    .phm-menu-item {
        border-bottom: 2px solid rgba(0, 0, 0, 0.2);
    }
    
    .phm-social-icon {
        border: 2px solid var(--phm-text-color);
    }
}

/* Reducción de movimiento */
@media (prefers-reduced-motion: reduce) {
    .phm-hamburger,
    .phm-menu,
    .phm-overlay,
    .phm-menu-link,
    .phm-close,
    .phm-submenu-indicator,
    .phm-social-icon {
        transition: none !important;
        animation: none !important;
    }
}
