/* =========================================================
   RESET
========================================================= */
*{
    margin:0;
    padding:0;
    box-sizing:border-box;
}

/* =========================================================
   BODY
========================================================= */
body{
    font-family:Arial, Helvetica, sans-serif;
    background:#f3f4f6;
    color:#111827;
    padding:15px;
}

.cabecalho-planilha{
    margin-bottom:18px;
}

#tituloTabela{
    font-size:28px;
    margin:0;
    line-height:1.15;
    outline:none;
    cursor:text;
    border-radius:4px;
    padding:2px 4px;
    transition:background 0.15s;
    display:inline-block;
}

#tituloTabela:hover{
    background:rgba(29,78,216,0.08);
}

#tituloTabela:focus{
    background:rgba(29,78,216,0.12);
    outline:2px solid #1d4ed8;
}

#subtituloTabela{
    font-size:14px;
    font-weight:500;
    color:#6b7280;
    margin:2px 0 0 0;
    outline:none;
    cursor:text;
    border-radius:4px;
    padding:2px 4px;
    transition:background 0.15s;
    display:inline-block;
    letter-spacing:0.3px;
}

#subtituloTabela:hover{
    background:rgba(107,114,128,0.1);
}

#subtituloTabela:focus{
    background:rgba(29,78,216,0.08);
    outline:2px solid #1d4ed8;
    color:#111827;
}

.meta-planilha{
    display:flex;
    flex-wrap:wrap;
    gap:8px;
    margin-top:8px;
}

.meta-planilha:empty{
    display:none;
}

.meta-planilha .meta{
    background:#eef2ff;
    color:#1e3a8a;
    padding:4px 10px;
    border-radius:999px;
    font-size:12px;
    font-weight:600;
    border:1px solid #c7d2fe;
}

.meta-planilha .meta-rotulo{
    font-weight:400;
    color:#475569;
    margin-right:4px;
}

/* =========================================================
   MENU PRINCIPAL (DROPDOWNS)
========================================================= */
.menu-container{
    display:flex;
    flex-wrap:wrap;
    gap:12px;
    background:#ffffff;
    padding:12px;
    border-bottom:2px solid #1d4ed8;
    border-radius:8px;
    margin-bottom:15px;
    box-shadow:0 2px 8px rgba(0,0,0,0.06);
}

.dropdown{
    position:relative;
    display:inline-block;
}

.btn-menu{
    background-color:#1d4ed8;
    color:white;
    padding:10px 16px;
    border:none;
    cursor:pointer;
    border-radius:6px;
    font-weight:600;
    font-size:14px;
    display:flex;
    align-items:center;
    gap:8px;
    width:auto;
}

.btn-menu:hover{
    background-color:#1e40af;
}

.dropdown.aberto > .btn-menu{
    background-color:#1e3a8a;
}

.dropdown-content{
    display:none;
    position:absolute;
    background-color:white;
    min-width:280px;
    box-shadow:0 8px 20px rgba(0,0,0,0.15);
    z-index:1000;
    padding:15px;
    border-radius:8px;
    top:calc(100% + 6px);
    left:0;
}

.dropdown.aberto > .dropdown-content{
    display:block;
}

.dropdown-content .input-group{
    margin-bottom:10px;
}

.dropdown-content .input-group:last-child{
    margin-bottom:0;
}

.dropdown-content label{
    display:block;
    font-size:0.85rem;
    color:#444;
    margin-bottom:5px;
    font-weight:bold;
}

.dropdown-content .label-inline{
    font-weight:normal;
    cursor:pointer;
    display:flex;
    align-items:center;
    gap:8px;
}

.dropdown-content .label-inline input[type="checkbox"]{
    width:auto;
    margin:0;
}

.dropdown-content input,
.dropdown-content select,
.dropdown-content textarea{
    width:100%;
    padding:8px;
    border:1px solid #ddd;
    border-radius:4px;
    font-size:13px;
    box-sizing:border-box;
}

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

.dropdown-content hr{
    border:0;
    border-top:1px solid #eee;
    margin:10px 0;
}

.btn-full{
    width:100%;
    background:#eef2ff;
    border:1px solid #1d4ed8;
    color:#1d4ed8;
    padding:8px;
    border-radius:4px;
    cursor:pointer;
    font-weight:bold;
    margin-top:5px;
    font-size:13px;
}

.btn-full:hover{
    background:#1d4ed8;
    color:white;
}

