/* ═══════════════════════════════════════════════════════
   INTERFILM — TV EN DIRECT  |  tv.css
   Thème : noir/orange (#f5a623) / blanc
   Parcours : grille de sélection des chaînes -> lecteur plein écran
   ══════════════════════════════════════════════════════ */

/* ── CONTAINER PRINCIPAL ── */
#tvView {
  display: none;
  min-height: 100vh;
  background: var(--bg);
}

/* ── ACCÈS REFUSÉ ── */
.tv-locked {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  text-align: center;
  padding: 40px 20px;
  gap: 16px;
}
.tv-locked-icon {
  width: 72px; height: 72px;
  background: rgba(245,166,35,.1);
  border: 2px solid rgba(245,166,35,.25);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--gold);
}
.tv-locked h2 {
  font-family: var(--ff-head);
  font-size: 24px; font-weight: 800;
  color: var(--text);
}
.tv-locked p { color: var(--text2); font-size: 15px; max-width: 420px; }

/* ══════════════════════════════════════════════════════
   ÉTAPE 1 — SÉLECTION DE LA CHAÎNE
══════════════════════════════════════════════════════ */
.tv-select-step {
  padding: 0 clamp(20px, 4vw, 44px) 64px;
  max-width: 1480px;
  margin: 0 auto;
}

/* ── EN-TÊTE ── */
.tv-select-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  padding: 18px 0 22px;
}
.tv-select-header-left { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }

.tv-header-back {
  display: flex; align-items: center; gap: 8px;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.1);
  color: var(--text2);
  font-size: 13px; font-weight: 700;
  padding: 8px 16px; border-radius: 10px;
  cursor: pointer; transition: all .2s;
}
.tv-header-back:hover { background: rgba(255,255,255,.1); color: var(--text); }

.tv-live-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(232,48,74,.15);
  border: 1px solid rgba(232,48,74,.4);
  color: var(--red2);
  font-size: 11px; font-weight: 800;
  padding: 4px 10px;
  border-radius: 20px;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.tv-live-dot {
  width: 7px; height: 7px;
  background: var(--red2);
  border-radius: 50%;
  animation: tv-pulse 1.2s infinite;
  flex-shrink: 0;
}
@keyframes tv-pulse {
  0%,100% { opacity: 1; transform: scale(1); }
  50% { opacity: .5; transform: scale(.75); }
}
.tv-title {
  font-family: var(--ff-head);
  font-size: 28px; font-weight: 800;
  letter-spacing: .01em;
  color: var(--text);
}

/* ── RECHERCHE ── */
.tv-select-search {
  display: flex; align-items: center; gap: 10px;
  background: var(--s1);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 12px;
  padding: 10px 16px;
  min-width: 260px;
  color: var(--muted);
  transition: border-color .2s;
}
.tv-select-search:focus-within { border-color: rgba(245,166,35,.4); color: var(--text2); }
.tv-select-search input {
  flex: 1;
  background: none; border: none; outline: none;
  font-size: 13.5px; color: var(--text);
  font-family: var(--ff-body);
}
.tv-select-search input::placeholder { color: var(--muted); }

/* ── BANNIÈRE DE RACCOURCIS (TV / Sport) ── */
.tv-shortcuts-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  padding-bottom: 20px;
}
.tv-shortcut-card {
  display: flex; align-items: center; gap: 14px;
  background: var(--s1);
  border: 1px solid rgba(255,255,255,.09);
  border-radius: 16px;
  padding: 16px 18px;
  cursor: pointer;
  transition: all .2s ease;
  text-align: left;
  font-family: var(--ff-body);
}
.tv-shortcut-card:hover { transform: translateY(-2px); box-shadow: 0 14px 32px rgba(0,0,0,.3); }

