/* ==========================================================================
   NOVANIME - PAGES STYLES
   Version: 2.1 (Refactored)
   Description: Styles optimisés pour les pages anime, épisodes, listes, player & detail
   ========================================================================== */

/* ==========================================================================
   TABLE OF CONTENTS
   ==========================================================================
   1. Base & Utilities
   2. Player Section
      2.1 Container & Overlays
      2.2 Controls Bar & Nav
      2.3 Episode Dropdown & Menu
      2.4 Server/Player Switcher
   3. Cards & Grids
      3.1 Glass Episodes Grid (Home)
      3.2 Anime List Grid
      3.3 Pagination
   4. Anime Detail Layout
      4.1 Main Grid & Info Card
      4.2 Synopsis & Header
      4.3 Season Titles
   5. Comments & Forms
   6. Watchlist & Profile
   7. UI Elements (Badges, Tags, Buttons)
   8. Responsive & Motion
   ========================================================================== */

/* ==========================================================================
   1. BASE & UTILITIES
   ========================================================================== */

/* CRITICAL: Prevent horizontal overflow at root level */
html, body {
  overflow-x: hidden;
  max-width: 100%;
}

.text-shadow { text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8); }
.hover-opacity:hover { opacity: 0.8; }

/* Accessibilité : désactive les animations si préféré par l'utilisateur */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Fix player header visibility on touch devices */
@media (hover: none) {
  .player-header { opacity: 1; }
}

/* ==========================================================================
   2. PLAYER SECTION
   ========================================================================== */

/* 2.1 Container & Overlays */
.player-container { position: relative; width: 100%; background: #000; }

.player-wrapper {
  position: relative;
  width: 100%;
  padding-top: 56.25%; /* 16:9 */
  background: #000;
  overflow: hidden;
}

.player-wrapper iframe {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%;
  border: none;
}

/* Header overlay */
.player-header {
  position: absolute; top: 0; left: 0; width: 100%;
  padding: 15px;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.8), transparent);
  z-index: 10; opacity: 0;
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  transition: opacity var(--transition-normal, 0.3s ease);
}
.player-wrapper:hover .player-header { opacity: 1; }

/* Click-to-play screen */
.player-start-screen {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; gap: 0.5rem;
  justify-content: center; align-items: center;
  z-index: 100; cursor: pointer;
  /* Le fond est maintenant l'image .bg-blur-overlay avec z-index: 0 */
}

/* Contenu au-dessus de l'image de fond */
.player-start-screen > div:last-child,
.player-start-screen .position-relative {
  position: relative;
  z-index: 2;
}
.player-start-screen .play-btn {
  width: 80px; height: 80px;
  display: flex; justify-content: center; align-items: center;
  background: var(--primary-red);
  border-radius: 50%; font-size: 30px; color: #fff;
  box-shadow: 0 0 30px rgba(var(--primary-red-rgb, 197, 0, 0), 0.5);
  margin-bottom: 1rem;
  transition: transform var(--transition-fast, 0.2s ease), box-shadow var(--transition-fast, 0.2s ease);
}
.player-start-screen .play-btn i { margin: 0; transform: translateX(1px); }
.player-start-screen:hover .play-btn {
  transform: scale(1.1);
  box-shadow: 0 0 40px rgba(var(--primary-red-rgb, 197, 0, 0), 0.7);
}

/* Ad overlay */
.ad-overlay {
  position: absolute; inset: 0;
  display: none; justify-content: center; align-items: center;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(5px);
  z-index: 99;
}
.ad-close-btn { position: absolute; top: 10px; right: 10px; z-index: 100; }

/* Overlay fill helper - positionne l'image de fond */
.overlay-fill {
  position: absolute;
  inset: 0;
  z-index: 0;
}

.bg-blur-overlay {
  background-size: cover;
  background-position: center;
  filter: blur(10px);
  opacity: 0.5;
}
.player-start-screen__content { position: relative; z-index: 1; }

/* Ad overlay - hidden by default */
#ad-overlay-container {
  display: none;
  position: absolute; inset: 0;
  justify-content: center; align-items: center;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(5px);
  z-index: 99;
}
#ad-overlay-container.active { display: flex; }

