:root {
    /* --- CORES PADRÃO DO SISTEMA --- */
    --main-red: #FF8C00;       
    --dark-red: #D96F00;
    --purple-main: #4A148C;    
    --purple-dark: #311B92;
    --gray-light: #f5f5f5;
    --gray-medium: #cccccc;
    --black: #212121;
    --gray-button: #999;
    --gray-button-hover: #666;
    
    /* Cores Dashboard Legado */
    --green-add: #28a745;
    --green-add-hover: #218838;
    --teal-status: #17a2b8;
    --teal-status-hover: #138496;
    --navy-archive: #34495e;
    --navy-archive-hover: #2c3e50;
    --gray-logout: #6c757d;
    --gray-logout-hover: #5a6268;
}

* { box-sizing: border-box; }

body {
    margin: 0; padding: 20px;
    background-color: var(--gray-light);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    display: flex; justify-content: center; align-items: flex-start;
    min-height: 100vh;
}

/* CONTAINER */
.container, .form-container, .dashboard, .frame, .login-container {
    background: white; padding: 30px; border-radius: 12px;
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.1);
    width: 100%; max-width: 1350px; 
    margin: 20px 0; text-align: center;
}
.form-container.narrow, .login-container { max-width: 500px; }
.dashboard-box { max-width: 900px; } 

/* Regra Global de Imagem */
img { width: 120px; margin: 0 auto 20px auto; display: block; }

h1 { font-size: 1.8rem; color: var(--black); margin-bottom: 25px; text-align: center; }
p { margin: 5px 0; }
label { display: block; margin-bottom: 8px; color: var(--black); font-weight: 500; text-align: left; }

/* Inputs */
input[type="text"], input[type="email"], input[type="number"], 
input[type="date"], input[type="password"], textarea, select {
    width: 100%; padding: 12px; margin-bottom: 15px;
    border: 1px solid var(--gray-medium); border-radius: 8px; font-size: 1rem;
}

/* BARRA DE PESQUISA */
form.filter-form {
    display: flex; flex-wrap: wrap; gap: 15px;
    background-color: #f8f9fa; 
    padding: 20px; border-radius: 12px; margin-bottom: 30px;
    border: 1px solid #e9ecef; align-items: center;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.02);
}
form.filter-form input[type="text"], 
form.filter-form select {
    flex: 1; min-width: 250px; border: 1px solid #ced4da;
    background: white; padding: 12px 15px; border-radius: 8px;
    font-size: 1rem; margin-bottom: 0; transition: all 0.3s ease;
}
form.filter-form input[type="text"]:focus,
form.filter-form select:focus {
    border-color: var(--main-red);
    box-shadow: 0 0 0 3px rgba(255, 140, 0, 0.15); outline: none;
}
body.theme-extension form.filter-form input[type="text"]:focus,
body.theme-extension form.filter-form select:focus {
    border-color: var(--purple-main);
    box-shadow: 0 0 0 3px rgba(74, 20, 140, 0.15);
}
form.filter-form button {
    flex: 0 0 auto; width: auto; padding: 12px 30px; margin-bottom: 0;
    height: 48px; font-weight: 600; text-transform: uppercase;
    letter-spacing: 0.5px; font-size: 0.9rem;
    display: flex; align-items: center; justify-content: center; gap: 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}
form.filter-form button:hover {
    transform: translateY(-2px); box-shadow: 0 6px 8px rgba(0,0,0,0.15);
}

/* Tabela Inputs */
td { font-size: 0.85rem; padding: 8px 4px; }
td input[type="text"], td input[type="number"] {
    margin-bottom: 0; padding: 4px 6px; font-size: 0.85rem; height: 30px; border-radius: 4px;
}
td input[name="description"] { font-size: 0.8rem; }
td input[type="date"] {
    margin-bottom: 0; padding: 0 2px; font-size: 0.75rem; height: 30px; border-radius: 4px; width: 100%;
}

/* Botões Padrão */
button {
    flex: 1; padding: 12px; font-size: 1rem; border: none;
    border-radius: 8px; cursor: pointer; transition: background 0.3s ease, transform 0.2s ease; margin-bottom: 10px;
}
button:not(.back-btn):not(.delete):not(.sair):not(.reset-btn):not(.ext):not(.save):not(.btn-dash):not(.btn-action):not(.clear-btn) {
    background-color: var(--main-red); color: white;
}
button:not(.back-btn):not(.delete):not(.sair):not(.reset-btn):not(.ext):not(.save):not(.btn-dash):not(.btn-action):not(.clear-btn):hover {
    background-color: var(--dark-red);
}
button.back-btn, button.sair, button.clear-btn { background-color: var(--gray-button); color: white; }
button.back-btn:hover, button.sair:hover, button.clear-btn:hover { background-color: var(--gray-button-hover); }
button.ext { background-color: var(--purple-main) !important; color: white; }
button.ext:hover { background-color: var(--purple-dark) !important; }
button.reset-btn { background-color: var(--black); color: white; }