.tv-shortcut-icon {
  display: flex; align-items: center; justify-content: center;
  width: 46px; height: 46px; flex-shrink: 0;
  border-radius: 12px;
}
.tv-shortcut-tv {
  border-color: rgba(232,48,74,.35);
  background: linear-gradient(135deg, rgba(232,48,74,.1), rgba(232,48,74,.02));
}
.tv-shortcut-tv:hover { border-color: rgba(232,48,74,.6); }
.tv-shortcut-tv .tv-shortcut-icon { background: rgba(232,48,74,.15); color: var(--red2); }
.tv-shortcut-tv .tv-shortcut-arrow { color: var(--red2); }

.tv-shortcut-sport {
  border-color: rgba(245,166,35,.3);
  background: linear-gradient(135deg, rgba(245,166,35,.08), rgba(245,166,35,.02));
}
.tv-shortcut-sport:hover { border-color: rgba(245,166,35,.55); }
.tv-shortcut-sport .tv-shortcut-icon { background: rgba(245,166,35,.15); color: var(--gold); }
.tv-shortcut-sport .tv-shortcut-arrow { color: var(--gold); }

.tv-shortcut-text { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.tv-shortcut-text strong { font-size: 15px; font-weight: 800; color: var(--text); }
.tv-shortcut-text span { font-size: 12px; color: var(--text2); }
.tv-shortcut-arrow { flex-shrink: 0; opacity: .8; }

/* ── SÉLECTEUR DE PAYS ── */
.tv-country-selector {
  position: relative;
  display: inline-block;
  margin-bottom: 18px;
}
.tv-country-trigger {
  display: flex; align-items: center; gap: 10px;
  background: var(--s1);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 12px;
  padding: 10px 16px;
  cursor: pointer;
  font-size: 13.5px; font-weight: 700;
  color: var(--text);
  transition: border-color .2s;
}
.tv-country-trigger:hover { border-color: rgba(245,166,35,.35); }
.tv-country-trigger svg { color: var(--muted); flex-shrink: 0; }

.tv-country-code {
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 800;
  padding: 3px 6px; border-radius: 5px;
  background: rgba(245,166,35,.15);
  color: var(--gold);
  letter-spacing: .03em;
}

.tv-country-menu {
  position: absolute; top: calc(100% + 8px); left: 0;
  min-width: 220px;
  max-height: 320px; overflow-y: auto;
  background: var(--s1);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 14px;
  padding: 8px;
  box-shadow: 0 20px 50px rgba(0,0,0,.55);
  display: none;
  flex-direction: column;
  gap: 2px;
  z-index: 50;
}
.tv-country-menu.open { display: flex; }
.tv-country-option {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 9px;
  background: none; border: none;
  text-align: left; cursor: pointer;
  font-size: 13.5px; color: var(--text2);
  transition: all .15s;
}
.tv-country-option:hover { background: rgba(255,255,255,.06); color: var(--text); }
.tv-country-option.active { background: rgba(245,166,35,.12); color: var(--gold); }

/* ── FILTRES CATÉGORIES ── */
.tv-channels-filter {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 14px;
  padding: 4px 0 22px;
}
.tv-chips-row { display: flex; gap: 8px; flex-wrap: wrap; }
.tv-channels-count {
  display: flex; align-items: center; gap: 7px;
  font-size: 12.5px; color: var(--text2);
  white-space: nowrap; flex-shrink: 0;
}
.tv-channels-count strong { color: var(--text); font-weight: 800; }
.tv-channels-count .tv-live-dot { background: var(--gold); animation: none; }

.tv-chip {
  font-size: 12px; font-weight: 700;
  padding: 7px 16px; border-radius: 20px;
  cursor: pointer; transition: all .2s;
  background: var(--s1);
  border: 1px solid rgba(255,255,255,.1);
  color: var(--text2);
  letter-spacing: .02em;
}
.tv-chip:hover { background: rgba(255,255,255,.08); color: var(--text); }
.tv-chip.active {
  background: linear-gradient(135deg, rgba(245,166,35,.18), rgba(245,166,35,.08));
  border-color: rgba(245,166,35,.5);
  color: var(--gold);
}

/* ── GRILLE DE CHAÎNES ── */
.tv-channel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 18px;
}

