/* ========================================================
   BISA NONTON - Video Player & Theater Mode Styles
   ======================================================== */

.player-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(5, 7, 12, 0.95);
  backdrop-filter: blur(25px);
  -webkit-backdrop-filter: blur(25px);
  display: none;
  flex-direction: column;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.player-modal.active {
  display: flex;
  opacity: 1;
  pointer-events: auto;
}

/* Header bar in modal */
.player-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.75rem;
  background: linear-gradient(180deg, rgba(10, 12, 19, 0.9) 0%, transparent 100%);
  z-index: 20;
}

.player-title-info {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.player-main-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.player-episode-subtitle {
  font-size: 0.85rem;
  color: var(--primary);
  font-weight: 500;
}

.player-close-btn {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--border-glass);
  color: #fff;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.25rem;
  transition: var(--transition);
}

.player-close-btn:hover {
  background: rgba(255, 51, 102, 0.8);
  transform: rotate(90deg);
}

/* Main Body Layout */
.player-body {
  flex: 1;
  display: flex;
  overflow: hidden;
  position: relative;
}

/* Video Section */
.player-video-section {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  background: #000;
  overflow: hidden;
}

.video-container {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
}

video#main-video-element,
iframe#main-iframe-element {
  width: 100%;
  height: 100%;
  max-height: calc(100vh - 140px);
  object-fit: contain;
  background: #000;
  border: none;
}

video#main-video-element {
  cursor: pointer;
}

/* Mode Google Drive / Iframe */
.video-container.is-iframe-mode {
  width: 100%;
  height: 100%;
  max-height: 100%;
  padding: 0;
  margin: 0;
}

.video-container.is-iframe-mode iframe#main-iframe-element {
  width: 100% !important;
  height: 100% !important;
  max-height: 100% !important;
  min-height: 100% !important;
  flex: 1;
  border: none !important;
  background: #000;
  z-index: 1;
  display: block;
}

.video-container.is-iframe-mode .custom-controls-bar,
.video-container.is-iframe-mode .video-center-controls,
.video-container.is-iframe-mode .seek-preview-tooltip {
  display: none !important;
}

.video-container.is-iframe-mode .video-top-overlay {
  z-index: 25;
  transition: opacity 0.35s ease, transform 0.35s ease;
}

/* Auto-hide top overlay saat idle di mode iframe */
.video-container.is-iframe-mode.user-idle .video-top-overlay {
  opacity: 0;
  transform: translateY(-12px);
  pointer-events: none;
}

/* Tombol Fullscreen di Top Overlay */
.video-overlay-fs-btn {
  margin-left: auto;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  flex-shrink: 0;
}

.video-overlay-fs-btn:hover {
  background: var(--primary);
  border-color: var(--primary);
  transform: scale(1.08);
}

/* ========================================================
   VIDEO TOP OVERLAY (Judul Film & Episode saat diklik/aktif)
   ======================================================== */
.player-header {
  display: none !important; /* Tergantikan secara elegan oleh video-top-overlay langsung di dalam video ala Netflix */
}

.video-top-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  background: linear-gradient(180deg, rgba(5, 7, 12, 0.92) 0%, rgba(5, 7, 12, 0.55) 60%, transparent 100%);
  padding: 1.25rem 1.75rem 2rem;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  z-index: 25;
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1), transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: auto;
}

.video-container.user-idle .video-top-overlay {
  opacity: 0;
  transform: translateY(-10px);
  pointer-events: none;
}

.video-overlay-back-btn {
  background: rgba(14, 18, 28, 0.75);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: var(--transition);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
}

.video-overlay-back-btn:hover {
  background: var(--primary);
  border-color: var(--primary);
  transform: scale(1.08);
}

.video-overlay-title-group {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  overflow: hidden;
  max-width: calc(100% - 70px);
}

.video-overlay-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.9);
  margin: 0;
  line-height: 1.25;
}

.video-overlay-subtitle {
  font-size: 0.85rem;
  font-weight: 600;
  color: #ff6b8b;
  letter-spacing: 0.3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.7);
}

/* Fullscreen support for video-top-overlay */
.video-container:fullscreen .video-top-overlay,
.video-container:-webkit-full-screen .video-top-overlay,
.video-container.fullscreen-active .video-top-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  padding-top: max(1.25rem, env(safe-area-inset-top));
  padding-left: max(1.75rem, env(safe-area-inset-left));
  padding-right: max(1.75rem, env(safe-area-inset-right));
  z-index: 100;
}

