/* ===================================
   IMPORTAÇÃO DE FONTES
   =================================== */
@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;700&display=swap');

/* ===================================
   RESET E CONFIGURAÇÕES GLOBAIS
   =================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Roboto', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

/* ===================================
   CONTAINER PRINCIPAL
   =================================== */
.container {
    max-width: 1400px;
    margin: 0 auto;
}

/* ===================================
   CABEÇALHO
   =================================== */
.header {
    background: white;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
    text-align: center;
}

.header h1 {
    color: #1e3a8a;
    font-size: 2.5em;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.header p {
    color: #64748b;
    font-size: 1.1em;
    line-height: 1.6;
}

/* ===================================
   SEÇÃO DE OPÇÕES (Select)
   =================================== */
.options-section {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.options-section label {
    font-weight: bold;
    color: #334155;
}

select {
    padding: 10px 15px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1em;
    cursor: pointer;
    background: white;
    transition: all 0.3s;
}

select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

select:hover {
    border-color: #667eea;
}

/* ===================================
   CAMPO DE ENTRADA DA TURMA
   =================================== */
.turma-input-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.turma-input-group label {
    font-weight: bold;
    color: #334155;
}

#turma-input {
    padding: 10px 15px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1em;
    min-width: 200px;
    transition: all 0.3s;
}

#turma-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

#turma-input:hover {
    border-color: #667eea;
}

#turma-input::placeholder {
    color: #94a3b8;
    font-style: italic;
}

/* ===================================
   SEÇÃO DE UPLOAD
   =================================== */
.upload-section {
    background: white;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
    text-align: center;
}

.file-input-wrapper {
    position: relative;
    display: inline-block;
    margin-bottom: 20px;
}

.file-input-label {
    display: inline-block;
    padding: 15px 30px;
    background: #eff6ff;
    color: #1e40af;
    border: 2px dashed #3b82f6;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s;
    font-size: 1em;
}

.file-input-label:hover {
    background: #dbeafe;
    border-color: #1e40af;
    transform: translateY(-2px);
}

/* Esconde o input de arquivo padrão */
input[type="file"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.files-count {
    color: #64748b;
    margin-bottom: 20px;
    font-size: 0.95em;
    font-weight: 500;
}

/* ===================================
   BOTÕES
   =================================== */
.button-group {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

button {
    padding: 12px 30px;
    font-size: 1em;
    font-weight: bold;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background: #3b82f6;
    color: white;
}

.btn-primary:hover {
    background: #2563eb;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(59, 130, 246, 0.3);
}

.btn-primary:disabled {
    background: #94a3b8;
    cursor: not-allowed;
    transform: none;
}

/* Botão de exportar PDF - Verde */
.btn-success {
    background: #10b981;
    color: white;
}

.btn-success:hover {
    background: #059669;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(16, 185, 129, 0.3);
}

.btn-success:disabled {
    background: #94a3b8;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background: #6b7280;
    color: white;
}

.btn-secondary:hover {
    background: #4b5563;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(107, 114, 128, 0.3);
}

/* ===================================
   PAINEL DE FILTROS E BUSCA
   =================================== */
.filters-panel {
    background: white;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
    display: none;
}

.filters-panel.show {
    display: block;
    animation: slideDown 0.4s ease-out;
}

.filters-panel h3 {
    color: #1e293b;
    margin-bottom: 20px;
    font-size: 1.3em;
    text-align: center;
}

.filters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    align-items: end;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.filter-group label {
    font-weight: 600;
    color: #334155;
    font-size: 0.9em;
}

#search-student {
    padding: 10px 15px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1em;
    transition: all 0.3s;
}

#search-student:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

#search-student::placeholder {
    color: #94a3b8;
    font-style: italic;
}

#filter-status,
#sort-by {
    padding: 10px 15px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1em;
    cursor: pointer;
    background: white;
    transition: all 0.3s;
}

#filter-status:focus,
#sort-by:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.btn-filter {
    padding: 10px 20px;
    background: #6b7280;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s;
    font-size: 0.95em;
}

.btn-filter:hover {
    background: #4b5563;
    transform: translateY(-2px);
}

.filter-results {
    margin-top: 15px;
    padding: 12px;
    background: #f1f5f9;
    border-radius: 8px;
    text-align: center;
    font-weight: 600;
    color: #475569;
}

.filter-results span {
    color: #667eea;
    font-weight: bold;
}

/* ===================================
   ALERTAS
   =================================== */
.alert {
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: none;
    align-items: center;
    gap: 10px;
    font-weight: 500;
}

.alert.show {
    display: flex;
}

.alert-error {
    background: #fef2f2;
    color: #991b1b;
    border-left: 4px solid #dc2626;
}

.alert-info {
    background: #eff6ff;
    color: #1e40af;
    border-left: 4px solid #3b82f6;
}

/* ===================================
   LOADING SPINNER
   =================================== */
