/* =========================================================
   arquivo: style.css (Atualizado para Botões do Chat e Share)
   ========================================================= */

:root {
    /* ... Cores Principais (Manter) ... */
    --container-bg: #E5E5E5; 
    --border-radius-main: 3rem; 
    
    /* NOVO: Cores da Imagem de Fundo e Transparência */
    --dark-bg-color: #0c1a2c; /* Azul marinho escuro */
    --sidebar-bg: #fff; /* Fundo branco da sidebar */
    --chat-bg-user: #25D366; /* Verde Whatsapp */
    --chat-bg-bot: #334d70; /* Azul Bot */
}

/* Base Global */
body {
    font-family: 'Inter', sans-serif;
    display: flex;
    flex-direction: column; 
    min-height: 100vh; 
    background: var(--dark-bg-color); 
}

/* NOVO: Overlay de Fundo (A Imagem Grande com Transparência) */
.background-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('../assets/img/background.jpg.jpg'); 
    background-size: cover;
    background-position: center;
    opacity: 0.2; 
    z-index: -1; 
}

/* ===========================
   HEADER & BUSCA
   ========================== */
header {
    background-color: var(--dark-bg-color); 
    padding: 1.25rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between; 
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: 0 4px 12px rgba(0,0,0,0.5); 
    border-top-left-radius: 2rem; 
    border-top-right-radius: 2rem; 
}

.search-area {
    margin-left: auto; /* Empurra para a direita */
}

#search {
    padding: 0.75rem 1.25rem; 
    border-radius: 0.75rem;
    outline: none;
    background-color: rgba(0, 0, 0, 0.25); 
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.3); 
    box-shadow: none; 
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1); 
}
#search::placeholder {
    color: rgba(255, 255, 255, 0.7); 
}
#search:focus {
    outline: 3px solid #ffffff; 
    box-shadow: 0 0 0 3px rgba(144, 238, 144, 0.3); 
    transform: scale(1.01);
}

/* Contêiner Principal */
.main-container {
    display: flex;
    gap: 1rem; 
    align-items: flex-start;
    flex-grow: 1;
}

/* ===========================
   SIDEBAR (DESKTOP)
   ========================== */
.filter-sidebar-compact {
    flex-shrink: 0;
    width: 250px; 
    background-color: var(--sidebar-bg);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    padding: 1rem 0;
    border-radius: 1rem; 
    height: fit-content; 
    position: sticky;
    top: 6rem; /* Fica fixo abaixo do header */
}
.filter-sidebar-compact h2 {
    padding: 0 1.5rem 1rem 1.5rem;
    margin-bottom: 0.5rem;
    border-bottom: 3px solid #0c1a2c;
}

#filter-list { list-style: none; padding: 0; margin: 0; }
#filter-list > li { border-bottom: 1px solid #eee; }

.filter-summary {
    cursor: pointer;
    padding: 0.75rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 500;
    transition: background-color 0.2s;
}
.filter-summary:hover { background-color: #f5f5f5; }

.filter-options-compact {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out, padding 0.3s ease-out;
    padding: 0 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    scroll-behavior: smooth;
}
.filter-options-compact.open {
    max-height: 5000px; /* Aumentado para acomodar listas longas */
    overflow-y: visible; /* Remove scroll interno, deixa o wrapper controlar */
    padding: 0.5rem 1.5rem 1rem 1.5rem;
    border-top: 1px solid #eee;
}
.filter-options-compact label { font-size: 0.9rem; }

.filter-options-wrapper {
    max-height: 200px;      /* altura máxima visível */
    overflow-y: auto;       /* ativa o scroll */
}

/* Estilos para o grupo de filtros de data */
.date-filter-group {
    margin-bottom: 10px;
}

.date-filter-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: var(--text-dark-secondary); /* Ex: um cinza claro */
}

.date-input {
    width: 100%;
    padding: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 5px;
    background-color: rgba(0, 0, 0, 0.2); /* Fundo sutil */
    color: white;
    font-size: 0.9rem;
    cursor: pointer;
}

.date-input::-webkit-calendar-picker-indicator {
    filter: invert(1); 
}

.clear-filter-btn {
    width: 100%;
    padding: 8px;
    margin-top: 10px;
    background-color: #f6ad55; /* Cor de destaque */
    color: var(--dark-bg-color);
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 600;
    transition: opacity 0.2s;
}

.clear-filter-btn:hover {
    opacity: 0.9;
}


/* ===========================
   CARDS & GRID
   ========================== */

.notice-grid {
    flex-grow: 1;
    display: grid;
    color: #fff;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); 
    gap: 1rem; 
    padding-top: 1rem; 
    padding-bottom: 1.5rem;
}

