/* turkvost-cast.css - Modale de cast TurkVOST
 * Palette officielle reprise des variables CSS de turkvost.fr (style.css) :
 *   --bg #0a0a0a | --bg-alt #111111 | surface #1e1e22 | --red #E50914
 *   --red-dark #B20710 | --white #ffffff | muted #b3b3b3 | --green #46d369
 *   --gold-orange #FFA500 (erreurs) | bordures rgba(255,255,255,0.08)
 * Ne pas introduire de couleur hors de cette palette.
 */
/* Typographie alignee sur turkvost.fr : Outfit (titres) / DM Sans (corps) */
#tkCastModal, #tkCastModal * { font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif; }
#tkCastModal .tk-cast-title, #tkCastModal .tk-cast-pin-input input,
#tkCastModal .tk-remote-titre { font-family: 'Outfit', sans-serif; }

/* TurkVOST Cast Modal & Web Controller Styles */
.tk-cast-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: #ffffff;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.tk-cast-modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.tk-cast-card {
  background: #0a0a0a;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 16px;
  width: 100%;
  max-width: 380px;
  padding: 24px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5);
  position: relative;
}

.tk-cast-close {
  position: absolute;
  top: 14px;
  right: 14px;
  background: #1e1e22;
  border: none;
  color: #b3b3b3;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tk-cast-title {
  font-family: 'Outfit', sans-serif;
  letter-spacing: -0.3px;
  font-size: 18px;
  font-weight: 700;
  text-align: center;
  margin-bottom: 4px;
  color: #ffffff;
}

.tk-cast-subtitle {
  font-size: 13px;
  color: #b3b3b3;
  text-align: center;
  margin-bottom: 20px;
}

.tk-cast-pin-input {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 20px;
}

.tk-cast-pin-input input {
  font-family: 'Outfit', sans-serif;
  width: 54px;
  height: 60px;
  background: #1e1e22;
  border: 2px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  color: #E50914;
  font-size: 28px;
  font-weight: 800;
  text-align: center;
  outline: none;
  transition: border-color 0.2s;
}

.tk-cast-pin-input input:focus {
  border-color: #E50914;
  background: #1e1e22;
}

.tk-cast-btn-primary {
  width: 100%;
  padding: 14px;
  border-radius: 12px;
  background: #B20710;
  color: #ffffff;
  font-weight: 600;
  font-size: 15px;
  border: none;
  cursor: pointer;
  transition: background 0.2s;
}

.tk-cast-btn-primary:hover {
  background: #B20710;
}

.tk-cast-divider {
  display: flex;
  align-items: center;
  text-align: center;
  margin: 18px 0;
  color: #b3b3b3;
  font-size: 12px;
}

.tk-cast-divider::before, .tk-cast-divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.tk-cast-divider span {
  padding: 0 10px;
}

.tk-cast-btn-secondary {
  width: 100%;
  padding: 12px;
  border-radius: 12px;
  background: #1e1e22;
  color: #ffffff;
  font-weight: 600;
  font-size: 14px;
  border: 1px solid rgba(255,255,255,0.08);
  cursor: pointer;
}

/* Remote Control Mode */
.tk-remote-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid #1e1e22;
}

.tk-remote-status {
  font-size: 13px;
  color: #46d369;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Pastille retiree d'ici : elle est desormais un <i class="tk-dot"> dans le
   markup, sinon les deux se cumulaient et affichaient deux points verts. */

.tk-remote-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin: 20px 0;
}

.tk-remote-btn {
  background: #1e1e22;
  border: 1px solid rgba(255,255,255,0.08);
  color: #ffffff;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.1s, background 0.2s;
}

.tk-remote-btn:active {
  transform: scale(0.92);
}

.tk-remote-btn.play-pause {
  width: 64px;
  height: 64px;
  background: #B20710;
  border-color: #E50914;
  font-size: 22px;
}

.tk-remote-slider-container {
  margin: 16px 0;
}

.tk-remote-slider {
  width: 100%;
  accent-color: #E50914;
  height: 6px;
  border-radius: 3px;
  cursor: pointer;
}

.tk-remote-time {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: #b3b3b3;
  margin-top: 4px;
}

.tk-remote-subs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 8px 0;
  margin-top: 12px;
}

.tk-sub-chip {
  padding: 6px 14px;
  border-radius: 20px;
  background: #1e1e22;
  border: 1px solid rgba(255,255,255,0.08);
  color: #b3b3b3;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.tk-sub-chip.active {
  background: #B20710;
  border-color: #E50914;
  color: #ffffff;
}

/* ==========================================================================
   Phase 3 - Scanner QR, reprise 1 clic, volume, messages d'erreur
   Palette alignee sur l'existant : #0a0a0a carte, #1e1e22 surfaces,
   rgba(255,255,255,0.08) bordures, #E50914 accent, #b3b3b3 texte attenue.
   ========================================================================== */

