:root {
  --bg: #0a0a0a;
  --accent: #ff4c4c;
  --text: #f1f1f1;
  --muted: #aaa;
  --card-bg: #1a1a1a;
  --badge-film: #e94b4b;
  --badge-serie: #4b8ee9;
  --red: #dc2626;
  --red-hover: #b91c1c;
  --gray-bg: rgba(55, 65, 81, 0.6);
  --gray-hover: rgba(55, 65, 81, 0.8);
}

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

.rb {
  font-family: 'Roboto', sans-serif;
  background-color: #0a0a0a; /* noir profond */
  background-image:
    radial-gradient(circle at 15% 30%, rgba(97, 0, 0, 0.2) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(220, 20, 60, 0.15) 0%, transparent 50%),
    radial-gradient(circle at 50% 80%, rgba(110, 22, 22, 0.12) 0%, transparent 50%),
    url('https://cinepulse.to/assets/pipes-D68q0iVI.svg');
  color: #fff;
  min-height: 30vh;
  overflow-x: hidden;
  position: relative;
}

/* ✅ Container principal */
.ctn {
  position: relative;
  z-index: 1010;
  max-width: 1440px;
  margin: 0 auto;
  padding: 3rem 2rem;
  display: flex;
  flex-direction: column;
  padding-top: 100px;
}

body {
  font-family: 'Inter', sans-serif;
  background-color: var(--bg);
  color: var(--text);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 40px 20px;
  min-height: 100vh;
}

/* === Section recherche === */
.search-section {
  max-width: 720px;
  width: 100%;
  text-align: center;
  margin-bottom: 50px;
}

.title {
  font-size: 2.75rem;
  font-weight: 700;
  margin-bottom: 12px;
  line-height: 1.2;
  color: var(--text);
}

.subtitle {
  color: var(--accent);
  font-weight: 500;
  margin-bottom: 32px;
  font-size: 1.125rem;
}

.search-section .search-bar {
  position: relative;
  width: 100%;
  border: none;
  background: transparent;
  box-shadow: none;
}

.search-section .search-bar input[type="text"] {
  width: 100%;
  padding: 14px 48px;
  border-radius: 12px;
  border: none;
  background-color: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  font-size: 1rem;
  outline-offset: 2px;
  transition: background-color 0.3s ease;
}

.search-section .search-bar input[type="text"]::placeholder {
  color: rgba(255, 255, 255, 0.5);
}

.search-section .search-bar input[type="text"]:focus {
  background-color: rgba(255, 255, 255, 0.18);
  outline: 2px solid var(--accent);
}

.search-bar .search-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: rgba(255, 255, 255, 0.6);
  font-size: 1.2rem;
  pointer-events: none;
}

/* Résultats */
.results {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 24px;
  width: 100%;
  max-width: 1440px;
  padding: 40px 0;
  justify-items: center;
}

.suggestion-message {
  grid-column: 1 / -1;
  justify-self: center;
  text-align: center;
  margin: 2rem 0;
  color: #fff;
  font-size: 1.1rem;
}

.card {
  background: transparent;
  border-radius: 14px;
  overflow: visible;
  width: 200px;
  cursor: default;
}

.poster-container {
  position: relative;
  width: 100%;
  height: 320px;
  overflow: hidden;
  border-radius: 12px;
  box-shadow: 0 0 12px rgba(255, 76, 76, 0.15);
}

.poster-container img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 12px;
}

/* ✅ Barre de progression */
.nc-progress-wrap {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 14px; /* ↑ la barre monte légèrement */
  height: 6px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255,255,255,0.18);

  /* Ombre subtile derrière */
  box-shadow: 0 2px 6px rgba(0,0,0,0.5);
  pointer-events: none;
}

.nc-progress-fill {
  height: 100%;
  width: 0%;
  background: #e50914; /* ou ton violet */
  border-radius: 999px;
  transition: width .35s ease;

  /* halo sombre autour de la barre de progression */
  box-shadow: 0 0 6px rgba(0,0,0,0.6);
}

.badge-type {
  position: absolute;
  top: 10px;
  left: 10px;
  padding: 5px 12px;
  border-radius: 12px;
  font-weight: 700;
  font-size: 0.75rem;
  color: #fff;
  text-transform: uppercase;
  box-shadow: 0 0 6px rgba(0, 0, 0, 0.6);
  user-select: none;
}

.badge-type.film {
  background: var(--badge-film);
}

.badge-type.serie {
  background: var(--badge-serie);
}

/* Badge épisode SxEx pour les séries (en haut à droite de l’affiche) */
.badge-episode{
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 4px 10px;
  border-radius: 10px;
  background: rgba(0,0,0,0.9); /* noir */
  color: #fff;
  font-weight: 700;
  font-size: 0.75rem;
  letter-spacing: 0.02em;
  user-select: none;
  box-shadow: 0 2px 6px rgba(0,0,0,0.35);
}

.card-info {
  margin-top: 8px;
  text-align: left;
}

