/* =============================================================
   assets/css/header.css — Estilos do Header
   ============================================================= */

/* ============================================================
   PROGRESS BAR
   ============================================================ */
.nnews-progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 0;
    height: 4px;
    background: var(--color-primary);
    z-index: 99999; /* Acima de tudo */
    transition: width 0.1s ease-out;
}

/* ============================================================
   NEWS TICKER (Últimas Notícias)
   ============================================================ */
.nnews-ticker-wrap {
    background: #fff;
    color: #000;
    font-size: 15px; /* Aumentado para melhor leitura no mobile */
    border-bottom: 1px solid var(--color-border);
}

.nnews-ticker-inner {
    display: flex;
    align-items: center;
    height: 40px;
}

.nnews-ticker-label {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--color-primary);
    color: var(--color-white);
    padding: 0 16px;
    height: 100%;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    flex-shrink: 0;
    position: relative;
    z-index: 2;
}

/* Bolinha vermelha piscando (Live) */
.nnews-ticker-dot {
    width: 8px;
    height: 8px;
    background: #ef4444; /* red-500 */
    border-radius: 50%;
    animation: nnews-pulse-dot 1.5s infinite;
}

@keyframes nnews-pulse-dot {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

.nnews-ticker-content {
    flex: 1;
    overflow: hidden;
    position: relative;
    height: 100%;
    display: flex;
    align-items: center;
}

/* Efeito de Marquee (Rolar texto) */
.nnews-ticker-marquee {
    display: flex;
    white-space: nowrap;
    animation: nnews-marquee 60s linear infinite; /* Animacao mais lenta */
}

/* Pausar a animação ao passar o mouse */
.nnews-ticker-content:hover .nnews-ticker-marquee {
    animation-play-state: paused;
}

@keyframes nnews-marquee {
    0%   { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

.nnews-ticker-item {
    color: #000;
    text-decoration: none;
    padding: 0 24px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    position: relative;
    transition: color var(--transition);
}

.nnews-ticker-item::after {
    content: '';
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: rgba(0,0,0,.2);
}

.nnews-ticker-item:hover {
    color: var(--color-primary);
}

.nnews-ticker-time {
    color: var(--color-primary-light);
    font-weight: 600;
}

.nnews-ticker-title {
    font-weight: 400; /* Texto em movimento normal */
    font-size: 16px;
    text-transform: uppercase;
}

/* ============================================================
   TOPBAR (Logo + Carrossel)
   ============================================================ */
.site-header {
    background: var(--color-white);
    box-shadow: var(--shadow-md);
}

.header-topbar {
    border-bottom: 1px solid var(--color-border);
    padding: 10px 0;
}

.header-topbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-lg);
}

/* ── Logo ── */
.site-branding {
    flex-shrink: 0;
}

.site-logo-link {
    display: inline-block;
    line-height: 0;
}

.site-logo {
    max-height: 80px;
    width: auto;
    display: block;
    object-fit: contain;
}

.site-name-link {
    text-decoration: none;
}

.site-name {
    font-size: var(--font-size-xl);
    font-weight: 800;
    color: var(--color-primary);
    letter-spacing: -.02em;
}

/* ── Área de banner do header ── */
.header-banner-area {
    flex: 1;
    max-width: calc(100% - 320px);
    overflow: hidden;
    display: flex;
    justify-content: flex-end;
}

/* ── Carrossel do header ── */
.nnews-carousel {
    position: relative;
    overflow: hidden;
    border-radius: var(--radius-md);
    background: var(--color-gray-100);
}

/* Proporção 720×90 para desktop */
.header-carousel {
    aspect-ratio: 720 / 90;
    max-height: 90px;
    width: 100%;
    max-width: 720px;
}

/* Track de slides */
.nnews-carousel-track {
    display: flex;
    transition: transform 0.5s cubic-bezier(.25,.8,.25,1);
    height: 100%;
    will-change: transform;
}

.nnews-carousel-slide {
    flex: 0 0 100%;
    height: 100%;
    overflow: hidden;
}

.nnews-carousel-slide .nnews-banner,
.nnews-carousel-slide a {
    display: block;
    width: 100%;
    height: 100%;
}

.nnews-carousel-slide img,
.nnews-carousel-slide picture {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Botões prev/next */
.nnews-carousel-prev,
.nnews-carousel-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(9,67,214,.7);
    color: var(--color-white);
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transition: opacity var(--transition), background var(--transition);
    z-index: 2;
}

.nnews-carousel:hover .nnews-carousel-prev,
.nnews-carousel:hover .nnews-carousel-next {
    opacity: 1;
}

.nnews-carousel-prev { left: 6px; }
.nnews-carousel-next { right: 6px; }

.nnews-carousel-prev:hover,
.nnews-carousel-next:hover {
    background: var(--color-primary);
}

/* ============================================================
   NAVBAR (Menu + Busca)
   ============================================================ */
.main-navigation {
    background: var(--color-primary);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.nav-inner {
    display: flex;
    align-items: center;
    height: 46px;
}

/* ── Hambúrguer (oculto no desktop) ── */
.menu-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    padding: 8px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--color-white);
    border-radius: var(--radius-sm);
    flex-shrink: 0;
    transition: background var(--transition);
}