/* --- Reprise sur la derniere TV --- */
.tk-cast-resume {
  display: flex;
  gap: 8px;
  align-items: stretch;
  margin-bottom: 18px;
}

.tk-cast-btn-resume {
  flex: 1;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid #E50914;
  background: rgba(229, 9, 20, 0.12);
  color: #E50914;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease;
}
.tk-cast-btn-resume:hover { background: rgba(229, 9, 20, 0.22); }

.tk-cast-forget {
  padding: 0 12px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.08);
  background: transparent;
  color: #b3b3b3;
  font-size: 12px;
  cursor: pointer;
}
.tk-cast-forget:hover { color: #ffffff; border-color: #b3b3b3; }

/* --- Zone de scan QR --- */
.tk-qr-zone { margin-bottom: 4px; }

#tkQrReader {
  display: none;
  width: 100%;
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 10px;
  background: #000;
  border: 1px solid rgba(255,255,255,0.08);
}
#tkQrReader video { width: 100% !important; height: auto !important; display: block; }

.tk-qr-hint {
  font-size: 12px;
  color: #b3b3b3;
  text-align: center;
  margin-top: 8px;
  min-height: 16px;
}

/* --- Messages --- */
.tk-cast-error {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255, 165, 0, 0.1);
  border: 1px solid rgba(255, 165, 0, 0.35);
  color: #FFA500;
  font-size: 13px;
  line-height: 1.4;
  text-align: center;
}

.tk-cast-info {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(70, 211, 105, 0.1);
  border: 1px solid rgba(70, 211, 105, 0.3);
  color: #46d369;
  font-size: 13px;
  line-height: 1.4;
  text-align: center;
}

