/* ==========================================================================
   FILOSOFLIX — CINEMA STREAMING PLAYER & LESSON EXPERIENCE
   ========================================================================== */

:root {
  --player-bg: #07070a;
  --player-surface: #0f0f14;
  --player-surface-2: #16161f;
  --player-surface-3: #1f1f2b;
  --player-line: rgba(255, 255, 255, 0.08);
  --player-line-strong: rgba(255, 255, 255, 0.16);
  --player-brand: #d92c35;
  --player-brand-glow: rgba(217, 44, 53, 0.45);
  --player-green: #48c889;
  --sidebar-w: 400px;
  --plyr-color-main: #d92c35;
  --plyr-video-background: #000;
  --plyr-range-thumb-background: #fff;
  --plyr-range-thumb-shadow: 0 0 10px rgba(217, 44, 53, 0.8);
  --plyr-video-controls-background: linear-gradient(rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.88));
}

/* BASE PAGE - SCROLL NATURAL DA PÁGINA */
.player-page {
  background: var(--player-bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  color: var(--text);
}

/* TOP CONTEXTUAL BREADCRUMB BAR */
.player-top-nav {
  height: 54px;
  background: rgba(10, 10, 14, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--player-line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 70px;
  z-index: 40;
}

.player-breadcrumb {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.86rem;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.player-breadcrumb a {
  color: #fff;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  transition: color 0.15s ease;
  flex-shrink: 0;
}

.player-breadcrumb a:hover {
  color: var(--brand-2);
}

.player-top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.btn-theater-toggle, .btn-sidebar-toggle {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--player-line);
  color: #ddd;
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 0.80rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-theater-toggle:hover, .btn-sidebar-toggle:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-theater-toggle.active {
  background: var(--brand-soft);
  border-color: var(--brand);
  color: #fff;
}

/* MAIN LAYOUT (2 COLUMNS: VIDEO + PLAYLIST) */
.player-layout {
  display: grid;
  grid-template-columns: 1fr var(--sidebar-w);
  width: 100%;
  position: relative;
  transition: grid-template-columns 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.player-layout.theater-mode {
  grid-template-columns: 1fr 0px;
}

.player-layout.theater-mode .player-sidebar {
  display: none;
}

/* VIDEO STAGE & MAIN CONTENT */
.player-main {
  display: flex;
  flex-direction: column;
  padding: 24px 36px 80px;
  min-width: 0;
  overflow: visible;
  background: transparent;
}

.player-stage-wrap {
  position: relative;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
}

/* AMBIENT BACKLIGHT GLOW */
.player-ambient-glow {
  position: absolute;
  inset: -10px -10px 0px -10px;
  background: radial-gradient(circle at 50% 50%, var(--player-brand-glow) 0%, transparent 65%);
  filter: blur(40px);
  opacity: 0.35;
  z-index: 1;
  pointer-events: none;
  transition: opacity 0.5s ease;
}

/* VIDEO PLAYER WRAPPER */
.player-video-wrapper {
  position: relative;
  z-index: 2;
  width: 100%;
  aspect-ratio: 16/9;
  background: #000;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.09);
}

.player-video-wrapper video,
.player-video-wrapper iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: #000;
}

/* ==========================================================================
   PLYR LUXURY THEME CUSTOMIZATION
   ========================================================================== */
.plyr {
  width: 100% !important;
  height: 100% !important;
  border-radius: 16px;
  font-family: inherit;
}

.plyr--video .plyr__controls {
  padding: 20px 24px 16px;
  background: linear-gradient(to top, rgba(5, 5, 8, 0.95) 0%, rgba(5, 5, 8, 0.6) 60%, transparent 100%);
  gap: 12px;
}

/* PLAY BUTTON CENTRALIZADO PERFEITO SEM DEFORMAÇÃO */
.plyr__control--overlaid {
  position: absolute !important;
  top: 50% !important;
  left: 50% !important;
  transform: translate(-50%, -50%) !important;
  background: rgba(217, 44, 53, 0.92) !important;
  box-shadow: 0 0 35px var(--player-brand-glow), 0 8px 24px rgba(0,0,0,0.5) !important;
  padding: 22px !important;
  border-radius: 50% !important;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), background 0.2s ease !important;
}

.plyr__control--overlaid:hover {
  background: #e50914 !important;
  transform: translate(-50%, -50%) scale(1.08) !important;
}

/* REMOVER CAPA/POSTER QUANDO PAUSADO - PAUSA NO FRAME EXATO */
.plyr__poster,
.plyr--paused.plyr--video .plyr__poster,
.plyr--stopped.plyr--video .plyr__poster,
.plyr--playing.plyr--video .plyr__poster {
  display: none !important;
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
  background: transparent !important;
}

.plyr--video .plyr__progress__buffer {
  color: rgba(255, 255, 255, 0.2) !important;
}

.plyr--full-ui input[type=range] {
  color: var(--player-brand) !important;
}

/* MENUS DE CONFIGURAÇÕES (GERAL, QUALIDADE, VELOCIDADE) */
.plyr__menu__container {
  background: rgba(14, 14, 20, 0.98) !important;
  backdrop-filter: blur(24px) !important;
  border: 1px solid rgba(255, 255, 255, 0.20) !important;
  border-radius: 12px !important;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.85) !important;
  color: #ffffff !important;
  padding: 8px !important;
  min-width: 195px !important;
}

/* ITENS DO MENU PRINCIPAL (Qualidade, Velocidade) */
.plyr__menu__container .plyr__control[role=menuitem] {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  padding: 10px 32px 10px 14px !important;
  color: #f3f3f6 !important;
  font-weight: 600 !important;
  font-size: 0.88rem !important;
  border-radius: 8px !important;
  position: relative !important;
}

.plyr__menu__container .plyr__control[role=menuitem]:hover,
.plyr__menu__container .plyr__control[role=menuitem][aria-expanded=true] {
  background: rgba(255, 255, 255, 0.12) !important;
  color: #ffffff !important;
}

.plyr__menu__container .plyr__control[role=menuitem]::after {
  content: '' !important;
  position: absolute !important;
  right: 12px !important;
  top: 50% !important;
  transform: translateY(-50%) rotate(-45deg) !important;
  width: 6px !important;
  height: 6px !important;
  border-width: 2px 2px 0 0 !important;
  border-style: solid !important;
  border-color: rgba(255, 255, 255, 0.7) !important;
}

.plyr__menu__container .plyr__menu__value {
  margin-left: auto !important;
  margin-right: 6px !important;
  color: #a5a5b5 !important;
  font-weight: 600 !important;
  font-size: 0.84rem !important;
}

/* BOTÃO DE VOLTAR DO SUBMENU (◄ Velocidade / ◄ Qualidade) */
.plyr__menu__container .plyr__control--back {
  padding: 10px 14px 10px 34px !important;
  font-weight: 800 !important;
  font-size: 0.90rem !important;
  text-align: left !important;
  display: flex !important;
  align-items: center !important;
  margin-bottom: 6px !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.14) !important;
  border-radius: 6px !important;
  color: #ffffff !important;
  position: relative !important;
}

