/* Importar fonte Inter do Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;700&display=swap');

body {
    font-family: 'Inter', sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f0f2f5; /* Cor de fundo mais clara e moderna */
    color: #333;
    transition: background-color 0.5s ease-in-out; 
}

/* Estilos para o cabeçalho */
.app-header {
    background-size: cover;
    background-position: center;
    padding: 15px 0;
    color: white;
    text-align: center;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 120px; /* Aumenta a altura mínima do cabeçalho */
}

.app-header.day-mode {
    background-image: url('../static/img/dia.jpeg');
}

.app-header.night-mode {
    background-image: url('../static/img/noite.jpeg');
}

.header-content {
    display: flex;
    flex-direction: row; 
    align-items: center;
    justify-content: space-between; /* Alinha o conteúdo à esquerda e direita */
    width: 100%;
    max-width: 1600px;
    padding: 0 40px; /* Aumenta o padding lateral */
    gap: 30px; 
    position: relative; 
}

.app-logo {
    max-width: 150px; /* Tamanho do logo ajustado */
    height: auto;
    border-radius: 12px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.app-header h1 {
    margin: 0;
    font-size: 1.8em; 
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    white-space: nowrap; 
}

.logout-button {
    background-color: #d32f2f;
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1em;
    transition: background-color 0.3s ease, transform 0.2s ease;
    font-weight: 600;
}

.logout-button:hover {
    background-color: #c62828;
    transform: translateY(-2px);
}

/* Estilos para as abas de navegação */
.navigation-tabs {
    display: flex;
    flex-wrap: wrap; 
    justify-content: center;
    background-color: #ffffff;
    padding: 10px;
    border-bottom: 1px solid #e0e0e0;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.tab-button {
    position: relative; /* NECESSÁRIO para o badge */
    background-color: #ffffff;
    border: none;
    padding: 12px 20px;
    cursor: pointer;
    font-size: 1em;
    margin: 3px;
    border-radius: 8px; 
    transition: all 0.3s ease;
    flex-grow: 1; 
    max-width: 250px; 
    color: #555;
    font-weight: 500;
}

/* NOVO: Badge de Notificação (Restaurado) */
.notification-badge {
    position: absolute;
    top: 0px;
    right: 0px;
    background-color: #d32f2f; /* Vermelho vibrante */
    color: white;
    border-radius: 50%;
    padding: 5px 8px;
    font-size: 0.75em;
    font-weight: bold;
    min-width: 20px;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    display: none; /* Inicia oculto, JS mostra se houver pendências */
}


.tab-button:hover {
    background-color: #e9e9e9;
    transform: translateY(-2px);
}

.tab-button.active {
    background-color: #4CAF50;
    color: white;
    font-weight: bold;
    box-shadow: 0 2px 5px rgba(76, 175, 80, 0.3);
    transform: translateY(-2px);
}

/* Estilos para o botão "Links Importantes" */
.tab-button[data-section-id="links-importantes"] {
    background-color: #bbdefb; /* Um azul bem claro */
    color: #1a237e; /* Cor do texto para contraste */
    font-weight: bold;
}
.tab-button[data-section-id="links-importantes"]:hover {
    background-color: #90caf9; /* Um tom um pouco mais escuro ao passar o mouse */
}

/* Estilos para os novos botões */
.tab-button[data-section-id="form-ocorrencias"], .tab-button[data-section-id="resultados-ocorrencias"] {
    background-color: #ffcdd2; /* Vermelho claro */
    color: #b71c1c;
    font-weight: bold;
}
.tab-button[data-section-id="form-ocorrencias"]:hover, .tab-button[data-section-id="resultados-ocorrencias"]:hover {
    background-color: #ef9a9a;
}
.tab-button[data-section-id="links-visitações"] {
    background-color: #c8e6c9; /* Verde claro */
    color: #1b5e20;
    font-weight: bold;
}
.tab-button[data-section-id="links-visitações"]:hover {
    background-color: #a5d6a7;
}

/* NOVO: Estilo para o botão de Solicitações de Presença */
.tab-button[data-section-id="solicitacoes-presenca-admin"] {
    background-color: #ffeb3b; /* Amarelo */
    color: #f57f17;
    font-weight: bold;
}
.tab-button[data-section-id="solicitacoes-presenca-admin"]:hover {
    background-color: #fdd835;
}

/* NOVO: Estilo para o botão de Evasão (Vermelho Forte) */
.tab-button[data-section-id="evasao-monitoramento"] {
    background-color: #ef5350; /* Vermelho claro */
    color: #b71c1c;
    font-weight: bold;
}
.tab-button[data-section-id="evasao-monitoramento"]:hover {
    background-color: #e53935;
}


/* Estilos para as seções de conteúdo (formulários e resultados) */
.section {
    background-color: #ffffff;
    margin: 20px auto;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    width: calc(100% - 40px);
    max-width: 1600px;
    box-sizing: border-box; 
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    border-bottom: 2px solid #eee;
    padding-bottom: 10px;
}

.result-header h2 {
    margin: 0;
    border-bottom: none;
}

.toggle-form-result {
    background-color: #2196f3;
    color: white;
    padding: 8px 16px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.toggle-form-result:hover {
    background-color: #1e88e5;
}


h2 {
    color: #4CAF50;
    text-align: center;
    margin-bottom: 25px;
    font-size: 2em;
    border-bottom: 2px solid #eee;
    padding-bottom: 10px;
}

.form-section {
    background-color: #f9f9f9;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.05);
}

.form-section h3 {
    color: #333;
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 1.4em;
    border-bottom: 1px dashed #ddd;
    padding-bottom: 8px;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
    color: #555;
}

input[type="text"],
input[type="number"],
input[type="date"],
input[type="url"],
input[type="week"],
input[type="email"],
input[type="tel"],
select,
textarea {
    width: calc(100% - 22px); 
    padding: 12px;
    margin-bottom: 15px;
    border: 1px solid #ccc;
    border-radius: 8px;
    box-sizing: border-box;
    font-size: 1em;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

/* Novo estilo para campos Readonly */
input[readonly] {
    background-color: #eee;
    cursor: not-allowed;
    color: #777;
    font-weight: bold;
}


input[type="text"]:focus,
input[type="number"]:focus,
input[type="date"]:focus,
input[type="url"]:focus,
input[type="week"]:focus,
input[type="email"]:focus,
input[type="tel"]:focus,
select:focus,
textarea:focus {
    border-color: #4CAF50;
    box-shadow: 0 0 8px rgba(76, 175, 80, 0.3);
    outline: none;
}

/* NOVO: Estilo para input inválido (ajuda na validação do datalist) */
input:invalid:not([type="radio"]):not([type="checkbox"]):not(:placeholder-shown) {
    border-color: #d32f2f;
    box-shadow: 0 0 8px rgba(211, 47, 47, 0.3);
}

textarea {
    resize: vertical;
    min-height: 80px;
}

button[type="submit"],
button[type="button"] {
    background-color: #4CAF50;
    color: white;
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.1em;
    margin-top: 10px;
    transition: background-color 0.3s ease, transform 0.2s ease, box-shadow 0.3s ease;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

button[type="submit"]:hover,
button[type="button"]:hover {
    background-color: #45a049;
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
}

button[type="submit"]:active,
button[type="button"]:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.red-button {
    background-color: #d32f2f;
}

.red-button:hover {
    background-color: #c62828;
}

/* NOVO: Estilos para o botão de ação azul (Verificar Presença) */
.blue-button, .check-button {
    background-color: #2196f3;
    color: white;
    padding: 6px 12px;
    border-radius: 5px;
    font-size: 0.85em;
    margin: 5px 0; /* Espaçamento interno em TD */
    display: inline-block;
    transition: background-color 0.2s ease;
}

.blue-button:hover, .check-button:hover {
    background-color: #1e88e5;
    transform: none; /* Não aplica o efeito hover padrão */
}

/* NOVO: Botão de remoção de participante na lista de presença */
.remove-participant-button {
    background-color: #ff9800; /* Laranja de aviso */
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.8em;
    transition: background-color 0.2s ease;
    margin-left: 10px;
}

.remove-participant-button:hover {
    background-color: #f57c00;
}


.radio-group, .checkbox-container {
    margin-bottom: 15px;
    padding: 10px;
    border: 1px dashed #ddd;
    border-radius: 8px;
    background-color: #fefefe;
}

.radio-group label, .checkbox-container label {
    display: inline-block;
    margin-right: 20px;
    font-weight: normal;
    cursor: pointer;
    margin-bottom: 5px;
}

.radio-group input[type="radio"], .checkbox-container input[type="checkbox"] {
    margin-right: 5px;
    width: auto;
    vertical-align: middle;
}

.participante-item {
    background-color: #e8f5e9;
    border: 1px solid #c8e6c9;
    padding: 10px 15px;
    margin-bottom: 10px;
    border-radius: 8px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    font-size: 0.95em;
    position: relative; /* Para posicionamento do botão de exclusão */
}

/* NOVO: Estilo para linha de participante em Risco de Evasão (2 Faltas) */
.participante-item.risco-evasao {
    background-color: #fffde7; /* Amarelo muito claro */
    border-color: #ffeb3b; /* Amarelo do aviso */
}

/* NOVO: Estilo para linha de participante Evadido (3+ Faltas) */
.participante-item.evadido {
    background-color: #fbecec; /* Vermelho muito claro */
    border-color: #f44336; /* Vermelho de perigo */
}


.participante-item .participante-nome {
    font-weight: bold;
    color: #2e7d32;
    flex-basis: 100%; 
    margin-bottom: 5px;
}

/* Ajuste o layout do nome do participante para incluir o botão de remoção */
.participante-name-group {
    display: flex;
    align-items: center;
    flex-basis: 100%; 
    margin-bottom: 5px;
}
.participante-item .participante-nome {
    flex-grow: 1;
    margin-bottom: 0;
}


.participante-item .participante-info {
    color: #555;
    font-size: 0.85em;
    flex-basis: 100%;
    margin-bottom: 10px;
}

.participante-item .radio-group {
    border: none;
    padding: 0;
    margin: 0;
    background-color: transparent;
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
}

.participante-item .radio-group label {
    margin-right: 0;
}

/* Estilos para tabelas de resultados */
.filters {
    background-color: #e3f2fd;
    border: 1px solid #bbdefb;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.filters h3 {
    color: #2196f3;
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 1.3em;
    border-bottom: 1px dashed #90caf9;
    padding-bottom: 8px;
}

.filters form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); 
    gap: 20px; 
    align-items: start; 
}

.filters label {
    display: none; /* Esconde a label e usa o placeholder */
}

.filters input, .filters select {
    width: 100%;
    margin-bottom: 0; 
}

.filters .button-group {
    grid-column: 1 / -1; 
    display: flex;
    justify-content: flex-end; 
    gap: 10px; 
    margin-top: 15px;
}
.filters button {
    margin-top: 0; 
}

.metrics {
    background-color: #fff3e0;
    border: 1px solid #ffe0b2;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.metrics h3 {
    color: #ff9800;
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 1.3em;
    border-bottom: 1px dashed #ffcc80;
    padding-bottom: 8px;
}

/* NOVO: Estilo para o background da métrica de Evasão */
#metrics-evasao {
    background-color: #fbecec; /* Vermelho claro */
    border: 1px solid #f44336;
}

#metrics-evasao h3 {
    color: #b71c1c; /* Vermelho escuro */
    border-bottom: 1px dashed #ef9a9a;
}
#metrics-evasao p span {
    color: #b71c1c; /* Vermelho escuro */
}


