/* ========================================
   FOOTER CONSOLIDADO - TODOS LOS ESTILOS
   ======================================== */

/* Estructura base: footer siempre al final (viewport si hay poco contenido, o tras el contenido) */
html {
    min-height: 100vh;
    margin: 0;
    padding: 0;
}

body {
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* main ocupa todo el espacio disponible y empuja el footer al final */
main {
    flex: 1 0 auto;
}

/* Footer principal - Unificado para público y privado (al final del contenido, no fijo) */
.unified-footer {
    background: #111827; /* Gris oscuro como solicitado */
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding: 20px 0;
    margin-top: auto;
    flex-shrink: 0;
    width: 100%;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
}

/* Overlay para el menú del footer */
.footer-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 99999998;
    display: none;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.footer-menu-overlay.show,
.footer-menu-overlay.visible {
    display: flex;
    opacity: 1;
    pointer-events: all;
}

.footer-menu-overlay.hidden {
    display: none;
    opacity: 0;
    pointer-events: none;
}

/* Controlar overflow del body cuando el menú está abierto */
body.footer-menu-open {
    overflow: hidden !important;
}

/* Menú desplegable del footer */
.footer-navigation.footer-menu-open {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 95%;
    max-width: 500px;
    min-height: 450px;
    background: #111827;
    border: 2px solid #374151;
    border-radius: 8px;
    padding: 20px;
    z-index: 99999999;
    max-height: 600px;
    overflow: visible;
    visibility: visible;
    opacity: 1;
    flex-direction: column;
    gap: 20px;
    align-items: stretch;
    justify-content: flex-start;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8);
}

/* Enlaces del menú desplegable */
.footer-navigation.footer-menu-open .footer-link {
    display: block;
    width: 100%;
    padding: 16px 20px;
    margin: 0;
    text-align: center;
    background-color: transparent;
    border: 1px solid #374151;
    border-radius: 8px;
    color: #ffffff;
    text-decoration: none;
    font-size: 16px;
    font-weight: 500;
    transition: all 0.2s ease;
    min-height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.footer-navigation.footer-menu-open .footer-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Footer público: ocupar el 90% del ancho visible */
.unified-footer:not(.footer-private) .footer-container {
    width: 90%;
    max-width: none;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
    min-height: 20px;
}

/* Zona izquierda: Copyright */
.footer-copyright {
    color: rgba(255, 255, 255, 0.8);
    font-size: 14px;
    font-weight: 400;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    flex-shrink: 0;
    white-space: nowrap;
}

/* Crédito "Boyta" en blanco */
.footer-copyright a {
    color: #ffffff;
    text-decoration: none;
}

.footer-copyright a:hover,
.footer-copyright a:focus {
    color: #ffffff;
    text-decoration: underline;
}

/* Zona centro: Navegación */
.footer-navigation {
    display: flex;
    gap: 32px;
    align-items: center;
    flex-wrap: wrap;
    justify-content: center;
    flex: 5;
    min-width: 0; /* Permite que se encoja en pantallas pequeñas */
}

.footer-link {
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    min-height: 48px;
    display: inline-flex;
    align-items: center;
    padding: 8px 12px;
    font-size: 14px;
    font-weight: 400;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    transition: all 0.3s ease;
    position: relative;
    padding: 4px 0;
    white-space: nowrap;
}

.footer-link:hover {
    color: #3B82F6; /* Azul en hover como solicitado */
    text-decoration: none;
    transform: translateY(-1px);
}

.footer-link:focus {
    outline: 0;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.35);
    border-radius: 4px;
    color: #3B82F6;
}

.footer-link:active {
    transform: translateY(0);
}

/* Zona derecha: Versión */
.footer-status {
    flex-shrink: 0;
    display: flex;
    align-items: center;
}

.footer-version {
    color: rgba(255, 255, 255, 0.6);
    font-size: 13px;
    font-weight: 400;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: rgba(255, 255, 255, 0.1);
    padding: 4px 8px;
    border-radius: 4px;
    white-space: nowrap;
}

/* Botón hamburguesa del footer */
.footer-menu-toggle {
    display: none; /* Oculto por defecto en desktop */
    background: none;
    min-width: 48px;
    min-height: 48px;
    padding: 12px;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    transition: all 0.3s ease;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 4px;
    width: 40px;
    height: 40px;
}

.footer-menu-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
}

.footer-menu-toggle:focus {
    outline: 2px solid #3B82F6;
    outline-offset: 2px;
}

