/* andreroriz.com — Design System Global */

@import url('https://fonts.googleapis.com/css2?family=Sora:wght@300;400;600;700;800&family=DM+Sans:wght@300;400;500;700&family=DM+Mono:wght@400;500&display=swap');

:root {
  --azul: #0d9488;
  --azul-escuro: #0f766e;
  --verde: #2DD4BF;
  --roxo: #C9A227;
  --laranja: #f59e0b;
  --vermelho: #dc2626;
  --cinza-escuro: #111827;
  --cinza-medio: #374151;
  --cinza-claro: #f3f6fd;
  --borda: #e2e8f0;
  --radius: 10px;
  --radius-lg: 16px;
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.14);
  --font-title: 'Sora', sans-serif;
  --font-body: 'DM Sans', sans-serif;
  --font-mono: 'DM Mono', monospace;
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--cinza-escuro);
  background: #fff;
  line-height: 1.6;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-title);
  line-height: 1.25;
}

a { color: var(--azul); text-decoration: none; }
a:hover { color: var(--azul-escuro); }

.btn-primary {
  background: var(--azul);
  border-color: var(--azul);
}
.btn-primary:hover {
  background: var(--azul-escuro);
  border-color: var(--azul-escuro);
}
.btn-success {
  background: var(--verde);
  border-color: var(--verde);
}

