/* ══════════════════════════════════════════════════════════════════
   PALAMA-TV — REPLAY VIEW
   Affichage des dernières vidéos des chaînes TV françaises
   Reuse des composants .yt-card existants
   ══════════════════════════════════════════════════════════════════ */

/* ─── Container principal ─── */
.replay-view {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.replay-view.hidden {
  display: none !important;
}

/* ─── Header : pills de sélection chaîne ─── */
.replay-header {
  flex-shrink: 0;
  padding: 10px 16px 8px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  background: rgba(8,8,18,0.5);
}

.replay-channel-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.replay-channel-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border-radius: 20px;
  border: 1.5px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.04);
  color: rgba(255,255,255,0.65);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.replay-channel-pill:hover {
  border-color: var(--ch-color, rgba(124,106,255,0.5));
  color: #fff;
  background: rgba(255,255,255,0.08);
}

.replay-channel-pill.active {
  background: var(--ch-color, #7c6aff);
  border-color: var(--ch-color, #7c6aff);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 2px 12px color-mix(in srgb, var(--ch-color, #7c6aff) 40%, transparent);
}

/* ─── Filtre par période ─── */
.replay-period-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 16px 4px;
  flex-shrink: 0;
}

.replay-period-btn {
  padding: 4px 12px;
  border-radius: 16px;
  border: 1.5px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.03);
  color: rgba(255,255,255,0.6);
  font-size: 11.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.replay-period-btn:hover {
  border-color: rgba(124,106,255,0.5);
  color: #fff;
}

.replay-period-btn.active {
  background: #7c6aff;
  border-color: #7c6aff;
  color: #fff;
  font-weight: 600;
}

html.device-mobile .replay-period-bar {
  flex-wrap: nowrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
html.device-mobile .replay-period-bar::-webkit-scrollbar { display: none; }

/* ─── Status ─── */
.replay-status {
  padding: 8px 16px;
  font-size: 12px;
  color: rgba(255,255,255,0.45);
  min-height: 28px;
  flex-shrink: 0;
}

/* ─── Grille de résultats — hérite de .yt-results ─── */
.replay-grid {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* ─── Grille : colonnes de taille égale, lignes alignées ─── */
.replay-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  grid-auto-rows: 1fr;        /* toutes les lignes ont la même hauteur */
  gap: 12px;
  align-content: start;
}

/* ─── Carte replay : hauteur uniforme quelle que soit la longueur du titre ─── */
.replay-grid .yt-card {
  display: flex;
  flex-direction: column;
  height: 100%;
}

/* ─── Vignettes carrées (au lieu du 16:9 par défaut) ─── */
.replay-grid .yt-thumb {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: #111;
  border-radius: 8px;
  flex-shrink: 0;
}
.replay-grid .yt-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* ─── Bloc info : padding fixe, occupe le reste de la carte ─── */
.replay-grid .yt-info {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 8px 4px 4px;
}

/* Titre : toujours 2 lignes réservées (hauteur fixe) → cartes alignées */
.replay-grid .yt-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary, #fff);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  height: calc(1.35em * 2);   /* réserve 2 lignes même pour un titre court */
  margin-bottom: 4px;
}

/* Méta (date · vues) : collée en bas de la carte */
.replay-grid .yt-meta {
  font-size: 10px;
  color: var(--text-muted, rgba(255,255,255,0.45));
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: auto;
}

/* ─── Badge couleur chaîne ─── */
.replay-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  color: #fff !important;
  letter-spacing: .04em;
  text-transform: uppercase;
  display: inline-block;
  margin-bottom: 5px;
}

/* ─── Mode compact : video joue → strip fixe en bas ─── */
.replay-view.yt-compact {
  position: fixed !important;
  bottom: 0; left: 0; right: 0;
  height: 180px !important;
  z-index: 90;
  background: rgba(8,8,18,0.98);
  border-top: 1px solid rgba(255,255,255,0.07);
  flex: none !important;
  overflow: hidden;
  box-shadow: 0 -4px 24px rgba(0,0,0,0.6);
}

.replay-view.yt-compact .replay-header,
.replay-view.yt-compact .replay-period-bar,
.replay-view.yt-compact .replay-status,
.replay-view.yt-compact #replayLoadMoreWrap {
  display: none !important;
}

.replay-view.yt-compact .replay-grid {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  gap: 8px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 8px 12px;
  scrollbar-width: thin;
}

.replay-view.yt-compact .yt-card {
  flex: 0 0 150px;
  width: 150px;
  min-width: 150px;
}

/* ─── Mobile : pills scrollable horizontalement ─── */
html.device-mobile .replay-channel-pills {
  flex-wrap: nowrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: 2px;
}

html.device-mobile .replay-channel-pills::-webkit-scrollbar {
  display: none;
}

html.device-mobile .replay-channel-pill {
  font-size: 11px;
  padding: 5px 11px;
}

html.device-mobile .replay-grid {
  grid-template-columns: repeat(2, 1fr) !important;
  gap: 8px;
  padding: 8px;
}

/* ─── iPad : 3 colonnes ─── */
html.device-ipad .replay-grid {
  grid-template-columns: repeat(3, 1fr) !important;
  gap: 10px;
}
