/* ============================================
   Trilha Comercial — Lobocode / IonX
   Custom CSS · Zero dependência externa
   ============================================ */

:root {
  /* Cores base */
  --bg: #f7f8fa;
  --bg-card: #ffffff;
  --bg-sidebar: #1a1f2e;
  --bg-sidebar-hover: #252b3d;
  --bg-sidebar-active: #2f3651;
  --bg-code: #f1f3f5;
  --bg-quote: #fffbeb;

  /* Texto */
  --text: #1a1f2e;
  --text-soft: #4a5266;
  --text-mute: #7a8294;
  --text-sidebar: #c8cdd9;
  --text-sidebar-active: #ffffff;

  /* Acentos por módulo */
  --c1: #2563eb;  /* Semana 1 - azul */
  --c1-bg: #eff6ff;
  --c2: #d97706;  /* Semana 2 - âmbar */
  --c2-bg: #fffbeb;
  --c3: #16a34a;  /* Semana 3 - verde */
  --c3-bg: #f0fdf4;
  --c4: #7c3aed;  /* Semana 4 - roxo */
  --c4-bg: #faf5ff;
  --cex: #ea580c; /* Exercícios - laranja */
  --cex-bg: #fff7ed;

  /* Bordas e sombras */
  --border: #e5e7eb;
  --border-strong: #d1d5db;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.08);

  /* Layout */
  --sidebar-w: 280px;
  --header-h: 64px;
  --content-max: 820px;
  --radius: 10px;

  /* Tipografia */
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
               "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo,
               Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--c1); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ============================================
   HEADER
   ============================================ */

.site-header {
  position: fixed;
  top: 0;
  left: var(--sidebar-w);
  right: 0;
  height: var(--header-h);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  z-index: 100;
  gap: 16px;
}

.site-header .brand {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.site-header .brand strong {
  font-size: 15px;
  color: var(--text);
}

.site-header .brand span {
  font-size: 12px;
  color: var(--text-mute);
}

.progress-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: var(--text-soft);
}

.progress-bar {
  width: 180px;
  height: 8px;
  background: var(--bg);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--c1), var(--c3));
  width: 0%;
  transition: width 0.4s ease;
}

.header-actions {
  display: flex;
  gap: 8px;
}

.btn {
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  color: var(--text);
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  font-family: inherit;
  transition: all 0.15s;
}
.btn:hover { background: var(--bg); border-color: var(--text-mute); }
.btn:focus-visible { outline: 2px solid var(--c1); outline-offset: 2px; }
.btn-primary {
  background: var(--c1);
  color: #fff;
  border-color: var(--c1);
}
.btn-primary:hover { background: #1d4ed8; border-color: #1d4ed8; }
.btn-danger {
  background: transparent;
  color: #dc2626;
  border-color: #fca5a5;
}
.btn-danger:hover { background: #fef2f2; }

/* ============================================
   SIDEBAR
   ============================================ */

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--bg-sidebar);
  color: var(--text-sidebar);
  overflow-y: auto;
  padding: 24px 0 60px;
  z-index: 200;
}

.sidebar-header {
  padding: 0 24px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  margin-bottom: 12px;
}

.sidebar-header h1 {
  margin: 0;
  font-size: 16px;
  color: var(--text-sidebar-active);
  font-weight: 600;
  letter-spacing: -0.01em;
}

.sidebar-header p {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--text-mute);
}

.nav-section {
  margin: 16px 0 4px;
  padding: 0 24px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-mute);
  font-weight: 600;
}

.nav-list {
  list-style: none;
  margin: 0;
  padding: 0 12px;
}

.nav-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 8px;
  border-left: 3px solid transparent;
  transition: background 0.15s, border-color 0.15s;
}

.nav-item:not(.nav-item--trackable) {
  padding-left: 38px;
}

.nav-item:hover {
  background: var(--bg-sidebar-hover);
}

.nav-item:has(a.active) {
  background: var(--bg-sidebar-active);
  border-left-color: var(--c1);
}

.nav-item a {
  flex: 1;
  min-width: 0;
  display: block;
  padding: 0;
  color: var(--text-sidebar);
  font-size: 14px;
  border-left: none;
  background: transparent;
  transition: color 0.15s;
}

.nav-label {
  display: block;
  line-height: 1.4;
}

.nav-item a:hover {
  background: transparent;
  color: var(--text-sidebar-active);
  text-decoration: none;
}

.nav-item:has(a.active) a {
  color: var(--text-sidebar-active);
}

.nav-item a.done {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  color: var(--text-mute);
}

.nav-item a.done .nav-label {
  flex: 1;
}

.nav-item a.done::after {
  content: "✓";
  flex-shrink: 0;
  color: var(--c3);
  font-weight: 700;
  margin-top: 1px;
}

.nav-check {
  appearance: none;
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border: 1.5px solid var(--text-mute);
  border-radius: 4px;
  background: transparent;
  cursor: pointer;
  flex-shrink: 0;
  display: grid;
  place-content: center;
  margin: 2px 0 0;
}
.nav-check:checked {
  background: var(--c3);
  border-color: var(--c3);
}
.nav-check:checked::after {
  content: "✓";
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
}
.nav-check:focus-visible { outline: 2px solid var(--c1); outline-offset: 2px; }

/* ============================================
   MOBILE TOGGLE
   ============================================ */

.mobile-toggle {
  display: none;
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 300;
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  padding: 8px 10px;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
}

