/* --- CONFIGURAÇÕES GERAIS / DESKTOP --- */
.menu-toggle-checkbox, .menu-icon-label { display: none; }
.menu-mobile { display: none; } 

/* =======================================================
    CONFIGURAÇÃO UNIFICADA PARA MOBILE (ATÉ 768px)
   ======================================================= */
@media (max-width: 768px) {
    
    /* 1. COMPORTAMENTO DO BODY (TRAVA SCROLL SEM FICAR BRANCO) */
    body {
        height: auto !important;
        min-height: 100vh !important;
        overflow-x: hidden !important;
        overflow-y: auto !important;
        display: block !important;
        padding-top: 1px !important; 
    }

    /* Trava o fundo apenas quando o menu estiver aberto */
    body:has(.menu-toggle-checkbox:checked) {
        overflow: hidden !important;
        touch-action: none; /* Impede gestos no fundo */
    }

    /* 2. HEADER FIXO */
    header {
        position: fixed !important;
        top: 0;
        left: 0;
        width: 100%;
        height: 70px !important;
        padding: 1 px !important;
        background: #142850 !important;
        display: flex !important;
        flex-direction: row !important;
        justify-content: space-between !important;
        align-items: center !important;
        z-index: 1100 !important;
    }

    header h1 {
        font-size: 1.2rem !important;
        margin: 0 !important;
        white-space: nowrap;
    }

    /* 3. ÍCONE HAMBÚRGUER (3 BARRINHAS) */
    .menu-icon-label {
        display: flex !important;
        flex-direction: column;
        justify-content: center;
        gap: 5px;
        width: 30px;
        height: 30px;
        cursor: pointer;
        z-index: 1200;
        position: relative;
    }

    .menu-icon-label span {
        display: block;
        width: 100%;
        height: 3px;
        background-color: #FFDE21;
        border-radius: 2px;
        transition: 0.3s ease-in-out;
    }

    /* 4. PAINEL DO MENU MOBILE (O QUE DESLIZA) */
    .menu-mobile {
        display: flex !important;
        flex-direction: column;
        position: fixed;
        top: 0;
        right: -100%; 
        width: 260px; 
        height: 100dvh; /* Altura dinâmica para iPhone */
        background: #142850;
        padding: 90px 20px 80px 20px; /* Padding bottom maior para o 'Dúvidas' */
        gap: 5px;
        transition: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: -5px 0 15px rgba(0,0,0,0.5);
        z-index: 1150;
        
        /* Controle de Scroll Interno */
        overflow-y: auto !important;
        overflow-x: hidden !important;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
        touch-action: pan-y;
    }

    .menu-toggle-checkbox:checked ~ .menu-mobile {
        right: 0;
    }

    /* 5. LINKS DO MENU E DROPDOWN (DETAILS) */
    .menu-mobile a, 
    .menu-mobile details summary {
        color: white !important;
        text-decoration: none;
        font-size: 1.1rem;
        font-weight: 500;
        text-align: left;
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 15px 10px;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        list-style: none;
        outline: none;
    }

    /* Botão de Destaque (Voltar) no Mobile */
    .menu-mobile .nav-highlight-btn {
        background-color: #FFDE21 !important;
        color: #142850 !important;
        justify-content: center;
        border-radius: 8px;
        margin-bottom: 15px;
        font-weight: bold;
    }

    /* Dropdown Acervo */
    details summary::-webkit-details-marker { display: none; }
    details summary::after {
        content: '▾';
        color: #FFDE21;
        transition: 0.3s;
    }
    details[open] summary::after { transform: rotate(180deg); }

    .dropdown-content-css {
        background-color: rgba(255, 255, 255, 0.05) !important;
        display: block !important;
        position: static !important;
        padding-left: 20px !important;
    }

    .dropdown-content-css a {
        font-size: 1rem !important;
        border-bottom: 1px solid rgba(255, 255, 255, 0.05) !important;
    }

    /* 6. BOTÃO ACESSIBILIDADE (EM CIMA DO LIBRAS) */
    .btn-acessibilidade {
        position: fixed !important;
        right: 15px !important;
        top: 150px !important;
        width: 45px !important;
        height: 45px !important;
        display: flex !important;
        align-items: center;
        justify-content: center;
        background-color: #142850 !important;
        border: 2px solid #FFDE21 !important;
        border-radius: 50% !important;
        color: #FFDE21 !important;
        font-size: 24px !important;
        z-index: 1000 !important;
        box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    }

    /* 7. AVATAR (ESTILO ENCOLHIDO) */
    #welcome-assistant {
        position: fixed !important;
        bottom: 20px !important;
        right: 15px !important;
        z-index: 1000 !important;
        transform: scale(0.85);
        transform-origin: bottom right;
    }

    #avatar-img { width: 70px !important; height: auto; }

    #speech-bubble {
        position: absolute;
        bottom: 85px;
        right: 0;
        width: 180px;
        padding: 12px;
        font-size: 0.8rem;
        background: #fff;
        border: 2px solid #FFDE21;
        border-radius: 15px;
    }

    /* Esconde Avatar e Acessibilidade quando menu abre */
    .menu-toggle-checkbox:checked ~ #welcome-assistant,
    .menu-toggle-checkbox:checked ~ .btn-acessibilidade {
        display: none !important;
    }

    /* Animação do X */
    .menu-toggle-checkbox:checked + .menu-icon-label span:nth-child(1) { transform: rotate(45deg) translate(6px, 6px); }
    .menu-toggle-checkbox:checked + .menu-icon-label span:nth-child(2) { opacity: 0; }
    .menu-toggle-checkbox:checked + .menu-icon-label span:nth-child(3) { transform: rotate(-45deg) translate(5px, -5px); }

    .menu-desktop { display: none !important; }
}

/* Ajusta a área dos cards para ocupar a largura total */
    .news-cards {
        display: grid !important; /* Transforma em grade */
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)) !important; /* Cards lado a lado se couberem */
        gap: 15px !important;
        width: 100% !important;
        padding: 10px 0 !important;
        max-height: none !important; /* Remove scroll interno se houver */
        overflow-y: visible !important;
    }

    /* Ajusta o card individualmente */
    .news-card {
        width: 100% !important;
        margin: 0 !important;
        box-sizing: border-box !important;
        padding: 10px !important;
        background: rgba(255, 255, 255, 0.1) !important; /* Leve destaque */
        border-radius: 10px !important;
        text-align: center !important;
    }

    .news-card img {
        width: 100% !important;
        height: auto !important;
        border-radius: 5px !important;
    }

    /* Ajusta a área de exibição da notícia principal */
    .news-content {
        width: 100% !important;
        text-align: center !important;
        padding: 20px 10px !important;
    }

    .news-content img {
        max-width: 100% !important;
        height: auto !important;
    }
}