.plyr__menu__container .plyr__control--back:hover {
  background: rgba(255, 255, 255, 0.08) !important;
}

.plyr__menu__container .plyr__control--back::after {
  content: '' !important;
  position: absolute !important;
  left: 12px !important;
  top: 50% !important;
  transform: translateY(-50%) rotate(45deg) !important;
  width: 6px !important;
  height: 6px !important;
  border-width: 0 0 2px 2px !important;
  border-style: solid !important;
  border-color: #fff !important;
}

/* ITENS DE ESCOLHA (SUBMENU RADIO: 0.5x, 1x, 1080p, Auto) */
.plyr__menu__container .plyr__control[role=menuitemradio],
.plyr__menu__container [role=menuitemradio] {
  color: #e5e5ea !important;
  font-size: 0.88rem !important;
  font-weight: 600 !important;
  padding: 9px 14px !important;
  border-radius: 8px !important;
  position: relative !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  transition: background 0.12s ease !important;
}

/* REMOVER COMPLETAMENTE QUALQUER BOLINHA/PONTO BRANCO DE RÁDIO */
.plyr__menu__container .plyr__control[role=menuitemradio]::before,
.plyr__menu__container .plyr__control[role=menuitemradio]::after,
.plyr__menu__container [role=menuitemradio]::before,
.plyr__menu__container [role=menuitemradio]::after {
  display: none !important;
  content: none !important;
  opacity: 0 !important;
  visibility: hidden !important;
  width: 0 !important;
  height: 0 !important;
}