@media (max-width: 900px) {
  .mobile-toggle { display: block; }
  .sidebar { transform: translateX(-100%); transition: transform 0.25s; }
  .sidebar.open { transform: translateX(0); }
  .site-header { left: 0; padding-left: 60px; }
  .header-actions { display: none; }
  .progress-wrap { display: none; }
}

/* ============================================
   CONTEÚDO PRINCIPAL
   ============================================ */

main {
  margin-left: var(--sidebar-w);
  padding-top: var(--header-h);
  min-height: 100vh;
}

.content {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 48px 32px 96px;
}

.content h1 {
  font-size: 36px;
  letter-spacing: -0.02em;
  margin: 0 0 8px;
  font-weight: 700;
}

.content h2 {
  font-size: 26px;
  margin: 48px 0 12px;
  letter-spacing: -0.015em;
  font-weight: 700;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.content h2:first-of-type { border-top: none; padding-top: 0; }

.content h3 {
  font-size: 20px;
  margin: 32px 0 8px;
  font-weight: 600;
}

.content p { margin: 0 0 16px; }

.content ul, .content ol { padding-left: 24px; margin: 0 0 16px; }
.content li { margin-bottom: 6px; }

.content strong { color: var(--text); font-weight: 600; }
.content em { color: var(--text-soft); }

.content code {
  background: var(--bg-code);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.92em;
  color: #be185d;
}

.content blockquote {
  border-left: 4px solid var(--c2);
  background: var(--bg-quote);
  padding: 12px 16px;
  margin: 16px 0;
  border-radius: 0 6px 6px 0;
  color: var(--text-soft);
}

.content hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 32px 0;
}

/* ============================================
   BADGES & TAGS
   ============================================ */

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.01em;
  margin-right: 6px;
  vertical-align: middle;
}

.badge-sem1 { background: var(--c1-bg); color: var(--c1); }
.badge-sem2 { background: var(--c2-bg); color: var(--c2); }
.badge-sem3 { background: var(--c3-bg); color: var(--c3); }
.badge-sem4 { background: var(--c4-bg); color: var(--c4); }
.badge-ex { background: var(--cex-bg); color: var(--cex); }
.badge-meta {
  background: var(--bg);
  color: var(--text-mute);
  border: 1px solid var(--border);
  font-weight: 500;
}

.lesson-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 0 24px;
  font-size: 13px;
  color: var(--text-mute);
}

/* ============================================
   CAIXA DE AULA / EXERCÍCIO
   ============================================ */

.lesson-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin: 20px 0;
  box-shadow: var(--shadow-sm);
}

.exercise-card {
  background: var(--cex-bg);
  border: 1px solid #fed7aa;
  border-left: 4px solid var(--cex);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin: 28px 0;
}

/* ============================================
   TABELAS
   ============================================ */

.content table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
  font-size: 15px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.content th, .content td {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.content th {
  background: var(--bg);
  font-weight: 600;
  font-size: 13px;
  color: var(--text-soft);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.content tr:last-child td { border-bottom: none; }
.content tbody tr:nth-child(even) { background: #fafbfc; }

/* ============================================
   PAINEL DE PROGRESSO (dentro da aula)
   ============================================ */

.lesson-progress {
  margin-top: 48px;
  padding-top: 24px;
  border-top: 2px dashed var(--border);
}

.lesson-progress h3 {
  margin: 0 0 16px;
  font-size: 16px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-mute);
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  font-size: 15px;
}

.lesson-check {
  appearance: none;
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  border: 2px solid var(--border-strong);
  border-radius: 6px;
  background: var(--bg-card);
  cursor: pointer;
  display: grid;
  place-content: center;
  flex-shrink: 0;
  margin: 0;
  transition: all 0.15s;
}
.lesson-check:hover { border-color: var(--c3); }
.lesson-check:checked {
  background: var(--c3);
  border-color: var(--c3);
}
.lesson-check:checked::after {
  content: "✓";
  color: #fff;
  font-size: 14px;
  font-weight: 800;
}
.lesson-check:focus-visible { outline: 2px solid var(--c1); outline-offset: 2px; }

.rating-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 12px 0;
  font-size: 14px;
  color: var(--text-soft);
}

.rating-row select,
.notes-row textarea {
  font-family: inherit;
  font-size: 14px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  padding: 6px 10px;
  background: var(--bg-card);
  color: var(--text);
}

.rating-row select:focus-visible,
.notes-row textarea:focus-visible {
  outline: 2px solid var(--c1);
  outline-offset: 1px;
  border-color: var(--c1);
}

.notes-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 12px;
}

.notes-row label {
  font-size: 13px;
  color: var(--text-mute);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
}

.notes-row textarea {
  min-height: 80px;
  resize: vertical;
  width: 100%;
  max-width: 600px;
}

/* ============================================
   NAVEGAÇÃO PREV/NEXT
   ============================================ */

.lesson-nav {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.lesson-nav a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  background: var(--bg-card);
  color: var(--text);
  transition: all 0.15s;
}

.lesson-nav a:hover {
  background: var(--bg);
  border-color: var(--c1);
  color: var(--c1);
  text-decoration: none;
}

.lesson-nav .next { margin-left: auto; }

/* ============================================
   PRINT
   ============================================ */

@media print {
  .sidebar, .site-header, .lesson-progress, .lesson-nav { display: none; }
  main { margin-left: 0; padding-top: 0; }
  .content { max-width: 100%; padding: 24px; }
}
