.advanced-video-player {
  position: relative;
  width: 100%;
  background: #000;
  border-radius: 12px;
  overflow: hidden;
  font-family: "DM Sans", sans-serif;
}

.video-container {
  position: relative;
  width: 100%;
  height: 100%;
  max-height: 70vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.video-element {
  width: 100%;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  display: block;
  background: #000;
  object-fit: contain;
}

.video-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.play-button-overlay {
  pointer-events: all;
}

.play-btn-large {
  background: rgba(255, 255, 255, 0.9);
  border: none;
  border-radius: 50%;
  width: 80px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
}

.play-btn-large:hover {
  background: rgba(255, 255, 255, 1);
  transform: scale(1.1);
}

.play-btn-large i {
  font-size: 2rem;
  color: #4b0082;
  margin-left: 4px;
}

.loading-indicator {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: none;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.loading-indicator .spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-top: 3px solid #fff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.video-controls {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
  padding: 20px 16px 16px;
  opacity: 0;
  transform: translateY(100%);
  transition: all 0.3s ease;
  pointer-events: none;
}

.video-controls.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: all;
}

.progress-container {
  position: relative;
  margin-bottom: 12px;
}

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

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

.progress-filled {
  height: 100%;
  background: linear-gradient(90deg, #4b0082, #ff1493);
  border-radius: 3px;
  transition: width 0.1s ease;
}

.progress-handle {
  position: absolute;
  top: 50%;
  width: 16px;
  height: 16px;
  background: #fff;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  opacity: 0;
  transition: opacity 0.2s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

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

.time-tooltip {
  position: absolute;
  bottom: 100%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.8rem;
  white-space: nowrap;
  margin-bottom: 8px;
  display: none;
  pointer-events: none;
}

.controls-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

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

.control-btn {
  background: none;
  border: none;
  color: white;
  cursor: pointer;
  padding: 8px;
  border-radius: 4px;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
}

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

.control-btn i {
  font-size: 1rem;
}

.volume-slider {
  display: flex;
  align-items: center;
  opacity: 0;
  width: 0;
  overflow: hidden;
  transition: all 0.3s ease;
}

.controls-left:hover .volume-slider {
  opacity: 1;
  width: 80px;
  margin-left: 8px;
}

.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: #fff;
  border-radius: 50%;
  cursor: pointer;
}

.time-display {
  color: white;
  font-size: 0.9rem;
  font-weight: 500;
  white-space: nowrap;
}

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

.playback-rate-container {
  position: relative;
}

.playback-rate-btn {
  min-width: 40px;
  font-size: 0.9rem;
  font-weight: 500;
}

.playback-rate-menu {
  position: absolute;
  bottom: 100%;
  right: 0;
  background: rgba(0, 0, 0, 0.9);
  border-radius: 8px;
  padding: 8px;
  margin-bottom: 8px;
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.2s ease;
  pointer-events: none;
  backdrop-filter: blur(10px);
}

.playback-rate-menu.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: all;
}

.rate-option {
  display: block;
  width: 100%;
  background: none;
  border: none;
  color: white;
  padding: 8px 16px;
  text-align: left;
  cursor: pointer;
  border-radius: 4px;
  transition: background 0.2s ease;
  font-size: 0.9rem;
}

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

.rate-option.active {
  background: linear-gradient(90deg, #4b0082, #ff1493);
  color: white;
}

/* Fullscreen styles */
.advanced-video-player:-webkit-full-screen {
  width: 100vw;
  height: 100vh;
}

.advanced-video-player:-moz-full-screen {
  width: 100vw;
  height: 100vh;
}

.advanced-video-player:fullscreen {
  width: 100vw;
  height: 100vh;
}

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

/* Responsive design */
@media (max-width: 768px) {
  .controls-row {
    gap: 4px;
  }

  .controls-left,
  .controls-right {
    gap: 4px;
  }

  .control-btn {
    min-width: 28px;
    height: 28px;
    padding: 6px;
  }

  .time-display {
    font-size: 0.8rem;
  }

  .volume-slider {
    display: none;
  }

  .play-btn-large {
    width: 60px;
    height: 60px;
  }

  .play-btn-large i {
    font-size: 1.5rem;
  }

  .video-container {
    max-height: 60vh;
  }

  .video-element {
    max-height: 60vh;
  }
}

@media (max-width: 576px) {
  .modal-dialog {
    margin: 0;
    height: 100%;
  }
  .modal-content {
    height: 100%;
    border-radius: 0;
  }
  .modal-body {
    max-height: unset;
    overflow-y: auto;
    padding: 0.5rem;
  }

  .video-container {
    max-height: 50vh;
  }
}

/* Medios fluidos dentro del modal */
.modal-body img,
.modal-body video,
.modal-body iframe {
  width: 100%;
  height: auto;
  display: block;
  max-width: 100%;
  object-fit: contain;
}

.modal-body .advanced-video-player {
  max-width: 100%;
  max-height: 70vh;
}

.modal-body .video-element {
  max-height: 60vh;
}

@media (max-width: 576px) {
  .modal-body .advanced-video-player {
    max-height: 50vh;
  }

  .modal-body .video-element {
    max-height: 50vh;
  }
}

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

/* Adaptaciones para teléfonos */
@media (max-width: 480px) {
  .video-container {
    max-height: 60vh;
    padding: 10px;
  }
  
  .video-element {
    max-height: 55vh;
  }
  
  .video-controls {
    padding: 8px;
    font-size: 14px;
  }
}

@media (max-width: 375px) {
  .video-container {
    max-height: 50vh;
    padding: 8px;
  }
  
  .video-element {
    max-height: 45vh;
  }
}

@media (max-width: 480px) and (orientation: landscape) {
  .video-container {
    max-height: 80vh;
  }
  
  .video-element {
    max-height: 75vh;
  }
}
