/* ============================================================================
   system-alert-banner.css
   Banner global de avisos do sistema (admin -> usuários).
   Fica fixo no topo de todas as páginas, empurra o conteúdo para baixo,
   NÃO pode ser fechado pelo usuário final.
============================================================================ */

#system-alert-banner-root {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 99999;
    pointer-events: none;
}

#system-alert-banner-root .system-alert-banner {
    pointer-events: auto;
    width: 100%;
    padding: 12px 20px;
    box-sizing: border-box;
    font-family: 'Outfit', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    animation: sab-slide-down 0.35s ease-out;
}

#system-alert-banner-root .sab-inner {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    align-items: flex-start;
    gap: 14px;
}

#system-alert-banner-root .sab-icon {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    background: rgba(255, 255, 255, 0.12);
}

#system-alert-banner-root .sab-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

#system-alert-banner-root .sab-title {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    opacity: 0.85;
}

#system-alert-banner-root .sab-message {
    font-size: 0.92rem;
    font-weight: 500;
    line-height: 1.45;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

#system-alert-banner-root .sab-message a {
    color: inherit;
    text-decoration: underline;
    font-weight: 600;
}

#system-alert-banner-root .sab-message a:hover {
    opacity: 0.85;
}

/* ===== Tipos de alerta (cores) ===== */

#system-alert-banner-root .system-alert-banner.type-info {
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.95), rgba(59, 130, 246, 0.95));
    color: #fff;
}

#system-alert-banner-root .system-alert-banner.type-warning {
    background: linear-gradient(135deg, rgba(217, 119, 6, 0.95), rgba(245, 158, 11, 0.95));
    color: #fff;
}

#system-alert-banner-root .system-alert-banner.type-danger {
    background: linear-gradient(135deg, rgba(185, 28, 28, 0.95), rgba(239, 68, 68, 0.95));
    color: #fff;
}

/* Pulse sutil no ícone do alerta danger para chamar atenção */
#system-alert-banner-root .system-alert-banner.type-danger .sab-icon {
    animation: sab-pulse 2s ease-in-out infinite;
}

/* ===== Empurra o conteúdo da página para baixo quando há alerta =====
   --sab-height é definida dinamicamente pelo JS com a altura REAL do banner
   (considerando quebras de linha em mensagens longas). 72px é fallback.

   NOTA IMPORTANTE: algumas páginas (dashboard.css, contatos.css, etc.)
   definem `body { height: 100vh; overflow: hidden }` para layout full-screen.
   Usamos `box-sizing: border-box` + padding-top para que o padding fique
   DENTRO dos 100vh do body (em vez de esticar além da viewport). Depois
   reduzimos a altura dos containers flex internos (.dashboard-container,
   etc.) para caber no content-box restante. */
html.has-system-alert body {
    box-sizing: border-box;
    padding-top: var(--sab-height, 72px);
}

/* Ajuste para containers flex com height:100vh (dashboard, processos, etc.)
   — precisam encolher para caber no body com padding-top. */
html.has-system-alert .dashboard-container,
html.has-system-alert .app-container,
html.has-system-alert .layout-container {
    height: calc(100vh - var(--sab-height, 72px)) !important;
}

/* Ajuste para sidebar fixa (layout do painel) */
html.has-system-alert .sidebar {
    top: var(--sab-height, 72px) !important;
    height: calc(100vh - var(--sab-height, 72px)) !important;
}

/* Ajuste para header fixo do dashboard */
html.has-system-alert .top-header {
    top: var(--sab-height, 72px) !important;
}

/* ===== Animações ===== */

@keyframes sab-slide-down {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes sab-pulse {
    0%, 100% { transform: scale(1); }
    50%      { transform: scale(1.12); }
}

/* ===== Mobile responsivo ===== */
@media (max-width: 768px) {
    #system-alert-banner-root .system-alert-banner {
        padding: 10px 14px;
    }
    #system-alert-banner-root .sab-icon {
        width: 32px;
        height: 32px;
        font-size: 1rem;
    }
    #system-alert-banner-root .sab-title {
        font-size: 0.68rem;
    }
    #system-alert-banner-root .sab-message {
        font-size: 0.85rem;
    }
    /* No mobile, aumentamos o fallback (caso o JS não tenha medido ainda) */
    html.has-system-alert body {
        padding-top: var(--sab-height, 84px);
    }
    html.has-system-alert .dashboard-container,
    html.has-system-alert .app-container,
    html.has-system-alert .layout-container {
        height: calc(100vh - var(--sab-height, 84px)) !important;
    }
    html.has-system-alert .sidebar {
        top: var(--sab-height, 84px) !important;
        height: calc(100vh - var(--sab-height, 84px)) !important;
    }
    html.has-system-alert .top-header {
        top: var(--sab-height, 84px) !important;
    }
}

/* ===== Impressão: esconde o banner ===== */
@media print {
    #system-alert-banner-root { display: none !important; }
    html.has-system-alert body { padding-top: 0 !important; }
}