.badge-basico        { background: #dcfce7; color: #059669; }
.badge-intermediario { background: #dbeafe; color: #2563eb; }
.badge-avancado      { background: #faf5ff; color: #7c3aed; }
.badge-expert        { background: #fff7ed; color: #ea580c; }

.nivel-badge {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
}

.course-card {
  border: 1px solid var(--borda);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform 0.2s, box-shadow 0.2s;
  height: 100%;
  display: flex;
  flex-direction: column;
}
.course-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}
.course-card .cover {
  aspect-ratio: 16/9;
  background: linear-gradient(135deg, var(--azul-escuro), var(--azul));
  object-fit: cover;
  width: 100%;
}
.course-card .body { padding: 1rem; flex: 1; }

.stars { color: #f59e0b; }

.hero-section {
  background: linear-gradient(135deg, var(--azul-escuro) 0%, #1a3a8a 50%, var(--azul) 100%);
  color: #fff;
  padding: 4rem 0;
}

.site-footer {
  background: var(--cinza-escuro);
  color: #d1d5db;
  padding: 3rem 0 1.5rem;
}

[data-theme="dark"] {
  --cinza-escuro: #f3f4f6;
  --cinza-claro: #111827;
}
[data-theme="dark"] body {
  background: #0b1220;
  color: #e5e7eb;
}

code, pre {
  font-family: var(--font-mono);
}

/* Área do aluno */
.aluno-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 1.5rem;
  padding: 2rem 0;
  min-height: calc(100vh - 120px);
}
.aluno-sidebar {
  background: var(--cinza-claro);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  height: fit-content;
  position: sticky;
  top: 1rem;
}
.aluno-sidebar .nav-link {
  color: var(--cinza-medio);
  border-radius: var(--radius);
  padding: 0.5rem 0.75rem;
  font-weight: 500;
}
.aluno-sidebar .nav-link:hover,
.aluno-sidebar .nav-link.active {
  background: #fff;
  color: var(--azul);
  box-shadow: var(--shadow);
}
.stat-card {
  background: #fff;
  border: 1px solid var(--borda);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow);
}
.stat-card .stat-value {
  font-size: 2rem;
  font-weight: 800;
  font-family: var(--font-title);
  color: var(--azul-escuro);
}
.progress-course {
  height: 8px;
  border-radius: 999px;
  background: var(--borda);
}
.progress-course .bar {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--azul), var(--verde));
  transition: width 0.3s;
}

/* Player de curso — 3 colunas */
.course-player {
  display: grid;
  grid-template-columns: 260px 1fr 280px;
  gap: 0;
  min-height: calc(100vh - 72px);
  background: #fff;
}
.course-player .player-sidebar {
  border-right: 1px solid var(--borda);
  overflow-y: auto;
  max-height: calc(100vh - 72px);
  background: var(--cinza-claro);
}
.course-player .player-main {
  overflow-y: auto;
  max-height: calc(100vh - 72px);
  padding: 1.5rem;
}

/* Vídeo fixo no topo enquanto o texto rola (todos os cursos) */
.lesson-video-sticky {
  position: sticky;
  top: 0;
  z-index: 15;
  background: #fff;
  padding-bottom: 0.5rem;
  margin-bottom: 0.5rem;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
}
.lesson-video-shell {
  display: flex;
  flex-direction: column;
  width: 100%;
  /* altura total (vídeo + barra) — fallback antes do JS */
  height: clamp(170px, 26vh, 360px);
}
.course-player .lesson-video-shell {
  height: clamp(150px, 18vh, 240px);
}
.lesson-video-viewport {
  flex: 1 1 auto;
  min-height: 120px;
  overflow: hidden;
  background: #000;
}
.lesson-video-viewport video,
.lesson-video-viewport iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  object-fit: contain;
  background: #000;
}
.lesson-video-resize-bar {
  flex: 0 0 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  cursor: ns-resize;
  touch-action: none;
  user-select: none;
  background: linear-gradient(180deg, #f8fafc 0%, #eef2f7 100%);
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-top: none;
  border-radius: 0 0 12px 12px;
}
.lesson-video-resize-grip {
  width: 44px;
  height: 4px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.28);
  transition: background 0.15s, width 0.15s;
}
.lesson-video-resize-label {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: rgba(15, 23, 42, 0.45);
  transition: color 0.15s;
}
.lesson-video-shell:hover .lesson-video-resize-grip,
.lesson-video-shell.is-resizing .lesson-video-resize-grip {
  background: var(--azul);
  width: 56px;
}
.lesson-video-shell:hover .lesson-video-resize-label,
.lesson-video-shell.is-resizing .lesson-video-resize-label {
  color: var(--azul);
}
.lesson-video-resize-bar:focus-visible {
  outline: 2px solid var(--azul);
  outline-offset: -2px;
}
.lesson-video-frame {
  display: block;
  background: #000;
}
.lesson-body {
  position: relative;
  z-index: 1;
}
.lesson-page .lesson-video-sticky {
  top: 64px;
  z-index: 1020;
  margin-bottom: 1rem;
}
.course-player .player-notes {
  border-left: 1px solid var(--borda);
  overflow-y: auto;
  max-height: calc(100vh - 72px);
  padding: 1rem;
  background: #fafbfc;
}
.chapter-list .chapter-item {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.65rem 1rem;
  border-bottom: 1px solid var(--borda);
  color: inherit;
  font-size: 0.88rem;
  text-decoration: none;
  line-height: 1.35;
}
.chapter-list .chapter-item:hover { background: #fff; }
.chapter-list .chapter-item.active {
  background: #fff;
  border-left: 3px solid var(--azul);
  font-weight: 600;
}
.chapter-list .chapter-item__status {
  flex: 0 0 1rem;
  width: 1rem;
  height: 1rem;
  margin-top: 0.15rem;
  border-radius: 50%;
  border: 2px solid #cbd5e1;
  background: #fff;
}
.chapter-list .chapter-item.in-progress .chapter-item__status {
  border-color: var(--azul);
  background: linear-gradient(90deg, var(--azul) 50%, #fff 50%);
}
.chapter-list .chapter-item.done .chapter-item__status {
  border-color: var(--verde);
  background: var(--verde);
  position: relative;
}
.chapter-list .chapter-item.done .chapter-item__status::after {
  content: '';
  position: absolute;
  left: 0.2rem;
  top: 0.05rem;
  width: 0.28rem;
  height: 0.5rem;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.chapter-list .chapter-item__title {
  flex: 1 1 auto;
  min-width: 0;
}
.chapter-list .chapter-item__badge {
  flex: 0 0 auto;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  background: #e8edf5;
  color: #475569;
  white-space: nowrap;
}
.chapter-list .chapter-item__badge--done {
  background: rgba(16, 185, 129, 0.15);
  color: #059669;
}
.player-progress { margin-top: 0.25rem; }
.player-progress__meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}
.player-progress__label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #64748b;
  font-weight: 700;
}
.player-progress__pct {
  font-size: 0.85rem;
  color: var(--azul);
}
.player-progress__track {
  height: 8px;
  border-radius: 999px;
  background: #e2e8f0;
  overflow: hidden;
  margin-bottom: 0.35rem;
}
.player-progress__bar {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #1a4fd6, #34d399);
  transition: width 0.35s ease;
}
.player-progress__stats { font-size: 0.78rem; }
.lesson-progress-hint { min-height: 1.25rem; }
.chat-messages {
  max-height: 400px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.chat-bubble {
  max-width: 85%;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-lg);
  font-size: 0.95rem;
}
.chat-bubble.aluno { align-self: flex-end; background: var(--azul); color: #fff; }
.chat-bubble.ia,
.chat-bubble.admin { align-self: flex-start; background: var(--cinza-claro); }

@media (max-width: 992px) {
  .aluno-layout { grid-template-columns: 1fr; }
  .aluno-sidebar { position: static; }
  .course-player { grid-template-columns: 1fr; }
  .course-player .player-sidebar,
  .course-player .player-notes { max-height: none; }
  .course-player .player-main {
    overflow-y: visible;
    max-height: none;
  }
  .course-player .lesson-video-sticky {
    top: 64px;
  }
  .lesson-video-shell {
    height: clamp(140px, 20vh, 200px);
  }
  .course-player .lesson-video-shell {
    height: clamp(130px, 16vh, 180px);
  }
}
