/* ============================================================
   StreamHub - Estilos Principales
   Paleta: Negros, grises y morado como color de acento
   Fuente: Space Mono (mono) + DM Sans (cuerpo)
   ============================================================ */

/* --- Importar fuentes de Google Fonts --- */
@import url('https://fonts.googleapis.com/css2?family=Space+Mono:wght@400;700&family=DM+Sans:wght@300;400;500;600;700&display=swap');

/* --- Variables CSS para el sistema de temas --- */
:root {
  /* Colores modo DARK (predeterminado) */
  --bg-primary: #0a0a0c;
  --bg-secondary: #111116;
  --bg-card: #16161d;
  --bg-card-hover: #1e1e28;
  --bg-input: #1a1a22;

  --text-primary: #f0f0f5;
  --text-secondary: #9090a8;
  --text-muted: #5a5a72;

  --accent: #8b5cf6;
  --accent-hover: #7c3aed;
  --accent-soft: rgba(139, 92, 246, 0.15);
  --accent-glow: rgba(139, 92, 246, 0.3);

  --border: rgba(255, 255, 255, 0.07);
  --border-accent: rgba(139, 92, 246, 0.4);

  --shadow: 0 4px 24px rgba(0, 0, 0, 0.5);
  --shadow-card: 0 2px 12px rgba(0, 0, 0, 0.4);

  --navbar-bg: rgba(10, 10, 12, 0.92);
  --live-badge: #ef4444;

  /* Transición suave para cambio de tema */
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- Variables CSS para modo LIGHT --- */
[data-theme="light"] {
  --bg-primary: #f4f4f8;
  --bg-secondary: #ffffff;
  --bg-card: #ffffff;
  --bg-card-hover: #f0f0f7;
  --bg-input: #ededf5;

  --text-primary: #0a0a14;
  --text-secondary: #4a4a62;
  --text-muted: #8a8aa8;

  --accent: #7c3aed;
  --accent-hover: #6d28d9;
  --accent-soft: rgba(124, 58, 237, 0.1);
  --accent-glow: rgba(124, 58, 237, 0.2);

  --border: rgba(0, 0, 0, 0.08);
  --border-accent: rgba(124, 58, 237, 0.35);

  --shadow: 0 4px 24px rgba(0, 0, 0, 0.1);
  --shadow-card: 0 2px 12px rgba(0, 0, 0, 0.08);

  --navbar-bg: rgba(244, 244, 248, 0.92);
}

/* ============================================================
   BASE
   ============================================================ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: 'DM Sans', sans-serif;
  font-size: 15px;
  line-height: 1.6;
  transition: var(--transition);
  min-height: 100vh;
  overflow-x: hidden;
  animation: page-fade-in .25s ease;
}

/* Transición de página (ver assets/js/page-transition.js): fundido de
   entrada al cargar (arriba) y de salida justo antes de navegar a otra
   página interna — sin pushState, así que no hay riesgo de que los scripts
   de cada página se re-ejecuten sobre el mismo scope global. */
@keyframes page-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
body.page-leaving {
  opacity: 0;
  transition: opacity .16s ease;
}

.page-progress-bar {
  position: fixed;
  top: 0; left: 0;
  width: 0%;
  height: 2.5px;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent-glow, var(--accent));
  z-index: 99999;
  transition: width .35s cubic-bezier(.4,0,.2,1);
}

/* Scrollbar personalizado */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--accent); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent-hover); }

/* ============================================================
   NAVBAR
   ============================================================ */
