/**
 * THE LINKERS SYSTEM - BOTTOM NAVIGATION (MOBILE/TABLET)
 * 
 * Sistema de navegación inferior para mobile/tablet
 * Optimizado para uso con una mano y alcance del pulgar
 * 
 * @package    The_Linkers_System
 * @subpackage Public/CSS
 * @since      1.0.3
 */

/* ============================================
   VARIABLES DE BRANDING
   ============================================ */
:root {
    --tls-azul-principal: #0066C4;
    --tls-azul-oscuro: #002D5A;
    --tls-naranja: #FF6B35;
    --tls-blanco: #FFFFFF;
    --tls-gris-claro: #F5F7FA;
    --tls-gris-medio: #CBD5E0;
    --tls-texto-oscuro: #2D3748;
    --tls-bottom-nav-height: 70px;
}

/* ============================================
   MOBILE & TABLET: HEADER Y SIDEBAR
   ============================================ */
@media screen and (max-width: 768px) {
    
    /* Ocultar sidebar lateral completamente */
    .tls-panel-sidebar {
        display: none !important;
    }
    
    /* Ajustar contenido principal para que use toda la pantalla */
    .tls-panel-content {
        margin-left: 0 !important;
        padding-left: 0 !important;
        width: 100% !important;
        padding-bottom: calc(var(--tls-bottom-nav-height) + 20px) !important;
    }
    
    /* ===== HEADER MOBILE ===== */
    
    /* Hacer header fijo arriba */
    .tls-linker-header {
        position: fixed !important;
        top: 0;
        left: 0;
        right: 0;
        z-index: 999;
        background: var(--tls-azul-oscuro) !important;
        padding: 12px 15px !important;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    }
    
    /* Container del header simplificado */
    .tls-header-container {
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        max-width: 100% !important;
        padding: 0 !important;
    }
    
    /* Logo más pequeño */
    .tls-header-logo {
        flex: 0 0 auto;
    }
    
    .tls-header-logo .tls-logo-img {
        height: 32px !important;
        width: auto !important;
        max-width: 150px !important;
        display: block !important;
    }
    
    /* Info de usuario: solo botón cerrar sesión */
    .tls-header-user {
        display: flex !important;
        align-items: center !important;
        gap: 0 !important;
    }
    
    /* Ocultar avatar y nombre en mobile (están en el dashboard) */
    .tls-header-user .tls-user-avatar,
    .tls-header-user .tls-user-info {
        display: none !important;
    }
    
    /* Botón cerrar sesión más compacto - CORREGIDO */
    .tls-header-user #tls-logout-btn,
    .tls-header-user .tls-btn {
        background: transparent !important;
        border: 1px solid var(--tls-blanco) !important;
        color: var(--tls-blanco) !important;
        padding: 6px 12px !important;
        border-radius: 5px !important;
        font-size: 13px !important;
        white-space: nowrap !important;
        cursor: pointer !important;
        text-decoration: none !important;
    }
    
    .tls-header-user #tls-logout-btn:hover,
    .tls-header-user .tls-btn:hover {
        background: rgba(255, 255, 255, 0.1) !important;
    }
    
    /* Ocultar navegación del header (usamos bottom nav) */
    .tls-linker-nav {
        display: none !important;
    }
    
    /* Ajustar contenido para el header fijo */
    .tls-panel-wrapper {
        padding-top: 60px !important;
    }
    
    /* Ajustar main content */
    main.tls-main-content {
        margin-top: 0 !important;
    }
}

/* ============================================
   BOTTOM NAVIGATION - ESTRUCTURA
   ============================================ */
