/* ============================================
   REELBOX — Player CSS
   TikTok/Reels Style — Professional
   ============================================ */

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --red:    #E50914;
  --red-d:  #b20710;
  --glow:   rgba(229,9,20,0.45);
  --bg:     #000;
  --surface:#111;
  --card:   #1a1f2e;
  --text:   #fff;
  --muted:  #b3b3b3;
  --dim:    #555;
  --green:  #46d369;
  --gold:   #FFD700;
  --radius: 10px;
  --ease:   0.25s ease;
}

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

body.player-page {
  position: fixed;
  inset: 0;
  /* Use dvh (dynamic viewport height) para ocultar barra do navegador mobile */
  height: 100dvh;
  height: -webkit-fill-available;
}

/* Fix para iOS Safari */
html {
  height: -webkit-fill-available;
}

/* ============================================
   LAYOUT
   ============================================ */
.player-wrap {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100dvh;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

/* ============================================
   VIDEO
   ============================================ */
.video-area {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
  overflow: hidden;
}

#videoPlayer {
  /* 9:16 vertical — nunca corta, mostra tudo */
  display: block;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  background: #000;
}

/* Desktop: limita a largura para não esticar demais */
@media (min-width: 769px) {
  #videoPlayer {
    max-height: 100dvh;
    max-width: 440px;
    width: auto;
    height: 100dvh;
  }
}

/* Mobile: ocupa toda a altura disponível */
@media (max-width: 768px) {
  #videoPlayer {
    width: 100vw;
    height: auto;
    max-height: 100dvh;
  }
}

/* ============================================
   BACK BUTTON
   ============================================ */
.btn-back {
  position: fixed;
  top: 18px;
  left: 18px;
  z-index: 200;
  width: 42px; height: 42px;
  border-radius: 50%;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(8px);
  border: 1.5px solid rgba(255,255,255,0.18);
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  font-size: 1.3rem;
  text-decoration: none;
  opacity: 0;
  transform: translateY(-8px);
  transition: background var(--ease), transform var(--ease), opacity 0.3s ease;
}
.btn-back.visible { opacity: 1; transform: translateY(0); }
.btn-back:hover { background: rgba(0,0,0,0.8); }

/* ============================================
   VIDEO INFO — bottom-left overlay
   ============================================ */
.video-info {
  position: fixed;
  bottom: 110px;
  left: 18px;
  z-index: 150;
  max-width: 60%;
  pointer-events: none;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}
.video-info.visible {
  opacity: 1;
  transform: translateY(0);
}
.video-info-series {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--red);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: 4px;
  text-shadow: 0 1px 6px rgba(0,0,0,0.9);
}
.video-info-title {
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.3;
  text-shadow: 0 2px 8px rgba(0,0,0,0.9);
}

/* ============================================
   SIDE ACTIONS — right column
   ============================================ */
.side-actions {
  position: fixed;
  right: 16px;
  bottom: 110px;
  z-index: 150;
  display: flex;
  flex-direction: column;
  gap: 20px;
  align-items: center;
  opacity: 0;
  transform: translateX(8px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}
.side-actions.visible {
  opacity: 1;
  transform: translateX(0);
}

.side-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  transition: transform var(--ease), color var(--ease);
}
.side-btn:hover { transform: scale(1.15); color: var(--red); }
.side-btn svg, .side-btn .side-icon {
  width: 28px; height: 28px;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.8));
}
.side-btn .side-label {
  font-size: 0.68rem;
  font-weight: 600;
  text-shadow: 0 1px 4px rgba(0,0,0,0.8);
}

/* PiP active state */
.side-btn.pip-active {
  color: var(--red);
}
.side-btn.pip-active svg {
  filter: drop-shadow(0 0 6px rgba(229,9,20,0.8));
}

/* PiP banner — aparece quando entra em PiP */
.pip-banner {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0,0,0,0.85);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 16px;
  padding: 28px 36px;
  text-align: center;
  z-index: 500;
  display: none;
  animation: fadeIn 0.3s ease;
}
.pip-banner.show { display: block; }
.pip-banner .pip-icon { font-size: 3rem; margin-bottom: 12px; }
.pip-banner h3 { font-size: 1.1rem; font-weight: 700; margin-bottom: 8px; }
.pip-banner p { font-size: 0.85rem; color: var(--muted); line-height: 1.5; }
.pip-banner .pip-close {
  margin-top: 16px;
  padding: 10px 24px;
  background: var(--red);
  border: none;
  border-radius: 20px;
  color: #fff;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background var(--ease);
}
.pip-banner .pip-close:hover { background: var(--red-d); }

/* ============================================
   CUSTOM CONTROLS — bottom bar
   ============================================ */