/* ========================================================
   CENTER OVERLAY CONTROLS (Transparent with 3 Action Buttons)
   ======================================================== */
.video-center-controls {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3rem;
  z-index: 12;
  background: radial-gradient(circle at center, rgba(5, 7, 12, 0.45) 0%, rgba(5, 7, 12, 0.25) 50%, transparent 80%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s cubic-bezier(0.4, 0, 0.2, 1), transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  transform: scale(0.95);
}

.video-container.controls-active .video-center-controls,
.video-container.is-paused .video-center-controls,
.video-container:not(.user-idle) .video-center-controls {
  opacity: 1;
  pointer-events: auto;
  transform: scale(1);
}

.center-btn {
  background: rgba(14, 18, 28, 0.75);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1.5px solid rgba(255, 255, 255, 0.18);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.6);
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.center-btn:hover {
  background: rgba(255, 51, 102, 0.25);
  border-color: var(--primary);
  transform: scale(1.1);
  box-shadow: 0 0 25px rgba(255, 51, 102, 0.45);
}

.center-btn:active {
  transform: scale(0.92);
}

/* Play/Pause Button (Tengah) */
.center-btn-playpause {
  width: 72px;
  height: 72px;
  font-size: 1.85rem;
  background: var(--primary-gradient);
  border-color: rgba(255, 255, 255, 0.3);
  box-shadow: 0 10px 30px rgba(255, 51, 102, 0.4);
}

/* Animasi pulse ambient saat video siap diputar (paused) */
.video-container.is-paused .center-btn-playpause {
  animation: playGlowAmbient 2s infinite ease-in-out;
}

@keyframes playGlowAmbient {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 10px 30px rgba(255, 51, 102, 0.4), 0 0 0 0 rgba(255, 51, 102, 0.4);
  }
  50% {
    transform: scale(1.08);
    box-shadow: 0 12px 35px rgba(255, 51, 102, 0.8), 0 0 0 12px rgba(255, 51, 102, 0);
  }
}

.center-btn-playpause.pulse-action {
  animation: playPulseAction 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes playPulseAction {
  0% { transform: scale(0.9); }
  50% { transform: scale(1.22); box-shadow: 0 0 35px var(--primary); }
  100% { transform: scale(1); }
}

.center-btn-playpause:hover {
  background: var(--primary);
  transform: scale(1.12);
  box-shadow: 0 0 30px rgba(255, 51, 102, 0.7);
}

.center-btn-playpause span {
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.center-btn-playpause svg {
  width: 32px;
  height: 32px;
  fill: #fff;
  display: block;
}

.center-btn-playpause svg path {
  fill: #fff;
}

/* Skip 10s Buttons (Kiri & Kanan) */
.center-btn-skip {
  position: relative;
  width: 56px;
  height: 56px;
}

.center-btn-skip svg {
  width: 28px;
  height: 28px;
  color: #fff;
  transition: transform 0.15s ease;
}

.center-skip-badge {
  position: absolute;
  font-size: 0.62rem;
  font-weight: 800;
  color: #fff;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -46%);
  pointer-events: none;
  letter-spacing: -0.5px;
}

.center-btn-skip:hover svg {
  transform: scale(1.08);
}

.center-btn-skip.skip-pulse {
  animation: skipPulse 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes skipPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.25); background: rgba(255, 51, 102, 0.4); border-color: var(--primary); }
  100% { transform: scale(1); }
}

/* Loading Spinner */
.video-loading-spinner {
  position: absolute;
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 1rem;
  z-index: 10;
  pointer-events: none;
}

.video-loading-spinner.active {
  display: flex;
}

.spinner-circle {
  width: 50px;
  height: 50px;
  border: 4px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Custom Controls Bar */
.custom-controls-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(0deg, rgba(0, 0, 0, 0.95) 0%, rgba(0, 0, 0, 0.6) 60%, transparent 100%);
  padding: 1.5rem 1.5rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  z-index: 15;
  transition: opacity 0.3s ease, transform 0.3s ease;
  opacity: 1;
}

.video-container.user-idle .custom-controls-bar {
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
}

/* ========================================================
   SEEK PREVIEW TOOLTIP (Netflix Style)
   ======================================================== */