@media screen and (max-width: 768px) {
    
    .tls-bottom-nav {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: var(--tls-bottom-nav-height);
        background: var(--tls-blanco);
        border-top: 1px solid var(--tls-gris-medio);
        box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
        z-index: 1000;
        display: flex;
        justify-content: space-around;
        align-items: center;
        padding: 0;
    }
    
    /* Item individual del menú */
    .tls-bottom-nav-item {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        text-decoration: none;
        color: var(--tls-gris-medio);
        padding: 8px 0;
        transition: all 0.3s ease;
        position: relative;
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
    }
    
    /* Icono del item */
    .tls-bottom-nav-item .icon {
        font-size: 24px;
        margin-bottom: 4px;
        transition: transform 0.2s ease;
    }
    
    /* Label del item */
    .tls-bottom-nav-item .label {
        font-size: 11px;
        font-weight: 500;
        line-height: 1;
    }
    
    /* Estado ACTIVO */
    .tls-bottom-nav-item.active {
        color: var(--tls-azul-principal);
    }
    
    .tls-bottom-nav-item.active .icon {
        transform: scale(1.1);
    }
    
    /* Indicador superior cuando está activo */
    .tls-bottom-nav-item.active::before {
        content: '';
        position: absolute;
        top: 0;
        left: 50%;
        transform: translateX(-50%);
        width: 40px;
        height: 3px;
        background: var(--tls-azul-principal);
        border-radius: 0 0 3px 3px;
    }
    
    /* Efecto hover/touch */
    .tls-bottom-nav-item:active {
        background: var(--tls-gris-claro);
    }
    
    /* Badge de notificaciones (opcional) */
    .tls-bottom-nav-item .badge {
        position: absolute;
        top: 8px;
        right: calc(50% - 20px);
        background: var(--tls-naranja);
        color: var(--tls-blanco);
        font-size: 10px;
        font-weight: 700;
        padding: 2px 5px;
        border-radius: 10px;
        min-width: 18px;
        text-align: center;
        line-height: 1.2;
    }
}

/* ============================================
   TABLET: 769px - 1024px
   ============================================ */
@media screen and (min-width: 769px) and (max-width: 1024px) {
    
    /* En tablet también usar bottom nav */
    .tls-panel-sidebar {
        display: none !important;
    }
    
    .tls-panel-content {
        margin-left: 0 !important;
        width: 100% !important;
    }
    
    /* Bottom nav un poco más espacioso en tablet */
    .tls-bottom-nav-item .icon {
        font-size: 26px;
    }
    
    .tls-bottom-nav-item .label {
        font-size: 12px;
    }
}

/* ============================================
   DESKTOP: RESTAURAR SIDEBAR LATERAL
   ============================================ */
@media screen and (min-width: 1025px) {
    
    /* Ocultar bottom nav en desktop */
    .tls-bottom-nav {
        display: none !important;
    }
    
    /* Mostrar sidebar lateral normal */
    .tls-panel-sidebar {
        display: block !important;
    }
    
    /* Header desktop normal */
    .tls-panel-header {
        position: static;
    }
}

/* ============================================
   ANIMACIONES Y TRANSICIONES
   ============================================ */

/* Fade in del bottom nav al cargar */
@keyframes slideUpFadeIn {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@media screen and (max-width: 768px) {
    .tls-bottom-nav {
        animation: slideUpFadeIn 0.3s ease-out;
    }
}

/* ============================================
   ACCESIBILIDAD
   ============================================ */

/* Focus visible para teclado */
.tls-bottom-nav-item:focus {
    outline: 2px solid var(--tls-azul-principal);
    outline-offset: -2px;
}

/* Mejorar contraste para texto */
@media (prefers-contrast: high) {
    .tls-bottom-nav-item {
        color: var(--tls-texto-oscuro);
    }
    
    .tls-bottom-nav-item.active {
        color: var(--tls-azul-oscuro);
    }
}

/* Reducir animaciones si el usuario lo prefiere */
@media (prefers-reduced-motion: reduce) {
    .tls-bottom-nav,
    .tls-bottom-nav-item,
    .tls-bottom-nav-item .icon {
        animation: none !important;
        transition: none !important;
    }
}

/* ============================================
   SAFE AREA (iPhone con notch)
   ============================================ */

@supports (padding-bottom: env(safe-area-inset-bottom)) {
    @media screen and (max-width: 768px) {
        .tls-bottom-nav {
            padding-bottom: env(safe-area-inset-bottom);
            height: calc(var(--tls-bottom-nav-height) + env(safe-area-inset-bottom));
        }
        
        .tls-panel-content {
            padding-bottom: calc(var(--tls-bottom-nav-height) + env(safe-area-inset-bottom) + 20px) !important;
        }
    }
}
/* Ocultar bottom nav en página de login */
body.tls-linker-login .tls-bottom-nav {
    display: none !important;
}

/* O si no tiene esa clase, usar el body class de WordPress */
body.login .tls-bottom-nav {
    display: none !important;
}
