/* ============================================================================== */
/* CSS CORRIGIDO, UNIFICADO E ORGANIZADO                     */
/* ============================================================================== */

/* --- Variáveis Globais --- */
:root {
    --primary: #4361ee;
    --primary-dark: #3a56d4;
    --secondary: #7209b7;
    --accent: #f72585;
    --light: #f8f9fa;
    --dark: #212529;
    --gray: #6c757d;
    --light-gray: #e9ecef;
    --success: #059669; /* Verde para sucesso */
    --danger: #dc3545;  /* Vermelho para perigo */
    --card-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    --radius-sm: 6px;
    --space-xs: 4px;
    --space-sm: 8px;
    --text-base: 1rem;
    --text-2xl: 1.5rem;
}

/* --- Reset e Estilos Gerais --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', system-ui, sans-serif;
}
body {
    background-color: var(--light);
    color: var(--dark);
    line-height: 1.6;
}
.container {
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px 0;
}
a { text-decoration: none; }

/* --- Cabeçalho e Navegação --- */
header {
    background-color: white;
    box-shadow: 0 2px 10px rgba(0,0,0,0.07);
    position: sticky; top: 0; z-index: 1000;
}
.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
}
.logo {
    display: flex; align-items: center; gap: 10px;
    font-size: 24px; font-weight: 700; color: var(--primary);
}
.logo-icon {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    width: 40px; height: 40px; border-radius: 10px;
    display: flex; align-items: center; justify-content: center; color: white;
}
nav ul {
    display: flex;
    list-style: none;
    gap: 1.5rem;
    align-items: center;
    margin: 0;
    padding: 0;
}
nav a { color: var(--dark); font-weight: 500; transition: color 0.3s; }
nav a:hover { color: var(--primary); }

.nav-with-user {
    display: flex;
    align-items: center;
    gap: 2rem;
}
.user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 500;
}
.role-badge {
    background: rgba(0, 0, 0, 0.05);
    border: 1px solid var(--light-gray);
    color: var(--dark);
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.8rem;
    font-weight: 500;
}
.badge {
    background: #ef4444; /* Mantido pois é específico e não genérico */
    color: white;
    border-radius: 50%;
    padding: 2px 6px;
    font-size: 0.7rem;
    margin-left: 5px;
}

/* --- Botões --- */
.btn {
    padding: 10px 22px; border-radius: 8px; font-weight: 600;
    cursor: pointer; transition: all 0.3s; border: none;
    display: inline-flex; align-items: center; gap: 8px;
    justify-content: center;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-2px); }
