/* Расширенный видеоплеер */
.enhanced-video-player {
  position: relative;
  background: #000;
  border-radius: 8px;
  overflow: hidden;
  max-width: 100%;
  margin: 0 auto;
}

.main-video-element {
  width: 100%;
  height: auto;
  display: block;
}

.audio-track {
  display: none;
}

/* Контролы видео */
.video-controls {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
  padding: 20px;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.enhanced-video-player:hover .video-controls,
.enhanced-video-player.controls-visible .video-controls {
  opacity: 1;
}

/* Прогресс бар */
.progress-container {
  margin-bottom: 15px;
}

.progress-bar {
  position: relative;
  height: 6px;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 3px;
  cursor: pointer;
  margin-bottom: 10px;
}

.progress-filled {
  height: 100%;
  background: #007bff;
  border-radius: 3px;
  width: 0%;
  transition: width 0.1s ease;
}

.progress-handle {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  background: #007bff;
  border-radius: 50%;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.3s ease;
  left: 0%;
}

.progress-bar:hover .progress-handle {
  opacity: 1;
}

.time-display {
  color: white;
  font-size: 14px;
  font-family: monospace;
}

/* Кнопки управления */
.control-buttons {
  display: flex;
  align-items: center;
  gap: 15px;
  flex-wrap: wrap;
}

.control-btn {
  background: none;
  border: none;
  color: white;
  font-size: 18px;
  cursor: pointer;
  padding: 8px;
  border-radius: 4px;
  transition: background-color 0.3s ease;
}

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

/* Громкость */
.volume-control {
  display: flex;
  align-items: center;
  gap: 10px;
}

.volume-slider {
  width: 80px;
  height: 4px;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}

.volume-slider::-webkit-slider-thumb {
  appearance: none;
  width: 14px;
  height: 14px;
  background: #007bff;
  border-radius: 50%;
  cursor: pointer;
}

.volume-slider::-moz-range-thumb {
  width: 14px;
  height: 14px;
  background: #007bff;
  border-radius: 50%;
  cursor: pointer;
  border: none;
}

/* Выбор языка */
.audio-language-control {
  display: flex;
  align-items: center;
  gap: 10px;
}

.audio-language-control label {
  color: white;
  font-size: 14px;
}

.language-select {
  padding: 6px 10px;
  border: none;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.9);
  color: #333;
  font-size: 14px;
  cursor: pointer;
}

/* Загрузочный индикатор */
.loading-indicator {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: white;
  text-align: center;
  display: none;
}

.loading-indicator.visible {
  display: block;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid rgba(255, 255, 255, 0.3);
  border-top: 4px solid white;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 10px;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* Центральная кнопка воспроизведения */
.center-play-btn {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  cursor: pointer;
  opacity: 0.8;
  transition: opacity 0.3s ease;
}

.center-play-btn:hover {
  opacity: 1;
}

.center-play-btn.hidden {
  display: none;
}

.play-button-circle {
  width: 80px;
  height: 80px;
  background: rgba(0, 0, 0, 0.7);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 24px;
  border: 3px solid rgba(255, 255, 255, 0.8);
}

/* Полноэкранный режим */
.enhanced-video-player.fullscreen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 9999;
  border-radius: 0;
}

.enhanced-video-player.fullscreen .main-video-element {
  height: 100vh;
  object-fit: contain;
}

/* Страница просмотра */
.watch-page {
  background: #000;
  color: white;
}

.watch-page .header {
  background: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(10px);
}

.watch-page .logo,
.watch-page .nav-link {
  color: white;
}

.watch-page .nav-link:hover {
  color: #007bff;
}

.video-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem;
}

.video-header {
  text-align: center;
  margin-bottom: 2rem;
}

.video-title {
  font-size: 2.5rem;
  margin-bottom: 1rem;
  color: white;
}

.video-description {
  font-size: 1.1rem;
  color: #ccc;
  max-width: 800px;
  margin: 0 auto;
}

.video-info {
  margin-top: 2rem;
  padding: 1.5rem;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  backdrop-filter: blur(10px);
}

.video-stats p {
  margin-bottom: 0.5rem;
  color: #ccc;
}

/* Адаптивность для видеоплеера */
@media (max-width: 768px) {
  .video-container {
    padding: 1rem;
  }

  .video-title {
    font-size: 1.8rem;
  }

  .control-buttons {
    gap: 10px;
  }

  .volume-control {
    display: none;
  }

  .audio-language-control {
    flex-direction: column;
    gap: 5px;
  }

  .play-button-circle {
    width: 60px;
    height: 60px;
    font-size: 18px;
  }
}

@media (max-width: 480px) {
  .video-controls {
    padding: 15px;
  }

  .control-buttons {
    flex-wrap: wrap;
    justify-content: center;
  }

  .progress-bar {
    height: 8px;
  }

  .progress-handle {
    width: 20px;
    height: 20px;
  }
}

/* Enhanced Video Player Styles */
.video-player-wrapper {
    position: relative;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
    max-width: 100%;
}

.enhanced-video-player {
    width: 100%;
    height: auto;
    display: block;
    outline: none;
}

/* Loading overlay */
.video-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: white;
    z-index: 10;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #333;
    border-top: 4px solid #fff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.video-loading p {
    margin: 0;
    font-size: 16px;
    opacity: 0.9;
}

/* Custom video controls */
.custom-video-controls {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 5;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.custom-video-controls.show {
    opacity: 1;
}

.custom-video-controls * {
    pointer-events: auto;
}

.controls-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    background: linear-gradient(
        to bottom,
        rgba(0, 0, 0, 0.7) 0%,
        transparent 20%,
        transparent 80%,
        rgba(0, 0, 0, 0.8) 100%
    );
}