.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 10px;
}

.metrics p {
    margin-bottom: 8px;
    font-size: 1.1em;
}

.metrics p span {
    font-weight: bold;
    color: #d35400;
}

.table-container {
    overflow-x: auto; 
    border: 1px solid #ddd;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

table {
    width: 100%;
    border-collapse: collapse;
    margin: 0;
    background-color: #ffffff;
}

table th, table td {
    border: 1px solid #ddd;
    padding: 12px 15px;
    text-align: left;
    white-space: nowrap; 
}

/* NOVO: Regras de cor para as linhas de Evasão na tabela de resultados */
#table-evasao tbody tr:nth-child(even) {
    background-color: #f2f2f2;
}

/* Prioriza a cor base de Evasão (Evadido > Risco) */
#table-evasao tbody tr[style*="background-color: rgb(255, 205, 210)"] { /* Cor vermelha para Evadido */
    background-color: #ffcdd2 !important;
}

#table-evasao tbody tr[style*="background-color: rgb(255, 249, 196)"] { /* Cor amarela para Risco */
    background-color: #fff9c4 !important;
}

table td {
    vertical-align: top; /* Garante que o conteúdo (botões) comece no topo */
}

table th {
    background-color: #4CAF50;
    color: white;
    font-weight: bold;
    text-transform: uppercase;
    font-size: 0.9em;
    position: sticky; 
    top: 0;
    z-index: 1;
}