.plyr__menu__container .plyr__control[role=menuitemradio]:hover,
.plyr__menu__container [role=menuitemradio]:hover {
  background: rgba(255, 255, 255, 0.10) !important;
  color: #ffffff !important;
}

.plyr__menu__container .plyr__control[role=menuitemradio][aria-checked=true],
.plyr__menu__container [role=menuitemradio][aria-checked=true] {
  background: var(--brand) !important;
  color: #ffffff !important;
  font-weight: 800 !important;
  box-shadow: 0 4px 14px var(--player-brand-glow) !important;
}

.plyr__menu__container .plyr__control[role=menuitemradio][aria-checked=true] .plyr__badge,
.plyr__menu__container [role=menuitemradio][aria-checked=true] .plyr__badge {
  background: rgba(0, 0, 0, 0.35) !important;
  color: #fff !important;
}

.plyr__menu__container .plyr__badge {
  background: rgba(255, 255, 255, 0.18) !important;
  color: #fff !important;
  font-weight: 700 !important;
  border-radius: 4px !important;
  margin-left: auto !important;
}

.plyr__tooltip {
  background: rgba(10, 10, 14, 0.95) !important;
  backdrop-filter: blur(8px);
  border: 1px solid var(--player-line-strong);
  border-radius: 6px !important;
  font-size: 0.76rem !important;
  font-weight: 700 !important;
  padding: 4px 8px !important;
  color: #fff !important;
}

/* CINEMA META OVERLAY BADGES */
.player-badges-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.player-badge-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.74rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 5px 12px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--player-line);
  color: #bbb;
}

.player-badge-pill.brand {
  background: var(--brand-soft);
  border-color: rgba(217, 44, 53, 0.4);
  color: #ff5e67;
}

.player-badge-pill.hd {
  background: rgba(72, 200, 137, 0.12);
  border-color: rgba(72, 200, 137, 0.3);
  color: var(--player-green);
}

/* CONTROLS & ACTION CARD */
.player-header-card {
  background: var(--player-surface);
  border: 1px solid var(--player-line);
  border-radius: 16px;
  padding: 24px 28px;
  margin-top: 20px;
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
  width: 100%;
}

.player-header-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 20px;
}

.player-lesson-title {
  font-size: 1.65rem;
  font-weight: 900;
  line-height: 1.25;
  letter-spacing: -0.03em;
  margin: 0 0 8px;
  color: #fff;
}

.player-course-name {
  font-size: 0.88rem;
  color: var(--brand-2);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 4px;
}

.player-actions-row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.btn-complete-lesson {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: 0.88rem;
  padding: 10px 18px;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  border: none;
}

.btn-complete-lesson.completed {
  background: rgba(72, 200, 137, 0.16);
  border: 1px solid rgba(72, 200, 137, 0.45);
  color: var(--player-green);
}

.btn-complete-lesson.completed:hover {
  background: rgba(72, 200, 137, 0.25);
  transform: translateY(-1px);
}

/* INTERACTIVE TABS */
.player-tabs-nav {
  display: flex;
  gap: 8px;
  margin-top: 24px;
  border-bottom: 1px solid var(--player-line);
  padding-bottom: 12px;
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
  width: 100%;
}

.player-tab-btn {
  background: transparent;
  border: 1px solid transparent;
  color: #8c8884;
  font-size: 0.90rem;
  font-weight: 700;
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.15s ease;
}

.player-tab-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.04);
}

