/* Premium Custom Video Player UI - Elite Upgrades */

.player-section {
  background: var(--bg-deep);
  border: 1px solid var(--border-light);
  border-radius: 24px;
  overflow: hidden;
  margin-bottom: 24px;
  box-shadow: var(--shadow-accent-glow);
  position: relative;
  display: flex;
  flex-direction: column;
  transition: var(--transition-smooth);
}

.player-section:hover {
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow: 0 0 32px rgba(112, 21, 220, 0.35);
}

.video-container {
  position: relative;
  width: 100%;
  aspect-ratio: 16/9;
  background: #000;
  overflow: hidden;
}

.video-container video {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* 1. OVERLAY CONTROLS */
.player-controls-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.35);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s cubic-bezier(0.25, 1, 0.5, 1);
  z-index: 10;
}

.video-container:hover .player-controls-overlay,
.video-container.show-controls .player-controls-overlay {
  opacity: 1;
  pointer-events: all;
}

/* Header bar inside player - Localized Blur */
.player-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  background: linear-gradient(180deg, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0) 100%);
  backdrop-filter: blur(8px);
  padding: 16px 20px;
}

.player-title-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1;
}

.player-title {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.player-header-actions {
  display: flex;
  align-items: center;
  gap: 18px;
}

.player-action-icon {
  color: #fff;
  cursor: pointer;
  opacity: 0.8;
  transition: var(--transition-smooth);
}

.player-action-icon:hover {
  opacity: 1;
  transform: scale(1.15);
  color: var(--accent-secondary);
}

/* Center Play/Pause & Seeks */
.player-center-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 48px;
}

.btn-center-play {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  border: 2px solid #fff;
  backdrop-filter: blur(8px);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition-smooth);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.35);
}

.btn-center-play:hover {
  transform: scale(1.1);
  background: #fff;
  color: var(--bg-deep);
  box-shadow: 0 0 28px rgba(255, 255, 255, 0.5);
}

.btn-center-seek {
  background: transparent;
  border: none;
  color: #fff;
  cursor: pointer;
  opacity: 0.75;
  transition: var(--transition-smooth);
}

.btn-center-seek:hover {
  opacity: 1;
  transform: scale(1.15);
  color: var(--accent-secondary);
}

/* Bottom Controls & Seekbar - Localized Blur */
.player-bottom-controls {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  background: linear-gradient(0deg, rgba(0,0,0,0.9) 0%, rgba(0,0,0,0) 100%);
  backdrop-filter: blur(8px);
  padding: 20px 24px;
}

.timeline-slider-container {
  display: flex;
  align-items: center;
  width: 100%;
}

.timeline-slider {
  -webkit-appearance: none;
  width: 100%;
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.25);
  outline: none;
  cursor: pointer;
  transition: height 0.1s;
}

.timeline-slider:hover {
  height: 6px;
}

.timeline-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent-secondary);
  border: 2px solid #fff;
  box-shadow: 0 0 10px var(--accent-secondary);
  margin-top: -5px;
}

.player-time-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.85);
  font-weight: 500;
}

/* 2. CHANNELS CHIPS ROW BELOW VIDEO */
.player-servers-row {
  display: flex;
  gap: 12px;
  padding: 16px 24px;
  background: rgba(255, 255, 255, 0.01);
  border-bottom: 1px solid var(--border-light);
  overflow-x: auto;
}

.player-servers-row::-webkit-scrollbar {
  display: none;
}

.server-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: 12px;
  border: 1px solid var(--border-light);
  background: rgba(255, 255, 255, 0.03);
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition-smooth);
}

.server-chip.active {
  background: rgba(243, 85, 136, 0.1);
  border-color: var(--accent-secondary);
  color: var(--accent-secondary);
  box-shadow: 0 2px 8px rgba(243, 85, 136, 0.15);
}

/* 3. SCROLLING ANNOUNCEMENT BANNER */
.announcement-banner {
  background: rgba(112, 21, 220, 0.05);
  border-bottom: 1px solid rgba(112, 21, 220, 0.12);
  display: flex;
  align-items: center;
  padding: 10px 24px;
  gap: 12px;
  overflow: hidden;
}

.announcement-icon {
  color: var(--accent-secondary);
  flex-shrink: 0;
  filter: drop-shadow(0 0 4px var(--accent-secondary));
}

.announcement-scroll {
  width: 100%;
  overflow: hidden;
  white-space: nowrap;
}

.announcement-text {
  display: inline-block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  padding-left: 100%;
  animation: marquee 28s linear infinite;
}

@keyframes marquee {
  0% { transform: translate3d(0, 0, 0); }
  100% { transform: translate3d(-100%, 0, 0); }
}

/* Lock overlay logic */
.video-container.locked .player-controls-overlay {
  background: transparent;
}

.video-container.locked .player-center-controls,
.video-container.locked .player-bottom-controls,
.video-container.locked .player-title-wrap,
.video-container.locked .player-action-icon:not(.btn-lock) {
  display: none !important;
}

/* FLOATING DOCK PLAYER */
.player-section.floating {
  position: fixed;
  bottom: 105px;
  right: 20px;
  width: 290px;
  aspect-ratio: 16/9;
  z-index: 150;
  border-radius: 16px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.85);
  border: 1px solid var(--accent-primary);
  animation: floatIn 0.35s cubic-bezier(0.25, 1, 0.5, 1);
}

