/* =========================================
   RESET & VARIABLES
========================================= */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg-main: #05060a;
  --bg-elevated: #10121b;
  --bg-elevated-soft: #151823;
  --accent: #4f8bff;
  --accent-soft: #7aa4ff;
  --text-primary: #f3f4f8;
  --text-secondary: #a3a6b4;
  --border-subtle: rgba(255, 255, 255, 0.04);
  --radius-lg: 14px;
  --radius-md: 10px;
  --radius-pill: 999px;
  --shadow-soft: 0 18px 45px rgba(0, 0, 0, 0.75);
  --shadow-subtle: 0 10px 30px rgba(0, 0, 0, 0.55);
  --transition-fast: 0.16s ease-out;
  --transition-med: 0.22s ease-out;
}

body {
  background: radial-gradient(circle at top, #161a2b 0, #05060a 55%);
  color: var(--text-primary);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* =========================================
   HEADER (Navigation & Logo)
========================================= */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  padding: 10px 24px;
  background: linear-gradient(180deg, rgba(5, 7, 14, 0.98), rgba(5, 7, 14, 0.94));
  border-bottom: 1px solid rgba(255, 255, 255, 0.02);
  backdrop-filter: blur(16px);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.75);
}

.logo-container {
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 16px;
  padding: 4px 8px;
  background: radial-gradient(circle at top, #202538, #10121b);
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.6);
  transform-origin: left center;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), border-color var(--transition-fast), background var(--transition-fast);
}

.logo-link:hover {
  transform: scale(1.03) translateY(-1px);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.9);
  border-color: rgba(79, 139, 255, 0.5);
  background: radial-gradient(circle at top, #252b40, #111522);
}

header img.logo {
  height: 52px;
  display: block;
}

.brand-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.brand-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--text-secondary);
}

.brand-title {
  font-size: clamp(1.3rem, 1.1rem + 0.6vw, 1.6rem);
  letter-spacing: 0.08em;
  font-weight: 800;
  text-transform: uppercase;
  color: #ffffff;
}

/* Actions Header (Ex: Bouton Ma Liste sur One Piece) */
.header-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  padding-right: 4px;
  gap: 10px;
}

.add-list-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: radial-gradient(circle at 30% 20%, #7aa4ff, #4f8bff);
  color: #f3f4f8;
  font-weight: 800;
  font-size: 1.1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.75);
  cursor: pointer;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), filter var(--transition-fast);
}

.add-list-btn:hover {
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 16px 32px rgba(0, 0, 0, 0.9);
  filter: brightness(1.05);
}

.add-list-btn.added {
  background: radial-gradient(circle at 30% 20%, #5ad0b6, #20a78a);
}

/* Liens de Navigation */
.header-nav {
  margin-left: auto;
}

.header-nav ul {
  display: flex;
  gap: 24px;
  list-style: none;
}

.header-nav a {
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  transition: color var(--transition-fast);
}

.header-nav a:hover {
  color: var(--text-primary);
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
}

/* =========================================
   LAYOUT PRINCIPAL
========================================= */
.content-wrapper {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(280px, 2fr);
  gap: 18px;
  padding: 16px 22px 22px;
  max-width: 1400px;
  margin: 0 auto;
  flex: 1; /* Pousse le footer vers le bas */
  width: 100%;
}

/* Variante : Mode Film (Centré, pas de barre latérale) */
.content-wrapper.film-mode {
  display: flex;
  justify-content: center;
  align-items: center;
  max-width: 1000px;
}

/* =========================================
   LECTEUR VIDÉO & BOUTONS VO/VF
========================================= */
.video-section {
  background: radial-gradient(circle at top left, #1c2235 0, #05060a 50%);
  border-radius: var(--radius-lg);
  padding: 14px;
  box-shadow: var(--shadow-soft);
  display: flex;
  align-items: stretch;
  justify-content: center;
  border: 1px solid var(--border-subtle);
  transition: box-shadow var(--transition-med), transform var(--transition-fast), border-color var(--transition-fast);
}

.video-section.film-mode {
  width: 100%;
}

.video-section:hover {
  transform: translateY(-2px);
  box-shadow: 0 24px 55px rgba(0, 0, 0, 0.85);
  border-color: rgba(79, 139, 255, 0.25);
}

.video-container-inner {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}

/* Switch VO/VF */
.lang-switch {
  display: flex;
  justify-content: center;
  gap: 12px;
  padding: 4px;
}

.lang-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-secondary);
  padding: 8px 24px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  font-weight: 700;
  font-size: 0.9rem;
  letter-spacing: 0.05em;
  transition: all var(--transition-fast);
}

.lang-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
}