.btn-full.primario{
    background:#1d4ed8;
    color:white;
}

.btn-full.primario:hover{
    background:#1e40af;
}

input,
textarea,
select,
button{
    width:100%;
    padding:10px;
    border-radius:8px;
    border:1px solid #d1d5db;
    font-size:14px;
    font-family:inherit;
}

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

button{
    background:#1d4ed8;
    color:white;
    border:none;
    cursor:pointer;
    transition:0.2s;
}

button:hover{
    opacity:0.92;
}

button.secundario{
    background:#374151;
}

button.perigo{
    background:#b91c1c;
}

/* =========================================================
   BARRA DE BUSCA
========================================================= */
.barra-busca{
    display:flex;
    gap:10px;
    margin-bottom:15px;
    align-items:stretch;
}

.barra-busca input{
    flex:1;
    font-size:16px;
    padding:14px 16px;
}

.barra-busca button{
    width:auto;
    white-space:nowrap;
    padding:0 20px;
    background:#374151;
}

.barra-busca button.ativo{
    background:#b45309;
}

.barra-busca button.aprovado{
    background:#15803d;
}

.barra-busca button.reprovado{
    background:#b91c1c;
}

/* =========================================================
   TABELA CONTAINER
========================================================= */
.container{
    background:white;
    border-radius:12px;
    padding:15px;
    overflow:auto;
    box-shadow:0 2px 12px rgba(0,0,0,0.08);
}

/* =========================================================
   TABELA
========================================================= */
table{
    border-collapse:collapse;
    width:max-content;
    min-width:100%;
}

th,
td{
    border:1px solid #d1d5db;
    padding:6px;
    text-align:center;
    min-width:80px;
    font-size:13px;
}

th{
    background:#1d4ed8;
    color:#ffffff;
    position:sticky;
    top:0;
    z-index:10;
}

.nome-coluna{
    min-width:240px;
    text-align:left;
}

.obs-coluna{
    min-width:260px;
    text-align:left;
}

/* =========================================================
   LINHA DE DATAS
========================================================= */
.tr-datas th{
    background:#1e3a8a;
    padding:4px 6px;
}

.th-data{
    text-align:center;
}

.input-data{
    width:100%;
    min-width:120px;
    background:transparent;
    border:1px solid rgba(255,255,255,0.3);
    border-radius:4px;
    color:#ffffff;
    font-size:11px;
    padding:3px 4px;
    text-align:center;
    cursor:pointer;
    color-scheme:dark;
}

.input-data:focus{
    outline:2px solid #fbbf24;
    border-color:#fbbf24;
}

/* =========================================================
   COLUNA SELEÇÃO (checkboxes)
========================================================= */
.col-selecao{
    width:36px;
    min-width:36px;
    text-align:center !important;
    padding:4px !important;
}

.chk-aluno,
#chkSelecionarTodos{
    width:16px;
    height:16px;
    cursor:pointer;
    margin:0;
}

.linha-selecionada td{
    background:#fef3c7 !important;
}

.linha-selecionada .total{
    background:#fde68a !important;
}

/* =========================================================
   SOMATÓRIA — mesma estrutura visual das avaliações
========================================================= */
.th-somatoria{
    padding:0 !important;
    vertical-align:top;
}

.th-somatoria .th-topo{
    padding:6px;
    font-weight:bold;
}

.th-total-max-valor{
    background:rgba(255,255,255,0.15);
    border-top:1px solid rgba(255,255,255,0.25);
    color:#fbbf24;
    font-weight:bold;
    font-size:12px;
    text-align:center;
    padding:3px 4px;
}

/* =========================================================
   BARRA DE AÇÕES DE SELEÇÃO
========================================================= */
.barra-acoes-selecao{
    display:flex;
    align-items:center;
    gap:10px;
    background:#fef3c7;
    border:1px solid #fcd34d;
    padding:10px 15px;
    border-radius:8px;
    margin-bottom:15px;
    flex-wrap:wrap;
}

.barra-acoes-selecao[hidden]{
    display:none;
}

.barra-acoes-selecao .contador-selecao{
    flex:1;
    min-width:200px;
    color:#78350f;
    font-size:14px;
}

.barra-acoes-selecao .contador-selecao strong{
    font-size:16px;
    color:#7c2d12;
}

.barra-acoes-selecao button{
    width:auto;
    padding:8px 14px;
    font-size:13px;
    font-weight:bold;
}