.seek-preview-tooltip {
  position: absolute;
  bottom: calc(100% + 14px);
  left: 0;
  transform: translateX(-50%);
  display: none;
  flex-direction: column;
  align-items: center;
  pointer-events: none;
  z-index: 35;
  transition: opacity 0.15s ease;
  filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.7));
}

.seek-preview-tooltip.active {
  display: flex;
}

.seek-preview-thumb {
  width: 154px;
  height: 86px;
  background: #0a0d14;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.6), 0 0 15px rgba(255, 51, 102, 0.2);
}

.seek-preview-thumb video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #000;
  display: block;
}

.seek-preview-time {
  margin-top: 6px;
  padding: 0.2rem 0.65rem;
  background: rgba(14, 18, 28, 0.9);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  font-size: 0.78rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.5px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

/* Scrubber / Progress Bar */
.progress-container {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  position: relative;
  cursor: pointer;
  transition: height 0.15s ease;
  touch-action: none; /* Mencegah page scroll saat dragging scrubber */
}

/* Invisible expanded touch hit area for mobile fingertips */
.progress-container::before {
  content: '';
  position: absolute;
  top: -14px;
  bottom: -14px;
  left: 0;
  right: 0;
  z-index: 2;
}

.progress-container:hover,
.progress-container.dragging {
  height: 9px;
}

.progress-filled {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  background: var(--primary-gradient);
  border-radius: 4px;
  width: 0%;
  pointer-events: none;
  box-shadow: 0 0 10px rgba(255, 51, 102, 0.5);
}

.progress-buffer {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  background: rgba(255, 255, 255, 0.35);
  border-radius: 4px;
  width: 0%;
  pointer-events: none;
}

.progress-thumb {
  position: absolute;
  top: 50%;
  width: 14px;
  height: 14px;
  background: #fff;
  border-radius: 50%;
  transform: translate(-50%, -50%) scale(0);
  box-shadow: 0 0 8px rgba(0, 0, 0, 0.6);
  transition: transform 0.15s ease, background 0.15s ease;
  pointer-events: none;
  z-index: 3;
}

.progress-container:hover .progress-thumb,
.progress-container.dragging .progress-thumb {
  transform: translate(-50%, -50%) scale(1.25);
  background: #fff;
  box-shadow: 0 0 12px var(--primary);
}

/* Controls row */
.controls-main-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.controls-left, .controls-right {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.ctrl-btn {
  background: transparent;
  border: none;
  color: #fff;
  font-size: 1.15rem;
  width: 36px;
  height: 36px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}

.ctrl-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  color: var(--primary);
}

.ctrl-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.ctrl-btn svg {
  display: block;
  flex-shrink: 0;
  pointer-events: none;
}

/* Skip 10s Buttons */
.ctrl-btn-skip {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
}

.ctrl-btn-skip svg {
  width: 22px;
  height: 22px;
  color: inherit;
  transition: transform 0.15s ease;
}

.ctrl-btn-skip .skip-badge {
  position: absolute;
  font-size: 0.52rem;
  font-weight: 800;
  color: #fff;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -46%);
  pointer-events: none;
  letter-spacing: -0.5px;
  font-family: inherit;
}

.ctrl-btn-skip:hover svg {
  transform: scale(1.1);
}

.ctrl-btn-skip:active svg {
  transform: scale(0.95);
}

/* Time display */
.time-display {
  font-size: 0.85rem;
  font-weight: 500;
  color: #cbd5e1;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

/* Volume Slider */
.volume-wrapper {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.volume-slider {
  width: 70px;
  height: 4px;
  accent-color: var(--primary);
  cursor: pointer;
  transition: width 0.2s ease;
}

/* Quality Selector Dropdown */
.quality-dropdown-wrapper {
  position: relative;
}

.quality-badge-btn {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--border-glass);
  color: #fff;
  padding: 0.3rem 0.65rem;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
  transition: var(--transition);
}

.quality-badge-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: var(--primary);
}

.quality-menu {
  position: absolute;
  bottom: calc(100% + 8px);
  right: 0;
  background: var(--bg-surface);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  padding: 0.4rem;
  display: none;
  flex-direction: column;
  min-width: 120px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.6);
  z-index: 30;
}

.quality-menu.show {
  display: flex;
}