/* Iconos hamburguesa */
.hamburger-icon {
    display: block;
    width: 20px;
    height: 2px;
    background: #ffffff;
    border-radius: 1px;
    transition: all 0.3s ease;
}

/* Animación del botón hamburguesa */
.footer-menu-toggle.active .hamburger-icon:nth-child(1) {
    transform: translateY(6px) rotate(45deg);
}

.footer-menu-toggle.active .hamburger-icon:nth-child(2) {
    opacity: 0;
}

.footer-menu-toggle.active .hamburger-icon:nth-child(3) {
    transform: translateY(-6px) rotate(-45deg);
}

/* Responsive Design */
@media (max-width: 768px) {
    .footer-content {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        gap: 12px;
        position: relative;
    }

    .footer-copyright {
        order: 1;
        flex-shrink: 0;
    }

    .footer-menu-toggle {
        display: flex !important; /* Mostrar solo en móvil */
        order: 2;
        flex-shrink: 0;
    }

    .footer-navigation {
        display: none;
        position: fixed;
        bottom: 60px;
        left: 0;
        right: 0;
        background: #111827;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        padding: 20px;
        flex-direction: column;
        gap: 12px;
        width: 100%;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
        z-index: 100001;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease-out, padding 0.3s ease-out;
    }

    .footer-navigation.active {
        display: flex;
        max-height: 400px;
        padding: 20px;
        animation: slideUp 0.3s ease-out;
    }

    .footer-status {
        display: none;
    }

    .unified-footer {
        padding: 16px 0;
    }

}

/* Animación para el menú móvil */
@keyframes slideUp {
    from {
        opacity: 0;
        max-height: 0;
    }
    to {
        opacity: 1;
        max-height: 400px;
    }
}

@media (max-width: 480px) {
    .footer-navigation {
        gap: 16px;
        flex-direction: column;
    }

    .footer-link {
        font-size: 13px;
    }

    .footer-copyright {
        font-size: 13px;
    }

    .footer-version {
        font-size: 12px;
    }

    .footer-container {
        padding: 0 16px;
    }
}

/* Footer área privada: altura un tercio de la actual */
.unified-footer.footer-private {
    padding: 5px 0;
}
.unified-footer.footer-private .footer-container {
    padding: 0 16px;
}
.unified-footer.footer-private .footer-content {
    min-height: 0;
    gap: 8px;
}
.unified-footer.footer-private .footer-copyright {
    font-size: 12px;
}
.unified-footer.footer-private .footer-link {
    min-height: 20px;
    padding: 2px 0;
    font-size: 12px;
}
.unified-footer.footer-private .footer-version {
    font-size: 11px;
    padding: 2px 6px;
}
.unified-footer.footer-private .footer-menu-toggle {
    min-height: 28px;
    min-width: 28px;
    height: 28px;
    width: 28px;
    padding: 4px;
}
.unified-footer.footer-private .hamburger-icon {
    height: 1.5px;
}
.unified-footer.footer-private .footer-menu-toggle.active .hamburger-icon:nth-child(1) {
    transform: translateY(4px) rotate(45deg);
}
.unified-footer.footer-private .footer-menu-toggle.active .hamburger-icon:nth-child(3) {
    transform: translateY(-4px) rotate(-45deg);
}
@media (max-width: 768px) {
    .unified-footer.footer-private {
        padding: 6px 0;
    }
}

/* Área privada: separación antes del footer (footer no fijo) */
.layout-private #main-content {
    padding-bottom: 1.5rem !important;
}

/* El footer va al final del contenido; el sidebar puede llegar al final de la ventana si aplica */

/* Mejoras de accesibilidad */
.footer-link:focus-visible {
    outline: 2px solid #3B82F6;
    outline-offset: 2px;
}

/* Animaciones suaves */
.footer-link,
.footer-version {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Estados de hover mejorados */
.footer-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: #3B82F6;
    transition: width 0.3s ease;
}

.footer-link:hover::after {
    width: 100%;
}

/* Mejora del contraste para accesibilidad */
@media (prefers-contrast: high) {
    .unified-footer {
        background: #000000;
        border-top: 2px solid #ffffff;
    }

    .footer-copyright,
    .footer-link {
        color: #ffffff;
    }

    .footer-link:hover {
        color: #60A5FA;
    }
}

/* Modo oscuro (si se implementa en el futuro) */
@media (prefers-color-scheme: dark) {
    .unified-footer {
        background: #0F172A;
        border-top: 1px solid rgba(255, 255, 255, 0.2);
    }
}
