/* ==========================================================================
   YouTube-Style Custom Video Player Styles
   Pearls of Quran - High Performance & Responsive
   ========================================================================== */

/* Player Container */
.custom-video-player {
  position: relative;
  width: 100%;
  height: 100%;
  background: #000000;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  font-family: "Roboto", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Video Element */
.custom-video-player video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  background: #000;
  transition: filter 0.3s ease;
}

/* Quality Simulation Filters */
.custom-video-player.quality-720p video {
  filter: contrast(0.99) brightness(0.99);
}
.custom-video-player.quality-480p video {
  filter: blur(0.6px) contrast(0.97);
}
.custom-video-player.quality-360p video {
  filter: blur(1.2px) contrast(0.94);
}

/* Cursor hiding when controls hidden */
.custom-video-player.yt-controls-hidden {
  cursor: none;
}
.custom-video-player.yt-controls-hidden .yt-controls-container,
.custom-video-player.yt-controls-hidden .yt-center-play-btn {
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
}

/* Big Center Play Button Overlay */
.yt-center-play-btn {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 68px;
  height: 48px;
  background: rgba(28, 28, 28, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 14px;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  cursor: pointer;
  z-index: 5;
  transition: all 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  padding-left: 3px; /* visual center for play icon */
}

.yt-center-play-btn:hover {
  background: #ff0000;
  border-color: #ff0000;
  transform: translate(-50%, -50%) scale(1.1);
  box-shadow: 0 10px 30px rgba(255, 0, 0, 0.4);
}

.custom-video-player.playing .yt-center-play-btn {
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -50%) scale(0.85);
}

/* Action Feedback Pulse (When clicking video area) */
.yt-action-feedback {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.5);
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.65);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  opacity: 0;
  pointer-events: none;
  z-index: 6;
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.3s ease;
}

.yt-action-feedback.animate {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1.15);
}

/* Double-tap / Quick Seek Ripples */
.yt-seek-ripple {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 35%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: #ffffff;
  font-size: 20px;
  font-weight: 600;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.2) 0%, transparent 70%);
  opacity: 0;
  pointer-events: none;
  z-index: 6;
  transition: opacity 0.25s ease;
}

.yt-seek-ripple.left {
  left: 0;
  border-top-left-radius: 16px;
  border-bottom-left-radius: 16px;
}

.yt-seek-ripple.right {
  right: 0;
  border-top-right-radius: 16px;
  border-bottom-right-radius: 16px;
}

.yt-seek-ripple.animate {
  opacity: 1;
}

/* Quality Toast Notification */
.yt-toast-badge {
  position: absolute;
  top: 14px;
  left: 14px;
  background: rgba(15, 15, 15, 0.85);
  color: #ffffff;
  padding: 5px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.5px;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-8px);
  transition: all 0.3s ease;
  z-index: 10;
}

.yt-toast-badge.show {
  opacity: 1;
  transform: translateY(0);
}

/* Controls Container */
.yt-controls-container {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 0 10px 8px 10px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.85) 0%, rgba(0, 0, 0, 0.4) 60%, transparent 100%);
  z-index: 10;
  transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1), transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-sizing: border-box;
}

/* Scrubber / Progress Bar Area */
.yt-progress-area {
  position: relative;
  width: 100%;
  height: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
}

