/* --- LISTA DE VÍDEOS (GRID) --- */
.video-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
}

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

.video-card-link {
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.video-card-link:hover .video-card {
  transform: translateY(-5px);
  background-color: var(--bg-hover);
  border-color: var(--accent-color);
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

.video-card-link:focus-visible {
  outline: 4px solid var(--focus-color);
  outline-offset: 4px;
  border-radius: 8px;
}

/* --- Thumbnail --- */
.video-thumbnail-wrapper {
  position: relative;
  width: 100%;
  padding-top: 56.25%;
  background-color: #000;
  overflow: hidden;
}

.video-thumbnail-wrapper img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.video-card-link:hover img {
  transform: scale(1.05);
}

.play-icon-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 60px;
  height: 60px;
  background: rgba(130, 87, 229, 0.75);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid rgba(255, 255, 255, 0.5);
  opacity: 0.8;
  transition: opacity 0.2s;
}

.video-card-link:hover .play-icon-overlay {
  opacity: 1;
  background: var(--accent-color);
  border-color: var(--accent-color);
}

/* --- Badge: número da aula sobre a thumbnail --- */
.lesson-number-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  background: rgba(0, 0, 0, 0.72);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  z-index: 1;
}

/* --- Informações do card --- */
.video-info {
  padding: 20px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.video-info h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 10px;
  color: var(--text-main);
  line-height: 1.4;
}

.video-info p {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin: 0 0 12px;
  line-height: 1.6;
  flex: 1;
}

/* --- Badge: status da transcrição --- */
.transcript-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 4px;
  margin-top: auto;
  width: fit-content;
}

.transcript-status--available {
  background: rgba(130, 87, 229, 0.12);
  color: var(--accent-color);
}

.transcript-status--pending {
  background: rgba(168, 168, 179, 0.08);
  color: var(--text-muted);
}

/* --- Breadcrumb / voltar (página do curso) --- */
.course-breadcrumb {
  margin-bottom: 24px;
}

.course-breadcrumb a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: color 0.2s;
}

.course-breadcrumb a:hover {
  color: var(--accent-color);
}

/* --- Header da página de curso --- */
.course-header {
  margin-bottom: 40px;
}

.course-page-title {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 12px;
  line-height: 1.3;
}

.course-description {
  font-size: 1rem;
  color: var(--text-muted);
  max-width: 640px;
  margin: 0 0 16px;
  line-height: 1.6;
}

.course-lesson-count {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  color: #c4b5fd;
  background: rgba(130, 87, 229, 0.15);
  padding: 6px 14px;
  border-radius: 20px;
}

/* --- Heading "Aulas do curso" --- */
.video-list-heading {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
  margin: 0 0 20px;
  padding-top: 24px;
  border-top: 1px solid var(--border-color);
}

/* =============================================
   PÁGINA DE AULA
   ============================================= */

/* ── Breadcrumb: linha horizontal sutil ── */
.lesson-breadcrumb {
  margin-bottom: 24px;
}

.lesson-breadcrumb ol {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  font-size: 0.78rem;
  line-height: 1;
}

.lesson-breadcrumb li {
  display: flex;
  align-items: center;
  color: var(--text-muted);
}

.lesson-breadcrumb li:not(:last-child) .breadcrumb-separator {
  margin: 0 8px;
  color: #555;
  font-size: 1em;
}

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

.lesson-breadcrumb a:hover {
  color: #66b2ff;
}

.lesson-breadcrumb li[aria-current="page"] {
  color: var(--text-main);
}

@media (max-width: 575px) {
  .lesson-breadcrumb li:nth-child(2) a {
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: inline-block;
    vertical-align: middle;
  }
}

/* ── Layout 2 colunas (desktop) ── */
.lesson-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 28px;
}

@media (min-width: 992px) {
  .lesson-layout {
    grid-template-columns: 1fr 300px;
    gap: 36px;
    align-items: start;
  }
}

/* ── Coluna principal ── */
.lesson-primary {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* ── Vídeo ── */
.lesson-video-card {
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border-color);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  background: #000;
}

/* ── Info: título + badge + descrição ── */
.lesson-info {
  padding: 0 2px;
}

.lesson-info-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}

.lesson-page-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: #fff;
  margin: 0;
  line-height: 1.35;
  letter-spacing: -0.02em;
}

.lesson-progress-badge {
  flex-shrink: 0;
  font-size: 0.7rem;
  font-weight: 700;
  color: #c4b5fd;
  background: rgba(130, 87, 229, 0.12);
  padding: 4px 12px;
  border-radius: 20px;
  white-space: nowrap;
  margin-top: 4px;
}

.lesson-page-desc {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin: 0;
  line-height: 1.65;
}

/* ── Navegação prev / next ── */
.lesson-nav {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Base dos botões */
.btn-lesson-nav {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  font-size: 0.82rem;
  font-weight: 600;
  border-radius: 10px;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.2s, border-color 0.2s, box-shadow 0.2s;
  white-space: nowrap;
}

.btn-lesson-nav:focus-visible {
  outline: 3px solid var(--focus-color);
  outline-offset: 2px;
}

.transcript-summary:focus-visible,
.lesson-sidebar-item:focus-visible {
  outline: 3px solid var(--focus-color);
  outline-offset: 2px;
  border-radius: 4px;
}

.btn-lesson-nav i {
  font-size: 0.85rem;
}

/* Anterior — outlined */
.btn-lesson-nav--prev {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-main);
}

.btn-lesson-nav--prev:hover {
  border-color: #66b2ff;
  color: #66b2ff;
}

/* Próxima — filled, contraste reforçado (8.5:1 normal, 10:1 hover) */
.btn-lesson-nav--next {
  background: #5b32a8;
  border: 1px solid #5b32a8;
  color: #fff;
}