/* --- Telecommande --- */
.tk-remote-disconnect {
  background: none;
  border: none;
  color: #b3b3b3;
  font-size: 12px;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 6px;
}
.tk-remote-disconnect:hover { color: #FFA500; background: rgba(255, 165, 0, 0.08); }

.tk-remote-titre {
  font-size: 14px;
  font-weight: 600;
  color: #ffffff;
  margin: 6px 0 16px;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tk-remote-label {
  font-size: 12px;
  color: #b3b3b3;
  margin: 18px 0 8px;
}

.tk-remote-volume {
  display: flex;
  align-items: center;
  gap: 10px;
}
.tk-remote-volume .tk-remote-slider { flex: 1; }

.tk-vol-icon { font-size: 15px; line-height: 1; }

.tk-vol-val {
  font-size: 12px;
  color: #b3b3b3;
  min-width: 28px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* --- Accessibilite : cible tactile confortable sur mobile --- */
@media (max-width: 420px) {
  .tk-remote-btn { min-width: 56px; min-height: 48px; }
  .tk-cast-pin-input input {
  font-family: 'Outfit', sans-serif; min-height: 52px; }
}

/* --- Second choix de diffusion (Chromecast / AirPlay), jamais prioritaire --- */
.tk-cast-btn-secondary.tk-disabled {
  opacity: 0.45;
  cursor: not-allowed;
  border-color: rgba(255,255,255,0.08);
  color: #b3b3b3;
}
.tk-cast-btn-secondary.tk-disabled:hover { background: #1e1e22; }

.tk-alt-hint {
  font-size: 11px;
  color: #b3b3b3;
  text-align: center;
  margin-top: 6px;
  line-height: 1.4;
}

/* ==========================================================================
   Telecommande - design "glass sombre" (valide le 26/08/2026)
   Verre depoli facon iOS : flou d'arriere-plan, bordure lumineuse, reflet
   interne. Rouge TurkVOST reserve aux elements actifs.
   ========================================================================== */

.tk-cast-card {
  background: rgba(28, 28, 30, 0.72);
  -webkit-backdrop-filter: blur(40px) saturate(180%);
  backdrop-filter: blur(40px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 26px;
  /* Reflet interne haut : c'est lui qui donne l'effet "verre" plutot que "gris". */
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14),
              0 20px 45px rgba(0, 0, 0, 0.6);
}

.tk-cast-modal-overlay {
  background: rgba(0, 0, 0, 0.55);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

/* --- En-tete : etat seul, la croix reste en absolu sans rien chevaucher --- */
.tk-remote-header {
  display: flex;
  align-items: center;
  gap: 8px;
  /* Reserve la place de la croix de fermeture (29px + marge). */
  padding-right: 40px;
  margin-bottom: 14px;
  border-bottom: none;
}

.tk-remote-status {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #ffffff;
  font-size: 14px;
  font-weight: 600;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tk-remote-status .tk-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #46d369;
  box-shadow: 0 0 8px #46d369;
  flex: none;
}

.tk-cast-close {
  width: 29px;
  height: 29px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #b3b3b3;
  font-size: 15px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.tk-cast-close:hover { background: rgba(255, 255, 255, 0.18); color: #ffffff; }

.tk-remote-titre {
  font-size: 14px;
  font-weight: 600;
  color: #ffffff;
  margin: 0 0 14px;
  text-align: left;
  /* Deux lignes max plutot qu'une troncature brutale a la premiere. */
  white-space: normal;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.35;
}

/* --- Commandes --- */
.tk-remote-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 26px;
  margin-bottom: 20px;
}

.tk-remote-btn {
  background: none;
  border: none;
  color: #ffffff;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  cursor: pointer;
  padding: 6px;
  min-width: 44px;
  min-height: 44px;
}
.tk-remote-btn span { font-size: 9px; color: #b3b3b3; font-weight: 600; }
.tk-remote-btn:active { opacity: 0.6; }

.tk-remote-btn.play-pause {
  width: 62px;
  height: 62px;
  border-radius: 50%;
  background: #E50914;
  box-shadow: 0 8px 24px rgba(229, 9, 20, 0.5);
  justify-content: center;
  padding: 0;
}
.tk-remote-btn.play-pause:active { transform: scale(0.94); }

/* --- Volume : icone SVG, plus d'emoji --- */
.tk-remote-volume {
  display: flex;
  align-items: center;
  gap: 11px;
  margin: 0 0 18px;
}
.tk-vol-icon { color: #b3b3b3; display: flex; align-items: center; flex: none; }
.tk-vol-val { color: #b3b3b3; font-size: 11px; min-width: 24px; text-align: right; font-variant-numeric: tabular-nums; }

/* --- Sous-titres : passage a la ligne, plus de langue coupee --- */
.tk-remote-subs {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 16px;
  overflow: visible;
}

.tk-sub-chip {
  padding: 7px 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #b3b3b3;
  font-size: 12px;
  white-space: nowrap;
  cursor: pointer;
}
.tk-sub-chip.active {
  background: #E50914;
  border-color: #E50914;
  color: #ffffff;
  font-weight: 600;
}

/* --- Deconnecter : pleine largeur en bas, hors de portee de la croix --- */
.tk-remote-disconnect {
  display: block;
  width: 100%;
  margin-top: 4px;
  padding: 11px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #ff453a;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
}
.tk-remote-disconnect:hover { background: rgba(255, 69, 58, 0.14); border-color: rgba(255, 69, 58, 0.3); }

/* --- Barres de progression et de volume --- */
.tk-remote-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.16);
  outline: none;
}
.tk-remote-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 13px; height: 13px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.5);
  cursor: pointer;
}
.tk-remote-slider::-moz-range-thumb {
  width: 13px; height: 13px; border: none;
  border-radius: 50%; background: #ffffff;
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.5);
  cursor: pointer;
}
#tkScrubber { accent-color: #E50914; }

.tk-remote-time {
  display: flex;
  justify-content: space-between;
  color: #b3b3b3;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  margin-top: 7px;
  margin-bottom: 18px;
}

.tk-remote-label { font-size: 11px; color: #b3b3b3; margin: 0 0 8px; }


/* --- Bouton "Épisode suivant", visible seulement s'il en existe un --- */
.tk-remote-next {
  display: block;
  width: 100%;
  margin: 0 0 10px;
  padding: 11px;
  border-radius: 14px;
  background: rgba(229, 9, 20, 0.12);
  border: 1px solid rgba(229, 9, 20, 0.4);
  color: #E50914;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tk-remote-next:hover { background: rgba(229, 9, 20, 0.22); }

/* ==========================================================================
   Mini-lecteur — pilule centrée flottante (design 3, validé le 26/08/2026)
   Décollée du bord, largeur adaptée au titre, même verre dépoli que la
   télécommande pour rester cohérent avec turkvost.fr.
   ========================================================================== */

.tk-mini {
  position: fixed;
  left: 50%;
  /* Le centrage horizontal et l'animation d'entrée partagent `transform` :
     ils DOIVENT être combinés, sinon la pilule sort de l'écran au lieu de
     glisser. D'où le translate à deux valeurs. */
  transform: translate(-50%, 200%);
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  z-index: 9998; /* juste sous la modale */

  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 8px 7px 15px;
  max-width: calc(100% - 32px);

  border-radius: 40px;
  background: rgba(24, 24, 27, 0.88);
  -webkit-backdrop-filter: blur(34px) saturate(180%);
  backdrop-filter: blur(34px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15),
              0 10px 30px rgba(0, 0, 0, 0.75);

  cursor: pointer;
  transition: transform 0.42s cubic-bezier(0.32, 0.72, 0, 1);
}

.tk-mini.visible { transform: translate(-50%, 0); }

@media (prefers-reduced-motion: reduce) {
  .tk-mini { transition: none; }
}

.tk-mini > .tk-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #46d369;
  flex: none;
}

.tk-mini-infos { min-width: 0; }

.tk-mini-titre {
  color: #ffffff;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tk-mini-etat {
  color: #b3b3b3;
  font-size: 9.5px;
  margin-top: 1px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.tk-mini-play {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: #E50914;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
  cursor: pointer;
  padding: 0;
}
.tk-mini-play:active { transform: scale(0.92); }
.tk-mini-play svg { width: 13px; height: 13px; }