/* Dashboard Styles Básicos */
.dashboard-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 20px; margin-bottom: 20px; }
.btn-dash { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 25px 20px; font-size: 1.1rem; font-weight: 600; color: white; min-height: 140px; border-radius: 12px; box-shadow: 0 4px 6px rgba(0,0,0,0.1); width: 100%; }
.btn-dash:hover { transform: translateY(-3px); box-shadow: 0 6px 12px rgba(0,0,0,0.15); }
.btn-dash .icon { font-size: 2rem; margin-bottom: 12px; }

.footer-text { margin-top: 30px; font-size: 0.85rem; color: #777; border-top: 1px solid #eee; padding-top: 20px; }

/* Tabela */
table { width: 100%; border-collapse: collapse; margin-top: 20px; table-layout: fixed; }
th, td { padding: 8px 4px; border-bottom: 1px solid var(--gray-medium); text-align: left; vertical-align: middle; }
th { background-color: var(--main-red); color: white; font-weight: bold; font-size: 0.9rem; }
th.ext-table { background-color: var(--purple-main); }

/* --- EFEITO HOVER NAS TABELAS --- */
tr:hover {
    background-color: #dcdde1;
    transition: background-color 0.2s ease;
    cursor: pointer;
}

/* --- LARGURAS COLUNAS (AJUSTADAS) --- */
/* Descrição reduzida um pouco para dar espaço ao Grupo */
th.col-desc { width: 40%; min-width: 380px; }

/* Grupo aumentado para ~11 caracteres */
th.col-group { width: 115px; } 

/* Datas reduzidas para ~10 caracteres */
th.col-date { width: 95px; } 

th.col-hours { width: 55px; }
th.col-period { width: 65px; }
th.col-max { width: 55px; }
th.col-actions { width: 75px; text-align: center; } 
th.col-view-desc { width: auto; min-width: 350px; } 
th.col-list-id { width: 60px; }
th.col-list-mat { width: 110px; }
th.col-list-name { width: 25%; min-width: 250px; }
th.col-list-course { width: 35%; min-width: 300px; }
th.col-list-actions { width: 120px; text-align: center; }
th.col-status-name { width: 30%; min-width: 250px; }
th.col-status-course { width: 40%; min-width: 300px; }
th.col-status-val { width: 100px; text-align: center; }
th.col-status-btn { width: 140px; text-align: center; }
th.col-arch-name { width: 30%; min-width: 250px; }
th.col-arch-course { width: 40%; min-width: 300px; }
th.col-arch-actions { width: 120px; text-align: center; }

/* LARGURAS PARA TABELA DE GRUPOS (NOVO) */
th.col-grp-name { width: 50%; }
th.col-grp-val { width: 30%; }
th.col-grp-actions { width: 20%; text-align: center; }

/* CABEÇALHO CINZA */
th.col-status-name, th.col-status-course, th.col-status-val, th.col-status-btn,
th.col-arch-name, th.col-arch-course, th.col-arch-actions {
    background-color: #666 !important;
}

/* Status Styles */
.status-active { color: green; font-weight: bold; text-align: center; }
.status-archived { color: red; font-weight: bold; text-align: center; }
.btn-action { padding: 6px 12px; font-size: 0.85rem; margin: 0; width: 100%; border-radius: 4px; color: white; border: none; cursor: pointer; }
.btn-archive { background-color: #dc3545; }
.btn-unarchive { background-color: #28a745; }

/* Icones */
.row-buttons { display: flex; justify-content: center; gap: 10px; white-space: nowrap; }
.row-buttons a { text-decoration: none; font-size: 1.3rem; transition: transform 0.2s; line-height: 1; }
.row-buttons a:hover { transform: scale(1.2); }
.action-group { display: flex; justify-content: center; align-items: center; gap: 4px; width: 100%; }

/* Botões Mini */
button.save, button.delete {
    background-color: #28a745 !important; color: white; padding: 0;
    width: 28px !important; height: 28px !important; border-radius: 4px;
    font-size: 0.75rem !important; font-weight: bold; margin-bottom: 0;
    flex: none; display: flex; align-items: center; justify-content: center;
}
button.save:hover { background-color: #218838 !important; }
button.delete { background-color: #dc3545 !important; }
button.delete:hover { background-color: #c82333 !important; }

/* Paginação */
.pagination { display: flex; justify-content: center; gap: 8px; margin-top: 20px; }
.pagination a { padding: 6px 10px; text-decoration: none; color: var(--main-red); border: 1px solid var(--main-red); border-radius: 4px; }
.pagination a:hover { background-color: var(--main-red); color: white; }
.pagination a.active { background-color: var(--dark-red); color: white; border-color: var(--dark-red); }

/* Layout Geral */
.msg-success { color: green; font-weight: bold; margin: 15px 0; }
.msg-error { color: red; font-weight: bold; margin: 15px 0; }
.msg-info { color: #337ab7; font-weight: bold; margin: 15px 0; }
.total { text-align: right; margin-top: 15px; font-weight: bold; }
.button-group, .action-buttons, .bottom-buttons { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 15px; justify-content: center; }

/* TEMA EXTENSÃO */
body.theme-extension th { background-color: var(--purple-main); }
body.theme-extension button:not(.back-btn):not(.delete):not(.sair):not(.reset-btn):not(.save):not(.clear-btn):not(.btn-action):not(.ext) {
    background-color: var(--purple-main);
}
body.theme-extension button:not(.back-btn):not(.delete):not(.sair):not(.reset-btn):not(.save):not(.clear-btn):not(.btn-action):not(.ext):hover {
    background-color: var(--purple-dark);
}
body.theme-extension .pagination a { color: var(--purple-main); border-color: var(--purple-main); }
body.theme-extension .pagination a:hover { background-color: var(--purple-main); color: white; }
body.theme-extension .pagination a.active { background-color: var(--purple-dark); border-color: var(--purple-dark); color: white; }
body.theme-extension .row-buttons a { color: var(--purple-main); }

@media (max-width: 768px) {
    form.filter-form { flex-direction: column; align-items: stretch; }
    form.filter-form button { width: 100%; }
    table { table-layout: auto; display: block; overflow-x: auto; }
    th.col-desc, th.col-view-desc, th.col-list-name, th.col-list-course,
    th.col-status-name, th.col-status-course, th.col-arch-name, th.col-arch-course { width: auto; min-width: auto; }
}

/* HEADER */
.page-header {
    display: flex; align-items: center; justify-content: space-between;
    padding-bottom: 20px; margin-bottom: 30px; position: relative; text-align: left;
}
.page-header::after {
    content: ''; position: absolute; bottom: 0; left: 0; width: 100%; height: 4px;
    background: linear-gradient(to right, var(--main-red), var(--purple-main)); border-radius: 2px;
}
.page-header h1 { margin: 0; font-size: 1.6rem; color: var(--black); text-align: right; font-weight: 700; line-height: 1.2; max-width: 60%; }
.page-header h1 span { display: block; font-size: 0.9rem; color: #777; font-weight: 400; margin-top: 5px; }

/* === CORREÇÃO DO LOGO (ALINHAMENTO ESQUERDA) === */
.page-header img { 
    margin: 0;       
    height: 70px;    
    width: auto; 
}

@media (max-width: 600px) {
    .page-header { flex-direction: column; gap: 15px; align-items: center; }
    .page-header h1 { text-align: center; max-width: 100%; font-size: 1.4rem; }
    .page-header img { margin: 0 auto; } 
}

/* CARD DE INFORMAÇÕES */
.student-info-card {
    background: #fdfdfd; border: 1px solid #e9ecef; border-left: 6px solid var(--main-red);
    border-radius: 8px; padding: 20px 25px; margin-bottom: 30px; text-align: left;
    box-shadow: 0 4px 6px rgba(0,0,0,0.02); display: flex; flex-direction: column; gap: 5px;
}
body.theme-extension .student-info-card { border-left-color: var(--purple-main); }
.student-info-card h2 { margin: 0; font-size: 1.5rem; color: var(--black); font-weight: 700; }
.student-info-card p { margin: 0; font-size: 1rem; color: #666; }
.student-info-card .label { font-weight: 600; color: #444; margin-right: 5px; }

/* ==========================================================================
   NOVAS CLASSES ESPECÍFICAS PARA O ADMIN_DASHBOARD (BOTÕES MODERNOS)
   ========================================================================== */

/* 1. Editar Meus Dados (Azul Royal) */
.btn-dash-modern-edit { background: linear-gradient(135deg, #3a7bd5 0%, #3a6073 100%) !important; }

/* 2. Adicionar Novo Aluno (Verde ESCURO) */
.btn-dash-modern-add { background: linear-gradient(135deg, #136a46 0%, #218c54 100%) !important; }

/* 3. Lista Ativos (Azul Oceano) */
.btn-dash-modern-list-active { background: linear-gradient(135deg, #2980B9 0%, #6DD5FA 100%) !important; }

/* 4. Lista Arquivados (Cinza Azulado/Slate) */
.btn-dash-modern-list-archive { background: linear-gradient(135deg, #606c88 0%, #3f4c6b 100%) !important; }

/* 5. Alterar Status (AZUL PETRÓLEO/INDIGO) */
.btn-dash-modern-status { background: linear-gradient(135deg, #1488CC 0%, #2B32B2 100%) !important; }

/* 6. Atividades (Laranja ESCURO - Marca) */
.btn-dash-modern-activities { background: linear-gradient(135deg, #d35400 0%, #e67e22 100%) !important; }

/* 7. Extensão (Roxo ESCURO - Marca) */
.btn-dash-modern-extension { background: linear-gradient(135deg, #4a148c 0%, #311b92 100%) !important; }

/* 8. Gerenciamento de Grupos (Ciano/Turquesa - NOVO) */
.btn-dash-modern-groups { background: linear-gradient(135deg, #009688 0%, #004d40 100%) !important; }

/* 9. Gerência (Master - Dark) */
.btn-dash-modern-master { background: linear-gradient(135deg, #232526 0%, #414345 100%) !important; }

/* 10. Sair (Cinza Neutro) */
.btn-dash-modern-logout { background: linear-gradient(135deg, #6c757d 0%, #343a40 100%) !important; }

/* Hover Effect para todos os botões modernos */
.btn-dash-modern-edit:hover, .btn-dash-modern-add:hover, .btn-dash-modern-list-active:hover,
.btn-dash-modern-list-archive:hover, .btn-dash-modern-status:hover, .btn-dash-modern-activities:hover,
.btn-dash-modern-extension:hover, .btn-dash-modern-groups:hover, .btn-dash-modern-master:hover, .btn-dash-modern-logout:hover {
    transform: none !important; /* Sem pulo */
    filter: brightness(0.85);   /* Escurece 15% */
    box-shadow: 0 4px 6px rgba(0,0,0,0.1) !important; 
}

/* ==========================================================================
   CONFIGURAÇÕES DE IMPRESSÃO (PRINT MODE) - CORRIGIDO DEFINITIVO
   ========================================================================== */
@media print {
    /* 1. Esconder elementos desnecessários */
    .filter-form,       
    .action-buttons,    
    .back-btn,
    .clear-btn,
    .hide-on-print,     
    .button-group,
    button {            
        display: none !important;
    }

    /* 2. Resetar Configurações de Página e Body */
    @page {
        margin: 1cm;
        size: auto;
    }

    body {
        /* IMPORTANTE: Remove o flexbox que centraliza o site na tela */
        display: block !important; 
        background-color: white;
        color: black;
        font-size: 11pt;
        margin: 0 !important;
        padding: 0 !important;
        height: auto !important;
        width: 100% !important;
    }

    /* 3. Forçar Container a ocupar 100% REAL */
    .container, .print-container {
        width: 100% !important;
        max-width: none !important; /* Remove o limite de 1350px */
        min-width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        border: none !important;
        box-shadow: none !important;
        display: block !important;
    }

    /* 4. Tabela Full Width */
    table {
        width: 100% !important;
        border-collapse: collapse;
        /* Muda para auto na impressão para o navegador ajustar melhor as colunas no papel */
        table-layout: auto !important; 
        font-size: 10pt;
    }
    
    th, td {
        border: 1px solid #000 !important;
        color: black !important;
        padding: 5px !important;
        /* Reseta larguras fixas para deixar a tabela fluir */
        width: auto !important; 
    }

    /* Cabeçalhos com fundo cinza para contraste na impressão */
    th {
        background-color: #f0f0f0 !important; 
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    /* Força as colunas pequenas a ficarem o menor possível (apenas o conteúdo) */
    th.col-date, th.col-hours, th.col-period, th.col-max, th.col-group {
        width: 1% !important;
        white-space: nowrap;
    }
    
    /* Força a descrição a ocupar todo o resto do espaço */
    th.col-desc, th.col-view-desc {
        width: auto !important;
    }

    /* 5. Header e Rodapé */
    .page-header {
        display: flex !important; /* Mantém layout flex no header para alinhar logo/texto */
        justify-content: space-between;
        align-items: center;
        border-bottom: 2px solid #000;
        margin-bottom: 20px;
        padding-bottom: 10px;
        width: 100% !important;
    }

    .page-header h1 {
        margin: 0;
        color: black;
        text-align: right;
        font-size: 1.4rem;
    }
    
    .page-header img {
        margin: 0 !important; /* Remove margem automatica do logo */
        height: 50px;
    }

    .student-info-card {
        border: 1px solid #000;
        border-left: 8px solid #000 !important;
        box-shadow: none;
        margin-bottom: 20px;
        width: 100% !important;
    }

    .total {
        border: 1px solid #000 !important;
        color: black !important;
        background: none !important;
        width: 100% !important;
        margin-top: 15px;
    }
}