table tbody tr:nth-child(even) {
    background-color: #f2f2f2;
}

table tbody tr:hover {
    background-color: #e0e0e0;
    transition: background-color 0.2s ease;
}

/* Estilos para Paginação */
.pagination-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 20px;
    gap: 10px;
    font-size: 1em;
}

.pagination-container .pagination-button {
    background-color: #2196f3;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.pagination-container .pagination-button:hover:not([disabled]) {
    background-color: #1e88e5;
}

.pagination-container .pagination-button[disabled] {
    background-color: #ccc;
    cursor: not-allowed;
}

/* NOVOS ESTILOS PARA LAYOUT EM GRADE */
.engajamento-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
}

.engajamento-grid label {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-right: 0;
}

.engajamento-grid input[type="checkbox"] {
    margin-right: 5px;
    width: auto;
}

/* Estilos para a lista de escolas (checkboxes) */
#escolas-checkbox-container {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid #ccc;
    padding: 10px;
    border-radius: 8px;
    background-color: #fefefe;
}

#escolas-checkbox-container label {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-bottom: 5px;
    cursor: pointer;
    font-weight: normal;
}

#escolas-checkbox-container label:hover {
    background-color: #e8f5e9;
}

/* Estilos para o Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.4);
    backdrop-filter: blur(5px);
}

.modal-content {
    background-color: #fefefe;
    margin: 10% auto;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    width: 90%;
    max-width: 500px;
    max-height: 90vh; /* Permite scroll vertical se necessário */
    position: relative;
    animation: fadeIn 0.3s;
    overflow: auto; 
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