.quality-option {
  padding: 0.45rem 0.85rem;
  border-radius: 4px;
  background: transparent;
  border: none;
  color: #cbd5e1;
  font-size: 0.85rem;
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: var(--transition);
}

.quality-option:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.quality-option.active {
  background: rgba(255, 51, 102, 0.2);
  color: var(--primary);
  font-weight: 700;
}

/* Speed Selector Dropdown */
.speed-dropdown-wrapper {
  position: relative;
}

.speed-badge-btn {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--border-glass);
  color: #fff;
  padding: 0.3rem 0.65rem;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
  transition: var(--transition);
}

.speed-badge-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: var(--primary);
}

.speed-menu {
  position: absolute;
  bottom: calc(100% + 8px);
  right: 0;
  background: var(--bg-surface);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  padding: 0.4rem;
  display: none;
  flex-direction: column;
  min-width: 130px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.6);
  z-index: 30;
}

.speed-menu.show {
  display: flex;
}

.speed-option {
  padding: 0.45rem 0.85rem;
  border-radius: 4px;
  background: transparent;
  border: none;
  color: #cbd5e1;
  font-size: 0.85rem;
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: var(--transition);
}

.speed-option:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.speed-option.active {
  background: rgba(255, 51, 102, 0.2);
  color: var(--primary);
  font-weight: 700;
}

/* ========================================================
   EPISODE SIDEBAR (FOR SERIES)
   ======================================================== */
.episode-sidebar {
  width: 320px;
  background: rgba(14, 18, 28, 0.95);
  border-left: 1px solid var(--border-glass);
  display: flex;
  flex-direction: column;
  transition: width 0.3s ease;
}

.episode-sidebar.hidden {
  display: none;
}

.sidebar-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-glass);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar-title {
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.episode-count-badge {
  background: rgba(255, 255, 255, 0.1);
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.episode-list {
  flex: 1;
  overflow-y: auto;
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.episode-item {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.8rem 1rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}

.episode-item:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.15);
}

.episode-item.active {
  background: rgba(255, 51, 102, 0.15);
  border-color: var(--primary);
}

.episode-num-badge {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
  flex-shrink: 0;
}

.episode-item.active .episode-num-badge {
  background: var(--primary);
  color: #fff;
}

.episode-details {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
  gap: 2px;
}

.episode-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.episode-item.active .episode-name {
  color: #ff6b8b;
}

.episode-status {
  font-size: 0.75rem;
  color: var(--text-dim);
}

.episode-prog-track {
  width: 100%;
  height: 3px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 2px;
  margin-top: 5px;
  overflow: hidden;
}

.episode-prog-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 2px;
  box-shadow: 0 0 6px var(--primary);
}

/* ========================================================
   AUTO-PLAY NEXT EPISODE COUNTDOWN OVERLAY
   ======================================================== */
.autoplay-countdown-overlay {
  position: absolute;
  bottom: 5.5rem;
  right: 2rem;
  background: rgba(18, 22, 34, 0.95);
  border: 1px solid var(--primary);
  border-radius: var(--radius-md);
  padding: 1.25rem 1.5rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7), 0 0 20px var(--primary-glow);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-width: 360px;
  z-index: 25;
  animation: slideUp 0.3s ease;
}

.autoplay-countdown-overlay.hidden {
  display: none;
}

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

.autoplay-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.autoplay-next-title {
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.countdown-bar-container {
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  overflow: hidden;
}

.countdown-bar-fill {
  height: 100%;
  width: 100%;
  background: var(--primary-gradient);
  transition: width 1s linear;
}

.autoplay-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.autoplay-btn-now {
  flex: 1;
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 0.55rem;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
}

.autoplay-btn-now:hover {
  background: #ff1f59;
}

.autoplay-btn-cancel {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border: none;
  padding: 0.55rem 1rem;
  border-radius: 6px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: var(--transition);
}

.autoplay-btn-cancel:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* ========================================================
   FULLSCREEN MODE - Fit to Aspect Ratio
   Video fills the entire screen proportionally (no stretch).
   Works on all screen sizes: TV 1080p, phone 21:9, etc.
   ======================================================== */

/* Standard Fullscreen API & Fullscreen Active class */
.video-container:fullscreen,
.video-container:-webkit-full-screen,
.video-container.fullscreen-active {
  width: 100vw;
  height: 100vh;
  max-width: 100vw;
  max-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
}

.video-container:fullscreen video#main-video-element,
.video-container:-webkit-full-screen video#main-video-element,
.video-container.fullscreen-active video#main-video-element {
  width: 100%;
  height: 100%;
  max-height: 100vh;
  object-fit: contain; /* Proporsional — fit to aspect ratio, no stretch */
}

