/* ==========================================================================
   1. RESET E CONFIGURAÇÕES GERAIS
   ========================================================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: #f4f6f9;
    color: #333;
    overflow-x: hidden;
}

/* Container que divide a tela entre Menu e Conteúdo */
.dashboard-container {
    display: flex;
    min-height: 100vh;
}

/* ==========================================================================
   2. MENU LATERAL (SIDEBAR)
   ========================================================================== */
.sidebar {
    width: 260px;
    background-color: #334155; /* Azul escuro elegante */
    color: #fff;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1);
}

.sidebar .logo {
    padding: 24px;
    text-align: center;
    border-bottom: 1px solid #475569;
}

.sidebar .logo h2 {
    font-size: 1.4rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    color: #38bdf8; /* Detalhe em azul claro */
}

/* Links do Menu */
.sidebar .menu {
    display: flex;
    flex-direction: column;
    padding: 15px 0;
    flex-grow: 1;
}

.sidebar .menu a {
    color: #cbd5e1;
    text-decoration: none;
    padding: 12px 24px;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    transition: all 0.2s ease;
}

/* Efeito Hover e Link Ativo */
.sidebar .menu a:hover, 
.sidebar .menu a.active {
    background-color: #475569;
    color: #fff;
    border-left: 4px solid #38bdf8;
    padding-left: 20px; /* Leve recuo no hover */
}

/* Botão de Sair (Logout) posicionado na parte inferior */
.sidebar .menu .btn-logout {
    margin-top: auto;
    border-left: none;
    color: #ef4444; /* Vermelho */
    border-top: 1px solid #475569;
    padding-top: 20px;
}

.sidebar .menu .btn-logout:hover {
    background-color: #991b1b;
    color: #fff;
    border-left: none;
    padding-left: 24px;
}

/* ==========================================================================
   3. ÁREA DE CONTEÚDO PRINCIPAL (MAIN CONTENT)
   ========================================================================== */
.main-content {
    margin-left: 260px; /* Empurra o conteúdo para não ficar sob a sidebar fixa */
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

/* Barra Superior */
.topbar {
    background-color: #fff;
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: flex-end; /* Alinha infos do usuário à direita */
    padding: 0 30px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.user-info {
    font-size: 0.95rem;
    color: #475569;
}

/* Badge indicando o nível do usuário (Aluno, Professor, etc) */
.badge-nivel {
    background-color: #e2e8f0;
    color: #475569;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
    margin-left: 8px;
    display: inline-block;
}

/* Corpo do Dashboard */
.dashboard-body {
    padding: 30px;
    flex-grow: 1; /* Ocupa o espaço vertical restante, empurrando o footer para o fim */
}

.dashboard-body h1 {
    font-size: 1.8rem;
    color: #0f172a;
    margin-bottom: 8px;
}

.dashboard-body p {
    color: #64748b;
    margin-bottom: 30px;
}

/* Rodapé fixo ao fim de .main-content */
footer {
    padding: 16px 30px;
    color: #94a3b8;
    font-size: 0.85rem;
    border-top: 1px solid #e2e8f0;
}

.cabecalho-lista {
    display: flex;
    align-items: center;
    gap: 200px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.cabecalho-lista h1,
.cabecalho-lista .form-busca {
    margin-bottom: 0;
}

/* ==========================================================================
   4. CARDS DE ATALHO (GRID)
   ========================================================================== */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.card {
    background-color: #fff;
    padding: 24px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02), 0 1px 2px rgba(0, 0, 0, 0.06);
    border: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05), 0 10px 15px rgba(0, 0, 0, 0.03);
}

.card h3 {
    font-size: 1.15rem;
    color: #334155;
    margin-bottom: 10px;
}

.card p {
    font-size: 0.9rem;
    color: #627d98;
    margin-bottom: 20px;
    flex-grow: 1; /* Garante que o link fique sempre embaixo se o texto for curto */
}

.card-link {
    color: #0284c7;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    transition: color 0.2s;
}

.card-link:hover {
    color: #0369a1;
}

/* ==========================================================================
   5. OPÇÕES "EM BREVE" (sidebar e lista de gerenciar conta)
   ========================================================================== */
.sidebar .menu .opcao-em-breve {
    display: flex;
    align-items: center;
    padding: 12px 24px;
    font-size: 0.95rem;
    color: #64748b;
    cursor: default;
}

.sidebar .menu .opcao-em-breve small {
    margin-left: 6px;
    font-size: 0.75rem;
    font-style: italic;
}

.lista-opcoes-conta {
    list-style: none;
    margin-top: 20px;
    max-width: 480px;
}

.lista-opcoes-conta li {
    padding: 14px 4px;
    border-bottom: 1px solid #e2e8f0;
    font-size: 0.95rem;
}

.lista-opcoes-conta li a {
    color: #0284c7;
    text-decoration: none;
    font-weight: 600;
}

.lista-opcoes-conta li a:hover {
    color: #0369a1;
}

.lista-opcoes-conta li.opcao-em-breve {
    color: #94a3b8;
    cursor: default;
}

.lista-opcoes-conta li.opcao-em-breve span {
    font-size: 0.8rem;
    font-style: italic;
    margin-left: 6px;
}

/* ==========================================================================
   6. TABELAS
   ========================================================================== */
table {
    width: 100%;
    border-collapse: collapse;
    background-color: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02), 0 1px 2px rgba(0, 0, 0, 0.06);
    margin-top: 20px;
}

