:root {
    --bg: #141414;
    --bg-raised: #1f1f1f;
    --bg-card: #232323;
    --bg-card-hover: #2c2c2c;
    --text: #f5f5f1;
    --muted: #b3b3b3;
    --border: #3a3a3a;
    --accent: #e50914;
    --accent-hover: #f6121d;
    --success: #2ecc71;
    --danger: #e50914;
    --focus-ring: #54b3ff;
    --radius: 6px;
}

* { box-sizing: border-box; }

html { color-scheme: dark; }

body {
    margin: 0;
    font-family: -apple-system, "Helvetica Neue", Segoe UI, Roboto, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
}

a { color: inherit; }

/* Acessibilidade: foco sempre visível e consistente */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
    outline: 3px solid var(--focus-ring);
    outline-offset: 2px;
}

.skip-link {
    position: absolute;
    left: -9999px;
    top: 0;
    background: var(--accent);
    color: #fff;
    padding: 8px 16px;
    z-index: 100;
}
.skip-link:focus { left: 8px; top: 8px; }

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

.sidebar {
    width: 240px;
    flex-shrink: 0;
    background: linear-gradient(180deg, #000 0%, #0a0a0a 100%);
    color: var(--text);
    display: flex;
    flex-direction: column;
    padding: 24px 16px;
    border-right: 1px solid var(--border);
}

.sidebar .brand {
    margin-bottom: 32px;
    padding: 0 8px;
}

.brand-logo { height: 48px; width: auto; display: block; }

.sidebar ul { list-style: none; padding: 0; margin: 0; flex: 1; }

.sidebar li a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 12px;
    color: var(--muted);
    text-decoration: none;
    border-radius: var(--radius);
    margin-bottom: 4px;
    font-size: 0.95rem;
    font-weight: 500;
    transition: background 0.15s ease, color 0.15s ease;
}

.sidebar li a:hover { background: var(--bg-raised); color: var(--text); }

.sidebar li a.active {
    background: var(--accent);
    color: #fff;
}

