/* --------- Reset simple --------- */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* --------- Mode sombre doux / stylé (par défaut) --------- */
body {
  min-height: 100vh;
  font-family: 'Michroma', sans-serif !important;
  color: #f5f7ff;
  background:
    radial-gradient(circle at top, #22263f 0, #101322 35%, #050712 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow-x: hidden; /* pas de barre horizontale */
}

/* --------- Mode clair --------- */
body.light-mode {
  color: #0b1020;
  background:
    radial-gradient(circle at top, #ffffff 0, #f4f6ff 40%, #dde3ff 100%);
}

/* --------- Layout global --------- */
.page-header {
  width: 100%;
  max-width: 1200px;
  padding: 1.5rem 1.5rem 0.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header-left h1 {
  font-size: clamp(1.8rem, 2.5vw, 2.4rem);
  letter-spacing: 0.05em;
}

.header-left p {
  margin-top: 0.4rem;
  color: #c3c7ff;
  font-size: 0.95rem;
}

body.light-mode .header-left p {
  color: #5b5f82;
}

.page-content {
  width: 100%;
  max-width: 1200px;
  padding: 1rem 1.5rem 3rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2.5rem;
}

/* --------- Toggle thème --------- */
.header-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.theme-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  color: #d9ddff;
}

body.light-mode .theme-toggle {
  color: #333955;
}

.toggle-wrapper {
  position: relative;
}

.theme-toggle input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.toggle-track {
  width: 46px;
  height: 24px;
  border-radius: 999px;
  background: linear-gradient(135deg, #1d2a5a, #06b6d4);
  display: flex;
  align-items: center;
  padding: 2px;
  transition: background 0.25s ease;
}

body.light-mode .toggle-track {
  background: linear-gradient(135deg, #c7d2ff, #7dd3fc);
}

.toggle-thumb {
  width: 20px;
  height: 20px;
  border-radius: 999px;
  background: #f9fafb;
  box-shadow: 0 2px 6px rgba(0,0,0,0.4);
  transform: translateX(0);
  transition: transform 0.25s ease;
}

.theme-toggle input:checked + .toggle-track .toggle-thumb {
  transform: translateX(22px);
}

/* --------- Lecteur principal --------- */
.video-container {
  position: relative;
  width: min(60vw, 900px);
  aspect-ratio: 16/9;
  border-radius: 18px;
  overflow: hidden;
  box-shadow:
    0 25px 60px rgba(0, 0, 0, 0.7),
    0 0 0 1px rgba(255, 255, 255, 0.08);
  background: radial-gradient(circle at top left, #1d2033, #05060c);
}

body.light-mode .video-container {
  box-shadow:
    0 18px 40px rgba(148, 163, 184, 0.6),
    0 0 0 1px rgba(148, 163, 184, 0.6);
  background: radial-gradient(circle at top left, #e5ebff, #f1f5f9);
}

video#mainVideo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  cursor: pointer;
}

/* --------- Contrôles du lecteur --------- */
.controls {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;

  display: flex;
  flex-wrap: wrap;          /* permet une deuxième ligne */
  align-items: center;
  gap: 0.5rem;

  padding: 0.6rem 0.75rem 0.9rem;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.85), transparent);
  backdrop-filter: blur(12px);
  color: #f5f7ff;

  /* état par défaut = caché, géré par JS avec .visible/.hidden */
  opacity: 0;
  transform: translateY(100%);
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

body.light-mode .controls {
  background: linear-gradient(to top, rgba(15, 23, 42, 0.3), transparent);
  color: #0b1020;
}

#playPauseBtn,
#fullscreenBtn {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

/* Groupes volume + vitesse */
.control-group {
  display: flex;
  align-items: center;
}

.controls select {
  padding: 0.2rem 0.4rem;
  border-radius: 999px;
  background: rgba(13, 17, 36, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 0.85rem;
  color: #e5e7eb;
}

body.light-mode .controls select {
  background: rgba(226, 232, 240, 0.9);
  color: #0f172a;
  border-color: rgba(148, 163, 184, 0.8);
}

/* Slider volume */
.controls input[type="range"] {
  width: 6vw;
  min-width: 60px;
  accent-color: #06b6d4;
}

/* Barre de progression */
.progress-container {
  flex-grow: 1;
  height: 0.6rem;
  background: rgba(255, 255, 255, 0.2);
  margin: 0 0.5vw;
  border-radius: 999px;
  cursor: pointer;
  overflow: hidden;
}

body.light-mode .progress-container {
  background: rgba(148, 163, 184, 0.5);
}

.progress {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #1d4ed8, #06b6d4);
  border-radius: 999px;
}

/* Temps */
#time {
  font-size: 0.8rem;
  min-width: 5.2em;
  text-align: right;
  color: #e1e3ff;
}

body.light-mode #time {
  color: #1e293b;
}

/* Accessibilité visuelle pour les labels cachés */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* --------- Boutons de chapitres --------- */
.video-chapters {
  width: 100%;
  max-width: 900px;
  margin: 1rem auto 0.5rem;

  padding: 0.6rem 0.8rem;
  border-radius: 999px;

  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.6rem;

  background: radial-gradient(
    circle at top left,
    rgba(15, 23, 42, 0.95),
    rgba(15, 23, 42, 0.75)
  );
  box-shadow:
    0 14px 30px rgba(0, 0, 0, 0.7),
    0 0 0 1px rgba(148, 163, 184, 0.35);
  backdrop-filter: blur(12px);
}

.video-chapters .jump-btn {
  font-size: 0.8rem;
  padding: 0.45rem 1rem 0.45rem 1.6rem;
  text-transform: none;
  white-space: nowrap;
  position: relative;
}

/* pastille de chapitre à gauche */
.video-chapters .jump-btn::before {
  content: "";
  position: absolute;
  left: 0.7rem;
  top: 50%;
  transform: translateY(-50%);
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #38bdf8;
  box-shadow:
    0 0 6px rgba(56, 189, 248, 0.9),
    0 0 14px rgba(59, 130, 246, 0.7);
}

/* --------- Overlay quiz --------- */
.quiz-overlay {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.75);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.quiz-box {
  background: rgba(15, 23, 42, 0.95);
  border-radius: 16px;
  padding: 1rem 1.25rem;
  max-width: 480px;
  width: 100%;
  box-shadow:
    0 18px 40px rgba(0, 0, 0, 0.9),
    0 0 0 1px rgba(148, 163, 184, 0.5);
}

body.light-mode .quiz-box {
  background: #f9fafb;
  box-shadow:
    0 14px 30px rgba(148, 163, 184, 0.6),
    0 0 0 1px rgba(148, 163, 184, 0.7);
}

.quiz-question {
  font-size: 0.95rem;
  margin-bottom: 0.8rem;
}

.quiz-buttons {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 0.6rem;
}

.quiz-answer {
  font-size: 0.85rem;
  padding: 0.4rem 0.8rem;
}

.quiz-feedback {
  font-size: 0.9rem;
  margin-bottom: 0.6rem;
}

.quiz-continue-btn {
  display: none;
  font-size: 0.85rem;
}

/* --------- Section commentaires --------- */
.comments-section {
  width: 100%;
  max-width: 900px;
  background: rgba(15, 23, 42, 0.9);
  border-radius: 18px;
  padding: 1rem 1.25rem 1.4rem;
  box-shadow:
    0 18px 40px rgba(0, 0, 0, 0.8),
    0 0 0 1px rgba(148, 163, 184, 0.3);
}

body.light-mode .comments-section {
  background: rgba(248, 250, 252, 0.96);
  box-shadow:
    0 14px 30px rgba(148, 163, 184, 0.5),
    0 0 0 1px rgba(148, 163, 184, 0.5);
}

.comments-section h2 {
  font-size: 1.1rem;
  margin-bottom: 0.75rem;
  color: #e5e7ff;
}

body.light-mode .comments-section h2 {
  color: #111827;
}

/* Formulaire de commentaire */
.comment-form {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.comment-form textarea {
  resize: vertical;
  min-height: 70px;
  max-height: 160px;
  padding: 0.6rem 0.8rem;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.7);
  background: rgba(15, 23, 42, 0.85);
  color: #f9fafb;
  font-size: 0.9rem;
}

.comment-form textarea::placeholder {
  color: #9ca3af;
}

body.light-mode .comment-form textarea {
  background: #f9fafb;
  color: #0b1020;
  border-color: rgba(148, 163, 184, 0.9);
}

.comment-form-actions {
  display: flex;
  justify-content: flex-end;
}

#publishCommentBtn {
  padding: 0.4rem 0.9rem;
  font-size: 0.9rem;
}

/* Liste de commentaires */
.comments-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.comment {
  padding: 0.6rem 0.7rem;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(148, 163, 184, 0.4);
}

body.light-mode .comment {
  background: #ffffff;
  border-color: rgba(148, 163, 184, 0.7);
}

.comment-meta {
  font-size: 0.75rem;
  color: #9ca3af;
  margin-bottom: 0.25rem;
}

body.light-mode .comment-meta {
  color: #6b7280;
}

.comment-text {
  font-size: 0.9rem;
  line-height: 1.4;
  margin-bottom: 0.35rem;
}

.comment-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* --------- Carrousel style Netflix --------- */
.carousel-section {
  width: 100%;
  max-width: 1200px;
}

.carousel-section h2 {
  font-size: 1.2rem;
  margin-bottom: 0.8rem;
  color: #dde1ff;
}

body.light-mode .carousel-section h2 {
  color: #111827;
}

.carousel-container {
  position: relative;
  width: 100%;
  overflow: hidden;
  padding: 0.5rem 2.5rem;
}

.carousel {
  display: flex;
  gap: 1rem;
  scroll-behavior: smooth;
}

/* Carte Netflix */
.carousel-item {
  flex-shrink: 0;
  width: 18vw;
  max-width: 220px;
  min-width: 140px;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: linear-gradient(
    145deg,
    rgba(21, 24, 45, 0.95),
    rgba(5, 7, 20, 0.95)
  );
  border-radius: 14px;
  padding: 0.4rem;
  box-shadow: 0 12px 25px rgba(0, 0, 0, 0.7);
  border: 1px solid transparent;
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease,
    border-color 0.2s ease;
}

body.light-mode .carousel-item {
  background: linear-gradient(
    145deg,
    rgba(226, 232, 240, 0.95),
    rgba(241, 245, 249, 0.95)
  );
  box-shadow: 0 10px 22px rgba(148, 163, 184, 0.9);
}

.carousel-item video {
  width: 100%;
  aspect-ratio: 16/9;
  border-radius: 10px;
  object-fit: cover;
  cursor: pointer;
}

/* Légendes */
.caption {
  margin-top: 0.35rem;
  font-size: 0.8rem;
  color: #c7cbff;
  text-align: center;
}

body.light-mode .caption {
  color: #374151;
}

/* Effet survol Netflix */
.carousel-item:hover {
  transform: scale(1.05) translateY(-4px);
  box-shadow:
    0 18px 40px rgba(0, 0, 0, 0.9),
    0 0 0 1px rgba(255, 255, 255, 0.18);
}

/* État actif (vidéo actuellement lue) */
.carousel-item.active {
  border-color: #38bdf8;
  box-shadow:
    0 0 20px rgba(56, 189, 248, 0.7),
    0 12px 30px rgba(15, 23, 42, 0.9);
}

body.light-mode .carousel-item.active {
  border-color: #2563eb;
  box-shadow:
    0 0 20px rgba(37, 99, 235, 0.4),
    0 10px 24px rgba(148, 163, 184, 0.9);
}

/* Boutons carrousel */
.carousel-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  padding: 0;
  border-radius: 50%;
  font-size: 2rem;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
}

.carousel-btn.left {
  left: 0.6rem;
}

.carousel-btn.right {
  right: 0.6rem;
}

/* ============================
   Like / Dislike (hors vidéo)
   ============================ */
.video-actions {
  width: 100%;
  max-width: 900px;
  margin: 1.5rem auto 2rem auto;
  display: flex;
  justify-content: center;
  gap: 1rem;
  padding: 0 0.5rem;
}

/* ============================
   Boutons glow violet / bleu
   ============================ */
button,
.btn-primary,
#playPauseBtn,
#fullscreenBtn,
.carousel-btn,
.video-actions button,
.comment-btn,
.comment-like-btn,
.comment-dislike-btn,
.comment-delete-btn,
.quiz-answer,
.quiz-continue-btn,
.jump-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;

  padding: 0.6rem 1.4rem;
  border-radius: 999px;
  border: none;
  outline: none;

  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;

  cursor: pointer;
  color: #ffffff;

  background: linear-gradient(120deg, #7b2ff7, #4c00ff, #007bff, #7b2ff7);
  background-size: 280% 280%;
  animation: btnGradientShift 4s ease-in-out infinite;

  transition:
    transform 0.2s ease,
    box-shadow 0.25s ease,
    filter 0.25s ease,
    background-position 0.35s ease;
}

/* Glow externe */
button::before,
.btn-primary::before,
#playPauseBtn::before,
#fullscreenBtn::before,
.carousel-btn::before,
.video-actions button::before,
.comment-btn::before,
.comment-like-btn::before,
.comment-dislike-btn::before,
.comment-delete-btn::before,
.quiz-answer::before,
.quiz-continue-btn::before,
.jump-btn::before {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: inherit;
  background: inherit;
  filter: blur(18px);
  opacity: 0.75;
  z-index: -1;
  transition: opacity 0.3s ease, filter 0.3s ease;
}

/* Hover */
button:hover,
.btn-primary:hover,
#playPauseBtn:hover,
#fullscreenBtn:hover,
.carousel-btn:hover,
.video-actions button:hover,
.comment-btn:hover,
.comment-like-btn:hover,
.comment-dislike-btn:hover,
.comment-delete-btn:hover,
.quiz-answer:hover,
.quiz-continue-btn:hover,
.jump-btn:hover {
  transform: translateY(-2px) scale(1.04);
  filter: brightness(1.15);
  background-position: 100% 50%;
  box-shadow:
    0 0 18px rgba(123, 47, 247, 0.85),
    0 0 38px rgba(76, 0, 255, 0.75),
    0 0 60px rgba(0, 123, 255, 0.55);
}

button:hover::before,
.btn-primary:hover::before,
#playPauseBtn:hover::before,
#fullscreenBtn:hover::before,
.carousel-btn:hover::before,
.video-actions button:hover::before,
.comment-btn:hover::before,
.comment-like-btn:hover::before,
.comment-dislike-btn:hover::before,
.comment-delete-btn:hover::before,
.quiz-answer:hover::before,
.quiz-continue-btn:hover::before,
.jump-btn:hover::before {
  opacity: 1;
  filter: blur(23px);
}

/* Clic */
button:active,
.btn-primary:active,
#playPauseBtn:active,
#fullscreenBtn:active,
.carousel-btn:active,
.video-actions button:active,
.comment-btn:active,
.comment-like-btn:active,
.comment-dislike-btn:active,
.comment-delete-btn:active,
.quiz-answer:active,
.quiz-continue-btn:active,
.jump-btn:active {
  transform: translateY(1px) scale(0.96);
  background: linear-gradient(135deg, #3c00ff, #007bff, #00c2ff);
  background-size: 220% 220%;
  box-shadow: 0 0 12px rgba(0, 0, 0, 0.9);
}

button:active::before,
.btn-primary:active::before,
#playPauseBtn:active::before,
#fullscreenBtn:active::before,
.carousel-btn:active::before,
.video-actions button:active::before,
.comment-btn:active::before,
.comment-like-btn:active::before,
.comment-dislike-btn:active::before,
.comment-delete-btn:active::before,
.quiz-answer:active::before,
.quiz-continue-btn:active::before,
.jump-btn:active::before {
  opacity: 0.45;
  filter: blur(14px);
}

/* Animation du gradient */
@keyframes btnGradientShift {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

/* Ajustements spécifiques */
#playPauseBtn,
#fullscreenBtn {
  width: 2.6rem;
  height: 2.6rem;
  padding: 0;
  font-size: 1.2rem;
}

.video-actions button span {
  font-size: 0.95rem;
}

/* État actif persistant (like/dislike sélectionné) */
.video-actions button.active {
  filter: brightness(1.2);
  box-shadow:
    0 0 22px rgba(123, 47, 247, 0.9),
    0 0 40px rgba(76, 0, 255, 0.85);
}

/* --------- Responsive --------- */
@media (max-width: 900px) {
  .page-content {
    padding-inline: 1rem;
  }

  .video-container {
    width: 90vw;
  }

  .carousel-item {
    width: 30vw;
    max-width: 220px;
  }

  .controls input[type="range"] {
    width: 15vw;
  }
}

@media (max-width: 600px) {
  .controls {
    font-size: 0.9rem;
  }

  #time {
    display: none;
  }

  .video-chapters {
    border-radius: 18px;
    padding: 0.6rem;
    gap: 0.4rem;
  }

  .video-chapters .jump-btn {
    font-size: 0.7rem;
    padding: 0.35rem 0.8rem 0.35rem 1.4rem;
  }

  .carousel-item {
    width: 55vw;
  }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  .header-right {
    align-self: flex-end;
  }
}

/* --------- Auto-hide contrôles (couplé au JS) --------- */
/* Contrôles visibles (utilisé par le JS) */
.controls.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

/* Contrôles cachés */
.controls.hidden {
  opacity: 0;
  transform: translateY(100%);
  pointer-events: none;
}

/* En fullscreen : léger décalage si tu veux */
.fullscreen-mode .controls {
  bottom: 20px; /* tu peux remettre 0 si tu préfères */
}
