/* =====================================================
   trailers.css — Section Bandes-annonces
   Style AlloCiné
   Regarde Movie
===================================================== */

/* =====================================================
   SECTION
===================================================== */
#trailers-section {
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px 24px 28px;
}

/* En-tête avec titre + filtres sur la même ligne */
.trailers-header {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.trailers-title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  letter-spacing: 1.5px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  flex-shrink: 0;
}

/* =====================================================
   FILTRES — style pills comme AlloCiné
===================================================== */
#trailers-filters {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.trailer-filter-btn {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-dim);
  border-radius: 50px;
  padding: 5px 14px;
  font-family: var(--font-body);
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}
.trailer-filter-btn:hover {
  border-color: var(--border-hover);
  color: var(--text);
}
.trailer-filter-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* =====================================================
   GRILLE HORIZONTALE SCROLLABLE
===================================================== */
.trailers-carousel-wrapper { position: relative; }

#trailers-grid {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  scroll-behavior: smooth;
  padding-bottom: 12px;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
#trailers-grid::-webkit-scrollbar { display: none; }

/* =====================================================
   CARTE BANDE-ANNONCE
===================================================== */
.trailer-card {
  flex: 0 0 calc(25% - 11px);
  min-width: 200px;
  max-width: 320px;
  cursor: pointer;
}

/* Vignette vidéo */
.trailer-thumb {
  position: relative;
  width: 100%;
  aspect-ratio: 16/9;
  border-radius: 10px;
  overflow: hidden;
  background: #000;
  margin-bottom: 8px;
}

.trailer-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.4s ease, opacity 0.3s;
}

/* Overlay sombre + bouton play */
.trailer-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.25s;
}

.trailer-card:hover .trailer-overlay { background: rgba(0,0,0,0.55); }
.trailer-card:hover .trailer-thumb img { transform: scale(1.05); opacity: 0.85; }

/* Bouton play */
.trailer-play-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(229,9,20,0.9);
  border: 2px solid rgba(255,255,255,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.2s, background 0.2s;
  padding-left: 3px; /* Optique play */
}
.trailer-card:hover .trailer-play-btn {
  transform: scale(1.12);
  background: var(--accent);
}

/* Infos texte */
.trailer-info { padding: 0 2px; }

.trailer-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
  text-align: center;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 3px;
}

.trailer-sub {
  font-size: 0.72rem;
  color: var(--text-dim);
  text-align: center;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* =====================================================
   SCROLLBAR CUSTOM
===================================================== */
.trailer-scrollbar-track {
  width: 100%;
  height: 3px;
  background: var(--bg-surface);
  border-radius: 2px;
  margin-top: 8px;
  position: relative;
  cursor: pointer;
}

.trailer-scrollbar-thumb {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  position: absolute;
  left: 0; top: 0;
  min-width: 40px;
  cursor: grab;
  transition: opacity 0.2s;
}
.trailer-scrollbar-thumb:active { cursor: grabbing; }

/* =====================================================
   MODAL YOUTUBE
===================================================== */
.trailer-modal {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
.trailer-modal.active {
  opacity: 1;
  pointer-events: auto;
}

.trailer-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.88);
  backdrop-filter: blur(6px);
}

.trailer-modal-box {
  position: relative;
  width: 100%;
  max-width: 900px;
  background: #000;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 32px 80px rgba(0,0,0,0.8);
  animation: trailerModalIn 0.3s ease both;
}

@keyframes trailerModalIn {
  from { opacity: 0; transform: scale(0.94); }
  to   { opacity: 1; transform: scale(1); }
}

.trailer-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: rgba(255,255,255,0.05);
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.trailer-modal-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: calc(100% - 48px);
}

.trailer-modal-close {
  background: rgba(255,255,255,0.1);
  border: none;
  color: #fff;
  width: 32px; height: 32px;
  border-radius: 50%;
  font-size: 0.9rem;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.2s;
}
.trailer-modal-close:hover { background: var(--accent); }

.trailer-modal-video {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%;
}

.trailer-modal-video iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
}

/* =====================================================
   SKELETON
===================================================== */
.trailer-skeleton {
  pointer-events: none;
}

.trailer-skeleton-thumb {
  width: 100%;
  aspect-ratio: 16/9;
  background: var(--bg-surface);
  border-radius: 10px;
  margin-bottom: 8px;
  animation: tr-shimmer 1.6s infinite;
}

.trailer-skeleton-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 0 2px;
}

.trailer-skeleton-line {
  height: 9px;
  background: var(--bg-surface);
  border-radius: 5px;
  animation: tr-shimmer 1.6s infinite;
  margin: 0 auto;
}

@keyframes tr-shimmer {
  0%,100% { opacity: 0.4; }
  50%     { opacity: 0.75; }
}

/* =====================================================
   RESPONSIVE
===================================================== */
@media (max-width: 900px) {
  .trailers-header { gap: 12px; }
  .trailers-title  { font-size: 1.3rem; }
  .trailer-card, .trailer-skeleton {
    flex: 0 0 calc(33.33% - 10px);
  }
}

@media (max-width: 600px) {
  #trailers-section { padding: 18px 16px 22px; }
  .trailers-header  { flex-direction: column; align-items: flex-start; gap: 8px; }
  .trailer-card, .trailer-skeleton {
    flex: 0 0 calc(50% - 7px);
    min-width: 150px;
  }
  .trailer-play-btn { width: 38px; height: 38px; }
  .trailer-modal-box { border-radius: 10px; }
}