.nav-footer {
    border-top: 1px solid var(--border);
    padding-top: 14px;
    font-size: 0.85rem;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.nav-footer a {
    color: var(--muted);
    text-decoration: none;
    padding: 6px 8px;
    border-radius: var(--radius);
}
.nav-footer a:hover { color: var(--text); background: var(--bg-raised); }

.content { flex: 1; padding: 32px 40px; max-width: 1400px; }

.content h1 {
    font-size: 1.8rem;
    margin: 0 0 24px;
    font-weight: 700;
}

/* ---------- Cards ---------- */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

.card h3 { margin-top: 0; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-block;
    background: var(--accent);
    color: #fff;
    border: none;
    padding: 10px 20px;
    border-radius: var(--radius);
    cursor: pointer;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    transition: background 0.15s ease, transform 0.1s ease;
}

.btn:hover { background: var(--accent-hover); }
.btn:active { transform: scale(0.98); }

.btn.btn-secondary { background: #3a3a3a; color: var(--text); }
.btn.btn-secondary:hover { background: #4a4a4a; }

.btn.btn-danger { background: transparent; color: var(--danger); border: 1px solid var(--danger); }
.btn.btn-danger:hover { background: rgba(229, 9, 20, 0.15); }

/* ---------- Progress ---------- */
.progress-bar {
    background: #3a3a3a;
    border-radius: 4px;
    height: 6px;
    overflow: hidden;
    margin: 10px 0;
}

.progress-bar > div {
    background: var(--accent);
    height: 100%;
    transition: width 0.3s ease;
}

/* ---------- Course grid (estilo "catálogo") ---------- */
.course-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 20px;
}

.course-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.course-card:hover,
.course-card:focus-within {
    transform: translateY(-4px);
    background: var(--bg-card-hover);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.45);
}

.course-card__cover {
    height: 120px;
    background: linear-gradient(135deg, #3a0a0a, #1a1a1a);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
}

.course-card__body { padding: 16px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.course-card__body h3 { margin: 0; font-size: 1.05rem; }
.course-card__body p { margin: 0; color: var(--muted); font-size: 0.85rem; flex: 1; }
.badge-draft { color: var(--muted); font-weight: 400; font-size: 0.75rem; }

/* ---------- Forms ---------- */
label { display: block; margin-top: 12px; font-size: 0.85rem; color: var(--muted); }

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
textarea,
select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-top: 4px;
    background: var(--bg-raised);
    color: var(--text);
    font-size: 0.95rem;
}

input::placeholder, textarea::placeholder { color: #777; }

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
textarea:focus,
select:focus {
    border-color: var(--focus-ring);
}

input[type="radio"], input[type="checkbox"] { width: auto; margin-top: 0; accent-color: var(--accent); }

small { color: var(--muted); display: block; margin-top: 4px; }

/* ---------- Login (estilo "hero" Netflix) ---------- */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
    background:
        linear-gradient(to top, #000 0%, rgba(0,0,0,0.3) 60%, rgba(0,0,0,0.6) 100%),
        radial-gradient(ellipse at top, #3a0a0a 0%, #000 70%);
    background-blend-mode: multiply;
}

.login-box {
    background: rgba(0, 0, 0, 0.78);
    padding: 48px 40px;
    border-radius: 8px;
    width: 360px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
}

.login-box .logo-img {
    display: block;
    height: 96px;
    width: auto;
    margin: 0 auto 24px;
}

.login-box h1 { margin: 0 0 4px; font-size: 1.5rem; }
.login-box .subtitle { color: var(--muted); margin-bottom: 24px; font-size: 0.9rem; }

.login-box button { margin-top: 24px; width: 100%; padding: 12px; font-size: 1rem; }

/* ---------- Alerts ---------- */
.alert { padding: 12px 14px; border-radius: var(--radius); margin-bottom: 14px; font-size: 0.88rem; }
.alert-error { background: rgba(229, 9, 20, 0.15); color: #ff6b6b; border: 1px solid rgba(229, 9, 20, 0.4); }
.alert-success { background: rgba(46, 204, 113, 0.15); color: #5fe892; border: 1px solid rgba(46, 204, 113, 0.4); }

/* ---------- Tables ---------- */
table { width: 100%; border-collapse: collapse; }
table th, table td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--border); }
table th { color: var(--muted); font-weight: 600; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; }

.hidden { display: none; }

/* ---------- Listas de aula / módulo ---------- */
.lesson-list { list-style: none; padding: 0; margin: 0 0 12px; }

.lesson-list li { margin-bottom: 4px; }

.lesson-list a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius);
    text-decoration: none;
    color: var(--text);
    transition: background 0.15s ease;
}

.lesson-list a:hover { background: var(--bg-raised); }
.lesson-list .lesson-plain { display: flex; align-items: center; gap: 10px; padding: 10px 12px; color: var(--muted); }

.quiz-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius);
}
.quiz-link a { text-decoration: none; color: var(--text); }
.quiz-link a:hover { text-decoration: underline; }

/* ---------- Badges ---------- */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.badge-admin { background: rgba(229, 9, 20, 0.18); color: #ff6b6b; }
.badge-aluno { background: rgba(84, 179, 255, 0.18); color: #7cc4ff; }
.badge-ativo { background: rgba(46, 204, 113, 0.18); color: #5fe892; }
.badge-inativo { background: rgba(255, 255, 255, 0.08); color: var(--muted); }

/* ---------- Vídeo responsivo ---------- */
.video-frame {
    position: relative;
    width: 100%;
    padding-top: 56.25%;
    border-radius: 6px;
    overflow: hidden;
    background: #000;
}
.video-frame iframe {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    border: 0;
}

/* ---------- Opções de quiz ---------- */
.quiz-option {
    display: block;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 8px;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease;
}
.quiz-option:hover { border-color: var(--accent); background: var(--bg-raised); }
.quiz-option input { margin-right: 10px; }

/* ---------- Certificado ---------- */
.certificate {
    border: 4px solid var(--accent);
    background: var(--bg-card);
    padding: 48px;
    text-align: center;
    max-width: 700px;
    margin: 24px auto;
    border-radius: 8px;
}
.certificate h1 { margin: 16px 0; color: var(--text); }
.certificate .codigo { color: var(--muted); font-size: 0.8rem; margin-top: 32px; }

@media print {
    .sidebar, .btn { display: none !important; }
    body { background: #fff; color: #000; }
    .certificate { border-color: #000; background: #fff; }
}

@media (max-width: 768px) {
    .layout { flex-direction: column; }
    .sidebar { width: 100%; flex-direction: row; align-items: center; padding: 12px 16px; }
    .sidebar ul { display: flex; flex: 1; }
    .sidebar .brand { margin: 0 16px 0 0; }
    .nav-footer { flex-direction: row; border-top: none; padding-top: 0; }
    .content { padding: 20px; }
}