thead {
    background-color: #334155;
}

th {
    color: #fff;
    text-align: left;
    padding: 12px 16px;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

td {
    padding: 12px 16px;
    font-size: 0.9rem;
    color: #475569;
    border-bottom: 1px solid #e2e8f0;
}

tbody tr:last-child td {
    border-bottom: none;
}

tbody tr:hover {
    background-color: #f8fafc;
}

table a {
    color: #0284c7;
    text-decoration: none;
    font-weight: 600;
}

table a:hover {
    color: #0369a1;
}

/* ==========================================================================
   7. FORMULÁRIOS
   ========================================================================== */
/* Cada campo é uma linha: label com largura fixa à esquerda,
   caixa de texto com largura fixa alinhada à direita da label. */
.form-row {
    display: flex;
    align-items: center;
    margin-bottom: 18px;
}

.form-row label {
    width: 160px;
    flex-shrink: 0;
    font-size: 0.95rem;
    color: #334155;
    font-weight: 600;
}

.form-row input,
.form-row select {
    width: 320px;
    max-width: 100%;
    padding: 8px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 0.95rem;
    color: #334155;
}

.form-row input:focus,
.form-row select:focus {
    outline: none;
    border-color: #38bdf8;
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.15);
}

.campo-senha {
    position: relative;
    width: 320px;
    max-width: 100%;
}

.campo-senha input {
    width: 100%;
    padding-right: 42px;
}

.alternar-senha {
    position: absolute;
    top: 50%;
    right: 6px;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    background: none;
    border: none;
    border-radius: 6px;
    padding: 0;
    color: #94a3b8;
    cursor: pointer;
    transition: color 0.15s ease, background-color 0.15s ease;
}

.alternar-senha:hover {
    color: #334155;
    background-color: #f1f5f9;
}

.alternar-senha svg {
    display: block;
}

button[type="submit"] {
    background-color: #334155;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 10px 20px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

button[type="submit"]:hover {
    background-color: #475569;
}

.lista-niveis-atuais {
    list-style: none;
    margin: 12px 0 24px;
}

.lista-niveis-atuais li {
    display: flex;
    align-items: center;
    padding: 8px 0;
    font-size: 0.95rem;
    color: #334155;
}

.lista-niveis-atuais .nome-nivel {
    width: 160px;
    flex-shrink: 0;
}

.lista-niveis-atuais li form {
    display: contents;
}

/* ==========================================================================
   8. BUSCA E PAGINAÇÃO (listarUsuarios.php)
   ========================================================================== */
.form-busca {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
}

.form-busca input[type="text"] {
    width: 320px;
    max-width: 100%;
    padding: 8px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 0.95rem;
    color: #334155;
}

.form-busca input[type="text"]:focus {
    outline: none;
    border-color: #38bdf8;
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.15);
}

.link-limpar-busca {
    color: #64748b;
    text-decoration: none;
    font-size: 0.9rem;
}

.link-limpar-busca:hover {
    color: #334155;
    text-decoration: underline;
}

.info-paginacao {
    color: #64748b;
    font-size: 0.9rem;
    margin-bottom: 10px;
}

.paginacao {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 20px;
}

.paginacao a,
.paginacao .pagina-atual {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 34px;
    padding: 0 8px;
    border-radius: 6px;
    font-size: 0.9rem;
    text-decoration: none;
}

.paginacao a {
    color: #334155;
    background-color: #fff;
    border: 1px solid #e2e8f0;
}

.paginacao a:hover {
    background-color: #f1f5f9;
}

.paginacao .pagina-atual {
    background-color: #334155;
    color: #fff;
    font-weight: 600;
}

/* ==========================================================================
   9. RESPONSIVIDADE (TELA MENORES)
   ========================================================================== */
@media (max-width: 768px) {
    .dashboard-container {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .sidebar .menu {
        flex-direction: row;
        flex-wrap: wrap;
        padding: 5px;
    }
    
    .sidebar .menu a {
        padding: 10px 15px;
        font-size: 0.85rem;
    }
    
    .sidebar .menu .btn-logout {
        margin-top: 0;
        border-top: none;
        padding-top: 10px;
    }

    table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }

    .form-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .form-row label {
        width: auto;
        margin-bottom: 6px;
    }

    .form-row input,
    .form-row select {
        width: 100%;
    }

    .form-busca {
        flex-wrap: wrap;
    }

    .form-busca input[type="text"] {
        width: 100%;
    }

    .cabecalho-lista {
        gap: 12px;
    }
}