.notice-card {
    background-color: rgba(78, 74, 74, 0.19);
    color: #fff;

    padding: 0.6rem;         
    border-radius: 0.75rem;

    max-width: 280px;
    overflow: hidden;

    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 6px 15px rgba(0,0,0,0.5);

    display: flex;
    flex-direction: column;

    justify-content: flex-start; 
    gap: 0.45rem;             

    transition: transform 0.2s ease-in-out,
                box-shadow 0.2s ease-in-out,
                background-color 0.2s ease-in-out;
    position: relative;
}

.notice-card:hover {
    transform: translateY(-2px) scale(1.015); 
    box-shadow: 0 7px 16px rgba(0, 0, 0, 0.55); 
    background: linear-gradient(145deg, rgba(17,30,48,1) 0%, rgba(29,51,78,1) 100%);
}

.card-header-actions {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.5rem;
}

/* Ajuste de Imagem do Card (Logo) */
.notice-icon {
    height: 75px;           /* Altura aumentada para melhor visualização de logos quadrados */
    width: auto;
    max-width: 210px;       /* Largura aumentada para logos horizontais grandes */
    display: flex;
    align-items: center;
    justify-content: flex-start;
    margin-right: 10px;
}

.notice-icon img {
    max-height: 100%;
    max-width: 100%;
    width: auto;
    height: auto;
    object-fit: contain;    /* Garante que o logo não seja cortado */
    object-position: left;  /* Alinha a imagem à esquerda */
}

.share-btn {
    background: transparent;
    border: none;
    color: #f6ad55;
    cursor: pointer;
    font-size: 1.1rem;
    padding: 5px;
    transition: color 0.2s, transform 0.2s;
    z-index: 10;
    flex-shrink: 0;
}

.share-btn:hover {
    color: #fff;
    transform: scale(1.2);
}

.notice-card h3 {
    font-weight: 800;
    font-size: 1.1rem; 
    margin-bottom: 0.2rem;
    line-height: 1.25;
}
.notice-card p {
    font-size: 0.9rem;  
    line-height: 1.4;
    flex-grow: 1;       
    margin-bottom: 0.5rem;
}

/* Tags */
.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    margin-top: 0.75rem;

    max-height: 3.2em; 
    overflow: hidden;
    position: relative;
}


.tag {
    padding: 0.2rem 0.5rem;
    border-radius: 0.5rem;
    font-size: 0.75rem;
    font-weight: 500;
    background-color: #09165c;
    color: #fff;
    white-space: nowrap;
}

.tag-tema { 
    background-color: #09165c; 
    color: #fff; 
    border-radius: 0.5rem;
}

/* ===========================
   ANIMAÇÕES & FOOTER
   ========================== */

@keyframes fadeInUpInflate {
    0% {
        opacity: 0;
        transform: translateY(20px) scale(0.8); 
    }
    50% {
        opacity: 1;
        transform: translateY(-5px) scale(1.05); 
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1); 
    }
}

/* Footer */
footer {
    margin-top: auto; 
    text-align: center;
    color: rgba(255, 255, 255, 0.6); 
    border-top: 1px solid rgba(255, 255, 255, 0.1); 
}

/* Botão Flutuante que abre/fecha os filtros */
.filter-toggle-btn {
    display: none; 
    position: fixed;
    bottom: 2rem;
    left: 1rem;
    z-index: 100;
    padding: 1rem 1.2rem;
    border-radius: 50%;
    background-color: #fff; 
    color: var(--dark-bg-color);
    border: 1px solid rgba(0, 0, 0, 0.2); 
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
    transition: transform 0.2s;
    font-size: 1.2rem;
}
.filter-toggle-btn:hover {
    transform: scale(1.05);
}

/* ===========================
   RESPONSIVIDADE (MOBILE)
   ========================== */

.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 80;
    opacity: 0; 
    visibility: hidden;
    transition: opacity 0.3s ease-in-out, visibility 0.3s;
}