.barra-acoes-selecao .perigo{
    background:#b91c1c;
}

.barra-acoes-selecao .secundario{
    background:#6b7280;
}

/* =========================================================
   NOTA AUSENTE (F)
========================================================= */
.nota-ausente{
    color:#b91c1c;
    font-weight:bold;
    font-style:italic;
    background:#fef2f2;
}

/* =========================================================
   CABEÇALHO EDITÁVEL
   (texto sempre branco, fundo azul permanente)
========================================================= */
.th-editavel{
    background:#1d4ed8 !important;
    color:#ffffff !important;
    caret-color:#ffffff;
    vertical-align:top;
    padding:0 !important;
}

.th-topo{
    display:flex;
    align-items:center;
    justify-content:center;
    gap:4px;
    padding:6px 6px 4px;
    white-space:nowrap;
}

.th-nome{
    cursor:text;
    outline:none;
    padding:0 2px;
}

.th-nome:focus{
    outline:2px solid #fbbf24;
    border-radius:3px;
}

.th-valor{
    display:block;
    width:100%;
    background:rgba(255,255,255,0.15);
    border:none;
    border-top:1px solid rgba(255,255,255,0.25);
    color:#ffffff;
    font-size:12px;
    font-weight:bold;
    text-align:center;
    padding:3px 4px;
    cursor:text;
    box-sizing:border-box;
    min-width:0;
}

.th-valor:focus{
    background:rgba(255,255,255,0.25);
    outline:2px solid #fbbf24;
}

.th-valor::placeholder{
    color:rgba(255,255,255,0.4);
}

.btn-remover-atividade{
    background:transparent;
    color:#fbbf24;
    border:none;
    width:auto;
    padding:0 4px;
    cursor:pointer;
    font-size:14px;
    font-weight:bold;
    line-height:1;
    border-radius:3px;
}

.btn-remover-atividade:hover{
    background:#b91c1c;
    color:#ffffff;
}

/* =========================================================
   CÉLULAS
========================================================= */
.editavel{
    background:white;
    cursor:text;
}

.editavel:focus{
    outline:2px solid #2563eb;
    background:#dbeafe;
}

.observacao{
    text-align:left;
    white-space:pre-wrap;
    font-size:12px;
    color:#374151;
}

.acoes{
    width:80px;
    min-width:80px;
}

.btn-remover{
    background:#b91c1c;
    color:white;
    border:none;
    border-radius:6px;
    padding:4px 8px;
    cursor:pointer;
    font-size:12px;
}

/* =========================================================
   TOTAL
========================================================= */
.total{
    background:#dbeafe;
    font-weight:bold;
}

/* =========================================================
   RODAPÉ DE ESTATÍSTICAS
========================================================= */
.rodape-estatisticas{
    display:flex;
    flex-wrap:wrap;
    gap:10px;
    margin-top:15px;
    padding:12px 15px;
    background:white;
    border-radius:8px;
    box-shadow:0 2px 8px rgba(0,0,0,0.06);
    font-size:14px;
}

.estat{
    padding:6px 12px;
    border-radius:6px;
    background:#f3f4f6;
    color:#111827;
}

.estat strong{
    font-size:16px;
    margin-left:6px;
}

.estat-aprovados{
    background:#dcfce7;
    color:#14532d;
}

.estat-reprovados{
    background:#fee2e2;
    color:#7f1d1d;
}

.estat-total{
    background:#dbeafe;
    color:#1e3a8a;
}

.estat-media-corte{
    background:#fef3c7;
    color:#78350f;
}

.estat-media-turma{
    background:#ede9fe;
    color:#4c1d95;
}

/* =========================================================
   ESTATÍSTICAS NO TOPO (espelho do rodapé)
========================================================= */
.estatisticas-topo{
    display:flex;
    gap:8px;
    margin-left:auto;
    align-items:stretch;
    flex-wrap:wrap;
}

.estat-mini{
    display:flex;
    flex-direction:column;
    justify-content:center;
    align-items:center;
    padding:6px 16px;
    border-radius:8px;
    min-width:84px;
    text-align:center;
    border:1px solid transparent;
    transition:transform 0.15s;
}

.estat-mini:hover{
    transform:translateY(-1px);
}

.estat-mini .estat-label{
    font-size:10px;
    text-transform:uppercase;
    letter-spacing:0.6px;
    font-weight:700;
    opacity:0.75;
    margin-bottom:2px;
}

