@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  --bg: #f5f5f7;
  --surface: #ffffff;
  --surface-hover: #f0eef5;
  --border: #e5e3ee;
  --text: #1a1a2e;
  --text-muted: #6b6988;
  --accent: #7c3aed;
  --accent-light: #7c3aed;
  --accent-dark: #6d28d9;
  --success: #22c55e;
  --success-bg: rgba(34, 197, 94, 0.08);
  --warning: #f59e0b;
  --warning-bg: rgba(245, 158, 11, 0.06);
  --danger: #ef4444;
  --danger-bg: rgba(239, 68, 68, 0.06);
  --info: #3b82f6;
  --info-bg: rgba(59, 130, 246, 0.06);
  --code-bg: #1e1e2e;
  --code-text: #e8e6f0;
  --gradient-1: linear-gradient(135deg, #7c3aed 0%, #a78bfa 50%, #c084fc 100%);
  --gradient-2: linear-gradient(135deg, #faf9fe 0%, #f3f0ff 100%);
  --radius: 16px;
  --radius-sm: 10px;
  --radius-xs: 6px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  min-height: 100vh;
}

/* ─── SIDEBAR ─── */
.layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 28px 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.sidebar-header {
  padding: 0 24px 24px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-brand-icon {
  width: 40px;
  height: 40px;
  background: var(--gradient-1);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
  color: white;
}

.sidebar-brand h2 {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.sidebar-brand span {
  font-size: 12px;
  color: var(--text-muted);
  display: block;
  margin-top: 2px;
}

.sidebar-section {
  padding: 0 16px;
  margin-bottom: 8px;
}

.sidebar-section-title {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  padding: 8px 8px 6px;
}

.sidebar-pilar-title {
  font-size: 10px;
  margin-top: 10px;
  color: var(--accent);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 8px 8px 6px;
}

.sidebar-modulo-title {
  font-size: 9.5px;
  opacity: 0.7;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  padding: 4px 8px 6px;
}

/* ─── MÓDULO PROGRESS RING ─── */
.mprog {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px 12px;
  margin-top: 2px;
}

.mprog-ring-wrap {
  position: relative;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
}

.mprog-svg {
  transform: rotate(-90deg);
  width: 44px;
  height: 44px;
}

.mprog-track {
  fill: none;
  stroke: rgba(107, 105, 136, 0.15);
  stroke-width: 4;
}

.mprog-fill {
  fill: none;
  stroke: var(--accent);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-dasharray: 113.097;
  stroke-dashoffset: 113.097;
  transition: stroke-dashoffset 0.7s cubic-bezier(0.4, 0, 0.2, 1), stroke 0.4s;
}

.mprog-fill.complete {
  stroke: var(--success);
}

.mprog-pct {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  font-family: 'DM Sans', sans-serif;
  pointer-events: none;
}

.mprog-info {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.mprog-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  opacity: 0.8;
}

.mprog-label {
  font-size: 10px;
  color: var(--text-muted);
  opacity: 0.6;
}

/* ─── SIDEBAR ITEMS ─── */
.sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-xs);
  cursor: pointer;
  font-size: 13.5px;
  color: var(--text-muted);
  transition: all 0.15s;
  text-decoration: none;
}

.sidebar-nav-main {
  font-size: 14.5px;
  font-weight: 500;
  color: var(--text);
  padding: 10px 12px;
  gap: 10px;
}

.sidebar-nav-main .nav-icon {
  font-size: 16px;
  width: 20px;
  text-align: center;
}

.sidebar-item:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.sidebar-item.active {
  background: rgba(167, 139, 250, 0.1);
  color: var(--accent-light);
}

.sidebar-item.completed .item-check {
  color: var(--success);
}

.item-check {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 10px;
}

.item-check.done {
  border-color: var(--success);
  background: var(--success);
  color: white;
}

.sidebar-progress {
  margin-top: auto;
  padding: 20px 24px;
  border-top: 1px solid var(--border);
}

.progress-bar-bg {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 8px;
}

.progress-bar-fill {
  height: 100%;
  background: var(--gradient-1);
  border-radius: 3px;
  transition: width 0.6s ease;
}

.progress-text {
  font-size: 12px;
  color: var(--text-muted);
}

/* ─── MAIN CONTENT ─── */
.main {
  padding: 40px 56px 80px;
  max-width: 900px;
}

/* Breadcrumb */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 24px;
}

