/* Plataforma de cursos — estilos */
:root {
  --ink: #0F172A;
  --ink-2: #334155;
  --muted: #64748B;
  --line: #E2E8F0;
  --bg: #F8FAFC;
  --card: #FFFFFF;
  --accent: #0E5E6F;
  --accent-dark: #0A4553;
  --accent-soft: #E6F2F4;
  --ok: #15803D;
  --ok-soft: #DCFCE7;
  --warn: #B45309;
  --warn-soft: #FEF3C7;
  --bad: #B91C1C;
  --bad-soft: #FEE2E2;
  --radius: 12px;
  --display: 'Space Grotesk', system-ui, sans-serif;
  --body: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--body); color: var(--ink); background: var(--bg); line-height: 1.55; font-size: 16px; }
img { max-width: 100%; display: block; }
a { color: var(--accent); }
a:hover { color: var(--accent-dark); }
h1, h2, h3 { font-family: var(--display); line-height: 1.2; margin: 0 0 .5em; letter-spacing: -0.01em; }
h1 { font-size: clamp(1.75rem, 3vw, 2.4rem); }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.1rem; }
p { margin: 0 0 1em; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid #7DD3E0; outline-offset: 2px; }

/* Estrutura */
.container { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 20px; }
.topbar { background: var(--ink); color: #F8FAFC; }
.topbar .container { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 64px; flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: #F8FAFC; text-decoration: none; font-family: var(--display); font-weight: 700; font-size: 1.1rem; }
.brand:hover { color: #FFFFFF; }
.brand svg { flex: none; }
.topnav { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.topnav a, .topnav button { color: #CBD5E1; text-decoration: none; padding: 10px 12px; border-radius: 8px; font: inherit; font-size: .95rem; background: none; border: 0; cursor: pointer; min-height: 44px; display: inline-flex; align-items: center; }
.topnav a:hover, .topnav button:hover { color: #FFFFFF; background: rgba(255,255,255,.08); }
.topnav form { margin: 0; }
main { padding: 32px 0 64px; }

.shell { display: flex; flex-wrap: wrap; gap: 28px; align-items: flex-start; }
.sidenav { flex: 1 1 220px; max-width: 260px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; position: sticky; top: 16px; }
.sidenav a { display: flex; align-items: center; gap: 10px; padding: 11px 12px; border-radius: 8px; color: var(--ink-2); text-decoration: none; font-weight: 500; min-height: 44px; }
.sidenav a:hover { background: var(--bg); color: var(--ink); }
.sidenav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent-dark); font-weight: 600; }
.sidenav svg { flex: none; }
.content { flex: 999 1 560px; min-width: 0; }
@media (max-width: 760px) {
  .sidenav { max-width: none; position: static; display: flex; overflow-x: auto; gap: 4px; padding: 6px; }
  .sidenav a { white-space: nowrap; }
}

/* Componentes */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; }
.card + .card { margin-top: 20px; }
.grid > .card, .stack > .card, .grid-3 > .card { margin-top: 0; }
.card-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.card-title h2, .card-title h3 { margin: 0; }
.grid { display: grid; gap: 20px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid-3 { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.stats-wide { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.stack { display: flex; flex-direction: column; gap: 20px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.spread { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.page-head h1 { margin: 0; }
.page-head p { margin: 6px 0 0; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 18px; border-radius: 8px; border: 1px solid transparent; font: inherit; font-weight: 600; font-size: .95rem; text-decoration: none; cursor: pointer; background: var(--accent); color: #FFFFFF; }
.btn:hover { background: var(--accent-dark); color: #FFFFFF; }
.btn-ghost { background: var(--card); color: var(--ink); border-color: #CBD5E1; }
.btn-ghost:hover { background: var(--bg); color: var(--ink); }
.btn-danger { background: var(--card); color: var(--bad); border-color: #FCA5A5; }
.btn-danger:hover { background: var(--bad-soft); color: var(--bad); }
.btn-lg { min-height: 52px; padding: 14px 24px; font-size: 1.05rem; }
.btn-sm { min-height: 36px; padding: 6px 12px; font-size: .875rem; }
.btn-block { width: 100%; }
.inline { display: inline; margin: 0; }

.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: .8rem; font-weight: 600; background: var(--bg); color: var(--ink-2); border: 1px solid var(--line); }
.badge-ok { background: var(--ok-soft); color: #166534; border-color: #BBF7D0; }
.badge-warn { background: var(--warn-soft); color: #92400E; border-color: #FDE68A; }
.badge-bad { background: var(--bad-soft); color: #991B1B; border-color: #FECACA; }
.badge-accent { background: var(--accent-soft); color: var(--accent-dark); border-color: #B9DCE2; }

.progress { height: 8px; background: var(--line); border-radius: 999px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.progress-label { display: flex; justify-content: space-between; font-size: .85rem; color: var(--muted); margin-top: 6px; }

.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.stat strong { display: block; font-family: var(--display); font-size: clamp(1.35rem, 2.2vw, 1.9rem); line-height: 1.15; overflow-wrap: anywhere; }
.stat span { color: var(--muted); font-size: .9rem; }

.alert { padding: 14px 16px; border-radius: 10px; margin-bottom: 16px; border: 1px solid; font-size: .95rem; }
.alert-success { background: var(--ok-soft); border-color: #BBF7D0; color: #14532D; }
.alert-error { background: var(--bad-soft); border-color: #FECACA; color: #7F1D1D; }
.alert-info { background: var(--accent-soft); border-color: #B9DCE2; color: #0A3A44; }

/* Formulários */
.form { display: flex; flex-direction: column; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label, .label { font-weight: 600; font-size: .9rem; }
.field .hint { font-size: .85rem; color: var(--muted); }
input[type=text], input[type=email], input[type=password], input[type=tel], input[type=number], input[type=url], input[type=search], select, textarea {
  width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid #94A3B8; border-radius: 8px; font: inherit; color: var(--ink); background: #FFFFFF;
}
textarea { min-height: 140px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); outline: 2px solid #B9DCE2; outline-offset: 0; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: .92rem; color: var(--ink-2); }
.check input { width: 20px; height: 20px; margin: 2px 0 0; flex: none; accent-color: var(--accent); }
.form-row { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }

/* Tabelas */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); }
table { width: 100%; border-collapse: collapse; font-size: .93rem; }
th, td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: var(--bg); font-weight: 600; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; white-space: nowrap; }

/* Autenticação */
.auth { max-width: 440px; margin: 24px auto; }
.auth .card { padding: 32px; }
.auth h1 { font-size: 1.7rem; }

/* Catálogo e página do curso */
.course-card { display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.course-card .cover { aspect-ratio: 16 / 9; background: linear-gradient(135deg, #0F172A, #0E5E6F); display: flex; align-items: center; justify-content: center; color: #E2E8F0; font-family: var(--display); font-weight: 700; font-size: 1.2rem; padding: 20px; text-align: center; }
.course-card .cover img { width: 100%; height: 100%; object-fit: cover; }
.course-card .body { padding: 20px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.course-card .body h3 { margin: 0; }
.course-card .body .row { margin-top: auto; }
.hero { background: var(--ink); color: #F8FAFC; padding: 48px 0; margin: -32px 0 32px; }
.hero h1 { color: #FFFFFF; }
.hero p { color: #CBD5E1; font-size: 1.1rem; max-width: 720px; }
.price { font-family: var(--display); font-size: 2rem; font-weight: 700; }
.richtext { white-space: pre-line; color: var(--ink-2); }

/* Currículo */
.module { border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); overflow: hidden; }
.module + .module { margin-top: 12px; }
.module > summary { list-style: none; cursor: pointer; padding: 16px 20px; display: flex; justify-content: space-between; gap: 12px; align-items: center; font-weight: 600; }
.module > summary::-webkit-details-marker { display: none; }
.module > summary::after { content: '▾'; color: var(--muted); transition: transform .15s; }
.module[open] > summary::after { transform: rotate(180deg); }
.lesson-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.lesson-list li { border-bottom: 1px solid var(--line); }
.lesson-list li:last-child { border-bottom: 0; }
.lesson-list a, .lesson-list .locked { display: flex; align-items: center; gap: 12px; padding: 12px 20px; text-decoration: none; color: var(--ink-2); min-height: 48px; }
.lesson-list a:hover { background: var(--bg); color: var(--ink); }
.lesson-list a[aria-current="page"] { background: var(--accent-soft); color: var(--accent-dark); font-weight: 600; }
.lesson-list .meta { margin-left: auto; font-size: .82rem; color: var(--muted); white-space: nowrap; }
.dot { width: 22px; height: 22px; border-radius: 50%; border: 2px solid #CBD5E1; flex: none; display: inline-flex; align-items: center; justify-content: center; }
.dot.done { border-color: var(--ok); background: var(--ok); }
.dot.done::after { content: ''; width: 9px; height: 5px; border-left: 2px solid #FFF; border-bottom: 2px solid #FFF; transform: rotate(-45deg) translate(1px, -1px); }

/* Aula */
.lesson-layout { display: flex; gap: 24px; flex-wrap: wrap; align-items: flex-start; }
.lesson-main { flex: 999 1 620px; min-width: 0; }
.lesson-side { flex: 1 1 300px; min-width: 0; max-width: 380px; }
@media (max-width: 960px) { .lesson-side { max-width: none; } }
.player { position: relative; width: 100%; aspect-ratio: 16 / 9; background: #000; border-radius: var(--radius); overflow: hidden; }
.player iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
video.player { display: block; }
.no-video { aspect-ratio: 16 / 9; border-radius: var(--radius); background: var(--card); border: 1px dashed #CBD5E1; display: flex; align-items: center; justify-content: center; color: var(--muted); }
.lesson-nav { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 20px; }

/* Continuar de onde parou */
.resume { background: var(--ink); color: #F8FAFC; border-radius: 16px; padding: 28px; display: flex; gap: 24px; flex-wrap: wrap; align-items: center; justify-content: space-between; }
.resume h2 { color: #FFFFFF; margin: 4px 0 6px; }
.resume .eyebrow { color: #7DD3E0; font-size: .8rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
.resume p { color: #CBD5E1; margin: 0; }
.resume .progress { background: #334155; margin-top: 14px; max-width: 420px; }
.resume .progress > span { background: #7DD3E0; }
.resume .progress-label { max-width: 420px; color: #94A3B8; }
.resume .progress-label strong { color: #F8FAFC; }
.resume .btn { background: #FFFFFF; color: var(--ink); }
.resume .btn:hover { background: #E2E8F0; color: var(--ink); }

/* Linha do tempo */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: flex; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.timeline li:last-child { border-bottom: 0; }
.timeline .when { flex: none; width: 128px; color: var(--muted); font-size: .85rem; }
.timeline .what { flex: 1; min-width: 0; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.chips a { padding: 8px 14px; border-radius: 999px; border: 1px solid #CBD5E1; text-decoration: none; color: var(--ink-2); font-size: .9rem; min-height: 40px; display: inline-flex; align-items: center; background: var(--card); }
.chips a[aria-current="page"] { background: var(--accent); border-color: var(--accent); color: #FFFFFF; }

.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty h3 { color: var(--ink); }

.file-row { display: flex; align-items: center; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.file-row:last-child { border-bottom: 0; }
.file-icon { width: 40px; height: 40px; border-radius: 8px; background: var(--accent-soft); color: var(--accent-dark); display: flex; align-items: center; justify-content: center; font-size: .7rem; font-weight: 700; text-transform: uppercase; flex: none; }
.file-row .info { flex: 1; min-width: 180px; }

footer.site { border-top: 1px solid var(--line); padding: 24px 0; color: var(--muted); font-size: .875rem; background: var(--card); }

/* Admin */
.admin-bar { background: #1E293B; }

/* Certificado (impressão) */
.cert-page { background: #E2E8F0; padding: 32px 16px; min-height: 100vh; }
.cert-actions { max-width: 1000px; margin: 0 auto 16px; display: flex; gap: 12px; justify-content: flex-end; flex-wrap: wrap; }
.cert { max-width: 1000px; aspect-ratio: 1.414 / 1; margin: 0 auto; background: #FFFFFF; border: 14px solid var(--ink); outline: 2px solid var(--accent); outline-offset: -26px; padding: 7% 8%; display: flex; flex-direction: column; justify-content: space-between; text-align: center; }
.cert .eyebrow { letter-spacing: .3em; text-transform: uppercase; color: var(--accent); font-weight: 600; font-size: .85rem; }
.cert h1 { font-size: clamp(1.6rem, 4vw, 3rem); margin: 8px 0 0; }
.cert .name { font-family: var(--display); font-size: clamp(1.4rem, 3.4vw, 2.4rem); font-weight: 700; border-bottom: 2px solid var(--line); display: inline-block; padding: 0 24px 6px; margin: 6px 0 14px; }
.cert .text { font-size: clamp(.95rem, 1.6vw, 1.15rem); color: var(--ink-2); max-width: 720px; margin: 0 auto; }
.cert .foot { display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap; font-size: .85rem; color: var(--muted); text-align: left; }
.cert .sign { border-top: 1px solid var(--ink); padding-top: 6px; min-width: 220px; text-align: center; color: var(--ink); }
@media print {
  @page { size: A4 landscape; margin: 0; }
  .cert-page { background: #FFFFFF; padding: 0; }
  .cert-actions { display: none; }
  .cert { max-width: none; width: 297mm; height: 210mm; aspect-ratio: auto; }
}