.estat-mini .estat-valor{
    font-size:22px;
    font-weight:bold;
    line-height:1.1;
    font-variant-numeric:tabular-nums;
}

.estat-mini.estat-total{
    background:#dbeafe;
    color:#1e3a8a;
    border-color:#bfdbfe;
}

.estat-mini.estat-aprovados{
    background:#dcfce7;
    color:#14532d;
    border-color:#bbf7d0;
}

.estat-mini.estat-reprovados{
    background:#fee2e2;
    color:#7f1d1d;
    border-color:#fecaca;
}

.estat-mini.estat-media-turma{
    background:#ede9fe;
    color:#4c1d95;
    border-color:#ddd6fe;
}

/* =========================================================
   AUTO-AJUSTE PARA MUITAS COLUNAS
========================================================= */
.compacto th,
.compacto td{
    font-size:11px;
    padding:3px;
    min-width:55px;
}

.compacto .nome-coluna{
    min-width:160px;
}

.compacto .obs-coluna{
    min-width:180px;
}

/* =========================================================
   MOBILE
========================================================= */
@media screen and (max-width:700px){
    th,
    td{
        min-width:65px;
        font-size:11px;
        padding:4px;
    }
    .nome-coluna{
        min-width:180px;
    }
    .obs-coluna{
        min-width:180px;
    }
}

/* =========================================================
   IMPRESSÃO
========================================================= */
@media print{
    body{
        padding:0;
        background:white;
    }

    .menu-container,
    .barra-busca,
    .barra-acoes-selecao,
    .col-selecao,
    .acoes,
    .btn-remover,
    .btn-remover-atividade{
        display:none !important;
    }

    .ocultar-impressao{
        display:none !important;
    }

    .nota-ausente{
        background:#fef2f2 !important;
        color:#b91c1c !important;
        -webkit-print-color-adjust:exact;
        print-color-adjust:exact;
    }

    .th-total-max-valor{
        background:rgba(255,255,255,0.15) !important;
        -webkit-print-color-adjust:exact;
        print-color-adjust:exact;
        font-size:8px;
    }

    .container{
        box-shadow:none;
        border:none;
        padding:0;
        overflow:visible;
    }

    .cabecalho-planilha{
        margin-bottom:8px;
    }

    #tituloTabela{
        font-size:16px;
        padding:0;
        background:none !important;
    }

    #subtituloTabela{
        font-size:10px;
        padding:0;
        background:none !important;
        color:#374151 !important;
    }

    .meta-planilha{
        gap:6px;
        margin-top:4px;
    }

    .meta-planilha .meta{
        font-size:9px;
        padding:2px 6px;
        background:#eef2ff !important;
        -webkit-print-color-adjust:exact;
        print-color-adjust:exact;
    }

    table{
        width:100%;
        table-layout:fixed;
    }

    th,
    td{
        font-size:8px;
        padding:3px;
        word-break:break-word;
    }

    th,
    .th-editavel{
        background:#1d4ed8 !important;
        color:#ffffff !important;
        -webkit-print-color-adjust:exact;
        print-color-adjust:exact;
    }

    .total{
        background:#dbeafe !important;
        -webkit-print-color-adjust:exact;
        print-color-adjust:exact;
    }

    .tr-datas th{
        background:#1e3a8a !important;
        -webkit-print-color-adjust:exact;
        print-color-adjust:exact;
    }

    .input-data{
        border:none;
        background:transparent;
        pointer-events:none;
        font-size:9px;
        color:#ffffff !important;
        /* datas vazias ficam invisíveis automaticamente */
    }

    .th-valor{
        background:rgba(255,255,255,0.15) !important;
        -webkit-print-color-adjust:exact;
        print-color-adjust:exact;
        font-size:8px;
        pointer-events:none;
    }

    .rodape-estatisticas{
        box-shadow:none;
        padding:6px 0;
        margin-top:8px;
        font-size:10px;
        gap:6px;
    }

    .estat,
    .estat-aprovados,
    .estat-reprovados,
    .estat-total,
    .estat-media-corte{
        -webkit-print-color-adjust:exact;
        print-color-adjust:exact;
        padding:3px 6px;
    }

    .estat strong{
        font-size:11px;
    }

    /* Sem coluna de observações na impressão compacta */
    body.print-sem-obs .obs-coluna{
        display:none;
    }
}

