/* style.css - Versão Final Completa (Layout Netflix + Sidebar) */

:root {
    --bg: #121212;
    --card: rgba(30, 30, 30, 0.9); 
    --text: #e0e0e0;
    --accent: #00d4ff;
    --accent-hover: #00a3cc;
    --progress: #00ff88;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--text);
    margin: 0;
    padding: 0;
    min-height: 100vh;

    /* --- BACKGROUND --- */
    background-image: linear-gradient(rgba(0, 0, 0, 0.85), rgba(0, 0, 0, 0.85)), url('https://meuscursos.celius.com.br/uploads/bg.png');
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
    background-attachment: fixed;
}

.container { padding: 20px; max-width: 1000px; margin: 0 auto; }

/* --- LOGIN --- */
.login-body { display: flex; justify-content: center; align-items: center; height: 100vh; }
.login-box { 
    background: var(--card); 
    padding: 40px; 
    border-radius: 10px; 
    text-align: center; 
    width: 90%; 
    max-width: 300px; 
    backdrop-filter: blur(10px); 
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
    border: 1px solid rgba(255,255,255,0.05);
}

/* --- FORMS & INPUTS --- */
input, select, button {
    width: 100%; margin: 10px 0; padding: 12px; border-radius: 6px; border: none; box-sizing: border-box; outline: none;
}
input, select { background: rgba(51, 51, 51, 0.8); color: white; border: 1px solid transparent; }
input:focus, select:focus { border-color: var(--accent); }
button { background: var(--accent); color: #000; font-weight: bold; cursor: pointer; transition: all 0.2s; }
button:hover { background: var(--accent-hover); transform: translateY(-1px); }
.btn-toggle { margin-bottom: 20px; }

/* --- HEADER --- */
header { 
    background: rgba(0, 0, 0, 0.8); 
    padding: 15px 20px; 
    display: flex; 
    align-items: center; 
    justify-content: space-between; 
    backdrop-filter: blur(10px); 
    position: sticky; 
    top: 0; 
    z-index: 100; 
    border-bottom: 1px solid rgba(255,255,255,0.05);
}
header h1 { margin: 0; font-size: 1.2rem; font-weight: 700; letter-spacing: 1px; }
.back-btn, .btn-logout { color: white; text-decoration: none; font-size: 0.9rem; transition: color 0.2s; }
.back-btn:hover, .btn-logout:hover { color: var(--accent); }

/* --- CARDS GENÉRICOS --- */
.card {
    background: var(--card); 
    padding: 20px; 
    margin-bottom: 20px; 
    border-radius: 8px; 
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255,255,255,0.05);
}

/* --- GRID DE CURSOS (ESTILO NETFLIX) --- */
.course-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.course-card {
    background: var(--card);
    border-radius: 8px;
    text-decoration: none;
    color: inherit;
    display: block;
    position: relative;
    overflow: hidden;
    transition: transform 0.3s, box-shadow 0.3s;
    aspect-ratio: 2/3; /* Formato Poster */
    border: none;
    padding: 0; 
}

.course-card:hover {
    transform: scale(1.05);
    box-shadow: 0 10px 20px rgba(0,0,0,0.5);
    z-index: 2;
}

.course-cover {
    width: 100%; height: 100%; object-fit: cover; display: block;
}

.course-no-cover {
    width: 100%; height: 100%;
    background: linear-gradient(45deg, #1e1e1e, #2a2a2a);
    display: flex; align-items: center; justify-content: center;
    font-size: 3rem; color: #333;
}

.course-info-overlay {
    position: absolute; bottom: 0; left: 0; right: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.95), rgba(0,0,0,0));
    padding: 20px 10px 10px 10px;
    display: flex; flex-direction: column; justify-content: flex-end;
    min-height: 50%;
}

.course-info-overlay h2 {
    font-size: 1rem; margin: 0 0 5px 0; color: white;
    text-shadow: 0 1px 2px rgba(0,0,0,0.8);
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

.creator-badge { font-size: 0.7rem; color: var(--accent); opacity: 0.9; }

/* --- NOVO LAYOUT DA PÁGINA DO CURSO (Sidebar + Main) --- */
.course-layout {
    display: grid;
    grid-template-columns: 300px 1fr; /* Coluna esquerda fixa, direita flexível */
    gap: 30px;
    align-items: start;
}

/* Sidebar (Esquerda) */
.course-sidebar {
    position: sticky; /* Faz a capa acompanhar a rolagem */
    top: 90px; /* Distância do topo */
}

/* Capa Grande no Sidebar */
.course-poster-large {
    width: 100%;
    aspect-ratio: 2/3;
    object-fit: cover;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    margin-bottom: 15px;
    background: #222;
}

/* Pequeno formulário de upload na sidebar */
.cover-upload-form label { display: block; margin-bottom: 5px; font-size: 0.9rem; color: #aaa; }
.cover-upload-form input[type="file"] { font-size: 0.8rem; padding: 8px; background: rgba(0,0,0,0.3); }

/* --- CAPÍTULOS (ESTILO ACORDEÃO) --- */
.chapter-card {
    background: var(--card);
    margin-bottom: 15px;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.05);
    overflow: hidden;
}

.chapter-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 15px; cursor: pointer; background: rgba(255,255,255,0.02);
    transition: background 0.2s;
}
.chapter-header:hover { background: rgba(255,255,255,0.05); }

