@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
    --cor-primaria: #6366f1;
    --cor-primaria-escura: #4f46e5;
    --cor-primaria-clara: #818cf8;
    --cor-sucesso: #10b981;
    --cor-sucesso-clara: #34d399;
    --cor-perigo: #ef4444;
    --cor-fundo: #f4f5fb;
    --cor-card: #ffffff;
    --cor-borda: #e7e8f2;
    --cor-texto: #1e1b2e;
    --cor-texto-suave: #6b6b80;
    --sombra: 0 4px 16px rgba(30, 27, 46, 0.06);
    --sombra-forte: 0 12px 32px rgba(79, 70, 229, 0.16);
    --raio: 16px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--cor-fundo);
    color: var(--cor-texto);
    -webkit-font-smoothing: antialiased;
}

a {
    color: inherit;
    text-decoration: none;
}

/* ---------- Tela de login ---------- */
.tela-login {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 55%, #a855f7 100%);
    padding: 24px;
}

.card-login {
    background: var(--cor-card);
    border-radius: 24px;
    padding: 48px 40px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 24px 60px rgba(31, 15, 90, 0.35);
}

.card-login .logo {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    background: linear-gradient(135deg, var(--cor-primaria), #a855f7);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 26px;
    font-weight: 800;
    margin: 0 auto 20px;
}

.card-login h1 {
    text-align: center;
    font-size: 22px;
    margin: 0 0 4px;
}

.card-login p.subtitulo {
    text-align: center;
    color: var(--cor-texto-suave);
    margin: 0 0 28px;
    font-size: 14px;
}

.campo {
    margin-bottom: 18px;
}

.campo label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--cor-texto);
}

.campo input,
.campo select {
    width: 100%;
    padding: 12px 14px;
    border-radius: 10px;
    border: 1.5px solid var(--cor-borda);
    font-size: 14px;
    font-family: inherit;
    background: #fbfbfe;
    transition: border-color .15s, box-shadow .15s;
}

.campo input:focus,
.campo select:focus {
    outline: none;
    border-color: var(--cor-primaria);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.12);
    background: #fff;
}

.botao {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 13px 18px;
    border-radius: 10px;
    border: none;
    background: linear-gradient(135deg, var(--cor-primaria), var(--cor-primaria-escura));
    color: #fff;
    font-size: 14.5px;
    font-weight: 600;
    cursor: pointer;
    transition: transform .12s, box-shadow .12s, opacity .12s;
    font-family: inherit;
}

.botao:hover {
    box-shadow: var(--sombra-forte);
    transform: translateY(-1px);
}

.botao:active {
    transform: translateY(0);
}

.botao.secundario {
    background: #fff;
    color: var(--cor-primaria-escura);
    border: 1.5px solid var(--cor-borda);
}

.botao.perigo {
    background: linear-gradient(135deg, #f87171, var(--cor-perigo));
}

.botao.pequeno {
    width: auto;
    padding: 8px 14px;
    font-size: 13px;
}

.credenciais-padrao {
    margin-top: 22px;
    background: #f6f5ff;
    border: 1px dashed #c7c4f5;
    border-radius: 10px;
    padding: 12px 14px;
    font-size: 12.5px;
    color: #514f7a;
    line-height: 1.6;
}

/* ---------- Layout geral (logado) ---------- */
.layout {
    display: flex;
    min-height: 100vh;
}

.barra-lateral {
    width: 250px;
    flex-shrink: 0;
    background: #1a1730;
    color: #e9e8f5;
    padding: 26px 18px;
    display: flex;
    flex-direction: column;
}

.barra-lateral .marca {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 8px 26px;
    font-weight: 800;
    font-size: 17px;
}

.barra-lateral .marca .icone {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--cor-primaria-clara), #a855f7);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

.barra-lateral nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.barra-lateral nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 12px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    color: #c3c1dd;
    transition: background .12s, color .12s;
}

.barra-lateral nav a:hover {
    background: rgba(255,255,255,0.06);
    color: #fff;
}

