/**
 * ═══════════════════════════════════════════════════════════
 * 🟢🔴 STATUS INDICATOR - Indicador Online/Offline
 * ═══════════════════════════════════════════════════════════
 * Versão: 1.4.1
 * Data: 21/01/2026
 * Descrição: Indicador visual de conexão com internet
 *
 * 🆕 v1.4.1:
 * - Esconder badge durante splash screen (body:has(.splash-screen.active))
 *
 * v1.4.0:
 * - Badge de status DENTRO do card de navegação (ao lado do TEMPO)
 * - Badge flutuante ESCONDIDO durante navegação ativa
 * - Novo elemento: #nav-status-badge com estilos dedicados
 * - Sincronização automática entre badges via JS
 *
 * v1.3.0:
 * - Badge SEMPRE visível (z-index: 99999)
 *
 * v1.2.0:
 * - Estilo compacto e integrado com fundo escuro
 * ═══════════════════════════════════════════════════════════
 */

/* ═══════════════════════════════════════════════════════════
   INDICADOR DE STATUS (BOLINHA)
   ═══════════════════════════════════════════════════════════ */

.status-indicator {
    position: fixed;
    top: 12px;
    right: 12px;
    z-index: calc(var(--z-sistema) + 1) !important; /* 🆕 v1.2.0: Sempre acima de tudo */
    display: flex !important; /* 🆕 v1.2.0: Garantir visibilidade */
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.3s ease;
    cursor: pointer;
    user-select: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* Estado Online */
.status-indicator.online {
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
    color: #155724;
    border: 1px solid #28a745;
}

.status-indicator.online .status-dot {
    background: #28a745;
    box-shadow: 0 0 8px rgba(40, 167, 69, 0.6);
}

/* Estado Offline */
.status-indicator.offline {
    background: linear-gradient(135deg, #f8d7da 0%, #f5c6cb 100%);
    color: #721c24;
    border: 1px solid #dc3545;
}

.status-indicator.offline .status-dot {
    background: #dc3545;
    box-shadow: 0 0 8px rgba(220, 53, 69, 0.6);
    animation: pulse-offline 1.5s ease-in-out infinite;
}

/* Bolinha do indicador */
.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    transition: all 0.3s ease;
}

/* Animação de pulse quando offline */
@keyframes pulse-offline {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.2);
        opacity: 0.7;
    }
}

/* Texto do status */
.status-text {
    white-space: nowrap;
    transition: opacity 0.3s ease;
}

/* Modo compacto (só bolinha) */
.status-indicator.compact {
    padding: 8px;
    gap: 0;
}

.status-indicator.compact .status-text {
    display: none;
}

/* ═══════════════════════════════════════════════════════════
   TOAST NOTIFICATION
   ═══════════════════════════════════════════════════════════ */

.status-toast {
    position: fixed;
    top: 60px;
    right: 12px;
    z-index: calc(var(--z-modal) + 1);
    padding: 12px 20px;
    border-radius: 8px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    transform: translateX(120%);
    transition: transform 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    display: flex;
    align-items: center;
    gap: 10px;
}

.status-toast.show {
    transform: translateX(0);
}

.status-toast.online {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
}

.status-toast.offline {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
    color: white;
}

.status-toast-icon {
    font-size: 18px;
}

.status-toast-text {
    line-height: 1.3;
}

/* ═══════════════════════════════════════════════════════════
   RESPONSIVO - MOBILE
   ═══════════════════════════════════════════════════════════ */

@media (max-width: 480px) {
    .status-indicator {
        top: 8px;
        right: 8px;
        padding: 5px 10px;
        font-size: 11px;
    }
    
    .status-dot {
        width: 8px;
        height: 8px;
    }
    
    .status-toast {
        top: 50px;
        right: 8px;
        left: 8px;
        font-size: 13px;
    }
}

/* ═══════════════════════════════════════════════════════════
   TEMA ESCURO (NAVEGAÇÃO NOTURNA)
   ═══════════════════════════════════════════════════════════ */

body.dark-theme .status-indicator.online,
body.theme-dark .status-indicator.online {
    background: linear-gradient(135deg, #1e4620 0%, #2d5a30 100%);
    color: #a3d9a5;
    border-color: #28a745;
}

body.dark-theme .status-indicator.offline,
body.theme-dark .status-indicator.offline {
    background: linear-gradient(135deg, #4a1a1a 0%, #5c2020 100%);
    color: #f5a5a5;
    border-color: #dc3545;
}

/* ═══════════════════════════════════════════════════════════
   ESCONDER BADGE FLUTUANTE DURANTE SPLASH E NAVEGAÇÃO
   ═══════════════════════════════════════════════════════════ */

/* 🆕 v1.4.1: Esconder badge durante splash screen */
body:has(.splash-screen.active) .status-indicator {
    display: none !important;
}

/* 🆕 v1.4.0: Esconder badge flutuante quando navegação ativa */
/* O status é mostrado DENTRO do card via #nav-status-badge */
body.navigation-active .status-indicator {
    display: none !important;
}

/* ═══════════════════════════════════════════════════════════
   BADGE DE STATUS DENTRO DO CARD DE NAVEGAÇÃO
   ═══════════════════════════════════════════════════════════ */

/* Container do status no card */
.nav-status-item {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Badge de status (Online/Offline) */
.nav-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    transition: all 0.3s ease;
}

/* Estado Online */
.nav-status-badge.online {
    background: rgba(40, 167, 69, 0.9);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Estado Offline */
.nav-status-badge.offline {
    background: rgba(220, 53, 69, 0.9);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Bolinha do status */
.nav-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: white;
    box-shadow: 0 0 6px rgba(255, 255, 255, 0.5);
}

/* Animação pulse quando offline */
.nav-status-badge.offline .nav-status-dot {
    animation: nav-pulse-offline 1.5s ease-in-out infinite;
}

@keyframes nav-pulse-offline {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.2);
        opacity: 0.7;
    }
}

/* Mobile - texto menor */
@media (max-width: 480px) {
    .nav-status-badge {
        padding: 3px 8px;
        font-size: 10px;
        gap: 4px;
    }

    .nav-status-dot {
        width: 6px;
        height: 6px;
    }
}