/**
 * Custom YouTube Background - Responsive 16/9
 */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

.youtube-background {
  display: block;
  width: 100%;
}

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

/* Fallback pour les navigateurs qui ne supportent pas aspect-ratio */
@supports not (aspect-ratio: 16 / 9) {
  .youtube-background .header {
    height: 0;
    padding-bottom: 56.25%;
  }
}

.youtube-background .header__background {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.youtube-background .header__background iframe {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 100%;
  height: 100%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  object-fit: cover;
}

.youtube-background .header__video-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
  transition: opacity 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94), visibility 0.5s linear;
  z-index: 2;
}

.youtube-background .header__video-overlay--fadeOut {
  opacity: 0;
  visibility: hidden;
}

/* Indicateur de chargement */
.youtube-background .header__loading {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 48px;
  height: 48px;
  border: 4px solid rgba(255, 255, 255, 0.3);
  border-top: 4px solid #ff0000;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  z-index: 5;
  display: none;
}

.youtube-background .header__loading--active {
  display: block;
}

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

/* Bouton Son - en haut à droite */
.youtube-background .header__sound-btn {
  position: absolute;
  z-index: 4;
  top: 20px;
  right: 20px;
  width: 50px;
  height: 50px;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.7);
  cursor: pointer;
  backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  overflow: hidden;
  background-repeat: no-repeat;
  background-position: center;
  background-size: 24px 24px;
}

/* Pas d'effet de survol pour le bouton Sound */
.youtube-background .header__sound-btn:hover {
  background-color: rgba(0, 0, 0, 0.7);
  transform: none;
  background-repeat: no-repeat;
  background-position: center;
  background-size: 24px 24px;
}

.youtube-background .header__sound-btn.sound-on {
  background-image: url("../icons/sound-on.svg");
}

.youtube-background .header__sound-btn.sound-off {
  background-image: url("../icons/sound-off.svg");
}

/* Bouton Lecture/Pause - en bas à droite, toujours visible, sans effet hover */
.youtube-background .header__play-btn {
  position: absolute;
  z-index: 4;
  bottom: 20px;
  right: 20px;
  width: 50px;
  height: 50px;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.7);
  cursor: pointer;
  backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  overflow: hidden;
  background-repeat: no-repeat;
  background-position: center;
  background-size: 24px 24px;
}

/* Pas d'effet de survol pour le bouton Play - identique au bouton Sound */
.youtube-background .header__play-btn:hover {
  background-color: rgba(0, 0, 0, 0.7);
  transform: none;
  background-repeat: no-repeat;
  background-position: center;
  background-size: 24px 24px;
}

/* États du bouton Play */
.youtube-background .header__play-btn.playing {
  background-image: url("../icons/pause.svg");
}

.youtube-background .header__play-btn.paused {
  background-image: url("../icons/play.svg");
}

/* Barre de progression - raccourcie pour ne pas couvrir le bouton */
.youtube-background .header__progress-container {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 80px;
  z-index: 4;
  padding: 20px 20px 20px 30px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.7), transparent);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

/* La barre elle-même reste cliquable */
.youtube-background .header__progress-bar {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 3px;
  cursor: pointer;
  position: relative;
  pointer-events: auto;
}

.youtube-background:hover .header__progress-container {
  opacity: 1;
}

@media (max-width: 768px) {
  .youtube-background .header__progress-container {
    opacity: 1;
    right: 70px;
    padding: 15px 15px 15px 20px;
  }
}

@media (max-width: 480px) {
  .youtube-background .header__progress-container {
    right: 60px;
    padding: 12px 12px 12px 15px;
  }
}

.youtube-background .header__progress-bar:hover {
  height: 8px;
}

.youtube-background .header__progress-fill {
  width: 0%;
  height: 100%;
  background: #ff0000;
  border-radius: 3px;
  transition: width 0.1s linear;
  position: relative;
}

.youtube-background .header__progress-fill::after {
  content: '';
  position: absolute;
  right: -8px;
  top: 50%;
  transform: translateY(-50%);
  width: 12px;
  height: 12px;
  background: white;
  border-radius: 50%;
  opacity: 0;
  transition: opacity 0.2s ease;
  box-shadow: 0 0 6px rgba(0, 0, 0, 0.5);
}

.youtube-background .header__progress-bar:hover .header__progress-fill::after {
  opacity: 1;
}

/* Informations de temps */
.youtube-background .header__time-info {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  color: white;
  font-size: 12px;
  font-family: monospace;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
  pointer-events: none;
}

.youtube-background .header__current-time,
.youtube-background .header__duration {
  background: rgba(0, 0, 0, 0.5);
  padding: 2px 6px;
  border-radius: 4px;
  backdrop-filter: blur(4px);
}

/* Message temporaire */
.youtube-background .header__sound-message {
  position: absolute;
  bottom: 80px;
  right: 20px;
  z-index: 5;
  background: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 14px;
  backdrop-filter: blur(5px);
  pointer-events: none;
  animation: fadeIn 0.3s ease;
  font-family: Arial, sans-serif;
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes soundPulse {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1);
  }
  100% {
    transform: scale(1);
  }
}

.header__sound-btn--active {
  animation: soundPulse 0.3s ease;
}

/* Media Queries Responsive */
@media (max-width: 768px) {
  .youtube-background .header__play-btn,
  .youtube-background .header__sound-btn {
    width: 40px;
    height: 40px;
  }

  .youtube-background .header__sound-btn {
    top: 15px;
    right: 15px;
  }

  .youtube-background .header__play-btn {
    bottom: 15px;
    right: 15px;
  }

  .youtube-background .header__sound-btn {
    background-size: 20px 20px;
  }

  .youtube-background .header__play-btn {
    background-size: 20px 20px;
  }

  .youtube-background .header__progress-bar {
    height: 5px;
  }

  .youtube-background .header__progress-bar:hover {
    height: 5px;
  }

  .youtube-background .header__time-info {
    font-size: 10px;
    margin-top: 6px;
  }

  .youtube-background .header__sound-message {
    bottom: 70px;
    right: 15px;
    font-size: 12px;
    padding: 6px 12px;
  }
}

@media (max-width: 480px) {
  .youtube-background .header__play-btn,
  .youtube-background .header__sound-btn {
    width: 35px;
    height: 35px;
  }

  .youtube-background .header__sound-btn {
    top: 10px;
    right: 10px;
  }

  .youtube-background .header__play-btn {
    bottom: 10px;
    right: 10px;
  }

  .youtube-background .header__sound-btn {
    background-size: 18px 18px;
  }

  .youtube-background .header__play-btn {
    background-size: 18px 18px;
  }

  .youtube-background .header__time-info {
    font-size: 9px;
  }
}

/* Support pour les écrans très larges */
@media (min-width: 1920px) {
  .youtube-background .header {
    max-height: 90vh;
  }
}
