/**
 * RotaTruck - Bottom Navigation CSS
 * 
 * @version 1.1.0
 * @since Fase 7 - Mobile UX Base
 * @description Navegação inferior para modo NAVIGATING
 * 
 * COMPORTAMENTO:
 * - ESCONDIDO por padrão (display: none)
 * - VISÍVEL apenas durante navegação ativa
 * - Só aparece em mobile (< 768px)
 * 
 * Abas:
 * - 📍 Rota: Info da rota atual
 * - 🔔 Alertas: Radares, trânsito
 * - ⛽ Parar: Postos, restaurantes
 * - ✖️ Sair: Encerrar navegação
 */

/* ==================== BOTTOM NAVIGATION ==================== */

.bottom-nav {
    /* 🔧 CORRIGIDO: Começa ESCONDIDO */
    display: none !important;
    
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 64px;
    background: #ffffff;
    border-top: 1px solid #e5e7eb;
    z-index: calc(var(--z-nav-ui) + 5);
    
    /* Flexbox para itens */
    flex-direction: row;
    align-items: center;
    justify-content: space-around;
    
    /* Safe area para iPhone X+ */
    padding-bottom: env(safe-area-inset-bottom);
    
    /* Sombra superior */
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    
    /* Transição suave */
    transition: transform 0.3s ease, opacity 0.3s ease;
}

/* ==================== ESTADOS DE VISIBILIDADE ==================== */

/* Classe para mostrar (adicionada via JS durante NAVIGATING) */
.bottom-nav.visible {
    display: flex !important;
    transform: translateY(0);
    opacity: 1;
}

/* Classe para esconder com animação */
.bottom-nav.hidden {
    transform: translateY(100%);
    opacity: 0;
}

/* ==================== RESPONSIVIDADE ==================== */

/* Desktop: NUNCA mostrar */
@media (min-width: 769px) {
    .bottom-nav {
        display: none !important;
    }
    
    .bottom-nav.visible {
        display: none !important;
    }
    
    body.has-bottom-nav {
        padding-bottom: 0 !important;
    }
}

/* Mobile: Mostrar apenas quando .visible */
@media (max-width: 768px) {
    .bottom-nav.visible {
        display: flex !important;
    }
    
    /* Ajustar body quando bottom nav visível */
    body.has-bottom-nav {
        padding-bottom: 64px !important;
    }
    
    body.has-bottom-nav #map {
        bottom: 64px !important;
    }
}

/* ==================== ITEM DE NAVEGAÇÃO ==================== */

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    height: 100%;
    padding: 8px 4px;
    background: transparent;
    border: none;
    cursor: pointer;
    position: relative;
    
    /* Transição */
    transition: all 0.2s ease;
    
    /* Toque */
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.nav-item:active {
    transform: scale(0.95);
}

/* ==================== ÍCONE ==================== */

.bottom-nav .nav-icon {
    width: 24px;
    height: 24px;
    fill: #6b7280;
    transition: fill 0.2s ease, transform 0.2s ease;
}

.nav-item:hover .nav-icon {
    fill: #374151;
}

/* ==================== LABEL ==================== */

.nav-label {
    font-family: 'Segoe UI', -apple-system, sans-serif;
    font-size: 11px;
    font-weight: 500;
    color: #6b7280;
    margin-top: 4px;
    transition: color 0.2s ease;
    white-space: nowrap;
}

.nav-item:hover .nav-label {
    color: #374151;
}

/* ==================== ESTADO ATIVO ==================== */

.nav-item.active {
    /* Indicador superior */
    border-top: 3px solid #FF6B35;
    margin-top: -3px;
}

.nav-item.active .nav-icon {
    fill: #FF6B35;
    transform: scale(1.1);
}

.nav-item.active .nav-label {
    color: #FF6B35;
    font-weight: 600;
}

/* ==================== BOTÃO SAIR (ESPECIAL) ==================== */

.nav-item[data-tab="exit"] .nav-icon {
    fill: #dc3545;
}

.nav-item[data-tab="exit"] .nav-label {
    color: #dc3545;
}

.nav-item[data-tab="exit"]:hover .nav-icon,
.nav-item[data-tab="exit"].active .nav-icon {
    fill: #c82333;
}

.nav-item[data-tab="exit"]:hover .nav-label,
.nav-item[data-tab="exit"].active .nav-label {
    color: #c82333;
}

/* ==================== BADGE DE NOTIFICAÇÃO ==================== */

.nav-badge {
    position: absolute;
    top: 6px;
    right: 50%;
    transform: translateX(12px);
    
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
    font-size: 10px;
    font-weight: 700;
    
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    
    box-shadow: 0 2px 4px rgba(239, 68, 68, 0.4);
    
    /* Animação de pulso */
    animation: badgePulse 2s ease-in-out infinite;
}

@keyframes badgePulse {
    0%, 100% { 
        transform: translateX(12px) scale(1); 
    }
    50% { 
        transform: translateX(12px) scale(1.1); 
    }
}

/* ==================== TEMA ESCURO ==================== */

[data-theme="dark"] .bottom-nav,
.tema-escuro .bottom-nav,
body.dark-mode .bottom-nav {
    background: #1a1a1a;
    border-top-color: #333333;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .bottom-nav .nav-icon,
.tema-escuro .bottom-nav .nav-icon,
body.dark-mode .bottom-nav .nav-icon {
    fill: #9ca3af;
}

[data-theme="dark"] .nav-label,
.tema-escuro .nav-label,
body.dark-mode .nav-label {
    color: #9ca3af;
}

[data-theme="dark"] .nav-item:hover .nav-icon,
.tema-escuro .nav-item:hover .nav-icon,
body.dark-mode .nav-item:hover .nav-icon {
    fill: #d1d5db;
}

[data-theme="dark"] .nav-item:hover .nav-label,
.tema-escuro .nav-item:hover .nav-label,
body.dark-mode .nav-item:hover .nav-label {
    color: #d1d5db;
}

[data-theme="dark"] .nav-item.active .nav-icon,
.tema-escuro .nav-item.active .nav-icon,
body.dark-mode .nav-item.active .nav-icon {
    fill: #FF6B35;
}

[data-theme="dark"] .nav-item.active .nav-label,
.tema-escuro .nav-item.active .nav-label,
body.dark-mode .nav-item.active .nav-label {
    color: #FF6B35;
}

/* ==================== EFEITO RIPPLE ==================== */

.nav-item::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 107, 53, 0.2);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.3s, height 0.3s;
}

.nav-item:active::after {
    width: 60px;
    height: 60px;
}

/* ==================== MOBILE PEQUENO ==================== */

@media (max-width: 360px) {
    .bottom-nav {
        height: 56px;
    }
    
    .bottom-nav .nav-icon {
        width: 20px;
        height: 20px;
    }
    
    .nav-label {
        font-size: 10px;
    }
    
    body.has-bottom-nav {
        padding-bottom: 56px !important;
    }
    
    body.has-bottom-nav #map {
        bottom: 56px !important;
    }
}

/* ==================== ACESSIBILIDADE ==================== */

.nav-item:focus-visible {
    outline: 2px solid #FF6B35;
    outline-offset: -2px;
}

@media (prefers-reduced-motion: reduce) {
    .bottom-nav,
    .nav-item,
    .nav-icon,
    .nav-label,
    .nav-badge {
        transition: none !important;
        animation: none !important;
    }
}

/* ==================== PRINT ==================== */

@media print {
    .bottom-nav {
        display: none !important;
    }
}