.player-section.floating .player-servers-row,
.player-section.floating .announcement-banner {
  display: none !important;
}

@media (min-width: 1024px) {
  .player-section.floating {
    bottom: 24px;
    right: 24px;
    width: 380px;
  }
}

/* 4. THEATER POPUP LIGHTBOX FOR HIGHLIGHTS */
.theater-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(3, 4, 8, 0.94);
  backdrop-filter: blur(16px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 250;
  opacity: 0;
  pointer-events: none;
  transition: var(--transition-smooth);
}

.theater-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.theater-box {
  width: 92%;
  max-width: 900px;
  background: #000;
  border: 1px solid var(--border-light);
  border-radius: 24px;
  overflow: hidden;
  box-shadow: 
    0 24px 64px rgba(0, 0, 0, 0.9),
    0 0 32px rgba(0, 242, 254, 0.15);
  transform: scale(0.92);
  transition: var(--transition-smooth);
  position: relative;
}

.theater-overlay.active .theater-box {
  transform: scale(1);
}

.theater-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #fff;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 20;
  transition: var(--transition-smooth);
}

.theater-close:hover {
  background: #ef4444;
  border-color: #ef4444;
  transform: scale(1.1);
}

.theater-video-container {
  width: 100%;
  aspect-ratio: 16/9;
  background: #000;
}

.theater-video-container video {
  width: 100%;
  height: 100%;
}

/* Close Player icon hover */
.player-action-icon.btn-close-player:hover {
  color: #ef4444 !important;
}

/* Double Tap Seek Overlays */
.seek-indicator-overlay {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 40%;
  background: rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 15;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s cubic-bezier(0.25, 1, 0.5, 1);
}

.seek-indicator-overlay.left {
  left: 0;
  border-top-left-radius: 20px;
  border-bottom-left-radius: 20px;
}

.seek-indicator-overlay.right {
  right: 0;
  border-top-right-radius: 20px;
  border-bottom-right-radius: 20px;
}

.seek-indicator-overlay.active {
  opacity: 1;
  animation: seekFlash 0.8s ease-out;
}

.seek-ripple {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(3, 4, 8, 0.7);
  width: 90px;
  height: 90px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.seek-arrows {
  font-family: monospace;
  font-size: 1.4rem;
  font-weight: 900;
  color: #fff;
  letter-spacing: -2px;
  line-height: 1;
  margin-bottom: 2px;
  animation: seekPulse 0.4s infinite alternate;
}

.seek-text {
  font-size: 0.75rem;
  font-weight: 800;
  color: #fff;
  text-transform: uppercase;
}

@keyframes seekFlash {
  0% { background: rgba(255, 255, 255, 0.02); opacity: 0; }
  15% { background: rgba(255, 255, 255, 0.15); opacity: 1; }
  85% { background: rgba(255, 255, 255, 0.08); opacity: 1; }
  100% { background: rgba(255, 255, 255, 0); opacity: 0; }
}

@keyframes seekPulse {
  0% { transform: scale(0.9); opacity: 0.7; }
  100% { transform: scale(1.1); opacity: 1; }
}

/* CSS Screen Rotation Fallback */
.video-container.rotated video {
  transform: rotate(90deg);
  width: 100vh !important;
  height: 100vw !important;
  object-fit: contain;
}

@media (max-width: 768px) {
  .player-header {
    padding: 12px 14px;
  }
  .player-header-actions {
    gap: 12px;
  }
  .player-title {
    font-size: 0.92rem;
  }
}

/* Player Settings Dropdown Panel */
.player-settings-menu {
  position: absolute;
  bottom: 60px;
  right: 20px;
  width: 230px;
  background: rgba(11, 13, 25, 0.96);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 12px 6px;
  z-index: 100;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.85);
  font-family: var(--font-sans);
  color: #fff;
  transition: var(--transition-smooth);
}

.player-settings-menu.hidden {
  display: none !important;
}

.settings-screen {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.settings-screen.hidden {
  display: none !important;
}

.settings-menu-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 600;
  transition: var(--transition-smooth);
}

.settings-menu-item:hover {
  background: rgba(255, 255, 255, 0.06);
}

.val-label {
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 500;
}

.settings-screen-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px 10px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  margin-bottom: 6px;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--accent-secondary);
}

.btn-settings-back {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-light);
  color: #fff;
  cursor: pointer;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  transition: var(--transition-smooth);
}

.btn-settings-back:hover {
  background: rgba(255, 255, 255, 0.1);
}

.settings-options-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 180px;
  overflow-y: auto;
}

.settings-option-row {
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 600;
  transition: var(--transition-smooth);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.settings-option-row:hover {
  background: rgba(255, 255, 255, 0.05);
}

.settings-option-row.active {
  color: var(--accent-cyan);
  font-weight: 700;
}

.settings-option-row.active::after {
  content: "✓";
  font-weight: bold;
  font-size: 0.8rem;
}

@media (max-width: 1023px) {
  .player-section {
    position: sticky !important;
    top: 60px; /* Aligns below the sticky .mobile-header */
    z-index: 80;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 0 16px 0 !important;
    border-radius: 0 !important;
    border-left: none !important;
    border-right: none !important;
    border-top: none !important;
    border-bottom: 1px solid var(--border-light) !important;
  }
}