.btn-secondary { background: transparent; border: 2px solid var(--light-gray); color: var(--dark); }
.btn-secondary:hover { border-color: var(--primary); color: var(--primary); }
.btn-success { background-color: var(--success); color: white; }
.btn-success:hover { background-color: #047857; } /* Tom mais escuro do --success */
.btn-danger { background-color: var(--danger); color: white; }
.btn-danger:hover { background-color: #b91c1c; } /* Tom mais escuro do --danger */
.btn-icon { background: none; border: none; cursor: pointer; color: var(--gray); font-size: 1rem; }
.btn-icon:hover { color: var(--primary); }
.btn-delete { color: var(--accent); }

/* --- Alertas --- */
.flash-wrap { margin: 12px 0; }
.alert { padding: 10px 12px; border-radius: 8px; margin-bottom: 8px; }
.alert-success { background: #ecfdf5; color: #065f46; }
.alert-error, .alert-danger { background: #fee2e2; color: #991b1b; }
.alert-info { background: #eff6ff; color: #1e40af; }
.alert-warning { background: #fff7ed; color: #9a3412; }

/* --- Seções e Cards de Curso --- */
.hero {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white; text-align: center;
    padding: 80px 40px; border-radius: 15px; margin: 30px 0;
}
.hero h1 { font-size: 2.8rem; margin-bottom: 20px; }
.hero p { font-size: 1.2rem; margin-bottom: 30px; opacity: 0.9; }
.section-header { text-align: center; margin: 60px 0 40px; }
.section-header h1, .section-header h2 { font-size: 2.2rem; margin-bottom: 10px; }
.courses-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 30px;
}
.course-card {
    background: white; border-radius: 12px;
    box-shadow: var(--card-shadow); transition: all 0.3s;
    position: relative;
}
.course-card:hover { transform: translateY(-5px); }
.course-image {
    height: 180px; background-color: var(--light-gray);
    display: flex; align-items: center; justify-content: center;
    color: var(--primary); overflow: hidden;
    border-radius: 12px 12px 0 0;
}
.course-image img { width: 100%; height: 100%; object-fit: cover; }
.course-content { padding: 20px; }
.course-category {
    display: inline-block; background: var(--light-gray); color: var(--primary);
    padding: 4px 10px; border-radius: 6px; font-size: 0.8rem; font-weight: 600; margin-bottom: 10px;
}
.course-card h3 { font-size: 1.3rem; margin-bottom: 10px; }
.course-instructor, .course-description { color: var(--gray); font-size: 0.9rem; margin-bottom: 15px; }
.course-meta {
    display: flex; justify-content: space-between;
    color: var(--gray); font-size: 0.9rem; margin-bottom: 20px;
}
.course-footer { display: flex; justify-content: space-between; align-items: center; }
.course-price {
    font-size: var(--text-2xl); font-weight: 800;
    color: var(--primary); line-height: 1;
}
.course-price.free {
    font-size: var(--text-base); font-weight: 700;
    color: var(--success); background-color: rgba(5, 150, 105, 0.1);
    padding: var(--space-xs) var(--space-sm); border-radius: var(--radius-sm);
    border: 1px solid var(--success);
}
.course-status { position: absolute; top: 15px; right: 15px; padding: 4px 10px; border-radius: 20px; font-size: 0.8rem; font-weight: bold; color: white; }
.course-status.published { background-color: var(--success); }
.course-status.draft { background-color: var(--gray); }

/* --- Formulários --- */
.auth-container, .form-container { max-width: 500px; margin: 50px auto; }
.auth-container.wide { max-width: 950px; }
.auth-form, .course-form {
    background: white; padding: 40px;
    border-radius: 12px; box-shadow: var(--card-shadow);
}
.auth-form h2, .form-container h1 { text-align: center; margin-bottom: 30px; }
.form-group { margin-bottom: 20px; }
.form-group label { display: block; margin-bottom: 8px; font-weight: 500; }
.form-control {
    width: 100%; padding: 12px; border: 1px solid var(--light-gray);
    border-radius: 6px; font-size: 1rem;
    transition: all 0.3s;
}
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.1); outline: none; }
.full-width { width: 100%; justify-content: center; }
.auth-link { text-align: center; margin-top: 20px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

.register-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; }
.register-column fieldset { margin-bottom: 30px; }
.auth-form fieldset { border: none; padding: 0; }
.auth-form legend {
    font-size: 1.1rem; font-weight: 600; color: var(--dark);
    margin-bottom: 20px; padding-bottom: 10px;
    border-bottom: 1px solid var(--light-gray); width: 100%;
}
.checkbox-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.checkbox-group {
    display: flex; align-items: center; gap: 8px;
    background-color: var(--light); padding: 10px 12px;
    border-radius: 6px; border: 1px solid transparent;
    cursor: pointer;
}
.checkbox-group:hover { border-color: var(--primary); }
.checkbox-group input[type="checkbox"] { width: 1.1em; height: 1.1em; cursor: pointer; }
.checkbox-group label { margin-bottom: 0; font-weight: 500; cursor: pointer; }

/* --- Dashboards e Gerenciamento --- */
.dashboard-header { text-align: center; margin-bottom: 40px; }
.empty-state { text-align: center; padding: 40px; background: #f1f1f1; border-radius: 12px;}
.progress-bar { height: 8px; background: var(--light-gray); border-radius: 4px; overflow: hidden; margin: 10px 0 5px; }
.progress-fill { height: 100%; background: var(--primary); }
.progress-text { font-size: 0.9rem; color: var(--gray); }
.course-actions { margin-top: 20px; display: flex; gap: 10px; }
.course-actions .btn { flex-grow: 1; }
.actions-zone, .danger-zone { margin-top: 30px; background-color: white; padding: 30px; border-radius: 12px; box-shadow: var(--card-shadow); }
.danger-zone { border: 2px solid var(--danger); }
.actions-zone h2, .danger-zone h2 { text-align: center; margin-bottom: 20px; }
.danger-zone h2 { color: var(--danger); }
.manage-container { max-width: 800px; margin: 30px auto; }
.content-manager h2 { margin-bottom: 20px; padding-bottom: 10px; border-bottom: 1px solid var(--light-gray); }
.module-card { background-color: #fff; border-radius: 12px; padding: 20px; margin-bottom: 25px; box-shadow: 0 4px 15px rgba(0,0,0,0.05); }
.module-card.add-new { background-color: var(--light); border: 2px dashed var(--light-gray); box-shadow: none; }
.module-card h3 { margin-bottom: 15px; color: var(--primary); }
.module-header { display: flex; justify-content: space-between; align-items: center; padding-bottom: 15px; border-bottom: 1px solid var(--light-gray); margin-bottom: 15px; gap: 10px;}
.edit-module-form { display: flex; flex-grow: 1; align-items: center; gap: 10px;}
.form-control-inline { border: 1px solid transparent; font-size: 1.25rem; font-weight: bold; padding: 5px; border-radius: 6px; width: 100%;}
.form-control-inline:focus { border-color: var(--primary); background: #f8f9fa; }
.add-form { display: flex; gap: 10px; align-items: center; }
.lesson-form { flex-direction: column; align-items: stretch; gap: 15px; }
.lesson-list { list-style-type: none; margin-bottom: 20px; }
.lesson-item { display: flex; justify-content: space-between; align-items: center; padding: 10px; background-color: var(--light); border-radius: 6px; margin-bottom: 8px; }
.lesson-item a.lesson-link { display: flex; align-items: center; gap: 10px; color: var(--dark); flex-grow: 1; }
.lesson-item a.lesson-link:hover { color: var(--primary); }
.btn-delete-lesson { font-size: 0.8rem; color: var(--gray); }
.btn-delete-lesson:hover { color: var(--accent); }
.empty-lesson { color: var(--gray); font-style: italic; }

/* --- Visualização de Curso e Aulas --- */
.course-view-container, .lesson-view-container, .quiz-container { max-width: 900px; margin: 30px auto; }
.course-curriculum { margin-top: 40px; }
.module-accordion { margin-bottom: 10px; border: 1px solid var(--light-gray); border-radius: 8px; overflow: hidden; }
.accordion-header { background: #fff; width: 100%; border: none; text-align: left; padding: 15px 20px; font-size: 1.1rem; cursor: pointer; display: flex; justify-content: space-between; align-items: center; }
.accordion-header i { transition: transform 0.3s; }
.accordion-content { padding: 0 20px; max-height: 0; overflow: hidden; transition: max-height 0.3s ease-out, padding 0.3s ease-out; }
.accordion-content ul { list-style: none; padding: 15px 0; }
.accordion-content li a { display: block; padding: 10px; color: var(--dark); border-radius: 6px; }
.accordion-content li a:hover { background: var(--light-gray); color: var(--primary); }
.lesson-header { text-align: center; margin-bottom: 30px; }
.lesson-header a { display: block; margin-bottom: 15px; color: var(--gray); }
.lesson-header h1 { margin-bottom: 5px; }
.lesson-content { background: white; padding: 20px; border-radius: 12px; box-shadow: var(--card-shadow); }
.video-container { position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden; margin-bottom: 20px; }
.video-container iframe { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
.text-content { line-height: 1.8; margin-bottom: 20px; }
.download-container { text-align: center; padding: 20px; border-top: 1px solid var(--light-gray); margin-top: 20px; }

/* --- Certificado e Quiz --- */
.certificate-container { padding: 40px 0; }
.certificate-border { border: 10px solid var(--primary); padding: 40px; text-align: center; background: white; box-shadow: 0 10px 40px rgba(0,0,0,0.1); }
.certificate-header h1 { color: var(--primary); font-size: 2.5rem; }
.certificate-body { margin: 40px 0; }
.student-name { font-size: 2.2rem; color: var(--dark); margin: 10px 0; }
.course-title { font-size: 1.8rem; color: var(--secondary); margin: 10px 0; }
.congrats-text, .course-text, .date-text { font-size: 1.2rem; color: var(--gray); }
.certificate-footer { margin-top: 40px; border-top: 1px solid var(--light-gray); padding-top: 20px; }
.quiz-container { max-width: 800px; margin: 30px auto; }
.question-card { background: #fff; padding: 20px; margin-bottom: 20px; border-radius: 12px; box-shadow: var(--card-shadow); }
.question-text { font-weight: bold; font-size: 1.1rem; margin-bottom: 15px; }
.options-list .option-label { display: block; background: var(--light); padding: 12px 15px; border-radius: 8px; margin-bottom: 10px; cursor: pointer; transition: background-color 0.3s; }
.options-list .option-label:hover { background-color: #d1ecf1; }
.options-list input[type="radio"] { margin-right: 10px; }
.options-container .option-input { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.options-container input[type="radio"] { flex-shrink: 0; }
.correct-answer { font-weight: bold; color: var(--success); }

/* --- Componentes Diversos --- */
.current-attachment { background-color: var(--light); padding: 10px 15px; border-radius: 6px; margin-bottom: 10px; }
.current-attachment p { margin: 0; }
.students-table-container { background-color: #fff; border-radius: 12px; padding: 20px; box-shadow: var(--card-shadow); overflow-x: auto; }
.students-table { width: 100%; border-collapse: collapse; }
.students-table th, .students-table td { padding: 12px 15px; text-align: left; border-bottom: 1px solid var(--light-gray); }
.students-table thead th { font-weight: 600; color: var(--dark); }
.students-table tbody tr:hover { background-color: var(--light); }
.progress-bar-table { width: 100px; height: 8px; background-color: var(--light-gray); border-radius: 4px; overflow: hidden; display: inline-block; margin-right: 10px; }
.lesson-navigation { display: flex; justify-content: space-between; align-items: center; margin-top: 40px; padding-top: 20px; border-top: 1px solid var(--light-gray); }

/* --- Responsividade --- */
@media (max-width: 768px) {
    .register-grid { grid-template-columns: 1fr; gap: 0; }
    .form-row { grid-template-columns: 1fr; }
    .header-content { flex-direction: column; gap: 15px; }
    nav ul { flex-wrap: wrap; justify-content: center; }
    .nav-with-user { flex-direction: column; gap: 1rem; }
    .user-info { order: -1; }
}

/* Adicione este CSS ao seu style.css */

/* --- CABEÇALHO MODERNO --- */
.main-header {
    background-color: white;
    color: #111827; /* Texto escuro para fundo branco */
    padding: 0.5rem 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0,0,0,0.07);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.5rem;
    font-weight: 700;
    color: #4f46e5;
    text-decoration: none;
}

.logo-icon {
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    width: 40px; height: 40px; border-radius: 10px;
    display: flex; align-items: center; justify-content: center; color: white;
}

/* --- NAVEGAÇÃO DESKTOP --- */
.desktop-nav ul {
    display: flex; list-style: none; gap: 1.5rem; margin: 0;
}
.desktop-nav a {
    color: #374151; text-decoration: none; font-weight: 500; transition: color 0.2s;
}
.desktop-nav a:hover { color: #4f46e5; }

/* --- AÇÕES DO CABEÇALHO (DIREITA) --- */
.header-actions { display: flex; align-items: center; gap: 1rem; }

/* Botões para Visitantes */
.visitor-actions a { text-decoration: none; }
.btn-login {
    color: #374151; font-weight: 500;
    padding: 8px 16px; border-radius: 8px; transition: background-color 0.2s;
}
.btn-login:hover { background-color: #f3f4f6; }
.btn-register {
    background-color: #4f46e5; color: white; font-weight: 500;
    padding: 8px 16px; border-radius: 8px; transition: background-color 0.2s;
}
.btn-register:hover { background-color: #4338ca; }

/* Dropdown do Usuário Logado */
.user-dropdown { position: relative; cursor: pointer; }
.user-info { display: flex; align-items: center; gap: 8px; padding: 8px 12px; font-weight: 500; }
.user-dropdown .fa-chevron-down { font-size: 0.7rem; transition: transform 0.2s; }
.user-dropdown:hover .fa-chevron-down { transform: rotate(180deg); }
.dropdown-content {
    display: none; position: absolute; right: 0; top: 100%;
    background-color: white; color: #111827;
    border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    min-width: 220px; z-index: 1001; overflow: hidden;
}
.user-dropdown:hover .dropdown-content { display: block; }
.dropdown-header { padding: 12px 16px; border-bottom: 1px solid #e5e7eb; }
.role-badge {
    display: inline-flex; align-items: center; gap: 6px;
    background: #eef2ff; color: #4f46e5;
    padding: 2px 10px; border-radius: 12px;
    font-size: 0.8rem; font-weight: 500;
}
.dropdown-content a {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 16px; color: #374151; text-decoration: none; font-size: 0.9rem;
}
.dropdown-content a:hover { background-color: #f9fafb; color: #4f46e5; }
.dropdown-content a i { width: 16px; text-align: center; }

/* --- MENU MOBILE (HAMBURGUER) --- */
.mobile-menu-button {
    display: none; /* Escondido em telas grandes */
    background: none; border: none; color: #111827;
    font-size: 1.5rem; cursor: pointer;
}
.mobile-nav-links { display: none; } /* O menu mobile está SEMPRE escondido por padrão */

/* --- RESPONSIVIDADE --- */
@media (max-width: 768px) {
    .desktop-nav, .visitor-actions, .user-dropdown { display: none; } /* Esconde os itens de desktop */
    .mobile-menu-button { display: block; } /* Mostra o botão hamburguer */
    .mobile-nav-links.active {
        display: block; /* Mostra o menu SÓ quando o botão é clicado */
        background-color: #f9fafb;
        border-top: 1px solid #e5e7eb;
    }
    .mobile-nav-links ul { list-style: none; display: flex; flex-direction: column; align-items: center; gap: 1rem; padding: 1rem 0; margin: 0; }
    .mobile-nav-links a { color: #374151; text-decoration: none; font-size: 1.1rem; }
}

/* --- OUTROS ESTILOS GERAIS --- */
.main-content {
    padding-top: 2rem;
    padding-bottom: 2rem;
    min-height: 80vh;
}
.main-footer {
    background-color: #1f2937;
    color: #9ca3af;
    text-align: center;
    padding: 1.5rem 0;
    margin-top: 2rem;
}