.streamhub-navbar {
  background: var(--navbar-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 1000;
  transition: var(--transition);
  padding: 0 1.5rem;
  height: 64px;
}

/* Logo con fuente monoespaciada para identidad de marca */
.navbar-logo {
  font-family: 'Space Mono', monospace;
  font-weight: 700;
  font-size: 1.3rem;
  color: var(--text-primary) !important;
  text-decoration: none;
  letter-spacing: -0.5px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo-icon {
  width: 32px;
  height: 32px;
  background: var(--accent);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.logo-dot {
  color: var(--accent);
}

/* Links del navbar */
.navbar-nav .nav-link {
  color: var(--text-secondary) !important;
  font-size: 0.88rem;
  font-weight: 500;
  letter-spacing: 0.2px;
  padding: 0.4rem 0.75rem !important;
  border-radius: 6px;
  transition: var(--transition);
  text-transform: uppercase;
}

.navbar-nav .nav-link:hover,
.navbar-nav .nav-link.active {
  color: var(--text-primary) !important;
  background: var(--accent-soft);
}

/* Botón de inicio de sesión */
.btn-login {
  background: var(--accent);
  color: #fff !important;
  border: none;
  padding: 0.4rem 1.1rem !important;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  transition: var(--transition);
  letter-spacing: 0.3px;
}

.btn-login:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px var(--accent-glow);
}

/* Botón toggle de tema */
.btn-theme-toggle {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  font-size: 1rem;
}

.btn-theme-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* Hamburger icon en móvil */
.navbar-toggler {
  border: 1px solid var(--border) !important;
  background: var(--bg-card) !important;
  color: var(--text-primary) !important;
}

/* ============================================================
   SECCIONES GENERALES
   ============================================================ */
.section {
  padding: 3.5rem 0;
}

.section-title {
  font-family: 'Space Mono', monospace;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.3px;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 1.5rem;
}

.section-title::before {
  content: '';
  width: 4px;
  height: 20px;
  background: var(--accent);
  border-radius: 2px;
  flex-shrink: 0;
}

.section-subtitle {
  color: var(--text-muted);
  font-size: 0.82rem;
  margin-left: auto;
  font-family: 'Space Mono', monospace;
}

/* ============================================================
   MATCHES SLIDER (Sección 1)
   ============================================================ */
.matches-section {
  background: var(--bg-primary);
  padding: 2.5rem 0;
}

.matches-slider-wrapper {
  position: relative;
  overflow: hidden;
}

.matches-slider {
  display: flex;
  gap: 1rem;
  overflow-x: auto;
  scroll-behavior: smooth;
  padding: 0.5rem 0 1rem;
  scrollbar-width: none; /* Esconde scrollbar en Firefox */
  -ms-overflow-style: none; /* Esconde en IE */
  cursor: grab;
}

.matches-slider::-webkit-scrollbar { display: none; }
.matches-slider.grabbing { cursor: grabbing; }

/* Tarjeta de partido */
.match-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  min-width: 260px;
  max-width: 260px;
  padding: 1.1rem;
  flex-shrink: 0;
  transition: var(--transition);
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.match-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--accent);
  opacity: 0;
  transition: var(--transition);
}

.match-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-accent);
  transform: translateY(-3px);
  box-shadow: var(--shadow-card), 0 0 20px var(--accent-glow);
}

.match-card:hover::before {
  opacity: 1;
}

/* Cabecera de la tarjeta: liga */
.match-league {
  display: flex;
  align-items: center;
  gap: 7px;
  padding-bottom: 0.8rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0.9rem;
}

.match-league-logo {
  width: 20px;
  height: 20px;
  object-fit: contain;
}

.match-league-name {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  flex: 1;
}

/* Badge de estado: EN VIVO o próximo */
.match-status-badge {
  font-size: 0.65rem;
  font-weight: 700;
  font-family: 'Space Mono', monospace;
  padding: 2px 7px;
  border-radius: 4px;
  letter-spacing: 0.3px;
}

.badge-live {
  background: var(--live-badge);
  color: white;
  animation: pulse-badge 2s infinite;
}

.badge-upcoming {
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid var(--border-accent);
}

.badge-finished {
  background: var(--bg-secondary);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.team-box {
  color: var(--text-primary);
}

/* Animación de pulso para el badge LIVE */
@keyframes pulse-badge {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

/* ============================================================
   LAZY-LOAD DE IMÁGENES: shimmer mientras carga el logo/miniatura
   Se aplica directamente sobre el <img> (ya tiene su tamaño final
   por CSS, así que no hay salto de layout). assets/js/lazyload.js
   quita la clase en el evento load/error de cada imagen.
   ============================================================ */
.lazy-img {
  background: linear-gradient(90deg, var(--bg-secondary) 25%, var(--border) 37%, var(--bg-secondary) 63%);
  background-size: 400% 100%;
  animation: img-shimmer 1.4s ease infinite;
}
.lazy-img.lazy-img-loaded {
  animation: none;
  background: none;
}
@keyframes img-shimmer {
  0%   { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* Bloque de skeleton genérico (mismo shimmer de arriba, pero sin depender
   de assets/js/lazyload.js — se usa en placeholders que no son <img>, ej.
   las filas de "Programas en vivo ahora" mientras carga el JSON) */
.skeleton-block {
  display: block;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--bg-secondary) 25%, var(--border) 37%, var(--bg-secondary) 63%);
  background-size: 400% 100%;
  animation: img-shimmer 1.4s ease infinite;
}

/* Fallback genérico cuando una imagen (logo/poster/avatar) no carga —
   assets/js/lazyload.js reemplaza el <img> roto por este ícono */
.lazy-img-fallback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--accent);
}