@media (max-width: 1024px) {
    header {
        display: flex;             
        flex-direction: row;       
        flex-wrap: wrap;           
        justify-content: center;   
        align-items: center;       
        padding: 0.75rem 1rem;
    }

    .logo-area {
        width: 100%;               
        text-align: center;        
        margin-bottom: 0.5rem;    
    }

    .search-area {
        width: 100%;               
        display: flex;             
        justify-content: center;   
    }

    #search {
        width: 90%;                
        text-align: center;        
    }
    
    .main-container {
        flex-direction: column;
        max-width: 95%; 
        padding: 0 0 2rem 0; 
        margin: 0.3rem auto; 
    }

    .filter-toggle-btn {
        display: flex;
    }

    .filter-sidebar-compact {
        width: 300px; 
        height: 100%;
        position: fixed;
        top: 0;
        left: 0;
        z-index: 90;
        transform: translateX(-100%); 
        transition: transform 0.3s ease-out;
        border-radius: 0 10px 10px 0;
        overflow-y: auto;
        box-shadow: 10px 0 30px rgba(0, 0, 0, 0.5); 
        padding-top: 5rem; 
    }
    
    .filter-sidebar-compact.open {
        transform: translateX(0);
    }
    
    .sidebar-overlay.active {
        opacity: 1;
        visibility: visible;
    }
    
    .notice-grid {
        width: 100%; 
        padding: 0.5rem;
        grid-template-columns: 1fr; 
    }
}

/* =========================================================
   F. MODAL DE DETALHES DO EDITAL (AJUSTADO PARA SCROLL E ACCORDION)
   ========================================================= */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8); 
    z-index: 1000; 
    display: none; 
    justify-content: center;
    align-items: center;
    /* Scroll movido para dentro do modal, mas mantemos auto aqui por segurança mobile */
    overflow-y: auto; 
    padding: 20px 0;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}

.modal-overlay.open {
    display: flex; 
    opacity: 1;
}

.edital-modal {
    position: relative;
    background-color: var(--dark-bg-color); 
    color: #fff;
    width: 90%;
    max-width: 800px; 
    
    /* MODIFICAÇÃO: Altura máxima e layout flex para scroll interno */
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;

    min-height: 400px;
    padding: 30px;
    padding-bottom: 10px;
    border-radius: 1rem;
    box-shadow: 0 0 20px rgba(3, 0, 168, 0.7);
    transform: translateY(-50px); 
    transition: transform 0.4s ease-out;
}

.modal-overlay.open .edital-modal {
    transform: translateY(0); 
}

.modal-close-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    color: white;
    font-size: 2rem;
    cursor: pointer;
    transition: color 0.2s;
    z-index: 10; /* Garante que fique acima do conteúdo */
}

.modal-close-btn:hover {
    color: #f6ad55;
}

/* Container interno com scroll */
#modal-content-container {
    overflow-y: auto;
    padding-right: 10px; /* Espaço para scrollbar */
    flex: 1; /* Ocupa o espaço restante */
    margin-top: 25px; /* Afasta a área de rolagem do botão de fechar */
}

/* Customização da barra de rolagem do modal */
#modal-content-container::-webkit-scrollbar {
    width: 8px;
}
#modal-content-container::-webkit-scrollbar-track {
    background: rgba(255,255,255,0.05);
    border-radius: 4px;
}
#modal-content-container::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.2);
    border-radius: 4px;
}

.modal-content-container h2 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    border-bottom: 2px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 10px;
    color: #fff;
    padding-right: 30px; /* Evita sobrepor botão de fechar */
}

.modal-content-container p {
    font-size: 1.1rem;
    line-height: 1.8;
    margin-bottom: 20px;
    color: rgba(255, 255, 255, 0.9);
}

.modal-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 15px;
    margin-bottom: 25px;
    padding: 15px 0;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-details div strong {
    display: block;
    color: #f6ad55; 
    font-weight: 1000;
    margin-bottom: 5px;
}

.modal-details div span {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.95rem;
}

/* ===========================
   NOVOS ESTILOS PARA DOCUMENTOS EXPANSÍVEIS
   ========================== */
.attachments-section {
    margin-top: 30px;
    margin-bottom: 20px;
}

/* Cabeçalho Accordion */
.attachments-summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: rgba(255, 255, 255, 0.05);
    padding: 15px 20px;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.attachments-summary:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.attachments-summary h3 {
    font-size: 1.3rem;
    color: #fff;
    margin: 0;
}

.attachments-summary i {
    color: #f6ad55;
    font-size: 1.2rem;
    transition: transform 0.3s ease;
}

/* Wrapper Animado */
.attachments-wrapper {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease-out, margin-top 0.3s ease;
}

.attachments-wrapper.open {
    max-height: 1000px; /* Valor seguro para animação */
    margin-top: 15px;
}

