/* ==========================================================================
   STEALTH YOUTUBE VIDEO PLAYER - Custom Controls & Mobile Optimization
   ========================================================================== */

.stealth-player-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000000;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.6);
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

/* YouTube IFrame Embed Container */
.stealth-iframe-container {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none; /* Disables direct iframe clicks so YT links can't be clicked */
}

.stealth-iframe-container iframe {
  width: 100%;
  height: 100%;
  border: 0;
  object-fit: cover;
}

/* Stealth Overlay Shields (Hides YouTube Title, Channel, Share, Logo) */
.stealth-shield-top {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 65px;
  z-index: 12;
  background: linear-gradient(180deg, rgba(0,0,0,0.85) 0%, transparent 100%);
  pointer-events: auto;
  cursor: pointer;
}

.stealth-shield-bottom-right {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 140px;
  height: 55px;
  z-index: 12;
  background: transparent;
  pointer-events: auto;
  cursor: pointer;
}

/* Video Title in Custom Header Shield */
.player-top-header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  padding: 1rem 1.25rem;
  z-index: 13;
  display: flex;
  align-items: center;
  justify-content: space-between;
  pointer-events: none;
}

.player-lesson-badge {
  background: rgba(99, 102, 241, 0.25);
  border: 1px solid var(--accent-primary);
  color: var(--text-main);
  padding: 0.25rem 0.65rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.player-lesson-title {
  color: var(--text-main);
  font-size: 1rem;
  font-weight: 600;
  text-shadow: 0 2px 4px rgba(0,0,0,0.8);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 70%;
}

/* Center Click & Big Play Overlay */
.center-play-overlay {
  position: absolute;
  inset: 0;
  z-index: 14;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.3);
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.25s ease;
  -webkit-tap-highlight-color: transparent;
}

.stealth-player-wrapper.is-paused .center-play-overlay,
.stealth-player-wrapper:hover .center-play-overlay {
  opacity: 1;
}

.center-play-btn {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: var(--accent-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 1.8rem;
  box-shadow: 0 0 30px rgba(99, 102, 241, 0.6);
  transform: scale(0.9);
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  padding-left: 4px;
}

.center-play-overlay:hover .center-play-btn {
  transform: scale(1.1);
}

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

.stealth-player-wrapper:hover .custom-player-controls,
.stealth-player-wrapper.is-paused .custom-player-controls {
  opacity: 1;
}

/* Seekbar Track */
.seekbar-container {
  position: relative;
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  cursor: pointer;
  touch-action: none;
}

.seekbar-fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0%;
  background: var(--accent-gradient);
  border-radius: 4px;
  box-shadow: 0 0 10px rgba(99, 102, 241, 0.8);
}

.seekbar-thumb {
  position: absolute;
  top: 50%;
  left: 0%;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #ffffff;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 8px rgba(0, 0, 0, 0.5);
}

.seekbar-tooltip {
  position: absolute;
  bottom: 18px;
  transform: translateX(-50%);
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  font-size: 0.75rem;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease;
  white-space: nowrap;
}

.seekbar-container:hover .seekbar-tooltip {
  opacity: 1;
}

/* Controls Toolbar Items */
.controls-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

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

.ctrl-btn {
  background: transparent;
  color: var(--text-main);
  font-size: 1.1rem;
  padding: 0.35rem;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  min-height: 36px;
  touch-action: manipulation;
}

.ctrl-btn:hover {
  color: var(--accent-secondary);
}

.time-display {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  font-family: var(--font-heading);
}

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

.volume-slider {
  width: 0px;
  opacity: 0;
  height: 4px;
  accent-color: var(--accent-primary);
  transition: width 0.25s ease, opacity 0.25s ease;
  cursor: pointer;
}

.volume-wrapper:hover .volume-slider {
  width: 70px;
  opacity: 1;
}

/* Speed Dropdown Menu */
.speed-selector-wrapper {
  position: relative;
}

.speed-badge-btn {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  font-size: 0.8rem;
  padding: 0.25rem 0.55rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  min-height: 32px;
}

.speed-menu {
  position: absolute;
  bottom: 35px;
  right: 0;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
  display: none;
  z-index: 20;
}

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

.speed-option {
  background: transparent;
  color: var(--text-muted);
  font-size: 0.8rem;
  padding: 0.4rem 0.85rem;
  text-align: left;
  border-radius: 4px;
  touch-action: manipulation;
}

.speed-option:hover, .speed-option.active {
  background: var(--accent-primary);
  color: #fff;
}

/* Mobile Player Specific Overrides */
@media (max-width: 576px) {
  .player-top-header {
    padding: 0.5rem 0.75rem;
  }
  .player-lesson-badge {
    font-size: 0.65rem;
    padding: 0.15rem 0.45rem;
  }
  .player-lesson-title {
    font-size: 0.85rem;
  }
  .custom-player-controls {
    padding: 0.5rem 0.75rem;
  }
  .center-play-btn {
    width: 52px;
    height: 52px;
    font-size: 1.4rem;
  }
  .volume-wrapper {
    display: none; /* Hide volume slider on mobile, volume controlled by phone hardware buttons */
  }
}