.card-info h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-info p {
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 3px;
}

/* ✅ Message si aucun historique */
.empty-history {
  grid-column: 1 / -1;
  text-align: center;
  color: #aaa;
  padding: 3rem 1rem;
  font-size: 1.1rem;
  font-style: italic;
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  z-index: 999;
  top: 0;
  left: 0;
  height: 100vh;
  width: 100vw;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(6px);
  align-items: center;
  justify-content: center;
  padding: 40px;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* === Navigation recherche === */
.search-navigation {
  margin-top: 70px;
  position: relative;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  padding: 0 20px;
}

.btn-bottom {
  background-color: rgba(255, 255, 255, 0.08);
  color: white;
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
  border: none;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.btn-bottom-keep {
  background-color: rgba(255, 255, 255, 0.08);
  color: white;
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
  border: none;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.btn-bottom-stop {
  background-color: rgba(255, 255, 255, 0.08);
  color: white;
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
  border: none;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.btn-bottom:hover {
  background-color: rgba(255, 255, 255, 0.363);
}

.btn-group-center {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
  z-index: 1;
}

.btn-left {
  position: absolute;
  left: 5rem;
  background-color: rgba(255, 255, 255, 0.226);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.btn-right {
  position: absolute;
  right: 5rem;
  background-color: rgba(255, 255, 255, 0.226);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.shadow-bar {
  margin-top: 2rem;
  position: relative;
  z-index: 1;
  width: 100%;
  height: 1px;
  background-color: #ffffff23;
}

/* === Filtres === */
.filter-panel {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  background-color: rgba(255, 255, 255, 0.04);
  border-radius: 16px;
  padding: 24px;
  margin-top: 32px;
  display: none;
  flex-direction: column;
  gap: 24px;
  animation: slideDown 0.3s ease-in-out;
}

.filter-panel.show {
  display: flex;
}

@keyframes slideDown {
  0% {
    opacity: 0;
    transform: translateY(-10px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

.filter-group h4 {
  color: var(--text);
  font-size: 1.25rem;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.filter-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.filter-tag {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 0.9rem;
  font-weight: 500;
  color: white;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.filter-tag:hover {
  background: var(--accent);
  box-shadow: 0 0 8px rgba(255, 76, 76, 0.4);
}

.filter-tag.active {
  background: var(--accent);
  box-shadow: 0 0 10px rgba(255, 76, 76, 0.5);
  font-weight: 600;
}

/* === Modale détails === */
.modal-content {
  background-color: #181818;
  padding: 24px;
  border-radius: 16px;
  max-width: 600px;
  width: 100%;
  box-shadow: 0 0 20px rgba(255, 76, 76, 0.25);
  display: flex;
  flex-direction: column;
  align-items: center;
  animation: fadeIn 0.3s ease;
}

.modal-content img {
  width: 200px;
  height: auto;
  border-radius: 12px;
  margin-bottom: 16px;
}

.modal-content h2 {
  font-size: 1.75rem;
  margin-bottom: 12px;
  color: var(--accent);
}

.modal-content p {
  color: var(--text);
  margin: 4px 0;
  text-align: center;
}

.close {
  position: absolute;
  top: 12px;
  right: 16px;
  font-size: 1.5rem;
  color: var(--accent);
  cursor: pointer;
  transition: color 0.2s ease;
}

.close:hover {
  color: white;
}

.active-btn {
  background-color: #ff0000; 
  color: white;
}

.loader {
  border: 4px solid rgba(255,255,255,0.3);
  border-top-color: #e50914;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  margin: 2rem auto;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@media (max-width: 1350px) {
  .results {
    grid-template-columns: repeat(5, 1fr);
  }
}

@media (max-width: 1120px) {
  /* Le conteneur devient la barre */
  .btn-group-center{
    position: relative;                 /* nécessaire pour la ligne centrale */
    width: 100%;
    max-width: 720px;                   /* aligne sur la barre "Filtrer" */
    margin: 7px auto 0;
    display: flex;
    gap: 0;                             /* pas d’espace entre les moitiés */
    background: rgba(255,255,255,0.12);
    border: 1px solid rgba(255,255,255,0.18);
    border-radius: 12px;
    overflow: hidden;                   /* masque aux coins arrondis */
  }
  /* Ligne centrale nette, parfaitement droite et pleine hauteur */
  .btn-group-center::before{
    content:"";
    position:absolute;
    top:0; bottom:0;
    left:50%; transform: translateX(-0.5px); /* compense l’épaisseur */
    width:1px;
    background: rgba(255,255,255,0.35);
    pointer-events:none;
  }

  /* Les deux moitiés (50/50), pas de bordures internes */
  .btn-bottom-keep{
    flex: 1 1 50%;
    display:flex;
    align-items:center;
    justify-content:center;
    min-height: 42px;                   /* plus fin en hauteur */
    padding: 8px 12px;
    background: transparent;            /* fond géré par le parent */
    border: none;
    white-space: nowrap;
    font-size: 0.95rem;
    line-height: 1.2;
  }

  /* États */
  .btn-bottom-keep:hover{
    background: rgba(255,255,255,0.06);
  }
  .btn-bottom-keep:focus-visible{
    outline: 2px solid var(--accent);
    outline-offset: -2px;               /* focus à l’intérieur de la barre */
  }
  
  .ctn {
    padding-top: 90px;
  }

  .btn-bottom-stop {
    display: none;
  }

  .btn-right {
    display: none;
  }
  
  .results {
    grid-template-columns: repeat(4, 1fr);
  }

  .btn-left {
    position: static;
    width: 100%;
    max-width: 720px;
    margin-top: -2rem;        /* ← réduit l’espace entre la barre et le bouton */
    margin-bottom: 0;
    justify-content: center;
    display: flex;
    background-color: rgba(255, 255, 255, 0.12);
    height: 48px;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 500;
    gap: 8px;
    padding: 0 20px;
  }

  .search-navigation {
    margin-top: 0;          /* ← empêche l’espacement excessif global */
    padding: 0;
    gap: 12px;
    flex-direction: column;
    align-items: center;
  }
}

@media (max-width: 900px) {
  .btn-bottom-stop {
    display: none;
  }

  .btn-right {
    display: none;
  }
  
  .card {
    width: 160px;
  }

  .poster-container {
    height: 240px;
  }

  .card-info h3 {
    font-size: 0.9rem;
  }

  .card-info p {
    font-size: 0.75rem;
  }
}

@media (max-width: 800px) {
  .btn-left {
    position: static;
    width: 100%;
    max-width: 720px;
    margin-top: -2rem;        /* ← réduit l’espace entre la barre et le bouton */
    margin-bottom: 0;
    justify-content: center;
    display: flex;
    background-color: rgba(255, 255, 255, 0.12);
    height: 48px;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 500;
    gap: 8px;
    padding: 0 20px;
  }

  .search-navigation {
    margin-top: 0;          /* ← empêche l’espacement excessif global */
    padding: 0;
    gap: 12px;
    flex-direction: column;
    align-items: center;
  }
}

@media (max-width: 730px) {
  .btn-bottom-stop {
    display: none;
  }

  .btn-right {
    display: none;
  }
  
  .results {
    grid-template-columns: repeat(3, 1fr);
  }

  .card {
    width: 180px;
  }

  .poster-container {
    height: 260px;
  }

  .card-info h3 {
    font-size: 0.9rem;
  }

  .card-info p {
    font-size: 0.75rem;
  }
}

@media (max-width: 730px) {
  .btn-bottom-stop {
    display: none;
  }

  .btn-right {
    display: none;
  }
  
  .results {
    grid-template-columns: repeat(3, 1fr);
  }

  .card {
    width: 180px;
  }

  .poster-container {
    height: 260px;
  }

  .card-info h3 {
    font-size: 0.9rem;
  }

  .card-info p {
    font-size: 0.75rem;
  }
}

@media (max-width: 630px) {
  .btn-bottom-stop {
    display: none;
  }

  .btn-right {
    display: none;
  }
  
  .results {
    grid-template-columns: repeat(3, 1fr);
  }

  .card {
    width: 160px;
  }

  .poster-container {
    height: 240px;
  }

  .card-info h3 {
    font-size: 0.9rem;
  }

  .card-info p {
    font-size: 0.75rem;
  }
}

@media (max-width: 575px) {
  .btn-bottom-stop {
    display: none;
  }

  .btn-right {
    display: none;
  }
  
  .results {
    grid-template-columns: repeat(3, 1fr);
  }

  .card {
    width: 140px;
  }

  .poster-container {
    height: 220px;
  }

  .card-info h3 {
    font-size: 0.9rem;
  }

  .card-info p {
    font-size: 0.75rem;
  }
}

@media (max-width: 500px) {
  .results {
    grid-template-columns: repeat(2, 1fr);
  }

  .card {
    width: 180px;
  }

  .poster-container {
    height: 260px;
  }

  .card-info h3 {
    font-size: 0.9rem;
  }

  .card-info p {
    font-size: 0.75rem;
  }
}

@media (max-width: 420px) {
  .ctn {
    padding-top: 50px;
  }

  .card {
    width: 140px;
  }

  .poster-container {
    height: 210px;
  }

  .card-info h3 {
    font-size: 0.8rem;
  }

  .card-info p {
    font-size: 0.7rem;
  }

  .badge-type {
    font-size: 0.65rem;
    padding: 4px 10px;
  }
}

@media (max-width: 340px) {
  .card {
    width: 120px;
  }

  .poster-container {
    height: 180px;
  }

  .card-info h3 {
    font-size: 0.75rem;
  }

  .card-info p {
    font-size: 0.65rem;
  }

  .badge-type {
    font-size: 0.6rem;
    padding: 3px 8px;
  }
}