.breadcrumb a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.15s;
}

.breadcrumb a:hover { color: var(--accent-light); }
.breadcrumb .sep { opacity: 0.4; }

/* Lesson Header */
.lesson-header {
  margin-bottom: 36px;
}

.lesson-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(167, 139, 250, 0.12);
  color: var(--accent-light);
  font-size: 12px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 20px;
  margin-bottom: 14px;
  letter-spacing: 0.02em;
}

.lesson-badge.conceitual {
  background: rgba(59, 130, 246, 0.1);
  color: var(--info);
}

.lesson-header h1 {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.2;
  margin-bottom: 10px;
}

.lesson-meta {
  display: flex;
  align-items: center;
  gap: 20px;
  font-size: 13px;
  color: var(--text-muted);
}

.lesson-meta-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ─── VIDEO PLAYER ─── */
.video-container {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 36px;
  aspect-ratio: 16/9;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  cursor: pointer;
}

.video-placeholder {
  text-align: center;
}

.play-button {
  width: 72px;
  height: 72px;
  background: var(--gradient-1);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 8px 32px rgba(124, 58, 237, 0.3);
}

.video-container:hover .play-button {
  transform: scale(1.08);
  box-shadow: 0 12px 40px rgba(124, 58, 237, 0.45);
}

.play-button svg {
  width: 28px;
  height: 28px;
  fill: white;
  margin-left: 3px;
}

.video-placeholder p {
  color: var(--text-muted);
  font-size: 14px;
}

.video-duration {
  position: absolute;
  bottom: 16px;
  right: 16px;
  background: rgba(0,0,0,0.7);
  padding: 4px 10px;
  border-radius: var(--radius-xs);
  font-size: 12px;
  font-weight: 500;
  color: white;
}

/* ─── AUDIO PLAYER ─── */
.audio-section {
  background: var(--gradient-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 28px;
  margin-bottom: 36px;
  display: flex;
  align-items: center;
  gap: 20px;
}

.audio-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--gradient-1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.audio-info {
  flex: 1;
}

.audio-info h4 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 4px;
}