.yt-time-tooltip {
  position: absolute;
  bottom: 22px;
  left: 0;
  transform: translateX(-50%);
  background: rgba(28, 28, 28, 0.95);
  color: #ffffff;
  padding: 3px 7px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease;
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.yt-progress-area:hover .yt-time-tooltip {
  opacity: 1;
}

.yt-progress-bar {
  position: relative;
  width: 100%;
  height: 3px;
  background: rgba(255, 255, 255, 0.25);
  border-radius: 2px;
  transition: height 0.15s ease;
}

.yt-progress-area:hover .yt-progress-bar,
.yt-progress-area.dragging .yt-progress-bar {
  height: 5px;
}

.yt-buffer-bar {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 0%;
  background: rgba(255, 255, 255, 0.45);
  border-radius: 2px;
  transition: width 0.2s ease;
}

.yt-hover-bar {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 0%;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 2px;
  pointer-events: none;
}

.yt-played-bar {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 0%;
  background: #ff0000;
  border-radius: 2px;
}

/* Scrubber Thumb */
.yt-scrubber-handle {
  position: absolute;
  right: -6px;
  top: 50%;
  transform: translateY(-50%) scale(0);
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #ff0000;
  box-shadow: 0 0 6px rgba(255, 0, 0, 0.7);
  transition: transform 0.15s ease;
}

.yt-progress-area:hover .yt-scrubber-handle,
.yt-progress-area.dragging .yt-scrubber-handle {
  transform: translateY(-50%) scale(1);
}

/* Controls Row */
.yt-controls-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 36px;
  gap: 4px;
}

.yt-controls-left,
.yt-controls-right {
  display: flex;
  align-items: center;
  gap: 2px;
}

/* Control Buttons */
.yt-btn {
  background: transparent;
  border: none;
  outline: none;
  color: #eeeeee;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  cursor: pointer;
  font-size: 15px;
  transition: color 0.15s ease, transform 0.1s ease, background 0.15s ease;
}

.yt-btn:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.12);
}

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

/* Skip Buttons with relative badge numbers */
.yt-skip-btn {
  position: relative;
  font-size: 14px;
}

.yt-skip-text {
  position: absolute;
  font-size: 8px;
  font-weight: 700;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -46%);
  pointer-events: none;
  letter-spacing: -0.5px;
}

/* Volume Wrapper & Slider */
.yt-volume-wrapper {
  display: flex;
  align-items: center;
}

.yt-volume-slider-box {
  width: 0;
  overflow: hidden;
  transition: width 0.2s cubic-bezier(0.4, 0, 0.2, 1), margin 0.2s ease;
  display: flex;
  align-items: center;
}

.yt-volume-wrapper:hover .yt-volume-slider-box,
.yt-volume-slider-box:focus-within,
.yt-volume-slider-box.active {
  width: 58px;
  margin-right: 4px;
}

.yt-volume-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 58px;
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.35);
  outline: none;
  cursor: pointer;
}

.yt-volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #ffffff;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}

.yt-volume-slider::-moz-range-thumb {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #ffffff;
  cursor: pointer;
  border: none;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}

/* Time Readout */
.yt-time-display {
  color: #dddddd;
  font-size: 11px;
  font-weight: 500;
  padding: 0 6px;
  white-space: nowrap;
  letter-spacing: 0.2px;
}

.yt-time-sep {
  margin: 0 3px;
  opacity: 0.6;
}

/* Quality Indicator Badge */
.yt-quality-indicator {
  background: rgba(255, 255, 255, 0.12);
  color: #f1f1f1;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  letter-spacing: 0.3px;
  margin-right: 2px;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

/* Settings Popover Menu */
.yt-settings-wrapper {
  position: relative;
}

.yt-settings-menu {
  position: absolute;
  bottom: 44px;
  right: 0;
  width: 210px;
  background: rgba(24, 24, 27, 0.96);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.6);
  color: #f4f4f5;
  overflow: hidden;
  display: none;
  z-index: 100;
  animation: ytFadeIn 0.18s cubic-bezier(0, 0, 0.2, 1);
}

.yt-settings-menu.open {
  display: block;
}

@keyframes ytFadeIn {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Settings Views */
.yt-settings-view {
  display: none;
  padding: 6px 0;
}

.yt-settings-view.active {
  display: block;
}

/* Menu Items */
.yt-menu-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 14px;
  font-size: 12px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.yt-menu-item:hover {
  background: rgba(255, 255, 255, 0.1);
}

.yt-menu-item-left {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 500;
}

.yt-menu-item-left i {
  font-size: 13px;
  width: 16px;
  text-align: center;
  opacity: 0.85;
}

.yt-menu-item-right {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: #a1a1aa;
}

.yt-menu-item-right i {
  font-size: 10px;
}

/* Menu Sub-Header (with Back Button) */
.yt-menu-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px 10px 14px;
  font-size: 12px;
  font-weight: 600;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  cursor: pointer;
  color: #ffffff;
  transition: background 0.15s ease;
}