.custom-controls {
  position: fixed;
  bottom: 0;
  left: 0; right: 0;
  z-index: 160;
  padding: 0 18px 18px;
  background: linear-gradient(transparent, rgba(0,0,0,0.85) 40%, rgba(0,0,0,0.95) 100%);
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.3s ease, transform 0.3s ease;
  pointer-events: none;
}
.custom-controls.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: all;
}

/* Progress */
.progress-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.progress-track {
  flex: 1;
  height: 4px;
  background: rgba(255,255,255,0.2);
  border-radius: 2px;
  cursor: pointer;
  position: relative;
  transition: height var(--ease);
}
.progress-track:hover { height: 6px; }
.progress-fill {
  height: 100%;
  background: var(--red);
  border-radius: 2px;
  width: 0%;
  position: relative;
  pointer-events: none;
}
.progress-fill::after {
  content: '';
  position: absolute;
  right: -6px; top: 50%;
  transform: translateY(-50%);
  width: 14px; height: 14px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 0 8px var(--glow);
  opacity: 0;
  transition: opacity var(--ease);
}
.progress-track:hover .progress-fill::after { opacity: 1; }
.time-label {
  font-size: 0.75rem;
  color: var(--muted);
  white-space: nowrap;
  min-width: 80px;
  text-align: right;
}

/* Buttons row */
.controls-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.controls-center {
  display: flex;
  align-items: center;
  gap: 8px;
}
.ctrl-btn {
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  border-radius: 50%;
  transition: background var(--ease), transform var(--ease);
  font-size: 1.4rem;
}
.ctrl-btn:hover { background: rgba(255,255,255,0.1); transform: scale(1.1); }
.ctrl-btn.play-btn {
  width: 56px; height: 56px;
  background: rgba(255,255,255,0.12);
  backdrop-filter: blur(8px);
  border: 1.5px solid rgba(255,255,255,0.25);
  font-size: 1.6rem;
}
.ctrl-btn.play-btn:hover { background: var(--red); border-color: var(--red); }

/* Episodes button */
.eps-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255,255,255,0.1);
  backdrop-filter: blur(8px);
  border: 1.5px solid rgba(255,255,255,0.2);
  border-radius: 20px;
  padding: 8px 16px;
  color: #fff;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--ease), border-color var(--ease);
}
.eps-btn:hover { background: var(--red); border-color: var(--red); }
.eps-btn svg { width: 18px; height: 18px; }

/* ============================================
   EPISODES DRAWER
   ============================================ */
.drawer-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 300;
  opacity: 0; pointer-events: none;
  transition: opacity var(--ease);
}
.drawer-overlay.show { opacity: 1; pointer-events: all; }

.episodes-drawer {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 310;
  background: var(--card);
  border-radius: 20px 20px 0 0;
  max-height: 72vh;
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform 0.38s cubic-bezier(0.4,0,0.2,1);
  box-shadow: 0 -8px 40px rgba(0,0,0,0.7);
}
.episodes-drawer.show { transform: translateY(0); }

.drawer-handle {
  width: 40px; height: 4px;
  background: rgba(255,255,255,0.2);
  border-radius: 2px;
  margin: 12px auto 0;
  flex-shrink: 0;
}

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  flex-shrink: 0;
}
.drawer-header h3 {
  font-size: 1.05rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}
.drawer-close {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: rgba(255,255,255,0.08);
  border: none;
  color: #fff;
  font-size: 1.3rem;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: background var(--ease), transform var(--ease);
}
.drawer-close:hover { background: var(--red); transform: rotate(90deg); }

.drawer-list {
  overflow-y: auto;
  padding: 12px 16px 24px;
  flex: 1;
  scrollbar-width: thin;
  scrollbar-color: var(--red) transparent;
}
.drawer-list::-webkit-scrollbar { width: 4px; }
.drawer-list::-webkit-scrollbar-thumb { background: var(--red); border-radius: 2px; }

.ep-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 12px;
  border-radius: var(--radius);
  border: 1.5px solid transparent;
  margin-bottom: 8px;
  text-decoration: none;
  color: #fff;
  transition: background var(--ease), border-color var(--ease), transform var(--ease);
  cursor: pointer;
}
.ep-row:hover { background: rgba(255,255,255,0.07); border-color: rgba(255,255,255,0.12); transform: translateX(4px); }
.ep-row.active { background: rgba(229,9,20,0.15); border-color: var(--red); }
.ep-row.locked { opacity: 0.5; cursor: not-allowed; }
.ep-row.locked:hover { background: none; border-color: transparent; transform: none; }