.menu-toggle:hover { background: rgba(255,255,255,.1); }

.hamburger-bar {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--color-white);
    border-radius: 2px;
    transition: transform .3s, opacity .3s;
}

/* Hambúrguer → X quando ativo */
.menu-toggle[aria-expanded="true"] .hamburger-bar:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}
.menu-toggle[aria-expanded="true"] .hamburger-bar:nth-child(2) {
    opacity: 0;
}
.menu-toggle[aria-expanded="true"] .hamburger-bar:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* ── Logo mobile (oculta no desktop) ── */
.mobile-logo-link {
    display: none;
    margin: 0 auto;
}

.mobile-logo {
    max-height: 36px;
    width: auto;
}

/* ── Menu horizontal ── */
.nav-menu-wrap {
    flex: 1;
    overflow: hidden;
}

.nav-menu {
    display: flex;
    align-items: center;
    gap: 2px;
    list-style: none;
    margin: 0;
    padding: 0;
    height: 46px;
}

.nav-menu li a {
    display: inline-flex;
    align-items: center;
    height: 46px;
    padding: 0 14px;
    color: rgba(255,255,255,.9);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    transition: background var(--transition), color var(--transition);
    border-radius: var(--radius-sm);
    white-space: nowrap;
}

.nav-menu li a:hover,
.nav-menu li.current-menu-item > a,
.nav-menu li.current-page-ancestor > a {
    background: rgba(255,255,255,.15);
    color: var(--color-white);
}

.nav-menu li.current-menu-item > a {
    background: rgba(255,255,255,.2);
    font-weight: 700;
}

/* ── Ferramentas à Direita (Busca + Resizer) ── */
.nav-right-tools {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 15px;
}

.nnews-desktop-resizer {
    display: flex;
    align-items: center;
    gap: 5px;
    background: rgba(0,0,0,0.15);
    padding: 3px 5px;
    border-radius: 20px;
}

.nnews-desktop-resizer .nnews-resizer-btn {
    background: transparent;
    border: none;
    color: var(--color-white);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: background var(--transition);
    padding: 0;
}

.nnews-desktop-resizer .nnews-resizer-btn:hover {
    background: rgba(255,255,255,0.2);
}

.search-toggle {
    flex-shrink: 0;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(255,255,255,.1);
    color: var(--color-white);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--transition);
}

.search-toggle:hover { background: rgba(255,255,255,.2); }

/* ── Overlay do menu mobile ── */
.menu-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 998;
    opacity: 0;
    transition: opacity .3s;
}

.menu-overlay.visible {
    display: block;
    opacity: 1;
}

/* ============================================================
   MODAL DE BUSCA
   ============================================================ */
.search-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2000;
    background: transparent;
    padding: 20px var(--container-pad);
    transform: scale(0.95);
    opacity: 0;
    transition: transform .35s cubic-bezier(.16,1,.3,1), opacity .3s;
    pointer-events: none; /* Deixa os cliques passarem para o backdrop */
}

.search-modal:not([hidden]) {
    display: flex;
    align-items: center;
    justify-content: center;
    transform: scale(1);
    opacity: 1;
}

.search-modal-inner {
    width: 100%;
    max-width: 700px;
    margin: 0 auto;
    position: relative;
    background: #ffffff;
    padding: 25px;
    border-radius: var(--radius-md);
    box-shadow: 0 10px 40px rgba(0,0,0,.15);
    pointer-events: auto; /* Restaura os cliques para a caixa do modal */
}

.search-modal-form {
    display: flex;
    gap: var(--space-sm);
    align-items: center;
}