.chapter-actions { display: flex; gap: 10px; }

.chevron { transition: transform 0.3s; display: inline-block; margin-right: 8px; font-size: 0.8rem; }
.chapter-card.collapsed .chevron { transform: rotate(-90deg); }

.chapter-card.collapsed .chapter-content { display: none; }
.chapter-content { padding: 0; border-top: 1px solid rgba(255,255,255,0.05); }

.upload-area { padding: 15px; background: rgba(0,0,0,0.2); border-bottom: 1px solid rgba(255,255,255,0.05); }

/* --- LISTA DE AULAS --- */
.lesson-list { list-style: none; padding: 0; margin: 0; }

.lesson-item { 
    padding: 15px; 
    border-bottom: 1px solid rgba(255,255,255,0.05); 
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
    background: rgba(0,0,0,0.1);
}
.lesson-item:last-child { border-bottom: none; }
.lesson-item.watched { opacity: 0.5; } 

.lesson-info {
    display: flex;
    align-items: center; 
    gap: 15px;
    flex-grow: 1;
    width: 100%;
}

.lesson-info span[id^="lesson-title-text-"] {
    margin-bottom: 0 !important;
    line-height: 1.3;
    font-size: 1rem;
}

.lesson-actions { display: flex; gap: 5px; }

.video-wrapper { width: 100%; margin-top: 10px; }
video { width: 100%; border-radius: 6px; max-height: 500px; background: #000; display: block; }
.pdf-link { color: var(--accent); text-decoration: none; display: inline-block; margin-top: 5px; }

/* --- CHECKBOX CUSTOMIZADO --- */
.checkbox-container { 
    display: block; position: relative; cursor: pointer; 
    width: 24px; height: 24px; flex-shrink: 0; margin: 0; padding: 0;
}
.checkbox-container input { position: absolute; opacity: 0; cursor: pointer; height: 0; width: 0; }
.checkmark { 
    position: absolute; top: 0; left: 0; height: 24px; width: 24px; 
    background-color: rgba(255, 255, 255, 0.1); 
    border-radius: 4px; border: 1px solid rgba(255,255,255,0.2);
    transition: all 0.2s;
}
.checkbox-container:hover input ~ .checkmark { background-color: rgba(255, 255, 255, 0.2); }
.checkbox-container input:checked ~ .checkmark { background-color: var(--accent); border-color: var(--accent); }
.checkmark:after { content: ""; position: absolute; display: none; }
.checkbox-container input:checked ~ .checkmark:after { display: block; }
.checkbox-container .checkmark:after { 
    left: 8px; top: 4px; width: 5px; height: 10px; 
    border: solid #000; border-width: 0 2px 2px 0; 
    transform: rotate(45deg); 
}

/* --- BARRA DE PROGRESSO --- */
.progress-container { 
    background: rgba(255, 255, 255, 0.1); 
    height: 6px; border-radius: 3px; 
    margin-top: 5px; position: relative; overflow: hidden; 
    width: 100%; max-width: 200px;
}
.progress-bar { background: var(--progress); height: 100%; transition: width 0.3s ease; }
.progress-text { font-size: 11px; color: #888; float: right; margin-top: -15px; }

/* --- BOTÕES DE ÍCONE --- */
.btn-icon {
    background: none; border: none; cursor: pointer;
    font-size: 1.1rem; padding: 5px; opacity: 0.6; transition: 0.2s; color: var(--text);
}
.btn-icon:hover { opacity: 1; transform: scale(1.2); }
.btn-delete:hover { color: #ff4444; }
.btn-edit:hover { color: #ffbb00; }

.hidden { display: none !important; }

/* --- RESPONSIVIDADE --- */
@media (max-width: 768px) {
    /* No celular/tablet, a sidebar deixa de ser lado a lado e empilha */
    .course-layout { grid-template-columns: 1fr; }
    
    .course-sidebar { 
        position: static; 
        max-width: 250px; 
        margin: 0 auto 30px auto; 
    }

    .lesson-actions { flex-direction: column; }
    .lesson-item { align-items: flex-start; }
}