.ep-thumb-wrap {
  position: relative; flex-shrink: 0;
  width: 72px; height: 100px;
}
.ep-thumb {
  width: 72px; height: 100px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
  background: #222;
}
.ep-thumb-done {
  position: absolute; top: 4px; right: 4px;
  width: 20px; height: 20px; border-radius: 50%;
  background: #46d369; color: #000;
  font-size: .7rem; font-weight: 900;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 6px rgba(0,0,0,.5);
}
.ep-info { flex: 1; min-width: 0; }
.ep-num {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--red);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}
.ep-row.active .ep-num { color: var(--red); }
.ep-title {
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ep-status {
  font-size: 0.72rem;
  display: flex;
  align-items: center;
  gap: 5px;
}
.ep-status.free  { color: var(--green); }
.ep-status.lock  { color: var(--dim); }
.ep-status.now   { color: var(--red); }
.ep-play-icon {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: rgba(255,255,255,0.08);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.9rem;
  flex-shrink: 0;
  transition: background var(--ease);
}
.ep-row:hover .ep-play-icon { background: var(--red); }
.ep-row.active .ep-play-icon { background: var(--red); }

/* ============================================
   NEXT EPISODE OVERLAY
   ============================================ */
.next-overlay {
  position: fixed; inset: 0;
  z-index: 400;
  background: rgba(0,0,0,0.97);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.4s ease;
}
.next-overlay.show { display: flex; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.next-card {
  background: linear-gradient(160deg, #1a1a1a, #252525);
  border: 2px solid var(--red);
  border-radius: 20px;
  padding: 40px 32px;
  max-width: 480px;
  width: 100%;
  text-align: center;
  box-shadow: 0 20px 60px rgba(229,9,20,0.4);
  animation: slideUp 0.4s ease;
}
@keyframes slideUp { from { opacity:0; transform:translateY(40px); } to { opacity:1; transform:translateY(0); } }

.next-card h3 { font-size: 1.6rem; margin-bottom: 24px; }
.next-card .countdown { color: var(--red); font-size: 2.8rem; font-weight: 900; }

/* VIP popup */
.vip-crown { font-size: 4rem; margin-bottom: 12px; }
.vip-title {
  font-size: 2.4rem;
  font-weight: 900;
  background: linear-gradient(135deg, var(--gold), #FFA500);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 12px;
}
.vip-sub { font-size: 1rem; color: var(--muted); margin-bottom: 24px; line-height: 1.6; }
.vip-benefits {
  background: rgba(255,215,0,0.08);
  border: 1px solid rgba(255,215,0,0.3);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 24px;
  text-align: left;
}
.vip-benefits h4 { color: var(--gold); font-size: 0.95rem; margin-bottom: 10px; }
.vip-benefits li { font-size: 0.88rem; color: var(--muted); padding: 4px 0; }
.vip-benefits li::before { content: '✅ '; }

.next-actions { display: flex; flex-direction: column; gap: 10px; }
.btn-vip {
  padding: 16px 32px;
  background: linear-gradient(135deg, var(--gold), #FFA500);
  color: #000;
  font-weight: 900;
  font-size: 1rem;
  border: none;
  border-radius: 25px;
  cursor: pointer;
  box-shadow: 0 8px 28px rgba(255,215,0,0.35);
  transition: transform var(--ease), box-shadow var(--ease);
  text-decoration: none;
  display: block;
}
.btn-vip:hover { transform: scale(1.04); box-shadow: 0 12px 36px rgba(255,215,0,0.5); }
.btn-next {
  padding: 14px 32px;
  background: var(--red);
  color: #fff;
  font-weight: 700;
  font-size: 1rem;
  border: none;
  border-radius: 25px;
  cursor: pointer;
  transition: background var(--ease), transform var(--ease);
}
.btn-next:hover { background: var(--red-d); transform: scale(1.04); }
.btn-ghost {
  padding: 12px;
  background: none;
  border: 1px solid rgba(255,255,255,0.15);
  color: var(--muted);
  border-radius: 25px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: border-color var(--ease), color var(--ease);
}
.btn-ghost:hover { border-color: rgba(255,255,255,0.35); color: #fff; }

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
  .video-info { bottom: 100px; left: 14px; max-width: 58%; }
  .video-info-title { font-size: 0.92rem; }
  .side-actions { right: 12px; bottom: 100px; gap: 16px; }
  .side-btn svg, .side-btn .side-icon { width: 24px; height: 24px; }
  .custom-controls { padding: 0 14px 14px; }
  .ctrl-btn.play-btn { width: 50px; height: 50px; font-size: 1.4rem; }
  .next-card { padding: 30px 20px; }
  .vip-title { font-size: 2rem; }
}

@media (max-width: 480px) {
  .ep-thumb { width: 60px; height: 84px; }
  .ep-title { font-size: 0.82rem; }
}