.search-modal-input {
    flex: 1;
    background: #ffffff;
    border: 2px solid rgba(0,0,0,.1);
    border-radius: 100px;
    padding: 14px 24px;
    font-size: 18px;
    color: #000000;
    outline: none;
    box-shadow: 0 4px 12px rgba(0,0,0,.05);
    transition: border-color var(--transition), box-shadow var(--transition);
}

.search-modal-input::placeholder { color: rgba(0,0,0,.4); }

.search-modal-input:focus {
    border-color: var(--color-primary);
    background: #ffffff;
    box-shadow: 0 4px 20px rgba(0,0,0,.1);
}

.search-modal-submit {
    background: var(--color-primary);
    border: none;
    color: var(--color-white);
    border-radius: 50%;
    width: 52px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: background var(--transition);
}

.search-modal-submit:hover { background: var(--color-primary-dark, #000); }

.search-modal-close {
    display: none !important;
}

.search-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1999;
    background: transparent;
}

/* ============================================================
   RESPONSIVO — HEADER
   ============================================================ */

/* iPad retrato (≤991px): oculta logo do topbar, mantém logo mobile */
@media (max-width: 991px) {
    .header-topbar-inner { flex-direction: column; align-items: center; }
    .header-banner-area { max-width: 100%; width: 100%; }
    .header-carousel { aspect-ratio: 500 / 350; max-height: none; }
    .site-branding { text-align: center; }
}

/* Logo inside mobile drawer (Hidden on desktop) */
.mobile-drawer-logo {
    display: none;
}

/* Mobile (≤767px): hambúrguer + logo centro + lupa */
@media (max-width: 767px) {
    /* Reordenação Inteligente de Blocos (Flex no Page) */
    #page {
        display: flex;
        flex-direction: column;
    }
    
    /* Menu Fino no Topo Absoluto */
    .main-navigation { 
        order: 1; 
        position: sticky; 
        top: 0; 
        z-index: 1000; 
    }
    
    /* Letreiro Últimas embaixo do Menu */
    .nnews-ticker-wrap { order: 2; }
    
    /* Aumentar ícones do Topo (Hambúrguer e Lupa) */
    .nav-inner { 
        justify-content: space-between; 
        padding: 6px var(--container-pad); 
        height: auto; 
    }
    .menu-toggle { display: flex; gap: 7px; padding: 10px 8px; }
    .hamburger-bar { width: 28px; height: 3px; border-radius: 3px; }
    
    .search-toggle { width: 44px; height: 44px; }
    .search-toggle svg { width: 24px; height: 24px; }
    
    /* Header (Banner + Logo) */
    .site-header { 
        order: 3; 
        display: flex; 
        flex-direction: column; 
    }
    .header-topbar { order: 1; padding: 0; border-bottom: none; margin-top: 15px; margin-bottom: 0; } /* Banner em cima */
    .nnews-mobile-logo-wrap { order: 2; } /* Logo embaixo do banner */
    
    /* Resto do site */
    .site-content { order: 4; }
    .site-footer { order: 5; }
    .nnews-mobile-app-bar { order: 99; }
    .nnews-sidebar-overlay { order: 100; }
    .search-modal { order: 101; }
    .search-modal-backdrop { order: 102; }
    .nnews-back-top { order: 98; }

    /* Topbar: banner normal com margens e arredondamento */
    .header-topbar .container { padding: 0 var(--container-pad); width: 100%; }
    .header-topbar-inner { gap: 0; }
    .site-branding { display: none; }
    
    /* Esconder toda a topbar se não houver banner no mobile (evita espaço vazio de 15px) */
    .header-topbar:has(.header-banner-area:empty),
    .header-topbar:has(.nnews-carousel.nnews-hide-mobile) { display: none !important; }

    .header-banner-area { max-width: 100%; width: 100%; overflow: hidden; border-radius: var(--radius-md); }
    .header-banner-area img, .header-banner-area .nnews-banner-link { display: block; width: 100%; }
    .header-carousel { aspect-ratio: 500 / 350; max-height: none; width: 100%; border-radius: var(--radius-md); }
    
    /* Ticker encostado na borda no mobile */
    .nnews-ticker-inner.container { padding: 0; width: 100%; max-width: none; }

    .menu-toggle { display: flex; }
    
    /* Removemos a logo central da barra azul, pois o menu ficou muito fino */
    .mobile-logo-link { display: none !important; }

    /* Oculta Resizer do header no mobile */
    .nnews-desktop-resizer { display: none !important; }

    /* Drawer do menu */
    .mobile-drawer-logo {
        display: block;
        padding: 20px;
        width: 100%;
        box-sizing: border-box;
        text-align: center;
        border-bottom: 1px solid rgba(255,255,255,0.1);
        margin-bottom: 10px;
    }
    .mobile-drawer-logo img {
        max-width: 100%;
        height: auto;
    }
    .mobile-drawer-logo .site-name {
        color: var(--color-white);
        font-weight: 800;
        font-size: 24px;
    }
    .nav-menu-wrap {
        position: fixed;
        top: 0;
        left: -280px;
        width: 280px;
        height: 100vh;
        background: var(--color-primary);
        z-index: 999;
        overflow-y: auto;
        padding: var(--space-xl) 0;
        transition: left .3s cubic-bezier(.16,1,.3,1);
        box-shadow: 4px 0 24px rgba(0,0,0,.15);
    }

    .nav-menu-wrap.open {
        left: 0;
    }

    .nav-menu {
        flex-direction: column;
        height: auto;
        gap: 0;
        align-items: stretch;
    }

    .nav-menu li a {
        height: auto;
        padding: 14px 24px;
        color: var(--color-white);
        font-size: 18px;
        border-radius: 0;
        border-bottom: 1px solid rgba(255,255,255,0.1);
    }

    .nav-menu li a:hover {
        background: rgba(0,0,0,0.1);
        color: var(--color-white);
    }

    .nav-menu li.current-menu-item > a {
        background: rgba(0,0,0,0.15);
        color: var(--color-white);
        font-weight: 700;
    }
}