.audio-info p {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.audio-player {
  display: flex;
  align-items: center;
  gap: 12px;
}

.audio-play-btn {
  width: 36px;
  height: 36px;
  background: var(--accent-dark);
  border: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s;
}

.audio-play-btn:hover { background: var(--accent); }

.audio-play-btn svg {
  width: 14px;
  height: 14px;
  fill: white;
  margin-left: 2px;
}

.audio-wave {
  flex: 1;
  height: 32px;
  display: flex;
  align-items: center;
  gap: 2px;
}

.audio-wave-bar {
  width: 3px;
  background: var(--accent);
  border-radius: 2px;
  opacity: 0.3;
  transition: opacity 0.2s;
}

.audio-wave-bar.played { opacity: 1; }

.audio-time {
  font-size: 12px;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
  min-width: 40px;
}

/* ─── STEP BY STEP ─── */
.steps-section {
  margin-bottom: 40px;
}

.section-title {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-title-icon {
  width: 28px;
  height: 28px;
  background: rgba(167, 139, 250, 0.15);
  border-radius: var(--radius-xs);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

.step {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  margin-bottom: 16px;
  position: relative;
  transition: border-color 0.2s;
}

.step:hover {
  border-color: rgba(167, 139, 250, 0.3);
}

.step-number {
  position: absolute;
  top: -1px;
  left: 24px;
  background: var(--gradient-1);
  color: white;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 14px;
  border-radius: 0 0 var(--radius-xs) var(--radius-xs);
}

.step h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 12px;
  margin-top: 8px;
}

.step p {
  color: var(--text-muted);
  font-size: 14.5px;
  margin-bottom: 16px;
  line-height: 1.7;
}

.step ul, .step ol {
  color: var(--text-muted);
  font-size: 14.5px;
  margin-bottom: 16px;
  padding-left: 20px;
  line-height: 1.8;
}

/* Concept block for conceptual lessons */
.concept-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  margin-bottom: 16px;
}

.concept-block h3 {
  font-size: 17px;
  font-weight: 600;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.concept-block p {
  color: var(--text-muted);
  font-size: 14.5px;
  margin-bottom: 12px;
  line-height: 1.8;
}

.concept-block p:last-child { margin-bottom: 0; }

/* Metaphor callout */
.metaphor {
  background: var(--gradient-2);
  border: 1px solid rgba(167, 139, 250, 0.2);
  border-radius: var(--radius-sm);
  padding: 20px 24px;
  margin: 16px 0;
  font-size: 14.5px;
  color: var(--accent-dark);
  font-style: italic;
  line-height: 1.7;
}

.metaphor strong { font-style: normal; }

/* Code block */
.code-block {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-bottom: 16px;
}

.code-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: rgba(255,255,255,0.05);
  border-bottom: 1px solid rgba(255,255,255,0.1);
  font-size: 12px;
  color: #a0a0b8;
}

.code-copy-btn {
  background: none;
  border: 1px solid rgba(255,255,255,0.15);
  color: #a0a0b8;
  font-size: 11px;
  padding: 4px 10px;
  border-radius: var(--radius-xs);
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  transition: all 0.15s;
}

.code-copy-btn:hover {
  border-color: var(--accent);
  color: #c4b5fd;
}

.code-body {
  padding: 16px 20px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13.5px;
  line-height: 1.8;
  overflow-x: auto;
  color: #c4b5fd;
}

.code-body .comment { color: #6b7280; }
.code-body .prompt { color: #34d399; }

/* Screenshot placeholder */
.screenshot {
  background: #f0eef5;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 40px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  margin-bottom: 16px;
}

.screenshot-icon {
  font-size: 28px;
  margin-bottom: 8px;
  opacity: 0.5;
}

/* Result box */
.result-box {
  border-radius: var(--radius-sm);
  padding: 16px 20px;
  font-size: 13.5px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 16px;
}

.result-box:last-child { margin-bottom: 0; }

.result-box.success {
  background: var(--success-bg);
  border: 1px solid rgba(52, 211, 153, 0.2);
  color: var(--success);
}

.result-box.warning {
  background: var(--warning-bg);
  border: 1px solid rgba(251, 191, 36, 0.2);
  color: var(--warning);
}

.result-box.info {
  background: var(--info-bg);
  border: 1px solid rgba(59, 130, 246, 0.2);
  color: var(--info);
}

.result-box.danger {
  background: var(--danger-bg);
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: var(--danger);
}

.result-box-icon { font-size: 16px; flex-shrink: 0; margin-top: 1px; }

/* ─── CHECKLIST ─── */
.checklist-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  margin-bottom: 36px;
}

.checklist-section h3 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.checklist-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14.5px;
  cursor: pointer;
  user-select: none;
}

.checklist-item:last-child { border-bottom: none; }

.checklist-checkbox {
  width: 22px;
  height: 22px;
  border: 2px solid var(--border);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s;
}

.checklist-item.checked .checklist-checkbox {
  background: var(--success);
  border-color: var(--success);
}

.checklist-item.checked .checklist-checkbox::after {
  content: '\2713';
  color: white;
  font-size: 13px;
  font-weight: 700;
}

.checklist-item.checked span {
  text-decoration: line-through;
  color: var(--text-muted);
}

/* ─── NAVIGATION ─── */
.lesson-nav {
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.nav-btn {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  color: var(--text);
}

.nav-btn:hover {
  border-color: var(--accent);
  background: var(--surface-hover);
}

.nav-btn.next {
  justify-content: flex-end;
  text-align: right;
  background: rgba(167, 139, 250, 0.06);
  border-color: rgba(167, 139, 250, 0.2);
}

.nav-btn.next:hover {
  background: rgba(167, 139, 250, 0.12);
  border-color: var(--accent);
}

.nav-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.nav-title {
  font-size: 14px;
  font-weight: 600;
  margin-top: 2px;
}

.nav-arrow {
  font-size: 20px;
  color: var(--accent);
}

/* ─── TROUBLESHOOT ─── */
.troubleshoot {
  background: var(--warning-bg);
  border: 1px solid rgba(251, 191, 36, 0.15);
  border-radius: var(--radius);
  padding: 24px 28px;
  margin-bottom: 36px;
}

.troubleshoot summary {
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--warning);
  list-style: none;
}

.troubleshoot summary::-webkit-details-marker { display: none; }

.troubleshoot[open] .troubleshoot-content {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid rgba(251, 191, 36, 0.12);
}

.troubleshoot p {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.troubleshoot p:last-child { margin-bottom: 0; }

/* ─── MOBILE HEADER ─── */
.mobile-header {
  display: none;
}

/* ─── SIDEBAR OVERLAY ─── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 998;
}

/* ─── RESPONSIVE ─── */
@media (max-width: 900px) {
  .mobile-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 14px 20px;
    gap: 12px;
  }

  .mobile-header-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--text);
  }

  .mobile-header-icon {
    width: 32px;
    height: 32px;
    background: var(--gradient-1);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
  }

  .mobile-header-title {
    font-size: 13px;
    font-weight: 600;
    line-height: 1.3;
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mobile-hamburger {
    background: none;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 10px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex-shrink: 0;
  }

  .mobile-hamburger span {
    display: block;
    width: 20px;
    height: 2px;
    background: var(--text);
    border-radius: 2px;
    transition: all 0.2s;
  }

  .layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: -300px;
    width: 280px;
    height: 100vh;
    z-index: 999;
    transition: left 0.25s ease;
    box-shadow: none;
  }

  .sidebar.open {
    left: 0;
    box-shadow: 4px 0 32px rgba(0,0,0,0.15);
  }

  .sidebar-overlay.visible {
    display: block;
  }

  .main {
    padding: 24px 20px 80px;
  }

  .lesson-header h1 {
    font-size: 24px;
  }

  .lesson-header {
    margin-bottom: 24px;
  }

  /* Audio player empilhado no mobile */
  .audio-section {
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
    padding: 20px;
  }

  .audio-info {
    width: 100%;
  }

  .audio-player {
    width: 100%;
  }

  .audio-player audio {
    width: 100%;
  }

  /* Nav buttons full-width e destacados */
  .lesson-nav {
    flex-direction: column;
    gap: 12px;
    margin-top: 32px;
  }

  .nav-btn {
    padding: 18px 20px;
    font-size: 15px;
    justify-content: space-between !important;
    text-align: left !important;
  }

  .nav-btn.next {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
  }

  .nav-btn.next .nav-label,
  .nav-btn.next .nav-title {
    color: white;
  }

  .nav-btn.next .nav-arrow {
    color: white;
    font-size: 22px;
  }

  .nav-btn.prev {
    background: var(--surface);
  }

  .nav-title {
    font-size: 15px;
  }

  /* Steps mais legíveis */
  .step {
    padding: 24px 20px;
  }

  /* Vídeo responsivo */
  .video-container {
    border-radius: 10px;
  }

  /* Code blocks */
  .code-block {
    border-radius: 10px;
  }
}

/* ─── ANIMATIONS ─── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

.main > * {
  animation: fadeUp 0.5s ease forwards;
  opacity: 0;
}

.main > *:nth-child(1) { animation-delay: 0.05s; }
.main > *:nth-child(2) { animation-delay: 0.1s; }
.main > *:nth-child(3) { animation-delay: 0.15s; }
.main > *:nth-child(4) { animation-delay: 0.2s; }
.main > *:nth-child(5) { animation-delay: 0.25s; }
.main > *:nth-child(6) { animation-delay: 0.3s; }
.main > *:nth-child(7) { animation-delay: 0.35s; }
.main > *:nth-child(8) { animation-delay: 0.4s; }
.main > *:nth-child(9) { animation-delay: 0.45s; }