.spinner {
    border: 3px solid #f3f4f6;
    border-top: 3px solid #3b82f6;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    animation: spin 1s linear infinite;
    display: inline-block;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ===================================
   PAINEL DE ESTATÍSTICAS
   =================================== */
.statistics-panel {
    background: white;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
    display: none;
}

.statistics-panel.show {
    display: block;
    animation: slideDown 0.4s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.statistics-panel h3 {
    color: #1e293b;
    margin-bottom: 20px;
    font-size: 1.4em;
    text-align: center;
}

/* Grid de cartões de estatísticas */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

/* Cartão de estatística individual */
.stat-card {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 20px;
    border-radius: 10px;
    transition: all 0.3s;
    border: 2px solid transparent;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.1);
}

/* Cores dos diferentes tipos de cartões */
.stat-total {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.stat-approved {
    background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%);
    color: #15803d;
    border-color: #86efac;
}

.stat-failed {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    color: #991b1b;
    border-color: #fca5a5;
}

/* Ícone do cartão */
.stat-icon {
    font-size: 2.5em;
    line-height: 1;
}

/* Conteúdo do cartão */
.stat-content {
    flex: 1;
}

.stat-label {
    font-size: 0.9em;
    font-weight: 500;
    margin-bottom: 5px;
    opacity: 0.9;
}

.stat-value {
    font-size: 2em;
    font-weight: bold;
    line-height: 1;
}

.stat-percentage {
    font-size: 0.85em;
    margin-top: 3px;
    font-weight: 600;
    opacity: 0.85;
}

/* ===================================
   TABELA DE RESULTADOS
   =================================== */
.table-container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    display: none;
}

.table-container.show {
    display: block;
}

.table-wrapper {
    max-height: 70vh;
    overflow: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

/* Cabeçalho da tabela (fixo ao rolar) */
thead th {
    background: #1e3a8a;
    color: white;
    padding: 15px;
    text-align: center;
    font-weight: bold;
    border: 1px solid #1e40af;
    position: sticky;
    top: 0;
    z-index: 10;
}

thead th div {
    font-size: 1.1em;
}

thead th .subtitle {
    font-size: 0.85em;
    font-weight: normal;
    margin-top: 5px;
    opacity: 0.9;
}

/* Células do corpo da tabela */
tbody td {
    padding: 12px;
    border: 1px solid #e2e8f0;
    text-align: center;
}

tbody tr:nth-child(even) {
    background: #f8fafc;
}

tbody tr:hover {
    background: #f1f5f9;
    transition: background 0.2s;
}

.student-name {
    text-align: left;
    font-weight: 500;
    color: #1e293b;
}

/* ===================================
   CONTEÚDO DAS CÉLULAS
   =================================== */
.cell-content {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
}

.faltas-info {
    font-weight: 600;
    font-size: 0.95em;
}

.nota-info {
    font-size: 0.9em;
    color: #475569;
}

/* Badge de situação do aluno */
.situacao-badge {
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.85em;
    font-weight: bold;
    text-align: center;
    min-width: 120px;
}

.situacao-aprovado {
    background: #dcfce7;
    color: #15803d;
}

.situacao-reprovado {
    background: #fee2e2;
    color: #991b1b;
}

/* ===================================
   DESTAQUE DE FALTAS (Cores de fundo)
   =================================== */
.faltas-normal {
    background: white;
}

.faltas-atencao {
    background: #fef3c7;
    font-weight: bold;
}

.faltas-perigo {
    background: #fee2e2;
    font-weight: bold;
}

/* ===================================
   LEGENDA
   =================================== */
.legend {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    margin-top: 20px;
    display: none;
}

.legend.show {
    display: block;
}

.legend h3 {
    color: #1e293b;
    margin-bottom: 15px;
    font-size: 1.3em;
}

.legend-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 12px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9em;
    color: #334155;
}

.legend-color {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    border: 1px solid #cbd5e1;
    flex-shrink: 0;
}

.legend-note {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e2e8f0;
    font-size: 0.85em;
    color: #64748b;
    font-style: italic;
}

/* ===================================
   UTILITÁRIOS
   =================================== */
.hidden {
    display: none !important;
}

/* ===================================
   RESPONSIVIDADE (Mobile)
   =================================== */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    .header h1 {
        font-size: 1.8em;
        flex-direction: column;
    }

    .header p {
        font-size: 1em;
    }

    .options-section {
        flex-direction: column;
        text-align: center;
    }

    .button-group {
        flex-direction: column;
        width: 100%;
    }

    button {
        width: 100%;
        justify-content: center;
    }
    .filters-grid {
        grid-template-columns: 1fr;
    }
    /* Estatísticas em mobile */
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .stat-card {
        padding: 15px;
    }

    .stat-icon {
        font-size: 2em;
    }

    .stat-value {
        font-size: 1.8em;
    }

    .table-wrapper {
        max-height: 60vh;
    }

    thead th {
        font-size: 0.85em;
        padding: 10px;
    }

    tbody td {
        font-size: 0.85em;
        padding: 8px;
    }

    .legend-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .header h1 {
        font-size: 1.5em;
    }

    .file-input-label {
        padding: 12px 20px;
        font-size: 0.9em;
    }

    button {
        padding: 10px 20px;
        font-size: 0.9em;
    }

    .statistics-panel h3 {
        font-size: 1.2em;
    }

    .stat-value {
        font-size: 1.6em;
    }
}
/* ===================================
   BOTÃO DE CERTIFICADOS
   =================================== */
.btn-certificados {
    background: linear-gradient(135deg, #1a1a2e 0%, #0f3460 100%);
    color: #ffd700;
    border: 2px solid rgba(255, 215, 0, 0.4);
    font-size: 1em;
    font-weight: bold;
    padding: 12px 28px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    animation: certificadoPulse 2.5s ease-in-out infinite;
}

.btn-certificados:hover {
    background: linear-gradient(135deg, #0f3460 0%, #1a4a8a 100%);
    border-color: #ffd700;
    box-shadow: 0 4px 20px rgba(255, 215, 0, 0.35);
    transform: translateY(-2px);
    color: #ffe55c;
}

@keyframes certificadoPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255, 215, 0, 0.0); }
    50% { box-shadow: 0 0 12px 3px rgba(255, 215, 0, 0.25); }
}