/* Top controls */
.top-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    color: white;
}

.video-title {
    font-size: 18px;
    font-weight: 500;
}

/* Center controls */
.center-controls {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.play-pause-btn {
    background: rgba(0, 0, 0, 0.7);
    border: 3px solid rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    width: 80px;
    height: 80px;
    color: white;
    font-size: 24px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.play-pause-btn:hover {
    background: rgba(0, 0, 0, 0.9);
    border-color: white;
    transform: scale(1.1);
}

/* Bottom controls */
.bottom-controls {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    gap: 15px;
    background: rgba(0, 0, 0, 0.8);
}

.play-pause-btn-small {
    background: transparent;
    border: none;
    color: white;
    font-size: 18px;
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    transition: background 0.3s ease;
}

.play-pause-btn-small:hover {
    background: rgba(255, 255, 255, 0.2);
}

.time-display {
    display: flex;
    align-items: center;
    color: white;
    font-size: 14px;
    font-family: monospace;
    min-width: 100px;
}

.separator {
    margin: 0 5px;
    opacity: 0.7;
}

/* Progress bar */
.progress-container {
    flex: 1;
    margin: 0 15px;
}

.progress-bar {
    position: relative;
    height: 6px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
    cursor: pointer;
    overflow: hidden;
}

.progress-bar:hover {
    height: 8px;
    margin-top: -1px;
}

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

.progress-filled {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: #ff6b6b;
    border-radius: 3px;
    transition: width 0.1s ease;
}

.progress-handle {
    position: absolute;
    top: 50%;
    right: -6px;
    width: 12px;
    height: 12px;
    background: #ff6b6b;
    border-radius: 50%;
    transform: translateY(-50%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.progress-bar:hover .progress-handle {
    opacity: 1;
}

/* Volume controls */
.volume-container {
    display: flex;
    align-items: center;
    gap: 8px;
}

.volume-btn {
    background: transparent;
    border: none;
    color: white;
    font-size: 16px;
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    transition: background 0.3s ease;
}

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

.volume-slider {
    width: 80px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.volume-container:hover .volume-slider {
    opacity: 1;
}

.volume-range {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
    outline: none;
    cursor: pointer;
    -webkit-appearance: none;
}

.volume-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    background: #ff6b6b;
    border-radius: 50%;
    cursor: pointer;
}

.volume-range::-moz-range-thumb {
    width: 12px;
    height: 12px;
    background: #ff6b6b;
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

/* Settings and fullscreen buttons */
.settings-btn,
.fullscreen-btn,
.fullscreen-btn-small {
    background: transparent;
    border: none;
    color: white;
    font-size: 16px;
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    transition: background 0.3s ease;
}

.settings-btn:hover,
.fullscreen-btn:hover,
.fullscreen-btn-small:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Error overlay */
.video-error {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    z-index: 20;
}

.error-content {
    text-align: center;
    padding: 30px;
    max-width: 400px;
}

.error-content h3 {
    margin-bottom: 15px;
    font-size: 24px;
}

.error-content p {
    margin-bottom: 20px;
    opacity: 0.9;
    line-height: 1.5;
}

.error-content .btn {
    background: #ff6b6b;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    transition: background 0.3s ease;
}

.error-content .btn:hover {
    background: #ff5252;
}

/* Fullscreen styles */
.video-player-wrapper.fullscreen {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 9999 !important;
    border-radius: 0 !important;
}

.video-player-wrapper.fullscreen .enhanced-video-player {
    width: 100% !important;
    height: 100% !important;
    object-fit: contain;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .top-controls {
        padding: 10px 15px;
    }
    
    .video-title {
        font-size: 16px;
    }
    
    .play-pause-btn {
        width: 60px;
        height: 60px;
        font-size: 20px;
    }
    
    .bottom-controls {
        padding: 10px 15px;
        gap: 10px;
    }
    
    .time-display {
        font-size: 12px;
        min-width: 80px;
    }
    
    .progress-container {
        margin: 0 10px;
    }
    
    .volume-slider {
        width: 60px;
    }
    
    .volume-container:hover .volume-slider {
        opacity: 1;
    }
    
    /* Always show volume slider on mobile */
    .volume-slider {
        opacity: 1;
    }
}

@media (max-width: 480px) {
    .bottom-controls {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .progress-container {
        order: -1;
        width: 100%;
        margin: 0 0 10px 0;
    }
    
    .time-display {
        font-size: 11px;
    }
    
    .volume-container {
        display: none; /* Hide on very small screens */
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    .custom-video-controls {
        opacity: 1; /* Always show on touch devices */
    }
    
    .progress-bar {
        height: 8px; /* Larger touch target */
    }
    
    .play-pause-btn-small,
    .volume-btn,
    .settings-btn,
    .fullscreen-btn-small {
        padding: 12px; /* Larger touch targets */
    }
    
    .volume-slider {
        opacity: 1; /* Always show volume slider */
    }
}

/* High DPI displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .loading-spinner {
        border-width: 2px;
    }
    
    .progress-bar {
        height: 4px;
    }
    
    .progress-bar:hover {
        height: 6px;
    }
}

/* Accessibility improvements */
.custom-video-controls button:focus {
    outline: 2px solid #ff6b6b;
    outline-offset: 2px;
}

.progress-bar:focus {
    outline: 2px solid #ff6b6b;
    outline-offset: 2px;
}

.volume-range:focus {
    outline: 2px solid #ff6b6b;
    outline-offset: 2px;
}

/* Reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
    .loading-spinner {
        animation: none;
    }
    
    .custom-video-controls,
    .play-pause-btn,
    .progress-filled,
    .buffer-bar {
        transition: none;
    }
}