/* Contenido del partido: equipos */
.match-teams {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.match-team {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex: 1;
}

.team-logo {
  width: 44px;
  height: 44px;
  object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

.team-name {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-primary);
  text-align: center;
  line-height: 1.2;
}

/* Marcador / VS en el centro */
.match-score {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  min-width: 60px;
}

.score-numbers {
  font-family: 'Space Mono', monospace;
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
}

.score-vs {
  font-family: 'Space Mono', monospace;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-muted);
}

.match-venue-mini {
  font-size: 0.6rem;
  color: var(--text-muted);
  max-width: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: center;
}

.match-minute {
  font-family: 'Space Mono', monospace;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--accent);
  text-align: center;
}

/* Estadio + árbitro — pie de la tarjeta, separado de equipos/marcador */
.match-info-footer {
  margin-top: 0.6rem;
  padding-top: 0.55rem;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  text-align: center;
}
.match-info-footer span {
  font-size: 0.65rem;
  color: var(--text-muted);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.score-time {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-family: 'Space Mono', monospace;
}

/* Flechas de navegación del slider */
.slider-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-primary);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10;
  transition: var(--transition);
  font-size: 0.85rem;
}

.slider-arrow:hover {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 12px var(--accent-glow);
}

.slider-arrow-left { left: -5px; }
.slider-arrow-right { right: -5px; }

/* ============================================================
   CHANNELS SECTION (Sección 2)
   ============================================================ */
.channels-section {
  background: var(--bg-secondary);
  padding: 3rem 0;
  border-top: 1px solid var(--border);
}

/* Pills de categorías */
.category-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.pill {
  padding: 0.3rem 1rem;
  border-radius: 100px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  white-space: nowrap;
  letter-spacing: 0.2px;
}

.pill:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.pill.active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
  box-shadow: 0 2px 10px var(--accent-glow);
}

/* Barra de búsqueda */
.search-wrapper {
  position: relative;
  margin-bottom: 2rem;
}

.search-input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.65rem 1rem 0.65rem 2.8rem;
  color: var(--text-primary);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.9rem;
  transition: var(--transition);
  outline: none;
}

.search-input::placeholder {
  color: var(--text-muted);
}

.search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.search-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.85rem;
  pointer-events: none;
}

/* Grid de canales */
.channels-grid {
  display: grid;
  /* Grid responsivo: min 160px por columna */
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1rem;
}

/* Tarjeta de canal */
.channel-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.2rem 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.7rem;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  color: inherit;
  aspect-ratio: 1; /* Cuadrado */
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.channel-card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--accent-soft);
  opacity: 0;
  transition: var(--transition);
}

.channel-card:hover {
  border-color: var(--border-accent);
  transform: translateY(-4px);
  box-shadow: var(--shadow-card), 0 8px 24px var(--accent-glow);
  color: inherit;
}

.channel-card:hover::after {
  opacity: 1;
}

.channel-logo-wrapper {
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-secondary);
  border-radius: 12px;
  padding: 8px;
  position: relative;
  z-index: 1;
  transition: var(--transition);
}

.channel-card:hover .channel-logo-wrapper {
  background: var(--bg-card);
}

.channel-logo {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: var(--transition);
}

/* Logos sofascore (ligas/equipos): usan versión dark real, sin filtro de inversión */
img[data-logo-base] {
  filter: none !important;
  opacity: 1 !important;
}

.channel-card:hover .channel-logo {
  opacity: 1;
}

.channel-name {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-primary);
  text-align: center;
  line-height: 1.2;
  position: relative;
  z-index: 1;
}