.modal-content h3 {
    color: #4CAF50;
    margin-top: 0;
    margin-bottom: 20px;
    border-bottom: 1px solid #ddd;
    padding-bottom: 10px;
}

.modal-content .close-button {
    color: #aaa;
    position: absolute;
    top: 10px;
    right: 25px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.modal-content .close-button:hover,
.modal-content .close-button:focus {
    color: #000;
    text-decoration: none;
}

.modal-content .button-group {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

.modal-content .modal-save-button {
    background-color: #4CAF50;
}

.modal-content .modal-close-button {
    background-color: #9e9e9e;
}


/* Estilos para o botão de edição na tabela */
.edit-button {
    background-color: #2196f3;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.8em;
    transition: background-color 0.2s ease;
    margin: 2px;
}

.edit-button:hover {
    background-color: #1e88e5;
}

/* Estilos para o botão de exclusão na tabela (mantém o red-button) */
.delete-button {
    margin: 2px;
    padding: 5px 10px;
    font-size: 0.8em;
}

/* Estilos para o botão de reserva na tabela de Visitações */
.reserve-button {
    background-color: #4CAF50;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.8em;
    transition: background-color 0.2s ease;
}

.reserve-button:hover {
    background-color: #45a049;
}


/* Estilos para a página de Links Importantes */
.link-card {
    display: flex;
    flex-direction: row;
    align-items: center;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 15px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: box-shadow 0.3s ease;
    background-color: #f9f9f9;
}

.link-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.link-info {
    flex-grow: 1;
    padding-right: 20px;
}

.link-info h3 {
    margin-top: 0;
    margin-bottom: 5px;
    border-bottom: none;
}

.link-info h3 a {
    color: #4CAF50;
    text-decoration: none;
    font-size: 1.5em;
    transition: color 0.3s ease;
}

.link-info h3 a:hover {
    color: #45a049;
    text-decoration: underline;
}

.link-image-container {
    flex-shrink: 0;
    width: 25%;
    max-width: 200px;
    height: auto;
    border-radius: 8px;
    overflow: hidden;
}

.link-image {
    width: 100%;
    height: auto;
    display: block;
}

/* Estilos para o Modal de Aviso */
#aviso-modal .modal-content {
    /* Manter estilos originais, mas ajustar o tamanho */
    max-width: 500px; /* Adapte este valor se necessário */
    max-height: 90vh; /* Permite que o modal cresça um pouco mais em telas menores */
    padding: 20px;
    text-align: center;
}

.aviso-content {
    display: flex;
    flex-direction: column; 
    align-items: center; 
    gap: 15px;
}

/* Estilo para o Texto Topo (Ex: ATENÇÃO:) - Corrigido para Vermelho */
.aviso-texto h3 {
    margin-top: 0;
    color: #b71c1c; /* Vermelho escuro forte para "ATENÇÃO" */
    font-size: 1.5em;
    border-bottom: none;
    padding-bottom: 0;
    text-align: center;
}

/* Estilo para o Rodapé Verde (Ex: Todos os recursos liberados!) */
.aviso-rodape-verde {
    font-weight: bold;
    color: #4CAF50; /* Verde padrão do tema */
    margin-top: 15px;
    font-size: 1.1em;
}

/* Estilo para o Rodapé Final (Ex: BEM VINDO!) */
.aviso-rodape-final {
    font-size: 0.9em;
    color: #555;
}

/* Mantenha a imagem responsiva */
.aviso-content img {
    max-width: 100%; 
    height: auto; 
    border-radius: 8px;
    flex-shrink: 0;
    margin: 0 auto;
}

/* =========================================================
   FIM DOS AJUSTES DO MODAL
   ========================================================= */

/* Edit modal helpers */
.inline-checkbox{display:flex;align-items:center;gap:8px;margin:8px 0 14px;color:#444;}
.inline-checkbox input{transform:scale(1.05);}



/* =========================================================
   Responsividade / Mobile & DevTools (viewport menor)
   ========================================================= */
.header-content {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.logout-button {
  margin-left: auto;
}

.modal-content {
  max-height: 90vh;
  overflow-y: auto;
}

.reactivate-button {
  margin-top: 8px;
}

/* Ajustes para telas menores */
@media (max-width: 768px) {
  .login-container {
    width: 92%;
    padding: 24px;
  }

  .navigation-tabs {
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px;
  }

  .tab-button {
    flex: 1 1 auto;
    padding: 10px 12px;
    font-size: 0.95rem;
  }

  .header-content h1 p {
    font-size: 0.95rem;
    line-height: 1.2;
  }

  .logout-button {
    width: 100%;
    margin-left: 0;
  }

  .modal-content {
    width: 94%;
    padding: 18px;
  }

  table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }
}

/* Ajustes para alturas menores (ex.: DevTools aberto) */
@media (max-height: 700px) {
  .app-header {
    position: static;
    top: 0;
    z-index: 999;
  }

  .navigation-tabs {
    position: static;
    top: 0;
    z-index: 998;
  }
}