.lang-btn.active {
  background: linear-gradient(135deg, #4f8bff, #8ba8ff);
  color: #05060a;
  border-color: transparent;
  box-shadow: 0 4px 15px rgba(79, 139, 255, 0.4);
}

/* Wrapper Iframe 16/9 */
.video-wrapper {
  position: relative;
  width: 100%;
  border-radius: calc(var(--radius-lg) - 3px);
  overflow: hidden;
  background: radial-gradient(circle at top, #22263d, #05070e 60%);
  padding-bottom: 56.25%; /* Ratio 16:9 */
}

.video-player {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
}

/* =========================================
   LISTE DES ÉPISODES (Aside)
========================================= */
aside.episode-list {
  background: radial-gradient(circle at top right, #1a1f33 0, #090b11 55%);
  border-radius: var(--radius-lg);
  padding: 14px 16px 16px;
  box-shadow: var(--shadow-subtle);
  border: 1px solid var(--border-subtle);
  max-height: calc(100vh - 108px);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  /* Support Firefox Scrollbar */
  scrollbar-width: thin;
  scrollbar-color: #353851 #090b11;
}

/* Support Chrome/Safari Scrollbar */
aside.episode-list::-webkit-scrollbar,
.episode-list ul::-webkit-scrollbar {
  width: 8px;
}
aside.episode-list::-webkit-scrollbar-thumb,
.episode-list ul::-webkit-scrollbar-thumb {
  background: linear-gradient(#353851, #23263a);
  border-radius: 8px;
}

aside h2 {
  margin-bottom: 14px;
  text-align: center;
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

/* Dossiers / Arcs Narratifs (balise details) */
.episode-list details {
  margin-bottom: 11px;
  border-radius: var(--radius-md);
  background: linear-gradient(145deg, #121523, #090b13);
  border: 1px solid rgba(255, 255, 255, 0.03);
  overflow: hidden;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast);
}

.episode-list details[open] {
  box-shadow: 0 16px 30px rgba(0, 0, 0, 0.65);
  transform: translateY(-1px);
}

.episode-list summary {
  cursor: pointer;
  padding: 9px 14px;
  font-weight: 700;
  font-size: 0.98rem;
  user-select: none;
  color: #e0e3f5;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 6px;
}

.episode-list summary::-webkit-details-marker {
  display: none;
}

.episode-list summary::after {
  content: "⌄";
  margin-left: auto;
  font-size: 0.88rem;
  color: var(--text-secondary);
  transition: transform var(--transition-fast), color var(--transition-fast);
}

.episode-list details[open] > summary::after {
  transform: rotate(180deg);
  color: var(--accent-soft);
}

/* Liste d'épisodes classique */
.episode-list ul {
  list-style: none;
  margin: 0;
  padding: 4px 6px 10px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  /* Limiter la hauteur si c'est dans un <details> */
  max-height: 320px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #353851 #121523;
}

.episode-list li {
  padding: 8px 12px;
  cursor: pointer;
  border-radius: var(--radius-pill);
  transition: all var(--transition-fast);
  color: #d5d7e5;
  font-weight: 600;
  font-size: 0.92rem;
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.01);
}

.episode-list li::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  flex-shrink: 0;
  transition: all var(--transition-fast);
}

.episode-list li:hover {
  background: rgba(255, 255, 255, 0.06);
  transform: translateX(4px);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.55);
}

.episode-list li:hover::before {
  background: var(--accent-soft);
  transform: scale(1.2);
}

.episode-list li.active {
  background: linear-gradient(135deg, #4f8bff, #8ba8ff);
  color: #05060a;
  font-weight: 800;
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.7), 0 0 0 3px rgba(79, 139, 255, 0.15);
}

.episode-list li.active::before {
  background: #05060a;
}

.episode-list li:active {
  transform: translateX(2px) scale(0.995);
}

/* Badge Hors-série */
.episode-list li.hors-serie {
  color: #ffffff;
  font-style: italic;
  position: relative;
}

.episode-list li.hors-serie::after {
  content: "Hors-série";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: auto;
  font-size: 0.7em;
  color: #05060a;
  background: rgba(243, 244, 248, 0.9);
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-style: normal;
}

.episode-list li.hors-serie.active {
  color: #05060a !important;
}

/* =========================================
   FOOTER
========================================= */
.site-footer {
  text-align: center;
  padding: 24px;
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  border-top: 1px solid rgba(255, 255, 255, 0.03);
  margin-top: 20px;
  background: #030407;
}

/* =========================================
   RESPONSIVE (Mobiles & Tablettes)
========================================= */
@media (max-width: 900px) {
  .content-wrapper {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto;
  }
  aside.episode-list {
    max-height: none;
    order: 2;
  }
  .video-section {
    order: 1;
  }
}

@media (max-width: 640px) {
  .site-header {
    padding-inline: 14px;
  }
  header img.logo {
    height: 46px;
  }
  .brand-title {
    font-size: 1.15rem;
  }
  .header-nav ul {
    gap: 12px;
  }
  .header-nav a {
    font-size: 0.8rem;
  }
  .add-list-btn {
    width: 32px;
    height: 32px;
  }
  .content-wrapper {
    padding-inline: 12px;
  }
  .video-section {
    padding: 10px;
  }
  .lang-btn {
    padding: 6px 18px;
  }
}