.yt-menu-header:hover {
  background: rgba(255, 255, 255, 0.08);
}

.yt-menu-header i {
  font-size: 11px;
}

/* Menu Select Options */
.yt-menu-options {
  max-height: 220px;
  overflow-y: auto;
  padding-top: 4px;
}

.yt-menu-option {
  display: flex;
  align-items: center;
  padding: 8px 14px;
  font-size: 12px;
  cursor: pointer;
  gap: 10px;
  transition: background 0.15s ease;
  color: #e4e4e7;
}

.yt-menu-option:hover {
  background: rgba(255, 255, 255, 0.1);
}

.yt-menu-option i {
  font-size: 11px;
  width: 14px;
  opacity: 0;
  color: #ff0000;
}

.yt-menu-option.active {
  font-weight: 600;
  color: #ffffff;
}

.yt-menu-option.active i {
  opacity: 1;
}

.yt-quality-badge-tag {
  font-size: 9px;
  background: #ff0000;
  color: #ffffff;
  padding: 1px 5px;
  border-radius: 3px;
  font-weight: 700;
  margin-left: 4px;
}

/* Toggle Switch for Loop */
.yt-switch {
  position: relative;
  display: inline-block;
  width: 28px;
  height: 16px;
}

.yt-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.yt-switch-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(255, 255, 255, 0.25);
  transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 16px;
}

.yt-switch-slider:before {
  position: absolute;
  content: "";
  height: 12px;
  width: 12px;
  left: 2px;
  bottom: 2px;
  background-color: white;
  transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 50%;
}

.yt-switch input:checked + .yt-switch-slider {
  background-color: #ff0000;
}

.yt-switch input:checked + .yt-switch-slider:before {
  transform: translateX(12px);
}

/* Fullscreen Mode Overrides */
:fullscreen .custom-video-player,
:-webkit-full-screen .custom-video-player,
:-moz-full-screen .custom-video-player,
:-ms-fullscreen .custom-video-player {
  width: 100vw;
  height: 100vh;
}

:fullscreen .yt-controls-container,
:-webkit-full-screen .yt-controls-container,
:-moz-full-screen .yt-controls-container,
:-ms-fullscreen .yt-controls-container {
  padding: 0 24px 18px 24px;
}

:fullscreen .yt-btn,
:-webkit-full-screen .yt-btn,
:-moz-full-screen .yt-btn,
:-ms-fullscreen .yt-btn {
  width: 42px;
  height: 42px;
  font-size: 18px;
}

:fullscreen .yt-time-display,
:-webkit-full-screen .yt-time-display,
:-moz-full-screen .yt-time-display,
:-ms-fullscreen .yt-time-display {
  font-size: 13px;
}

/* Fullscreen wrapper override */
.hero-video-wrapper:fullscreen,
.hero-video-wrapper:-webkit-full-screen,
.hero-video-wrapper:-moz-full-screen,
.hero-video-wrapper:-ms-fullscreen {
  max-width: 100vw !important;
  width: 100vw !important;
  height: 100vh !important;
  aspect-ratio: unset !important;
  border-radius: 0 !important;
  border: none !important;
  box-shadow: none !important;
}

/* Responsive adjustments */
@media (max-width: 480px) {
  .yt-skip-btn {
    display: none;
  }
  .yt-volume-wrapper:hover .yt-volume-slider-box {
    width: 46px;
  }
  .yt-quality-indicator {
    display: none;
  }
  .yt-controls-container {
    padding: 0 6px 6px 6px;
  }
  .yt-btn {
    width: 30px;
    height: 30px;
    font-size: 13px;
  }
  .yt-time-display {
    font-size: 10px;
    padding: 0 3px;
  }
}