/* Mobile retrato (≤480px) */
@media (max-width: 480px) {
    .search-modal { padding: 40px var(--container-pad); }
    .search-modal-input { font-size: 15px; padding: 12px 18px; }
}

.dark-mode-toggle {
    flex-shrink: 0;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(255,255,255,.1);
    color: var(--color-white);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--transition);
    margin-right: 8px;
}
.dark-mode-toggle:hover { background: rgba(255,255,255,.2); }
html.dark-theme .icon-moon { display: none; }
html:not(.dark-theme) .icon-sun { display: none; }


/* ============================================================
   SUBMENU MODAL
   ============================================================ */
.submenu-modal-backdrop {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.6);
    z-index: 999998;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}
.submenu-modal-backdrop.visible {
    opacity: 1;
    pointer-events: auto;
}

.nav-menu .sub-menu {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.95);
    width: calc(100% - 80px); /* 40px margin each side */
    max-width: 450px;
    max-height: calc(100vh - 80px);
    overflow-y: auto;
    background: var(--color-primary); /* fallback */
    z-index: 999999;
    padding: 15px 0;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
    text-align: left;
    list-style: none;
    margin: 0;
    opacity: 0;
    transition: all 0.3s;
}

.nav-menu .sub-menu.modal-active {
    display: block;
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.nav-menu .sub-menu li {
    margin: 0;
    padding: 0;
}

.nav-menu .sub-menu li a {
    display: block;
    padding: 12px 20px;
    font-size: 18px;
    font-weight: 500;
    color: var(--color-white);
    text-decoration: none;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    transition: background 0.2s;
}
.nav-menu .sub-menu li:last-child a { border-bottom: none; }
.nav-menu .sub-menu li a:hover { background: rgba(255,255,255,0.1); }

/* Setinha no pai */
.menu-item-has-children > a::after {
    content: " ▼";
    font-size: 0.8em;
    opacity: 0.8;
}

/* Modal header injetado via JS */
.submenu-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px 10px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    margin-bottom: 10px;
}
.submenu-modal-title {
    font-weight: 700;
    color: #fff;
    font-size: 16px;
    margin: 0;
}
.submenu-modal-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    line-height: 1;
}

/* Sub-menus dentro de sub-menus */
.nav-menu .sub-menu .sub-menu {
    display: block;
    position: static;
    transform: none;
    width: 100%;
    max-width: none;
    box-shadow: none;
    padding: 0;
    opacity: 1;
}
.nav-menu .sub-menu .sub-menu li a {
    padding-left: 40px;
    font-size: 14px;
}



/* Remove backdrop visual e de bloqueio */
.submenu-modal-backdrop {
    display: none !important;
}
/* Adiciona uma leve sombra para destacar o modal já que não tem backdrop */
.nav-menu .sub-menu.modal-active {
    box-shadow: 0 15px 50px rgba(0,0,0,0.5), 0 0 0 2000px rgba(0,0,0,0.01) !important;
}