.tv-channel-card {
  position: relative;
  display: flex; flex-direction: column; align-items: center;
  gap: 10px;
  background: var(--s1);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 16px;
  padding: 26px 16px 20px;
  cursor: pointer;
  transition: transform .2s ease, border-color .2s ease, background .2s ease, box-shadow .2s ease;
  text-align: center;
  font-family: var(--ff-body);
}
.tv-channel-card:hover {
  transform: translateY(-3px);
  border-color: rgba(245,166,35,.4);
  background: var(--s2);
  box-shadow: 0 16px 36px rgba(0,0,0,.35);
}
.tv-channel-card:active { transform: translateY(-1px); }
.tv-channel-card:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

.tv-channel-card-live {
  position: absolute; top: 12px; left: 12px;
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 9.5px; font-weight: 800;
  letter-spacing: .06em;
  color: var(--red2);
  background: rgba(232,48,74,.12);
  border: 1px solid rgba(232,48,74,.3);
  padding: 3px 8px; border-radius: 20px;
}

.tv-fav-star {
  position: absolute; top: 10px; right: 10px;
  width: 26px; height: 26px;
  display: flex; align-items: center; justify-content: center;
  color: var(--muted); cursor: pointer;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 50%;
  transition: all .2s; flex-shrink: 0;
}
.tv-fav-star:hover, .tv-fav-star.active { color: var(--gold); border-color: rgba(245,166,35,.4); }
.tv-fav-star.active svg { fill: var(--gold); }

.tv-channel-card-logo {
  width: 72px; height: 72px;
  border-radius: 14px;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.08);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; flex-shrink: 0;
  margin-top: 6px;
}
.tv-channel-card-logo img { width: 100%; height: 100%; object-fit: contain; padding: 9px; }
.tv-channel-card-logo .tv-logo-fallback {
  font-weight: 900; font-size: 13px; color: var(--text2);
  text-align: center; line-height: 1.2; padding: 6px;
}

.tv-channel-card-name {
  font-weight: 800; font-size: 14.5px; color: var(--text);
  line-height: 1.3;
}
.tv-channel-card-cat {
  font-size: 10.5px; color: var(--muted);
  text-transform: uppercase; letter-spacing: .05em;
}

/* Générique pour le logo dans le lecteur (réutilisé en step 2) */
.tv-channel-logo {
  width: 44px; height: 44px;
  border-radius: 10px;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.1);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; flex-shrink: 0;
}
.tv-channel-logo img { width: 100%; height: 100%; object-fit: contain; padding: 5px; }
.tv-channel-logo .tv-logo-fallback {
  font-weight: 900; font-size: 11px; color: var(--text2);
  text-align: center; line-height: 1.2; padding: 4px;
}

/* ── SKELETON LOADER (grille) ── */
.tv-skeleton-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 18px;
  grid-column: 1 / -1;
}
.tv-sk-card {
  background: var(--s1);
  border: 1px solid rgba(255,255,255,.06);
  border-radius: 16px;
  padding: 26px 16px 20px;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
}
.tv-sk-logo {
  width: 72px; height: 72px; border-radius: 14px;
  background: linear-gradient(90deg,
    rgba(255,255,255,.05) 25%, rgba(255,255,255,.1) 50%, rgba(255,255,255,.05) 75%);
  background-size: 200% 100%;
  animation: tv-shimmer 1.4s infinite linear;
}
.tv-sk-line {
  width: 70%; height: 11px; border-radius: 6px;
  background: linear-gradient(90deg,
    rgba(255,255,255,.05) 25%, rgba(255,255,255,.1) 50%, rgba(255,255,255,.05) 75%);
  background-size: 200% 100%;
  animation: tv-shimmer 1.4s infinite linear;
}
@keyframes tv-shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* ── EMPTY STATE ── */
.tv-empty {
  grid-column: 1 / -1;
  padding: 60px 20px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}

/* ══════════════════════════════════════════════════════
   ÉTAPE 2 — LECTEUR
══════════════════════════════════════════════════════ */
.tv-player-step {
  position: fixed;
  inset: 0;
  z-index: 100000005;
  background: #000;
}