.btn-lesson-nav--next:hover {
  background: #4f2b94;
  border-color: #4f2b94;
  color: #fff;
  box-shadow: 0 4px 14px rgba(91, 50, 168, 0.45);
}

/* Disabled */
.btn-lesson-nav--disabled {
  opacity: 0.25;
  cursor: not-allowed;
  pointer-events: none;
}

/* ── Transcrição (card) ── */
.lesson-transcript {
  margin: 0;
}

.transcript-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-radius: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  cursor: pointer;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text-main);
  list-style: none;
  user-select: none;
  transition: background-color 0.2s, border-color 0.2s;
}

.transcript-summary-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.transcript-summary-left i {
  color: var(--accent-color);
  font-size: 1rem;
}

.transcript-summary:hover {
  background: var(--bg-hover);
  border-color: rgba(130, 87, 229, 0.25);
}

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

.transcript-chevron {
  font-size: 0.75rem;
  transition: transform 0.2s ease;
  flex-shrink: 0;
  color: var(--text-muted);
}

details[open] .transcript-chevron {
  transform: rotate(180deg);
}

details[open] .transcript-summary {
  border-radius: 12px 12px 0 0;
  border-bottom-color: transparent;
}

.transcript-content {
  padding: 28px 24px;
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.85;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-top: 0;
  border-radius: 0 0 12px 12px;
  margin-top: -1px;
}

.transcript-content > * {
  max-width: 72ch;
}

.transcript-content h3 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
  margin-top: 1.8rem;
  margin-bottom: 0.6rem;
}

.transcript-content h3:first-child {
  margin-top: 0;
}

.transcript-content p {
  margin-bottom: 1rem;
}

.transcript-content ul,
.transcript-content ol {
  padding-left: 1.4rem;
  margin-bottom: 1rem;
}

/* Links na transcrição — azul vibrante acessível */
.transcript-content a {
  color: #66b2ff;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.transcript-content a:hover {
  color: #99ccff;
}

.lesson-transcript-pending {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 20px 24px;
  border-radius: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* ── Sidebar (card) ── */
.lesson-sidebar {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  overflow: hidden;
  height: fit-content;
  scrollbar-width: thin;
  scrollbar-color: var(--border-color) transparent;
}

@media (min-width: 992px) {
  .lesson-sidebar {
    position: sticky;
    top: 24px;
    max-height: calc(100vh - 48px);
    overflow-y: auto;
  }
}

.lesson-sidebar::-webkit-scrollbar {
  width: 6px;
}

.lesson-sidebar::-webkit-scrollbar-track {
  background: transparent;
}

.lesson-sidebar::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 3px;
}

.lesson-sidebar::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

.lesson-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
}

.lesson-sidebar-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-main);
  margin: 0;
}

.lesson-sidebar-count {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-hover);
  padding: 3px 10px;
  border-radius: 20px;
}

.lesson-sidebar-list {
  list-style: none;
  padding: 8px;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.lesson-sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  text-decoration: none;
  color: var(--text-muted);
  font-size: 0.82rem;
  transition: background-color 0.15s, color 0.15s;
  position: relative;
}

.lesson-sidebar-item:hover {
  background: var(--bg-hover);
  color: var(--text-main);
}

/* Item ativo */
.lesson-sidebar-item--active {
  background: rgba(130, 87, 229, 0.1);
  color: #fff;
  font-weight: 600;
}

.lesson-sidebar-item--active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--accent-color);
}

.lesson-sidebar-item--active:hover {
  background: rgba(130, 87, 229, 0.16);
}

.lesson-sidebar-number {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  font-size: 0.7rem;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
}

.lesson-sidebar-item--active .lesson-sidebar-number {
  background: var(--accent-color);
  color: #fff;
  box-shadow: 0 2px 8px rgba(130, 87, 229, 0.35);
}

.lesson-sidebar-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.4;
}

/* Indicador "tocando" animado */
.lesson-sidebar-playing {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 14px;
  flex-shrink: 0;
}

.lesson-sidebar-playing span {
  display: block;
  width: 3px;
  background: var(--accent-color);
  border-radius: 2px;
  animation: playing-bar 0.8s ease-in-out infinite alternate;
}

.lesson-sidebar-playing span:nth-child(1) { height: 6px; animation-delay: 0s; }
.lesson-sidebar-playing span:nth-child(2) { height: 10px; animation-delay: 0.2s; }
.lesson-sidebar-playing span:nth-child(3) { height: 4px; animation-delay: 0.4s; }

@keyframes playing-bar {
  0%   { height: 4px; }
  100% { height: 14px; }
}

/* --- Atalhos de teclado --- */
kbd {
  background-color: #323238;
  color: var(--focus-color);
  border: 1px solid #555;
  border-radius: 4px;
  padding: 2px 6px;
  font-family: 'Consolas', monospace;
  font-size: 0.88em;
}

/* --- Responsividade --- */
@media (max-width: 575px) {
  .video-list {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .course-page-title {
    font-size: 1.5rem;
  }

  .lesson-page-title {
    font-size: 1.2rem;
  }

  .lesson-info-top {
    flex-direction: column;
    gap: 6px;
  }

  .lesson-primary {
    gap: 20px;
  }

  .lesson-nav {
    flex-wrap: wrap;
  }
}

/* Respeitar preferência por movimento reduzido */
@media (prefers-reduced-motion: reduce) {
  .video-card,
  .video-card-link:hover .video-card,
  .video-card-link:hover img,
  .transcript-chevron,
  .btn-lesson-nav,
  .lesson-sidebar-item,
  .lesson-sidebar-number,
  .lesson-sidebar-playing span {
    transition: none !important;
    transform: none !important;
    animation: none !important;
  }
}