.channel-category-label {
  font-size: 0.68rem;
  color: var(--accent);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  position: relative;
  z-index: 1;
}

/* Mensaje de no resultados */
.no-results {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--text-muted);
  padding: 3rem 0;
  font-size: 0.9rem;
}

/* ══════════════════════════════════════
   PROGRAMAS EN VIVO
══════════════════════════════════════ */
.section-programs { border-top: 1px solid var(--border); background: var(--bg-secondary); }
.program-row {
  display: grid; grid-template-columns: 200px 1fr auto;
  align-items: center; gap: 16px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 10px; padding: 12px 16px;
  cursor: pointer; transition: border-color .2s; text-decoration: none; margin-bottom: 10px;
  color: var(--text-primary);
}
.program-row:hover { border-color: var(--accent); background: var(--bg-card-hover); }
.program-ch { display: flex; align-items: center; gap: 12px; }
.program-ch-thumb {
  width: 56px; height: 56px; background: var(--bg-input);
  border-radius: 8px; display: flex; align-items: center; justify-content: center;
  flex: 0 0 56px; overflow: hidden;
}
.program-ch-thumb img { width: 100%; height: 100%; object-fit: cover; }
.program-ch-name { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.program-ch-cat  { font-size: 11px; color: var(--text-muted); text-transform: capitalize; }
.program-info h4 { font-size: 14px; font-weight: 500; color: var(--text-primary); margin: 0 0 4px; }
.program-info p  { font-size: 12px; color: var(--text-muted); margin: 0; line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.program-progress-wrap { min-width: 110px; text-align: right; }
.program-time { font-size: 11px; color: var(--text-muted); margin-bottom: 6px; display: block; font-family: 'Space Mono', monospace; }
.program-bar  { height: 3px; background: var(--border); border-radius: 2px; }
.program-bar-fill { height: 100%; background: var(--accent); border-radius: 2px; transition: width .5s; }

/* ============================================================
   FOOTER
   ============================================================ */
.streamhub-footer {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  padding: 2rem 0;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.82rem;
}

.footer-logo {
  font-family: 'Space Mono', monospace;
  font-weight: 700;
  font-size: 1rem;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

/* ============================================================
   CHANNEL PAGE (Página de reproducción)
   ============================================================ */
.channel-page-layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 1.5rem;
  padding: 1.5rem 0;
}

/* Theater mode */
.channel-page-layout.theater-mode {
  grid-template-columns: 1fr;
}
.channel-page-layout.theater-mode .chat-column {
  display: none;
}
.channel-page-layout.theater-mode.chat-open .chat-column {
  display: flex;
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 340px;
  z-index: 1040;
  background: var(--bg-secondary);
  border-left: 1px solid var(--border);
  box-shadow: -8px 0 32px rgba(0,0,0,.5);
  animation: chat-slide-in .2s ease;
}
/* El wrap de mensajes (o el panel de Telegram) ocupa todo el espacio
   disponible dentro del panel flotante */
.channel-page-layout.theater-mode.chat-open .chat-messages-wrap,
.channel-page-layout.theater-mode.chat-open .telegram-panel,
.channel-page-layout.theater-mode.chat-open .partido-timeline-panel {
  flex: 1;
  height: auto;
  min-height: 0;
}
@keyframes chat-slide-in {
  from { transform: translateX(100%); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

/* Backdrop del chat flotante */
.chat-theater-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 1039;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}
.chat-theater-backdrop.visible { display: block; }

/* Botón Chat en header (visible solo en teatro) */
#btn-chat-float { display: none; }
#btn-chat-float.visible { display: inline-flex; }
.chat-float-badge {
  display: none;
  background: #ef4444;
  color: #fff;
  font-size: .68rem;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 20px;
  min-width: 18px;
  text-align: center;
  line-height: 1.5;
}
.btn-chat-float .chat-float-badge.show { display: inline-block; }

/* Botón cerrar chat (solo en theater mode) */
.chat-float-close {
  display: none;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: 6px;
  cursor: pointer;
  font-size: .78rem;
  transition: background .15s, color .15s;
  flex-shrink: 0;
}
.chat-float-close:hover { background: var(--bg-card); color: var(--text-primary); }
.theater-mode.chat-open .chat-float-close { display: inline-flex; }

/* Botón modo teatro */
.btn-theater {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  border-radius: 6px;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
  white-space: nowrap;
  flex-shrink: 0;
  font-family: inherit;
}
.btn-theater:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}
.btn-theater.active {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

/* Header del reproductor */
.player-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.player-channel-name {
  font-family: 'Space Mono', monospace;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.live-pill {
  background: var(--live-badge);
  color: white;
  font-size: 0.72rem;
  font-weight: 700;
  font-family: 'Space Mono', monospace;
  padding: 3px 10px;
  border-radius: 100px;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 5px;
  animation: pulse-badge 2s infinite;
}

.live-pill::before {
  content: '';
  width: 6px;
  height: 6px;
  background: white;
  border-radius: 50%;
}

/* Wrapper del iframe con proporción 16:9 */
.player-iframe-wrapper {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%; /* Proporción 16:9 */
  height: 0;
  overflow: hidden;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: #000;
}

.player-iframe-wrapper iframe {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
  border: none;
}

/* Pantalla placeholder cuando no hay stream */
.player-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #0a0a0a;
  color: var(--text-muted);
  gap: 1rem;
}

.player-placeholder-icon {
  font-size: 3rem;
  color: var(--accent);
  opacity: 0.4;
}

/* Info del canal bajo el reproductor */
.channel-info-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 0;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  gap: 1rem;
}

.channel-info-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.channel-avatar {
  width: 48px;
  height: 48px;
  background: var(--bg-card);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  overflow: hidden;
  padding: 6px;
  flex-shrink: 0;
}

.channel-avatar img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.channel-title-group h2 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

.channel-views {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Botones de interacción al estilo YouTube */
.interaction-buttons {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.btn-interact {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 0.45rem 1rem;
  border-radius: 100px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  font-family: 'DM Sans', sans-serif;
}

.btn-interact:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.btn-interact.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

/* Columna derecha: chat */
.chat-column {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.chat-header {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: 14px 14px 0 0;
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.chat-title {
  font-family: 'Space Mono', monospace;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Pestañas Telegram / Chat en la cabecera del panel lateral */
.chat-tabs {
  display: flex;
  gap: 4px;
}
.chat-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: 'Space Mono', monospace;
  font-size: 0.76rem;
  font-weight: 700;
  padding: 6px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}
.chat-tab:hover {
  color: var(--text-primary);
  background: var(--bg-input);
}
.chat-tab.active {
  color: var(--accent);
  background: var(--accent-soft);
}

.chat-users-count {
  font-size: 0.72rem;
  color: var(--text-muted);
  background: var(--bg-input);
  padding: 2px 8px;
  border-radius: 100px;
}

.chat-messages {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-top: none;
  border-bottom: none;
  height: 400px;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* Mensaje de chat */
.chat-message {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  animation: fadeInUp 0.3s ease;
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.chat-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}

.chat-bubble {
  flex: 1;
}

.chat-user {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 2px;
}

.chat-text {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

/* Panel de acceso a Telegram (pestaña "Telegram" del panel lateral) */
.telegram-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 14px 14px;
  height: 400px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.85rem;
  padding: 2rem 1.5rem;
  text-align: center;
}
/* Variante: muestra el post embebido de Telegram en vez del mensaje genérico */
.telegram-panel.telegram-panel--post {
  display: block;
  align-items: unset;
  justify-content: unset;
  padding: 0.75rem;
  overflow-y: auto;
}
/* Panel "Minuto a minuto" (pestaña nueva, solo cuando hay ?partido=) */
.partido-timeline-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 14px 14px;
  height: 400px;
  overflow-y: auto;
  padding: 0.9rem 1.1rem;
}
.pt-skel-row { height: 24px; border-radius: 6px; margin-bottom: 8px; }
.pt-tl-item { display: flex; align-items: center; gap: .6rem; padding: .45rem 0; font-size: .78rem; border-bottom: 1px solid var(--border); }
.pt-tl-item:last-child { border-bottom: none; }
.pt-tl-minute { font-family: 'Space Mono', monospace; font-size: .7rem; color: var(--text-muted); width: 32px; flex-shrink: 0; text-align: right; }
.pt-tl-icon { width: 18px; text-align: center; flex-shrink: 0; }
.pt-tl-icon.goal { color: var(--accent); }
.pt-tl-icon.sub { color: #22c55e; }
.pt-tl-icon.yellow { color: #eab308; }
.pt-tl-icon.red { color: #ef4444; }
.pt-tl-text { color: var(--text-primary); flex: 1; }
.pt-tl-text small { color: var(--text-muted); display: block; font-size: .68rem; }
.pt-empty { color: var(--text-muted); font-size: .82rem; text-align: center; padding: 2rem 1rem; }

.telegram-panel-icon {
  font-size: 2.75rem;
  color: #26A5E4;
}
.telegram-panel h3 {
  font-family: 'Space Mono', monospace;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}
.telegram-panel p {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin: 0;
  line-height: 1.5;
  max-width: 260px;
}
.btn-telegram-join {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #26A5E4;
  color: #fff;
  font-size: 0.85rem;
  font-weight: 700;
  padding: 0.6rem 1.4rem;
  border-radius: 100px;
  text-decoration: none;
  transition: transform .15s ease, box-shadow .15s ease;
  box-shadow: 0 4px 14px rgba(38,165,228,.35);
}
.btn-telegram-join:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(38,165,228,.5);
  color: #fff;
}

/* Placeholder de chat no disponible */
.chat-unavailable {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-top: none;
  border-bottom: none;
  height: 400px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  color: var(--text-muted);
  font-size: 0.85rem;
  text-align: center;
  padding: 2rem;
}

.chat-unavailable-icon {
  font-size: 2.5rem;
  opacity: 0.3;
}

.chat-input-area {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 14px 14px;
  padding: 0.75rem;
}

.chat-input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.5rem 0.85rem;
  color: var(--text-muted);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.82rem;
  cursor: not-allowed;
  opacity: 0.6;
}

/* Sección de canales recomendados */
.recommended-section {
  padding: 2.5rem 0;
}

/* ============================================================
   AUTH PAGES (Login / Registro)
   ============================================================ */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-primary);
  padding: 2rem;
}

.auth-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 2.5rem;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow);
}

.auth-logo {
  font-family: 'Space Mono', monospace;
  font-weight: 700;
  font-size: 1.5rem;
  color: var(--text-primary);
  text-align: center;
  margin-bottom: 0.25rem;
}

.auth-subtitle {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 2rem;
}

.auth-tabs {
  display: flex;
  gap: 0;
  background: var(--bg-input);
  border-radius: 10px;
  padding: 4px;
  margin-bottom: 1.75rem;
}

.auth-tab {
  flex: 1;
  text-align: center;
  padding: 0.5rem;
  border-radius: 7px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  color: var(--text-muted);
  border: none;
  background: transparent;
  font-family: 'DM Sans', sans-serif;
}

.auth-tab.active {
  background: var(--accent);
  color: white;
  box-shadow: 0 2px 8px var(--accent-glow);
}

/* Inputs del formulario */
.form-group {
  margin-bottom: 1rem;
}

.form-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.4rem;
  letter-spacing: 0.3px;
}

.form-control-sh {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.65rem 1rem;
  color: var(--text-primary);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.9rem;
  transition: var(--transition);
  outline: none;
}

.form-control-sh:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.form-control-sh::placeholder {
  color: var(--text-muted);
}

.btn-auth-submit {
  width: 100%;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 10px;
  padding: 0.75rem;
  font-size: 0.95rem;
  font-weight: 700;
  font-family: 'DM Sans', sans-serif;
  cursor: pointer;
  transition: var(--transition);
  margin-top: 0.5rem;
  letter-spacing: 0.3px;
}

.btn-auth-submit:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px var(--accent-glow);
}

.auth-divider {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.78rem;
  margin: 1.25rem 0;
  position: relative;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 42%;
  height: 1px;
  background: var(--border);
}
.auth-divider::before { left: 0; }
.auth-divider::after { right: 0; }

.alert-sh {
  padding: 0.65rem 1rem;
  border-radius: 10px;
  font-size: 0.83rem;
  margin-bottom: 1rem;
  display: none;
}

.alert-sh.alert-error {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #f87171;
}

.alert-sh.alert-success {
  background: rgba(34, 197, 94, 0.12);
  border: 1px solid rgba(34, 197, 94, 0.3);
  color: #4ade80;
}

/* ============================================================
   NAVBAR MÓVIL
   ============================================================ */
@media (max-width: 991.98px) {
  .streamhub-navbar {
    height: auto;
    min-height: 64px;
    padding-top: 0;
    padding-bottom: 0;
  }

  .streamhub-navbar .navbar-collapse {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    margin: 0 -1.5rem;
    padding: 0.75rem 1.5rem 1rem;
    border-radius: 0 0 12px 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  }
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
  /* El botón flotante de Ko-fi/"volver arriba" (index.php) es fixed
     bottom-right sobre todas las páginas. En páginas cortas (ej. una liga
     con 1-2 partidos) no hay suficiente contenido para que el usuario haga
     scroll y el botón queda tapando la última tarjeta (canal, etc.) — se le
     deja un colchón fijo abajo para que nunca quede debajo. */
  body { padding-bottom: 96px; }

  .channel-page-layout {
    grid-template-columns: 1fr;
  }

  .chat-messages, .chat-unavailable, .telegram-panel, .partido-timeline-panel {
    height: 280px;
  }

  .channels-grid {
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  }

  .match-card {
    min-width: 220px;
  }

  /* Canal: ocultar botón teatro en móvil */
  #btn-theater { display: none !important; }

  /* Canal: mostrar siempre el botón de chat en móvil */
  #btn-chat-float { display: inline-flex !important; }

  /* Canal: ocultar el chat por defecto en móvil (panel flotante al abrir) */
  .channel-page-layout .chat-column {
    display: none;
  }
  .channel-page-layout.chat-open .chat-column {
    display: flex;
    position: fixed;
    top: 0; right: 0; bottom: 0;
    width: min(340px, 100vw);
    z-index: 1040;
    background: var(--bg-secondary);
    border-left: 1px solid var(--border);
    box-shadow: -8px 0 32px rgba(0,0,0,.5);
    animation: chat-slide-in .2s ease;
  }
  .channel-page-layout.chat-open .chat-messages-wrap,
  .channel-page-layout.chat-open .telegram-panel,
  .channel-page-layout.chat-open .partido-timeline-panel {
    flex: 1;
    height: auto;
    min-height: 0;
  }
}

@media (max-width: 576px) {
  .channels-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .section {
    padding: 2rem 0;
  }

  /* Home: barra de programas en dos filas para evitar desbordamiento horizontal */
  .program-row {
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto;
    gap: 8px 12px;
    padding: 10px 12px;
  }
  .program-ch          { grid-row: 1; grid-column: 1; }
  .program-info        { grid-row: 2; grid-column: 1 / 3; }
  .program-progress-wrap { grid-row: 1; grid-column: 2; min-width: 80px; text-align: right; }
}

/* ============================================================
   ANIMACIONES DE ENTRADA
   ============================================================ */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

.fade-in {
  animation: fadeIn 0.5s ease forwards;
}

.fade-in-delay-1 { animation-delay: 0.1s; opacity: 0; }
.fade-in-delay-2 { animation-delay: 0.2s; opacity: 0; }
.fade-in-delay-3 { animation-delay: 0.3s; opacity: 0; }

/* ============================================================
   BOOTSTRAP DROPDOWN - Override para dark/light theme
   ============================================================ */
.dropdown-menu {
  --bs-dropdown-bg: var(--bg-card);
  --bs-dropdown-border-color: var(--border);
  --bs-dropdown-color: var(--text-secondary);
  --bs-dropdown-link-color: var(--text-secondary);
  --bs-dropdown-link-hover-color: var(--accent);
  --bs-dropdown-link-hover-bg: var(--accent-soft);
  --bs-dropdown-link-active-bg: var(--accent);
  --bs-dropdown-link-active-color: white;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.5rem;
  margin-top: 0.35rem;
  box-shadow: var(--shadow);
}

.dropdown-item {
  border-radius: 8px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  padding: 0.45rem 1rem;
  transition: var(--transition);
}

.dropdown-item:hover {
  background: var(--accent-soft);
  color: var(--accent);
}

.dropdown-item.active,
.dropdown-item:active {
  background: var(--accent);
  color: white;
}

/* ============================================================
   EVENTOS PAGE - Fix pill styles en hero
   ============================================================ */
.events-hero-pills .pill {
  font-size: 0.78rem;
}
