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

:root {
    /* --- Paleta de Cores --- */
    --primary-color: #0056b3;
    --primary-hover: #004494;
    --primary-light: #e6f0ff;
    
    --secondary-bg: #f3f4f6;
    --white: #ffffff;
    --text-main: #1f2937;
    --text-muted: #6b7280;
    
    --danger: #dc2626;
    --success: #10b981;
    --warning: #f59e0b;
    --info: #17a2b8;
    --purple: #8b5cf6; /* Botão de Alunos */
    
    /* Cores para estado Desabilitado/Arquivado */
    --disabled-bg: #e5e7eb;
    --disabled-text: #9ca3af;

    /* --- Espaçamento e Bordas --- */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    
    /* --- Sombras --- */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

/* --- Reset Básico --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
    -webkit-font-smoothing: antialiased;
}

/* Configuração do Sticky Footer (Rodapé sempre embaixo) */
body {
    background-color: var(--secondary-bg);
    color: var(--text-main);
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* --- Layouts Gerais --- */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem;
    flex: 1; /* Ocupa espaço disponível empurrando o footer */
    width: 100%;
}

/* Grid Utilitário Responsivo (para forms) */
.grid-cols-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

/* --- Tela de Login --- */
body.login-body {
    background: linear-gradient(135deg, #0056b3 0%, #003d80 100%);
    padding: 1rem;
}

.login-container {
    background-color: var(--white);
    padding: 2.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 400px;
    text-align: center;
    animation: fadeIn 0.5s ease-out;
    margin: auto; /* Centraliza no flex */
}

.logo-area h2 { color: var(--primary-color); font-size: 1.5rem; font-weight: 700; }
.logo-area p { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 2rem; }

/* --- Barra de Navegação --- */
.main-nav {
    background: var(--white);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 100;
}
.brand { color: var(--primary-color); font-weight: 700; font-size: 1.25rem; }
.user-controls { display: flex; align-items: center; gap: 1rem; }
.user-name { font-size: 0.9rem; font-weight: 500; color: var(--text-main); }

/* --- Formulários --- */
.form-group { margin-bottom: 1.25rem; text-align: left; }
.form-group label {
    display: block; margin-bottom: 0.5rem; font-size: 0.875rem; font-weight: 500; color: var(--text-main);
}
input, select {
    width: 100%; padding: 12px 16px; border: 1px solid #d1d5db; border-radius: var(--radius-sm);
    font-size: 1rem; transition: all 0.2s; background: #f9fafb;
}
input:focus, select:focus {
    outline: none; border-color: var(--primary-color); box-shadow: 0 0 0 3px rgba(0, 86, 179, 0.15); background: white;
}

/* --- Botões --- */
button {
    width: 100%; padding: 12px; background-color: var(--primary-color); color: white;
    border: none; border-radius: var(--radius-sm); cursor: pointer; font-size: 0.95rem; font-weight: 600;
    transition: all 0.2s;
}
button:hover { background-color: var(--primary-hover); transform: translateY(-1px); }
button:active { transform: translateY(0); }

/* Variantes de Cor */
button.btn-danger { background-color: var(--danger); }
button.btn-success { background-color: var(--success); }
button.btn-info { background-color: var(--info); }
button.btn-purple { background-color: var(--purple); }

/* Botão Outline (Borda) */
button.btn-outline {
    background: transparent; border: 1px solid #d1d5db; color: var(--text-main);
}
button.btn-outline:hover { background: #f3f4f6; }
button.btn-sm { padding: 6px 12px; font-size: 0.8rem; width: auto; }

/* Botões Específicos (Vitrine & Aulas) */
.btn-matricular { background-color: var(--success); color: white; font-weight: 700; width: 100%; }
.btn-matricular:hover { background-color: #0d9668; transform: translateY(-2px); }

.btn-acessar { background-color: var(--primary-color); color: white; font-weight: 600; width: 100%; }
.btn-acessar:hover { background-color: var(--primary-hover); }

/* Botão Desabilitado (Arquivado) */
.btn-disabled {
    background-color: var(--disabled-bg) !important;
    color: var(--disabled-text) !important;
    cursor: not-allowed !important;
    transform: none !important;
    box-shadow: none !important;
}

.btn-action-lesson { padding: 10px 20px; border-radius: 6px; border: none; font-weight: 600; cursor: pointer; transition: all 0.2s; }
.btn-concluir { background-color: #2563eb; color: white; }
.btn-concluir:hover { background-color: #1d4ed8; }

.btn-next-lesson {
    background-color: var(--primary-color); color: white; padding: 10px 20px; border-radius: 6px;
    font-weight: 600; display: flex; align-items: center; gap: 5px; border: none; cursor: pointer;
}
.btn-next-lesson:hover { background-color: var(--primary-hover); transform: translateX(2px); }

/* --- Cards de Curso --- */
.grid-cursos {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); /* Responsivo */
    gap: 1.5rem;
    margin-top: 1.5rem;
}
.card-curso, .course-card {
    background: white; border-radius: var(--radius-md); box-shadow: var(--shadow-sm);
    transition: all 0.3s ease; border: 1px solid #e5e7eb; overflow: hidden;
    display: flex; flex-direction: column; height: 100%;
}
.card-curso:hover, .course-card:hover {
    transform: translateY(-4px); box-shadow: var(--shadow-md); border-color: var(--primary-light);
}

/* Estilo para Cursos Arquivados/Inativos */
.card-curso.archived {
    opacity: 0.6;
    background-color: #fafafa;
    border-color: #e5e7eb;
}
.card-curso.archived:hover {
    transform: none;
    box-shadow: var(--shadow-sm);
    border-color: #e5e7eb;
}
.card-curso.archived .card-img-top {
    filter: grayscale(100%);
}

.card-img-top {
    width: 100%; height: 200px; object-fit: contain; background: #f3f4f6; border-bottom: 1px solid #eee;
}
.card-body { padding: 1.5rem; flex: 1; display: flex; flex-direction: column; }
.card-title { font-size: 1.2rem; font-weight: 700; margin-bottom: 0.5rem; color: var(--text-main); }
.card-desc { color: var(--text-muted); font-size: 0.95rem; margin-bottom: 1.5rem; flex: 1; line-height: 1.6; }

/* Botões dentro do Card (Admin) */
.admin-card-actions {
    display: flex; gap: 8px; margin-top: auto; padding-top: 1rem; border-top: 1px solid #f3f4f6; flex-wrap: wrap;
}
.admin-card-actions button {
    flex: 1; display: flex; justify-content: center; align-items: center; gap: 5px; white-space: nowrap;
}

/* --- Player de Vídeo --- */
.video-wrapper {
    background: black; border-radius: var(--radius-md); overflow: hidden;
    box-shadow: var(--shadow-lg); margin-bottom: 2rem; display: none;
}
.video-container { position: relative; padding-bottom: 56.25%; height: 0; }
.video-container iframe { position: absolute; top: 0; left: 0; width: 100%; height: 100%; border: 0; }
.video-info { 
    padding: 1.5rem; background: white; border-top: 1px solid #eee;
    display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 1rem;
}

/* Lista de Aulas e Badges */
.lesson-list-active { background: white; border-radius: var(--radius-md); border: 1px solid #e5e7eb; overflow: hidden; }
.lesson-row {
    padding: 12px 20px; border-bottom: 1px solid #f3f4f6; cursor: pointer;
    display: flex; align-items: center; justify-content: space-between; transition: background 0.2s;
}
.lesson-row:hover { background: #f9fafb; }
.lesson-row.playing { background: var(--primary-light); color: var(--primary-color); font-weight: 600; border-left: 4px solid var(--primary-color); }
.lesson-row.finished { color: #059669; background-color: #f0fdf4; }

.lesson-feedback {
    background-color: #d1fae5; color: #065f46; padding: 8px 16px; border-radius: 50px;
    font-size: 0.9rem; font-weight: 600; display: flex; align-items: center; gap: 8px; animation: fadeIn 0.5s ease;
}

/* --- Painel Admin & Modais --- */
.admin-nav {
    background: white; padding: 1rem; display: flex; gap: 0.5rem; border-bottom: 1px solid #e5e7eb;
    overflow-x: auto; -webkit-overflow-scrolling: touch; /* Scroll suave no iOS */
}
.admin-nav button {
    background: transparent; color: var(--text-muted); border: none; font-weight: 500;
    padding: 10px 16px; border-radius: var(--radius-sm); white-space: nowrap;
}
.admin-nav button.active { background: var(--primary-light); color: var(--primary-color); }
.form-section { background: white; padding: 2rem; border-radius: var(--radius-md); box-shadow: var(--shadow-sm); border: 1px solid #e5e7eb; }

/* Estilos de Linha de Módulo (Admin) */
.module-row { 
    display: flex; gap: 10px; margin-bottom: 10px; align-items: center;
    background: #f9f9f9; padding: 10px; border-radius: var(--radius-sm); border: 1px solid #eee;
}
.module-row input { flex: 1; }
.btn-remove-mod {
    background: #dc3545; color: white; border: none; width: 30px; height: 30px;
    border-radius: 50%; cursor: pointer; display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}

/* Modais */
.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.5); z-index: 1000; display: flex; justify-content: center; align-items: center; backdrop-filter: blur(2px);
}
.modal-box {
    background: white; padding: 2rem; border-radius: var(--radius-md); width: 90%; max-width: 600px;
    max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow-lg); animation: fadeIn 0.3s ease-out;
}
.modal-actions {
    display: flex; gap: 10px; justify-content: flex-end; margin-top: 1.5rem; border-top: 1px solid #eee; padding-top: 1rem;
}
.modal-modules-list, .modal-students-list {
    background: #f9f9f9; border: 1px solid #eee; border-radius: var(--radius-sm);
    padding: 10px; margin-top: 10px; max-height: 250px; overflow-y: auto;
}
.modal-module-item, .student-item {
    display: flex; justify-content: space-between; align-items: center;
    background: white; padding: 8px 12px; margin-bottom: 5px; border: 1px solid #eee; border-radius: 4px; font-size: 0.9rem;
}
.student-item div { display: flex; flex-direction: column; }
.student-email { font-size: 0.8rem; color: var(--text-muted); }

/* --- Rodapé Institucional --- */
.main-footer {
    background-color: var(--white); padding: 2rem 1rem; text-align: center;
    border-top: 1px solid #e5e7eb; margin-top: auto; width: 100%;
}
.footer-logos {
    display: flex; justify-content: center; align-items: center; gap: 30px; margin-bottom: 1rem; flex-wrap: wrap;
}
.footer-logos img { height: 60px; width: auto; object-fit: contain; transition: transform 0.3s; }
.footer-logos img:hover { transform: scale(1.05); }
.footer-text { color: var(--text-muted); font-size: 0.85rem; font-weight: 500; }

/* Utilitários */
.hidden { display: none !important; }
.text-center { text-align: center; }
.error-message { color: var(--danger); font-size: 0.85rem; margin-top: 10px; display: none; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* --- RESPONSIVIDADE MOBILE (MEDIA QUERIES) --- */
@media (max-width: 768px) {
    /* Layout */
    .container { padding: 1rem; }
    
    /* Navegação Empilhada */
    .main-nav { padding: 1rem; flex-direction: column; gap: 1rem; text-align: center; }
    .user-controls { width: 100%; justify-content: center; margin-top: 0.5rem; }

    /* Grid de Colunas vira Única */
    .grid-cols-2 { grid-template-columns: 1fr !important; }
    
    /* Cards */
    .card-img-top { height: 180px; }
    .admin-card-actions { flex-direction: column; }
    .admin-card-actions button { width: 100%; }

    /* Player e Ações */
    .video-info { flex-direction: column; align-items: stretch; text-align: center; gap: 1.5rem; }
    .video-info > div:last-child { display: flex; flex-direction: column; gap: 10px; width: 100%; }
    
    /* Botões Full Width no Mobile */
    .btn-action-lesson, .btn-next-lesson, .lesson-feedback, .btn-concluir { width: 100%; justify-content: center; }

    /* Ajuste nos Inputs de Módulo do Admin */
    .module-row { flex-direction: column; align-items: stretch; }
    .btn-remove-mod { width: 100%; border-radius: 4px; background-color: #fee2e2; color: var(--danger); margin-top: 5px; }

    /* Rodapé */
    .footer-logos { gap: 15px; }
    .footer-logos img { height: 40px; }
    .footer-text { font-size: 0.75rem; }
    
    /* Login */
    .login-container { padding: 2rem 1.5rem; }
}