.attachment-list {
    list-style: none;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.attachment-list li {
    margin-bottom: 0;
    width: 100%;
}

/* Estilo Botão de Anexo (Estilo Lista Azulada) */
.attachment-list a {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 14px 20px;
    background-color: #334d70; /* Azul similar aos botões de lista */
    color: white;
    text-decoration: none;
    border-radius: 8px;
    transition: background-color 0.2s, transform 0.1s;
    font-weight: 500;
}

.attachment-list a:hover {
    background-color: #4a668c;
    transform: translateX(5px);
}

.attachment-list i {
    font-size: 1.2rem;
    color: #f6ad55; /* Cor do ícone de link */
}


.modal-share-btn {
    background: none;
    border: 1px solid #f6ad55;
    color: #f6ad55;
    padding: 5px 10px;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    transition: background 0.2s, color 0.2s;
    margin-right: 40px;
}

.modal-share-btn:hover {
    background: #f6ad55;
    color: #0c1a2c;
}

@media (max-width: 600px) {
    .edital-modal {
        padding: 20px;
        min-height: auto;
    }
    .modal-content-container h2 {
        font-size: 1.8rem;
    }
    .modal-details {
        grid-template-columns: 1fr;
    }
    .attachments-summary h3 {
        font-size: 1.1rem;
    }
}

/* =========================================================
   G. CHAT BOX & INTERFACE (UNIFICADO E REFATORADO)
   ========================================================= */

/* Botão Flutuante Principal */
.e-contact-buttons__chat-button-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 10000;
}

.e-contact-buttons__chat-button {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    background: #0c1a2c;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    overflow: hidden;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
}

.e-contact-buttons__chat-button:hover {
    transform: scale(1.1);
}

.chat-mascote-icon {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

/* Janela do Chat */
.e-contact-buttons__content-wrapper {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 320px;
    max-height: 420px;

    /* MODIFICADO: Flex para footer fixo */
    display: flex;
    flex-direction: column;

    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 15px 40px rgba(0,0,0,0.2);

    overflow: hidden;
    z-index: 9999;

    opacity: 0;
    pointer-events: none;
    transform: translateY(20px);
    transition: all 0.3s ease;
}

.e-contact-buttons__content-wrapper.open {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.chat-header {
    background: #0c1a2c;
    color: #fff;
    padding: 12px;
    font-weight: bold;
    flex-shrink: 0; /* Não encolher */
}

/* Área de Mensagens */
.chat-messages {
    flex: 1 1 auto; /* Cresce e ocupa espaço disponível */
    padding: 15px;
    overflow-y: auto; /* Scroll apenas aqui */
    min-height: 0; /* Correção para flexbox scroll */
    font-size: 0.9rem;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background-color: #f9f9f9;
    scroll-behavior: smooth; /* Animação suave no scroll */
}

/* Balões de Mensagem */
.message {
    padding: 8px 12px;
    border-radius: 15px;
    line-height: 1.4;
    font-size: 0.9rem;
    word-wrap: break-word;
    /* INSTRUÇÃO: Borda contorna apenas o texto e remove duplicidade */
    width: fit-content;
    max-width: 80%;
}

/* Mensagens do Bot (Esquerda) */
.message.bot {
    background-color: var(--chat-bg-bot);
    color: white;
    align-self: flex-start;
    margin-right: auto;
    border-bottom-left-radius: 2px;
    text-align: left;
}

/* Mensagens do Usuário (Direita) */
.message.user {
    background-color: var(--chat-bg-user);
    color: var(--dark-bg-color);
    align-self: flex-end;
    margin-left: auto;
    border-bottom-right-radius: 2px;
    text-align: right;
}

/* Input Area */
.chat-input-area {
    display: flex;
    gap: 8px;
    padding: 10px;
    border-top: 1px solid #eee;
    background: #fff;
    flex-shrink: 0; /* Mantém fixo embaixo, não encolhe */
}

.chat-input-area input, 
#chat-input { /* ID mantido para compatibilidade JS */
    flex: 1;
    padding: 10px;
    border-radius: 20px;
    border: 1px solid #ccc;
    background-color: #f0f0f0;
    color: #333;
    outline: none;
}

.chat-input-area button,
#send-button {
    border: none;
    background: #0c1a2c;
    color: #fff;
    border-radius: 50%;
    width: 38px;
    height: 38px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.chat-input-area button:hover {
    background-color: #f6ad55;
    color: #0c1a2c;
}

.admin-edit-btn {
    margin-top: 8px;
    padding: 6px;
    background: #f6ad55;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
}

body:not(.admin-mode) .admin-edit-btn {
    display: none;
}

/* ESTILOS NOVOS: Botões de Opção do Chat */
.chat-option-btn {
    background-color: #f6ad55;
    color: #0c1a2c;
    border: none;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    font-size: 0.85rem;
    text-align: left;
    transition: background 0.2s, transform 0.1s;
    width: 100%;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}
.chat-option-btn:hover {
    background-color: #ffc27a;
    transform: translateY(-1px);
}
.chat-option-btn:disabled {
    background-color: #ccc;
    color: #666;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}