.tv-player-fs-wrap {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  background: #000;
}
.tv-player-fs-wrap:fullscreen,
.tv-player-fs-wrap:-webkit-full-screen {
  width: 100%; height: 100%;
  max-width: none; max-height: none;
}

/* ── BARRE DE CONTRÔLES (bas du lecteur, façon contrôles vidéo) ──
   Superposée en overlay sur la vidéo, se masque automatiquement
   après quelques secondes d'inactivité et réapparaît au mouvement
   de la souris / au toucher (voir tv.js : tvShowControls). */
.tv-player-bottombar {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  z-index: 20;
  display: flex; align-items: center; gap: 14px;
  padding: 14px 20px;
  background: linear-gradient(to top, rgba(7,7,15,.94) 0%, rgba(7,7,15,.85) 60%, rgba(7,7,15,0) 100%);
  backdrop-filter: blur(10px);
  flex-shrink: 0;
  transition: opacity .25s ease, transform .25s ease;
  opacity: 1;
  transform: translateY(0);
}
.tv-player-fs-wrap.tv-controls-hidden .tv-player-bottombar {
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
}
.tv-player-back {
  display: flex; align-items: center; gap: 7px;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.1);
  color: var(--text2);
  font-size: 12.5px; font-weight: 700;
  padding: 8px 14px; border-radius: 10px;
  cursor: pointer; transition: all .2s;
  flex-shrink: 0;
}
.tv-player-back:hover { background: rgba(255,255,255,.1); color: var(--text); }