.video-container:fullscreen iframe#main-iframe-element,
.video-container:-webkit-full-screen iframe#main-iframe-element,
.video-container.fullscreen-active iframe#main-iframe-element {
  width: 100vw !important;
  height: 100vh !important;
  max-width: 100vw !important;
  max-height: 100vh !important;
  position: fixed;
  inset: 0;
  z-index: 10;
  background: #000;
  border: none;
}

/* Controls bar stays pinned at bottom in fullscreen with safe-area */
.video-container:fullscreen .custom-controls-bar,
.video-container:-webkit-full-screen .custom-controls-bar,
.video-container.fullscreen-active .custom-controls-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  padding-bottom: max(1.25rem, env(safe-area-inset-bottom));
  padding-left: max(1.5rem, env(safe-area-inset-left));
  padding-right: max(1.5rem, env(safe-area-inset-right));
}

/* Loading spinner centered in fullscreen */
.video-container:fullscreen .video-loading-spinner,
.video-container:-webkit-full-screen .video-loading-spinner,
.video-container.fullscreen-active .video-loading-spinner {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

/* Center controls in fullscreen */
.video-container:fullscreen .video-center-controls,
.video-container:-webkit-full-screen .video-center-controls,
.video-container.fullscreen-active .video-center-controls {
  position: fixed;
  inset: 0;
}

/* ========================================================
   RESPONSIVE DESIGN & MOBILE / IPHONE FIXES
   ======================================================== */
@media (max-width: 900px) {
  .player-body {
    flex-direction: column;
  }
  .episode-sidebar {
    width: 100%;
    max-height: 220px;
    border-left: none;
    border-top: 1px solid var(--border-glass);
  }
}

/* Mobile & iPhone Safari Viewport Fixes */
@media (max-width: 640px) {
  .player-header {
    padding: 0.75rem 1rem;
  }

  .player-main-title {
    font-size: 0.95rem;
    max-width: calc(100vw - 80px);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .player-episode-subtitle {
    font-size: 0.78rem;
  }

  .player-close-btn {
    width: 36px;
    height: 36px;
    font-size: 1.1rem;
    flex-shrink: 0;
  }

  /* Custom Controls Bar - Fit comfortably without horizontal overflow */
  .custom-controls-bar {
    padding: 0.85rem 0.75rem max(0.85rem, env(safe-area-inset-bottom));
    gap: 0.45rem;
  }

  .controls-main-row {
    gap: 0.4rem;
    width: 100%;
    justify-content: space-between;
  }

  .controls-left {
    gap: 0.35rem;
    min-width: 0;
    flex-shrink: 1;
  }

  .controls-right {
    gap: 0.35rem;
    flex-shrink: 0;
  }

  .ctrl-btn {
    width: 34px;
    height: 34px;
    font-size: 1rem;
    flex-shrink: 0;
  }

  .time-display {
    font-size: 0.72rem;
    letter-spacing: 0;
    min-width: 0;
    white-space: nowrap;
  }

  /* Sembunyikan slider volume statis di HP (iOS melarang penyesuaian volume JS dan memakai tombol fisik HP) */
  .volume-slider {
    display: none !important;
  }

  .speed-badge-btn, .quality-badge-btn {
    padding: 0.25rem 0.45rem;
    font-size: 0.75rem;
    gap: 0.2rem;
  }

  /* Center Controls Overlay on Mobile */
  .video-center-controls {
    gap: 1.75rem;
  }

  .center-btn-playpause {
    width: 60px;
    height: 60px;
    font-size: 1.5rem;
  }

  .center-btn-skip {
    width: 46px;
    height: 46px;
  }

  .center-btn-skip svg {
    width: 22px;
    height: 22px;
  }

  .center-skip-badge {
    font-size: 0.55rem;
  }

  /* Seek preview thumbnail for small screens */
  .seek-preview-thumb {
    width: 128px;
    height: 72px;
  }

  /* Autoplay overlay responsive */
  .autoplay-countdown-overlay {
    right: 1rem;
    left: 1rem;
    bottom: 5rem;
    max-width: none;
  }
}