.barra-lateral nav a.ativo {
    background: linear-gradient(135deg, var(--cor-primaria), #7c3aed);
    color: #fff;
}

.barra-lateral .rodape-lateral {
    margin-top: auto;
    padding-top: 20px;
    border-top: 1px solid rgba(255,255,255,0.08);
}

.usuario-mini {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    border-radius: 10px;
    margin-bottom: 8px;
}

.usuario-mini .avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--cor-primaria-clara), #a855f7);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
    color: #fff;
    flex-shrink: 0;
}

.usuario-mini .info {
    min-width: 0;
}

.usuario-mini .info .nome {
    font-size: 13.5px;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.usuario-mini .info .email {
    font-size: 11.5px;
    color: #9694b8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.link-sair {
    display: block;
    text-align: center;
    padding: 9px;
    border-radius: 9px;
    font-size: 13px;
    color: #c3c1dd;
    background: rgba(255,255,255,0.05);
}

.link-sair:hover {
    background: rgba(239,68,68,0.18);
    color: #fca5a5;
}

.conteudo {
    flex: 1;
    padding: 34px 40px;
    max-width: 980px;
}

.cabecalho-pagina {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 28px;
}

.cabecalho-pagina h1 {
    font-size: 25px;
    margin: 0 0 4px;
}

.cabecalho-pagina p {
    margin: 0;
    color: var(--cor-texto-suave);
    font-size: 14.5px;
}

/* ---------- Cartão de progresso geral ---------- */
.cartao-progresso {
    background: linear-gradient(135deg, var(--cor-primaria), #7c3aed);
    border-radius: var(--raio);
    padding: 26px 28px;
    color: #fff;
    margin-bottom: 30px;
    box-shadow: var(--sombra-forte);
}

.cartao-progresso .linha-topo {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
    flex-wrap: wrap;
    gap: 10px;
}

.cartao-progresso .linha-topo .titulo {
    font-size: 15px;
    font-weight: 600;
    opacity: 0.95;
}

.cartao-progresso .linha-topo .percentual {
    font-size: 28px;
    font-weight: 800;
}

.barra-progresso {
    background: rgba(255,255,255,0.25);
    border-radius: 999px;
    height: 10px;
    overflow: hidden;
}

.barra-progresso .preenchimento {
    background: #fff;
    height: 100%;
    border-radius: 999px;
    transition: width .4s ease;
}

.cartao-progresso .legenda {
    margin-top: 10px;
    font-size: 13px;
    opacity: 0.9;
}

/* ---------- Módulos e aulas ---------- */
.modulo {
    background: var(--cor-card);
    border-radius: var(--raio);
    box-shadow: var(--sombra);
    margin-bottom: 20px;
    overflow: hidden;
    border: 1px solid var(--cor-borda);
}

.modulo .cabecalho-modulo {
    padding: 18px 22px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.modulo .cabecalho-modulo h2 {
    font-size: 16.5px;
    margin: 0;
}

.selo-modulo {
    font-size: 12px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 999px;
    background: #eef0fc;
    color: var(--cor-primaria-escura);
    white-space: nowrap;
}

.selo-modulo.completo {
    background: #e3fbef;
    color: #059669;
}

.lista-aulas {
    border-top: 1px solid var(--cor-borda);
}

.item-aula {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 22px;
    border-bottom: 1px solid var(--cor-borda);
    transition: background .12s;
}

.item-aula:last-child {
    border-bottom: none;
}

.item-aula:hover {
    background: #fafafe;
}

.caixa-marcar {
    position: relative;
    flex-shrink: 0;
}

.caixa-marcar input {
    position: absolute;
    opacity: 0;
    width: 26px;
    height: 26px;
    margin: 0;
    cursor: pointer;
}

.caixa-marcar .visual {
    width: 26px;
    height: 26px;
    border-radius: 8px;
    border: 2px solid #d3d2e8;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all .15s;
    background: #fff;
}

.caixa-marcar input:checked ~ .visual {
    background: linear-gradient(135deg, var(--cor-sucesso-clara), var(--cor-sucesso));
    border-color: var(--cor-sucesso);
}

.caixa-marcar .visual svg {
    width: 15px;
    height: 15px;
    stroke: #fff;
    opacity: 0;
    transform: scale(0.5);
    transition: all .15s;
}

.caixa-marcar input:checked ~ .visual svg {
    opacity: 1;
    transform: scale(1);
}

.texto-aula {
    flex: 1;
    font-size: 14.5px;
    font-weight: 500;
    color: var(--cor-texto);
    transition: color .15s;
}

.item-aula.concluida .texto-aula {
    color: var(--cor-texto-suave);
    text-decoration: line-through;
    text-decoration-color: #c9c8de;
}

.estado-vazio {
    text-align: center;
    padding: 60px 20px;
    color: var(--cor-texto-suave);
}

.estado-vazio .icone-vazio {
    font-size: 40px;
    margin-bottom: 12px;
}

/* ---------- Tabelas administrativas ---------- */
.painel {
    background: var(--cor-card);
    border-radius: var(--raio);
    box-shadow: var(--sombra);
    border: 1px solid var(--cor-borda);
    padding: 24px;
    margin-bottom: 24px;
}

.painel h2 {
    font-size: 16px;
    margin: 0 0 18px;
}

table.tabela {
    width: 100%;
    border-collapse: collapse;
}

table.tabela th {
    text-align: left;
    font-size: 12.5px;
    text-transform: uppercase;
    letter-spacing: .03em;
    color: var(--cor-texto-suave);
    padding: 10px 12px;
    border-bottom: 2px solid var(--cor-borda);
}

table.tabela td {
    padding: 12px;
    border-bottom: 1px solid var(--cor-borda);
    font-size: 14px;
    vertical-align: middle;
}

table.tabela tr:last-child td {
    border-bottom: none;
}

.selo {
    display: inline-block;
    font-size: 11.5px;
    font-weight: 700;
    padding: 3px 9px;
    border-radius: 999px;
    background: #eef0fc;
    color: var(--cor-primaria-escura);
}

.selo.admin {
    background: #fff1e0;
    color: #b45309;
}

.acoes-tabela {
    display: flex;
    gap: 8px;
}

.acoes-tabela form {
    margin: 0;
}

.grade-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    align-items: end;
}

.mensagem {
    padding: 13px 16px;
    border-radius: 10px;
    font-size: 14px;
    margin-bottom: 22px;
    font-weight: 500;
}

.mensagem.sucesso {
    background: #e3fbef;
    color: #059669;
}

.mensagem.erro {
    background: #fdecec;
    color: #dc2626;
}

.grade-cards-admin {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 18px;
    margin-bottom: 30px;
}

.card-estatistica {
    background: var(--cor-card);
    border-radius: var(--raio);
    padding: 22px;
    border: 1px solid var(--cor-borda);
    box-shadow: var(--sombra);
}

.card-estatistica .numero {
    font-size: 30px;
    font-weight: 800;
    color: var(--cor-primaria-escura);
}

.card-estatistica .rotulo {
    font-size: 13px;
    color: var(--cor-texto-suave);
    margin-top: 4px;
}

.link-topo-form {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
    flex-wrap: wrap;
    gap: 10px;
}

.texto-suave {
    color: var(--cor-texto-suave);
    font-size: 13px;
}

.botao-icone-excluir {
    background: #fdecec;
    color: #dc2626;
    border: none;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 12.5px;
    font-weight: 600;
}

.botao-icone-excluir:hover {
    background: #fbd3d3;
}

@media (max-width: 820px) {
    .layout {
        flex-direction: column;
    }
    .barra-lateral {
        width: 100%;
        flex-direction: row;
        align-items: center;
        padding: 14px 18px;
        overflow-x: auto;
    }
    .barra-lateral .marca { padding: 0 14px 0 0; }
    .barra-lateral .rodape-lateral { display: none; }
    .barra-lateral nav { flex-direction: row; }
    .conteudo { padding: 24px 18px; }
}