/* Report button */
.report-btn {
  width: 32px; height: 32px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%;
  border: 1px solid var(--color-warning, #ffc107);
  background: transparent; color: var(--color-warning, #ffc107);
  cursor: pointer;
}
.report-btn:hover { background: rgba(var(--color-warning-rgb, 255, 193, 7), 0.15); }

.download-label { display: none; }
@media (min-width: 768px) { .download-label { display: inline; } }

/* 2.2 Controls Bar */
.controls-bar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 15px; padding: 15px 20px;
  background: var(--main-black);
  border-top: 1px solid var(--border-light);
  margin-bottom: 20px;
}
.nav-group { display: flex; align-items: center; flex-wrap: nowrap; gap: 10px; }

.nav-btn {
  width: 38px; height: 38px;
  display: flex; align-items: center; justify-content: center;
  background: var(--main-black);
  border: 1px solid #333; border-radius: var(--radius-sm, 6px);
  color: var(--text-secondary);
  transition: all var(--transition-fast, 0.2s ease);
}
.nav-btn:hover:not(.disabled) { background: #252525; border-color: #555; color: #fff; }
.nav-btn.disabled { opacity: 0.3; pointer-events: none; cursor: not-allowed; }

/* 2.3 Episode Dropdown */
.ep-dropdown { position: relative; z-index: 1000; }

.ep-menu {
  display: none;
  position: absolute; top: calc(100% + 8px); left: 0;
  width: 260px; max-height: 50vh;
  overflow-y: auto; overscroll-behavior: contain;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm, 6px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
  padding: 8px 0;
}
.ep-dropdown.active .ep-menu { display: block; }

.ep-trigger {
  display: flex; align-items: center; gap: 10px; min-width: 160px;
  padding: 10px 40px 10px 15px;
  background: var(--main-black);
  border: 1px solid #333; border-radius: var(--radius-sm, 6px);
  color: #fff; font-size: 0.9rem; font-weight: 500;
  cursor: pointer; position: relative;
  transition: border-color var(--transition-fast, 0.2s ease);
}
.ep-trigger:hover { border-color: var(--primary-red); }

.ep-trigger::after {
  content: ''; position: absolute; right: 15px; top: 50%;
  transform: translateY(-50%);
  border: 5px solid transparent; border-top-color: #888;
  transition: transform var(--transition-fast, 0.2s ease);
}
.ep-dropdown.active .ep-trigger::after {
  transform: translateY(-50%) rotate(180deg); border-top-color: var(--primary-red);
}

.ep-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 15px; color: var(--text-secondary);
  text-decoration: none; font-size: 0.85rem;
  border-bottom: 1px solid var(--border-light);
  transition: all var(--transition-fast, 0.2s ease);
}
.ep-item:last-child { border-bottom: none; }
.ep-item:hover { background: rgba(var(--accent-focus-rgb, 74, 144, 226), 0.15); color: #fff; padding-left: 20px; }
.ep-item.current {
  background: rgba(var(--accent-focus-rgb, 74, 144, 226), 0.25);
  color: var(--accent-focus, #4a90e2); font-weight: 700;
}
.ep-item .fa-check { font-size: 0.7rem; }

/* 2.4 Server/Player Switcher */
.players-switcher { display: flex; gap: 8px; flex-wrap: wrap; }
.srv-btn {
  padding: 10px 18px; background: var(--bg-card);
  border: 1px solid var(--border-color); border-radius: var(--radius-sm, 6px);
  color: var(--text-secondary); font-size: 0.85rem; font-weight: 500;
  cursor: pointer; transition: all var(--transition-fast, 0.2s ease);
}
.srv-btn:hover { background: #252525; border-color: var(--border-light); color: #fff; }
.srv-btn.active { background: var(--primary-red); border-color: var(--primary-red); color: #fff; font-weight: 600; }
.srv-btn:focus-visible { outline: 2px solid var(--primary-red); outline-offset: 2px; }

/* ==========================================================================
   3. CARDS & GRIDS
   ========================================================================== */

/* 3.1 Glass Episodes Grid (Home) */
.anime-grid-glass {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px; margin-bottom: 20px;
}
@media (max-width: 768px) { .anime-grid-glass { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; } }
@media (max-width: 480px) { .anime-grid-glass { grid-template-columns: repeat(2, 1fr); gap: 8px; } }

.ep-card {
  position: relative; border-radius: 8px; overflow: hidden;
  aspect-ratio: 16/9; background: #252d38;
  border: 1px solid #30363d; cursor: pointer;
  display: block; text-decoration: none;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.ep-card:hover { transform: translateY(-6px); box-shadow: 0 12px 30px rgba(0, 0, 0, 0.6); }
.ep-card:hover .ep-thumb img { transform: scale(1.08); filter: brightness(0.7); }
.ep-card:hover .ep-play { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.ep-card:hover .ep-num { color: #fff; }
.ep-card:hover .ep-season { background: rgba(255, 255, 255, 0.2); color: #fff; }

.ep-thumb { position: relative; aspect-ratio: 16/9; overflow: hidden; }
.ep-thumb img { width: 100%; height: 100%; object-fit: cover; object-position: center center; transition: transform 0.3s ease, filter 0.3s ease; display: block; }

.ep-badge {
  position: absolute; top: 8px; right: 8px;
  color: #fff; font-size: 10px; font-weight: 700;
  padding: 3px 7px; border-radius: 3px; letter-spacing: 0.5px; z-index: 2;
}
.ep-badge--vostfr { background: var(--primary-red); }
.ep-badge--vf     { background: var(--bg-vf-badge, #1a2535); }

.ep-play {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%) scale(0.8); opacity: 0;
  width: 44px; height: 44px;
  background: var(--primary-red); border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  z-index: 3; transition: opacity 0.25s ease, transform 0.25s ease;
}
.ep-play svg { width: 18px; height: 18px; fill: #fff; margin-left: 3px; }

/* Note: .ep-footer was hidden and triggered on hover, creating a visual conflict. Removed hover rule as it's deprecated. */

.ep-overlay {
  position: absolute; bottom: 0; left: 0; right: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.85) 0%, transparent 100%);
  padding: 20px 10px 8px;
}
.ep-title { color: #fff; font-size: 13px; font-weight: 600; }
.ep-bottom { display: flex; justify-content: space-between; align-items: center; }
.ep-num { color: var(--primary-red); font-size: 11px; font-weight: 700; transition: color 0.25s ease; }
.ep-season { color: var(--text-muted); font-size: 10px; background: rgba(255, 255, 255, 0.08); padding: 2px 6px; border-radius: 3px; transition: background 0.25s ease, color 0.25s ease; }

/* 3.2 Anime List Grid */
.anime-list-container { padding-bottom: 40px; }

/* --- Genre Filter Styles --- */
.genre-filter__grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 10px;
}
.genre-filter__item {
    position: relative;
}
.genre-filter__checkbox {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}
.genre-filter__label {
    display: block;
    padding: 8px 12px;
    background-color: var(--bg-body);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.85rem;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-fast);
    user-select: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.genre-filter__label:hover {
    border-color: var(--primary-red);
    color: var(--text-primary);
}
.genre-filter__checkbox:checked + .genre-filter__label {
    background-color: var(--primary-red);
    border-color: var(--primary-red);
    color: white;
    font-weight: 600;
}
.header-banner__right .btn-outline-light {
    border-color: rgba(255,255,255,0.1);
    color: var(--text-secondary);
}
.header-banner__right .btn-outline-light:hover {
    background-color: var(--primary-red);
    border-color: var(--primary-red);
    color: white;
}
#toggleGenreBtn {
    min-width: 160px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
#genreCollapse {
    transition: all 0.3s ease-in-out;
}

@media (max-width: 576px) {
    .genre-filter__grid {
        grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    }
}
/* --- End Genre Filter Styles --- */

.anime-grid-5 {
  display: grid; grid-template-columns: repeat(6, 1fr);
  gap: 15px; margin-bottom: 30px;
}
@media (max-width: 1200px) { .anime-grid-5 { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 992px) { .anime-grid-5 { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 768px) { .anime-grid-5 { grid-template-columns: repeat(2, 1fr); gap: 15px; } }
@media (max-width: 480px) { .anime-grid-5 { gap: 10px; } }
@media (max-width: 360px) { .anime-grid-5 { grid-template-columns: 1fr; } }

.anime-card {
  position: relative; display: block;
  border-radius: var(--radius-lg, 10px); overflow: hidden;
  background: var(--bg-card); border: 1px solid #333;
  box-shadow: var(--shadow-sm, 0 2px 8px rgba(0,0,0,0.2));
  text-decoration: none; cursor: pointer;
  transition: transform var(--transition-fast, 0.2s ease), border-color var(--transition-fast, 0.2s ease), box-shadow var(--transition-fast, 0.2s ease);
}
.anime-card:hover { transform: translateY(-3px); border-color: var(--primary-red); box-shadow: var(--shadow-md, 0 4px 12px rgba(0,0,0,0.3)); }

/* Title unified & contextualized */
.anime-card__title {
  position: absolute; bottom: 30px; left: 0; right: 0;
  padding: 8px 12px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.75), transparent);
  color: #fff; font-size: 0.85rem; font-weight: 700;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9);
}
/* Glass variant (home) */
.anime-card--glass .anime-card__title { bottom: 24px; padding: 10px 14px; background: linear-gradient(to top, rgba(0, 0, 0, 0.9), transparent); font-size: 0.9rem; }
/* List variant (page animes) */
.anime-card--list .anime-card__title {
  position: relative; bottom: auto; left: auto; right: auto;
  padding: 8px 12px; margin: 0; background: transparent; text-shadow: 0 1px 3px black;
}

/* Badges & Overlay for list cards */
.anime-card__overlay {
  position: absolute; bottom: 0; left: 0; right: 0;
  padding: 30px 12px 12px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.95) 0%, rgba(0, 0, 0, 0.6) 60%, transparent 100%);
  pointer-events: none;
}
.anime-card__badges {
  position: absolute; top: 10px; left: 10px; right: 10px;
  display: flex; flex-direction: row; gap: 5px; justify-content: space-between; z-index: 3;
}
.anime-card__badges .tag { min-width: 45px; text-align: center; padding: 2px 6px; font-size: 0.65rem; border-radius: 3px; }
.tag--year { margin-right: auto; }
.tag--ongoing, .tag--finished { margin-left: auto; }

.anime-card--list {
  aspect-ratio: 2/3; border-radius: var(--radius-lg, 10px);
  background: #252d38; border: 1px solid #30363d;
  box-shadow: var(--shadow-md, 0 4px 12px rgba(0,0,0,0.3));
  transition: transform var(--transition-fast, 0.2s ease), box-shadow var(--transition-fast, 0.2s ease);
}
.anime-card--list:hover { transform: translateY(-5px); box-shadow: var(--shadow-lg, 0 8px 20px rgba(0,0,0,0.4)); z-index: 2; }
.anime-card--list img { width: 100%; height: 100%; object-fit: cover; transition: transform var(--transition-normal, 0.3s ease); }
.anime-card--list:hover img { transform: scale(1.05); }

/* Pagination */
.pagination-container { display: flex; justify-content: center; width: 100%; margin-bottom: 40px; }
.pagination { display: flex; justify-content: center; width: 100%; margin: 20px 0 40px; }
.pagination__list { display: flex; gap: 8px; list-style: none; padding: 0; margin: 0; }
.pagination__link {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 12px; background: var(--main-black);
  border: 1px solid var(--border-light); border-radius: var(--radius-sm, 6px);
  color: #fff; text-decoration: none; transition: all var(--transition-fast, 0.2s ease);
}
.pagination__link:hover { background: #252525; border-color: #555; }
.pagination__link--current { background: #333; color: #fff; border-color: #333; pointer-events: none; cursor: default; }
.pagination__link--disabled { opacity: 0.6; pointer-events: none; cursor: default; }

/* Responsive pagination for mobile */
@media (max-width: 768px) {
  .pagination {
    max-width: 100%;
    overflow: hidden;
    padding: 0 8px; /* marge de sécurité */
  }
  .pagination__list {
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
  }
  .pagination__link {
    padding: 6px 10px;
    font-size: 0.9rem;
    min-width: 36px;
    justify-content: center;
  }
}

@media (max-width: 480px) {
  .pagination__list {
    gap: 4px;
  }
  .pagination__link {
    padding: 5px 8px;
    font-size: 0.85rem;
    min-width: 32px;
  }
  .pagination__link span:not(.sr-only) {
    display: none;
  }
  .pagination__link--prev::before,
  .pagination__link--next::after {
    content: "‹";
    font-size: 1.2rem;
  }
  .pagination__link--next::after {
    content: "›";
  }
}

/* ==========================================================================
   4. ANIME DETAIL LAYOUT
   ========================================================================== */

.anime-details-grid {
  display: grid; grid-template-columns: minmax(220px, 250px) 1fr;
  gap: 25px; padding: 10px;
  background-color: var(--bg-card);
  align-items: stretch; border-radius: var(--radius-lg, 10px);
}
.anime-details-grid__poster,
.anime-details-grid__info {
  display: flex; flex-direction: column; gap: 20px;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg, 10px); padding: 20px; height: 100%;
}

/* Info Card */
.info-card { background-color: transparent; border-radius: 0; padding: 0; border: none; }
.info-card__item {
  display: grid; grid-template-columns: 140px 1fr; align-items: center;
  padding: 12px 0; border-bottom: 1px solid var(--border-color);
}
.info-card__item:last-child { border-bottom: none; padding-bottom: 0; }
.info-card__label { font-weight: 700; color: var(--text-secondary); font-size: 0.9rem; }
.info-card__value { color: var(--text-primary); font-size: 0.9rem; display: flex; flex-wrap: wrap; gap: 8px; }
.info-card__item--genres { grid-template-columns: auto 1fr; column-gap: 6px; }
.info-card__item--genres .info-card__value { align-items: center; gap: 4px; }

.info-card__item--inline { display: flex; flex-direction: row; gap: 30px; grid-template-columns: none; }
.info-card__group { display: flex; align-items: center; gap: 8px; }
.info-card__group--right { margin-left: auto; }
.info-card__group .info-card__label, .info-card__group .info-card__value { margin: 0; }

/* Synopsis */
.synopsis-card { background-color: transparent; }
.synopsis-card .synopsis-content { margin-top: 12px; }
.synopsis-card .card-header-red { padding: 10px 15px; border-radius: var(--radius-md, 8px) var(--radius-md, 8px) 0 0; }
.synopsis-card .card-header-red h3 { margin: 0; font-size: 1.1rem; text-transform: uppercase; color: #fff; }

/* Season Titles */
.ep-season-title {
  position: static; padding: 10px 14px;
  background: var(--bg-card);
  font-size: 0.8rem; font-weight: 700; color: #fff;
  text-transform: uppercase; letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border-color);
}

/* ==========================================================================
   5. COMMENTS & FORMS
   ========================================================================== */

.comments-section {
  background-color: var(--bg-card);
  border-radius: var(--radius-md, 8px); padding: 20px;
  margin-top: 30px; border: 1px solid var(--border-color);
}
.comment-item { display: flex; gap: 15px; margin-bottom: 20px; padding-bottom: 20px; border-bottom: 1px solid var(--border-light); }
.comment-item:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.comment-avatar { flex-shrink: 0; width: 40px; height: 40px; }
.avatar-img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.comment-body { flex-grow: 1; }
.comment-header { margin-bottom: 5px; display: flex; justify-content: space-between; align-items: center; }
.comment-author { color: var(--primary-red); font-weight: bold; font-family: var(--font-title, 'Oswald', sans-serif); }
.comment-date { font-size: 0.8rem; color: var(--text-muted); }
.comment-text {
  background-color: rgba(255, 255, 255, 0.05);
  padding: 10px 15px; border-radius: 0 10px 10px 10px;
  font-size: 0.95rem; line-height: 1.5;
}
.no-comments {
  text-align: center; padding: 40px 20px;
  background-color: rgba(255, 255, 255, 0.02);
  border-radius: var(--radius-md, 8px); border: 1px dashed var(--border-color);
  color: var(--text-muted);
}
.no-comments i { font-size: 2rem; margin-bottom: 10px; color: var(--primary-red); opacity: 0.5; }

.contact-form { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 768px) { .contact-form { grid-template-columns: 1fr 1fr; } }
.contact-form label { display: block; margin-bottom: 0.375rem; font-weight: 500; color: var(--text-secondary); }
.contact-form input {
  width: 100%; background-color: var(--bg-input-dark, #1c2128);
  border: 1px solid var(--border-input, #232834); border-radius: 0.25rem;
  color: #fff; font-size: 0.95rem; padding: 0.5rem 0.75rem; outline: none;
}
.contact-form input:focus { border-color: var(--primary-red); }

.htmx-indicator { display: none; }

/* ==========================================================================
   6. WATCHLIST & PROFILE
   ========================================================================== */

.profile-header { display: grid; grid-template-columns: 150px 1fr; gap: 20px; align-items: center; }
.profile-avatar-wrapper {
  position: relative; width: 150px; height: 150px;
  border-radius: 50%; border: 3px solid var(--primary-red);
  overflow: hidden; cursor: pointer;
}
.profile-avatar-wrapper img { width: 100%; height: 100%; object-fit: cover; display: block; }
.profile-avatar-overlay {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0, 0, 0, 0.55); color: #fff;
  opacity: 0; transition: opacity var(--transition-fast, 0.2s ease);
}
.profile-avatar-wrapper:hover .profile-avatar-overlay { opacity: 1; }
.profile-stat__number { color: var(--primary-red); font-weight: 800; font-size: 2rem; line-height: 1; }
.btn-watchlist {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  padding: 12px 16px; border-radius: 10px;
  border: 1px solid rgba(var(--primary-red-rgb, 197, 0, 0), 0.55);
  background: rgba(var(--primary-red-rgb, 197, 0, 0), 0.12);
  color: #fff; font-weight: 700; text-transform: uppercase;
  font-family: 'Oswald', sans-serif; cursor: pointer;
  transition: background-color var(--transition-fast, 0.2s ease), border-color var(--transition-fast, 0.2s ease);
}
.btn-watchlist:hover { background: rgba(var(--primary-red-rgb, 197, 0, 0), 0.22); }
.btn-watchlist.active { background: var(--primary-red); border-color: var(--primary-red); }
.btn-watchlist:disabled { opacity: 0.7; cursor: not-allowed; }
.btn-watchlist__text { display: inline-block; }
.btn-watchlist:focus-visible, .profile-avatar-wrapper:focus-visible { outline: 2px solid var(--primary-red); outline-offset: 3px; }

/* Episodes loading and error states */
.episodes-loading-text {
    text-align: center;
    padding: 40px 20px;
    color: rgba(255,255,255,0.7);
    font-style: italic;
}
.episodes-error {
    text-align: center;
    padding: 40px 20px;
    color: #ff6b6b;
}

/* ==========================================================================
   7. UI ELEMENTS (HEADERS, BADGES, ETC.)
   ========================================================================== */

.header-title { margin: 0; font-family: 'Oswald', sans-serif; font-size: 1.2rem; font-weight: 700; color: #fff; text-transform: uppercase; letter-spacing: 0.5px; }
.filter-letter__container { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.filter-letter__btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 32px; height: 32px; padding: 4px 8px;
  background: var(--bg-card); border: 1px solid var(--border-color);
  border-radius: var(--radius-sm, 6px); color: var(--text-secondary);
  font-size: 0.85rem; font-weight: 500; text-decoration: none;
  transition: all var(--transition-fast, 0.2s ease); cursor: pointer;
}
.filter-letter__btn:hover { background: #252525; border-color: #555; color: #fff; transform: translateY(-1px); }
.filter-letter__btn--active { background: var(--primary-red); border-color: var(--primary-red); color: #fff; font-weight: 600; }
.filter-letter__btn:focus-visible { outline: 2px solid var(--primary-red); outline-offset: 2px; }

/* ==========================================================================
   8. PLAYER PAGE MOBILE FIXES
   ========================================================================== */

/* Prevent horizontal overflow on player page */
@media (max-width: 768px) {
  .player-container,
  .player-wrapper {
    max-width: 100vw;
    overflow-x: hidden;
  }
  
  /* Controls bar responsive */
  .controls-bar {
    padding: 12px 15px;
    gap: 10px;
    flex-wrap: wrap;
  }
  
  .nav-group {
    flex-wrap: wrap;
    gap: 8px;
  }
  
  .nav-btn {
    width: 36px;
    height: 36px;
  }
  
  /* Episode dropdown responsive */
  .ep-trigger {
    min-width: 140px;
    padding: 8px 35px 8px 12px;
    font-size: 0.85rem;
  }
  
  .ep-menu {
    width: 240px;
    max-height: 45vh;
  }
  
  /* Server switcher responsive */
  .srv-btn {
    padding: 8px 14px;
    font-size: 0.8rem;
  }
  
  /* Fix "REVENIR À LA FICHE" button */
  .btn-back-to-anime,
  .btn-revenir-fiche {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px 15px;
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-height: 44px;
    border-radius: var(--radius-sm, 6px);
    max-width: 100%;
    position: relative; /* garantit le ::before */
  }
  
  /* Hide decorative red vertical bar on mobile - comprehensive targeting */
  .player-container::after,
  .player-wrapper::after,
  .player-page::after,
  .main-content::after,
  .container::after,
  .container::before,
  .content-wrapper::after,
  .content-wrapper::before,
  .page-wrapper::after,
  .page-wrapper::before,
  .site-container::after,
  .site-container::before,
  .layout-container::after,
  .layout-container::before {
    display: none;
  }
  
  /* Comments section alignment */
  .comments-section,
  .comment-form,
  .comment-item {
    max-width: 100%;
    margin-left: 0;
    margin-right: 0;
    padding: 12px;
  }
  
  .comment-item {
    border-radius: var(--radius-sm, 6px);
    background: var(--bg-card);
    border: 1px solid var(--border-light);
  }
}

@media (max-width: 480px) {
  .controls-bar {
    padding: 10px 12px;
    gap: 8px;
  }
  
  .nav-btn {
    width: 32px;
    height: 32px;
    font-size: 0.9rem;
  }
  
  .ep-trigger {
    min-width: 120px;
    padding: 8px 30px 8px 10px;
    font-size: 0.8rem;
  }
  
  .ep-menu {
    width: 200px;
    max-width: calc(100vw - 20px);
    left: -10px;
    right: auto;
  }

  /* Prevent menu from overflowing viewport on very small screens */
  .ep-menu {
    max-width: calc(100vw - 40px);
  }
  
  .srv-btn {
    padding: 6px 12px;
    font-size: 0.75rem;
  }
  
  /* Ultra-compact "REVENIR À LA FICHE" button */
  .btn-back-to-anime,
  .btn-revenir-fiche {
    padding: 8px 12px;
    font-size: 0.8rem;
    min-height: 40px;
    position: relative; /* garantit le ::before */
    white-space: nowrap; /* empêche le retour à la ligne */
  }
  
  /* Shorten text on very small screens */
  .btn-back-to-anime span:not(.icon),
  .btn-revenir-fiche span:not(.icon) {
    display: none;
  }
  
  .btn-back-to-anime::before,
  .btn-revenir-fiche::before {
    content: "← FICHE";
    font-size: 0.8rem;
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
  }
}

/* ==========================================================================
   9. RESPONSIVE & LAYOUT TWEAKS
   ========================================================================== */

@media (max-width: 992px) {
  .anime-details-grid { grid-template-columns: 200px 1fr; gap: 20px; }
}
@media (max-width: 768px) {
  .anime-details-grid { grid-template-columns: 1fr; padding: 15px; }
  .anime-details-grid__poster { max-width: 250px; margin: 0 auto; }
  .info-card__item { grid-template-columns: 120px 1fr; }
  .anime-card--list { aspect-ratio: 2/3; border-radius: var(--radius-md, 8px); }
  .anime-card--list img { width: 100%; height: 100%; object-fit: cover; }
}
@media (max-width: 480px) {
  .info-card { padding: 15px; }
  .info-card__item { grid-template-columns: 1fr; gap: 5px; padding: 10px 0; }
  .info-card__item--inline { flex-direction: column; gap: 15px; }
  .info-card__group { width: 100%; }
  .info-card__label { font-size: 0.8rem; color: var(--text-muted); }
}

/* ==========================================================================
   CUSTOM SCROLLBAR (Optional but recommended for your design system)
   ========================================================================== */