.tv-player-bottombar-meta {
  display: flex; align-items: center; gap: 12px;
  min-width: 0; flex: 1;
}
.tv-channel-logo-sm {
  width: 40px; height: 40px;
  border-radius: 8px;
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.1);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; flex-shrink: 0;
}
.tv-channel-logo-sm img { width: 100%; height: 100%; object-fit: contain; padding: 4px; }
.tv-channel-name-live {
  font-weight: 800; font-size: 15px; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tv-channel-program {
  font-size: 12px; color: var(--text2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.tv-channel-actions {
  margin-left: auto;
  display: flex; align-items: center; gap: 8px;
  flex-shrink: 0;
}
.tv-action-btn {
  display: flex; align-items: center; justify-content: center;
  width: 36px; height: 36px;
  border-radius: 9px;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.1);
  cursor: pointer; transition: all .2s;
  color: var(--text2);
}
.tv-action-btn:hover { background: rgba(255,255,255,.12); color: var(--text); }
.tv-action-btn.active { background: rgba(245,166,35,.15); border-color: rgba(245,166,35,.4); color: var(--gold); }
.tv-action-btn.report-btn:hover { background: rgba(232,48,74,.15); border-color: rgba(232,48,74,.3); color: var(--red2); }

/* ── ÉCRAN DU LECTEUR ── */
.tv-player-screen {
  position: relative;
  flex: 1;
  min-height: 0;
  background: #000;
}
.tv-player-screen iframe,
.tv-player-screen video {
  width: 100%; height: 100%;
  border: none; display: block;
}
.tv-player-placeholder {
  width: 100%; height: 100%;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 14px; color: var(--text2);
}
.tv-player-placeholder svg { opacity: .3; }
.tv-player-placeholder span { font-size: 14px; opacity: .6; }

.tv-player-placeholder-logo {
  display: flex; align-items: center; justify-content: center;
  width: 96px; height: 96px;
  border-radius: 50%;
  background: rgba(245,166,35,.08);
  border: 2px solid rgba(245,166,35,.2);
}
.tv-player-placeholder-name {
  font-size: 19px; font-weight: 800; color: var(--text);
  margin-top: 4px;
}
.tv-player-placeholder-program { font-size: 13px; color: var(--text2); }
.tv-player-placeholder-live {
  display: flex; align-items: center; gap: 7px;
  margin-top: 4px;
}
.tv-player-placeholder-live span {
  font-size: 12px; color: var(--red2); font-weight: 700; opacity: 1;
}
.tv-player-placeholder-text {
  margin-top: 18px; max-width: 340px; text-align: center;
  color: var(--muted); font-size: 12.5px; line-height: 1.7;
}
.tv-player-placeholder-text strong { color: var(--text2); }
.tv-player-placeholder-text a {
  color: var(--gold); text-decoration: none; font-weight: 700;
  margin-top: 10px; display: inline-block;
}
.tv-player-placeholder-text a:hover { color: var(--gold2); }

/* En plein écran natif, la barre de contrôles (overlay) suit le même comportement */

/* ── MODAL SIGNALEMENT ── */
.tv-report-modal {
  position: fixed; inset: 0;
  z-index: 100000020;
  display: none; align-items: center; justify-content: center;
  background: rgba(0,0,0,.7);
  backdrop-filter: blur(4px);
}
.tv-report-modal.open { display: flex; }
.tv-report-box {
  background: var(--s1);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 20px;
  padding: 28px;
  width: 380px; max-width: calc(100vw - 32px);
  box-shadow: 0 24px 80px rgba(0,0,0,.8);
  animation: tv-modal-in .25s cubic-bezier(.34,1.4,.64,1);
}
@keyframes tv-modal-in {
  from { opacity: 0; transform: scale(.9) translateY(10px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
.tv-report-box h3 {
  font-family: var(--ff-head); font-size: 18px; font-weight: 800;
  color: var(--text); margin-bottom: 8px;
}
.tv-report-box p { font-size: 13.5px; color: var(--text2); margin-bottom: 16px; }
.tv-report-options { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; }
.tv-report-option {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 10px; cursor: pointer; transition: all .2s;
}
.tv-report-option:hover, .tv-report-option.selected {
  background: rgba(232,48,74,.1);
  border-color: rgba(232,48,74,.3);
}
.tv-report-option input[type=radio] { accent-color: var(--red2); }
.tv-report-option span { font-size: 14px; color: var(--text); cursor: pointer; }
.tv-report-actions { display: flex; gap: 10px; }
.tv-report-cancel {
  flex: 1; padding: 11px;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 10px; color: var(--text2);
  font-size: 14px; font-weight: 700;
  cursor: pointer; transition: all .2s;
}
.tv-report-cancel:hover { background: rgba(255,255,255,.1); color: var(--text); }
.tv-report-submit {
  flex: 1; padding: 11px;
  background: var(--red);
  border: none; border-radius: 10px;
  color: #fff; font-size: 14px; font-weight: 700;
  cursor: pointer; transition: all .2s;
}
.tv-report-submit:hover { background: var(--red2); }

/* ── TOAST TV ── */
.tv-toast {
  position: fixed; bottom: 80px; left: 50%;
  transform: translateX(-50%) translateY(20px);
  z-index: 100000030;
  background: var(--s2); border: 1px solid rgba(255,255,255,.12);
  color: var(--text); font-size: 13.5px; font-weight: 600;
  padding: 10px 20px; border-radius: 30px;
  box-shadow: 0 8px 32px rgba(0,0,0,.5);
  pointer-events: none; opacity: 0;
  transition: all .3s cubic-bezier(.34,1.4,.64,1);
  white-space: nowrap;
}
.tv-toast.show {
  opacity: 1; transform: translateX(-50%) translateY(0);
}

/* ── RESPONSIVE MOBILE ── */
@media (max-width: 900px) {
  .tv-select-header {
    flex-direction: column;
    align-items: stretch;
  }
  .tv-select-search { min-width: 0; }
  .tv-title { font-size: 22px; }
  .tv-shortcuts-row { grid-template-columns: 1fr; }
  .tv-channels-filter { justify-content: flex-start; }
  .tv-channel-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
  }
  .tv-channel-card { padding: 20px 10px 16px; }
  .tv-channel-card-logo { width: 58px; height: 58px; }
}

@media (max-width: 480px) {
  .tv-select-step { padding: 0 14px 48px; }
  .tv-channel-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  .tv-player-bottombar { padding: 10px 12px; gap: 10px; }
  .tv-player-back span { display: none; }
  .tv-channel-program { display: none; }
}