.player-tab-btn.active {
  color: #fff;
  background: var(--player-surface-2);
  border-color: var(--player-line-strong);
  box-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

.player-tab-pane {
  display: none;
  max-width: 1200px;
  margin: 20px auto 0;
  width: 100%;
}

.player-tab-pane.active {
  display: block;
  animation: tabFadeIn 0.2s ease;
}

@keyframes tabFadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.lesson-desc-content {
  line-height: 1.7;
  color: #d1ccc7;
  font-size: 0.96rem;
}

/* DIGITAL NOTEBOOK */
.notes-container {
  background: var(--player-surface);
  border: 1px solid var(--player-line);
  border-radius: 14px;
  padding: 20px;
}

.notes-textarea {
  width: 100%;
  min-height: 180px;
  background: #09090c;
  border: 1px solid var(--player-line);
  border-radius: 10px;
  padding: 14px;
  color: #fff;
  font-size: 0.92rem;
  line-height: 1.6;
  resize: vertical;
  outline: none;
  font-family: inherit;
  transition: border-color 0.2s ease;
}

.notes-textarea:focus {
  border-color: var(--player-brand);
}

/* MATERIALS DOWNLOAD CARD */
.material-download-card {
  background: var(--player-surface);
  border: 1px solid var(--player-line);
  border-radius: 14px;
  padding: 20px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.material-download-card:hover {
  border-color: rgba(255, 255, 255, 0.22);
  transform: translateY(-2px);
}

/* ==========================================================================
   SIDEBAR PLAYLIST & PROGRESS (STICKY & INDEPENDENT SCROLL)
   ========================================================================== */
.player-sidebar {
  background: #0a0a0e;
  border-left: 1px solid var(--player-line);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 124px;
  height: calc(100vh - 124px);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.15) transparent;
}

.player-sidebar::-webkit-scrollbar {
  width: 6px;
}
.player-sidebar::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.18);
  border-radius: 4px;
}

/* SIDEBAR PROGRESS HEADER */
.sidebar-course-header {
  padding: 20px;
  background: var(--player-surface);
  border-bottom: 1px solid var(--player-line);
  position: sticky;
  top: 0;
  z-index: 10;
}

.sidebar-progress-bar {
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 6px;
}

.sidebar-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--player-brand), #ff4d56);
  border-radius: 999px;
  transition: width 0.3s ease;
}

.sidebar-progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.76rem;
  color: var(--text-muted);
}

/* MODULE ACCORDION */
.playlist-module {
  border-bottom: 1px solid var(--player-line);
}

.playlist-module-header {
  padding: 14px 20px;
  background: #0f0f15;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.82rem;
  font-weight: 800;
  color: #bbb;
  user-select: none;
  transition: background 0.15s ease;
}

.playlist-module-header:hover {
  background: #14141c;
  color: #fff;
}

.playlist-module-arrow {
  transition: transform 0.2s ease;
  font-size: 0.70rem;
}

.playlist-module.open .playlist-module-arrow {
  transform: rotate(90deg);
}

.playlist-lessons-list {
  display: none;
}

.playlist-module.open .playlist-lessons-list {
  display: block;
}

/* LESSON ITEM ROW */
.playlist-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  font-size: 0.85rem;
  color: #b5b0ab;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease;
}

.playlist-item:hover {
  background: rgba(255, 255, 255, 0.04);
  color: #fff;
}

.playlist-item.active {
  background: rgba(217, 44, 53, 0.14);
  color: #ff5e67;
  font-weight: 700;
  border-left: 3px solid var(--player-brand);
}

.lesson-status-icon {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 800;
  color: #777;
  flex-shrink: 0;
}

.playlist-item.completed .lesson-status-icon {
  background: rgba(72, 200, 137, 0.2);
  color: var(--player-green);
}

.playlist-item.active .lesson-status-icon {
  background: var(--player-brand);
  color: #fff;
}

.playlist-item-meta {
  flex: 1;
  min-width: 0;
}

.playlist-item-title {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
}

.playlist-item-duration {
  font-size: 0.72rem;
  color: #666;
}

/* RESPONSIVENESS */
@media (max-width: 1100px) {
  .player-layout {
    grid-template-columns: 1fr;
  }
  .player-sidebar {
    height: auto;
    max-height: 550px;
    position: static;
  }
  .player-main {
    padding: 16px 20px 40px;
  }
}

@media (max-width: 640px) {
  .player-top-nav {
    padding: 0 14px;
    top: 60px;
  }
  .player-lesson-title {
    font-size: 1.3rem;
  }
  .player-header-card {
    padding: 16px;
  }
}
