/* ============================================================
   Orange TV — main.css
   Dark theme + orange accents, 10-foot UI optimizado
   ============================================================ */

:root {
  --bg: #0a0a0a;
  --bg-2: #141414;
  --bg-3: #1c1c1c;
  --bg-card: #1a1a1a;
  --line: #262626;
  --line-2: #333;
  --fg: #f2f2f2;
  --fg-2: #b8b8b8;
  --fg-3: #7a7a7a;
  --orange: #ff6b1a;
  --orange-2: #ff8a47;
  --orange-soft: rgba(255,107,26,0.15);
  --orange-glow: 0 0 0 3px rgba(255,107,26,0.5);
  --shadow: 0 8px 24px rgba(0,0,0,0.5);
  --shadow-lg: 0 20px 60px rgba(0,0,0,0.6);
  --radius: 10px;
  --radius-lg: 16px;
  --focus: var(--orange-glow);
  --dur: 180ms;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { background: var(--bg); color: var(--fg); }

/* El atributo [hidden] debe ganar sobre display: flex/grid */
[hidden] { display: none !important; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  min-height: 100vh;
}

/* Cursor solo con mouse (oculto en TV) */
@media (pointer: coarse), (hover: none) { body { cursor: none; } }

/* Accesibilidad focus */
:focus { outline: none; }
:focus-visible,
button:focus-visible,
[tabindex]:focus-visible,
input:focus-visible {
  box-shadow: var(--focus);
  border-radius: var(--radius);
  position: relative;
  z-index: 5;
}

/* ============================================================
   Boot loader
   ============================================================ */
.boot {
  position: fixed; inset: 0;
  background: var(--bg);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  z-index: 9999;
  transition: opacity 400ms ease, visibility 400ms ease;
}
.boot.is-hidden { opacity: 0; visibility: hidden; }
.boot-logo {
  font-size: 48px; font-weight: 800; letter-spacing: -1px;
  background: linear-gradient(135deg, var(--orange), var(--orange-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  margin-bottom: 24px;
}
.boot-bar {
  width: 220px; height: 4px; background: var(--bg-3); border-radius: 2px; overflow: hidden;
}
.boot-bar-fill {
  width: 0%; height: 100%;
  background: linear-gradient(90deg, var(--orange), var(--orange-2));
  animation: bootFill 1.2s ease-out forwards;
}
@keyframes bootFill { to { width: 100%; } }

/* ============================================================
   Topbar
   ============================================================ */
.topbar {
  position: sticky; top: 0; z-index: 100;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 14px 28px;
  background: linear-gradient(180deg, rgba(10,10,10,0.95) 0%, rgba(10,10,10,0.7) 100%);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  transition: transform var(--dur) var(--ease);
}
.topbar.is-hidden { transform: translateY(-100%); }

.topbar-left, .topbar-right { display: flex; align-items: center; }
.topbar-right { justify-content: flex-end; gap: 14px; }

.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; }
.brand-mark { color: var(--orange); font-size: 22px; line-height: 1; }
.brand-text { font-size: 18px; letter-spacing: 0.3px; }

.topnav { display: flex; gap: 4px; }
.nav-btn {
  background: transparent; color: var(--fg-2);
  border: 0; padding: 10px 18px; border-radius: 8px;
  font-size: 15px; font-weight: 500;
  cursor: pointer;
  transition: all var(--dur) var(--ease);
}
.nav-btn:hover { color: var(--fg); background: var(--bg-2); }
.nav-btn.is-active { color: var(--orange); background: var(--orange-soft); }

.search-toggle {
  width: 38px; height: 38px; display: grid; place-items: center;
  border-radius: 50%; background: var(--bg-2); color: var(--fg-2);
  cursor: pointer; transition: all var(--dur) var(--ease);
}
.search-toggle:hover { background: var(--bg-3); color: var(--fg); }

.net-indicator {
  display: flex; align-items: center; padding: 6px 10px;
  background: var(--bg-2); border-radius: 20px; gap: 8px;
  font-size: 12px; color: var(--fg-3);
}
.net-dot { width: 8px; height: 8px; border-radius: 50%; background: #4ade80; box-shadow: 0 0 8px #4ade80; }
.net-indicator.is-offline .net-dot { background: #ef4444; box-shadow: 0 0 8px #ef4444; }

/* ============================================================
   Search overlay
   ============================================================ */
.search-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(10,10,10,0.95);
  backdrop-filter: blur(8px);
  padding: 90px 28px 28px;
  display: flex; flex-direction: column; gap: 18px;
}
.search-box { display: flex; align-items: center; gap: 12px; max-width: 720px; margin: 0 auto; width: 100%; }
#searchInput {
  flex: 1; background: var(--bg-2); border: 1px solid var(--line);
  color: var(--fg); font-size: 18px; padding: 16px 20px; border-radius: 12px;
}
.search-close {
  background: var(--bg-2); color: var(--fg-2);
  border: 0; width: 44px; height: 44px; border-radius: 50%;
  font-size: 16px; cursor: pointer;
}
.search-close:hover { background: var(--bg-3); color: var(--fg); }
.search-results { max-width: 720px; margin: 0 auto; width: 100%; overflow-y: auto; flex: 1; }
.search-result-item {
  display: flex; align-items: center; gap: 14px; padding: 12px;
  border-radius: 8px; cursor: pointer; transition: background var(--dur);
}
.search-result-item:hover, .search-result-item.is-focused { background: var(--bg-2); }
.search-result-img { width: 50px; height: 50px; border-radius: 6px; object-fit: cover; background: var(--bg-3); }
.search-result-text { flex: 1; min-width: 0; }
.search-result-title { font-size: 15px; font-weight: 500; }
.search-result-sub { font-size: 12px; color: var(--fg-3); margin-top: 2px; }

/* ============================================================
   Main / Routes
   ============================================================ */
.main { padding: 28px 28px 80px; max-width: 1600px; margin: 0 auto; }
.route { display: none; }
.route.is-active { display: block; animation: fadeIn 250ms var(--ease); }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ============================================================
   Hero
   ============================================================ */
.hero {
  position: relative; height: 380px; border-radius: var(--radius-lg);
  overflow: hidden; margin-bottom: 32px;
  background: linear-gradient(135deg, #1a0a05 0%, #0a0a0a 100%);
}
.hero-bg { position: absolute; inset: 0; background-size: cover; background-position: center; opacity: 0.4; filter: blur(8px); transform: scale(1.1); }
.hero-shade { position: absolute; inset: 0; background: linear-gradient(90deg, rgba(10,10,10,0.95) 0%, rgba(10,10,10,0.5) 50%, transparent 100%); }
.hero-content { position: relative; padding: 56px 48px; max-width: 700px; }
.hero-tag {
  display: inline-block; font-size: 12px; font-weight: 700; letter-spacing: 2px;
  color: var(--orange); background: var(--orange-soft);
  padding: 6px 12px; border-radius: 4px; margin-bottom: 16px;
}
.hero-title { font-size: 44px; font-weight: 800; line-height: 1.1; margin-bottom: 12px; }
.hero-sub { font-size: 17px; color: var(--fg-2); margin-bottom: 24px; }
.hero-cta { display: flex; gap: 12px; flex-wrap: wrap; }

/* ============================================================
   Buttons
   ============================================================ */
.btn {
  background: var(--bg-2); color: var(--fg);
  border: 1px solid var(--line);
  padding: 12px 24px; border-radius: 8px;
  font-size: 15px; font-weight: 600;
  cursor: pointer; transition: all var(--dur) var(--ease);
  display: inline-flex; align-items: center; gap: 8px;
}
.btn:hover { background: var(--bg-3); transform: translateY(-1px); }
.btn-primary { background: var(--orange); color: #fff; border-color: var(--orange); }
.btn-primary:hover { background: var(--orange-2); border-color: var(--orange-2); }
.btn-ghost { background: rgba(255,255,255,0.05); }
.btn-ghost:hover { background: rgba(255,255,255,0.1); }

/* Player load error overlay (canal caído) */
.player-load-error {
  position: absolute; inset: 0; z-index: 10;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.85); backdrop-filter: blur(4px);
}
.player-load-error[hidden] { display: none; }
.player-load-error-card {
  background: var(--bg-2); border: 1px solid var(--line);
  border-radius: 14px; padding: 36px 40px;
  text-align: center; max-width: 520px;
  box-shadow: var(--shadow-lg);
}
.player-load-error-icon { font-size: 56px; margin-bottom: 12px; }
.player-load-error-title { font-size: 24px; font-weight: 700; margin-bottom: 8px; color: var(--orange); }
.player-load-error-msg { color: var(--fg-2); margin-bottom: 24px; line-height: 1.4; }
.player-load-error-actions { display: flex; gap: 12px; justify-content: center; }

/* Player loading overlay con countdown de 30s */
.player-loader {
  position: absolute; inset: 0; z-index: 50;
  display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(ellipse at top, rgba(255,107,26,0.15) 0%, transparent 50%),
    radial-gradient(ellipse at bottom, rgba(255,107,26,0.08) 0%, transparent 50%),
    linear-gradient(135deg, #0a0a0a 0%, #1a1a1a 50%, #0a0a0a 100%);
  background-size: 200% 200%;
  animation: player-bg-pan 8s ease-in-out infinite;
  overflow: hidden;
}
.player-loader[hidden] { display: none; }
@keyframes player-bg-pan {
  0%, 100% { background-position: 0% 0%; }
  50% { background-position: 100% 100%; }
}
.player-loader::before {
  content: '';
  position: absolute; inset: 0;
  background-image:
    repeating-linear-gradient(45deg, transparent 0, transparent 40px, rgba(255,107,26,0.03) 40px, rgba(255,107,26,0.03) 80px);
  pointer-events: none;
}
.player-loader-card {
  position: relative;
  text-align: center; max-width: 520px; padding: 40px 32px;
  background: rgba(20, 20, 20, 0.6);
  border: 1px solid rgba(255,107,26,0.2);
  border-radius: 20px;
  backdrop-filter: blur(10px);
  box-shadow: 0 20px 60px rgba(0,0,0,0.5), 0 0 60px rgba(255,107,26,0.1);
  z-index: 1;
}
.player-loader-icon {
  width: 96px; height: 96px;
  margin: 0 auto 24px;
  background: linear-gradient(135deg, var(--orange) 0%, var(--orange-2) 100%);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 48px;
  box-shadow: 0 8px 32px rgba(255,107,26,0.4);
  animation: player-icon-pulse 1.6s ease-in-out infinite;
}
@keyframes player-icon-pulse {
  0%, 100% { transform: scale(1); box-shadow: 0 8px 32px rgba(255,107,26,0.4); }
  50% { transform: scale(1.08); box-shadow: 0 12px 48px rgba(255,107,26,0.6); }
}
.player-loader-spinner-ring {
  position: absolute;
  top: 50%; left: 50%;
  width: 120px; height: 120px;
  margin: -60px 0 0 -60px;
  border: 3px solid transparent;
  border-top-color: var(--orange);
  border-right-color: rgba(255,107,26,0.5);
  border-radius: 50%;
  animation: player-spin 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite;
}
@keyframes player-spin { to { transform: rotate(360deg); } }
.player-loader-title {
  font-size: 28px; font-weight: 800; margin-bottom: 8px; color: var(--fg);
  letter-spacing: -0.5px;
}
.player-loader-subtitle {
  font-size: 16px; color: var(--fg-2); margin-bottom: 28px;
  line-height: 1.4;
}
.player-loader-bar {
  width: 100%; height: 10px;
  background: rgba(255,255,255,0.05);
  border-radius: 5px;
  overflow: hidden; margin-bottom: 12px;
  border: 1px solid rgba(255,255,255,0.05);
}
.player-loader-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--orange) 0%, var(--orange-2) 50%, #ffb380 100%);
  background-size: 200% 100%;
  width: 0%;
  transition: width 0.3s linear;
  box-shadow: 0 0 16px var(--orange);
  animation: player-bar-shimmer 1.5s linear infinite;
}
@keyframes player-bar-shimmer {
  to { background-position: -200% 0; }
}
.player-loader-countdown {
  font-size: 18px; color: var(--orange); font-weight: 700;
  font-variant-numeric: tabular-nums;
  margin-bottom: 24px;
  text-shadow: 0 0 12px var(--orange-soft);
}
.player-loader-cancel {
  background: transparent; color: var(--fg-2);
  border: 1px solid var(--line-2);
  padding: 12px 24px; font-size: 14px;
  cursor: pointer; border-radius: 8px;
  transition: all var(--dur);
  font-weight: 500;
}
.player-loader-cancel:hover {
  background: var(--bg-3); color: var(--fg); border-color: var(--orange);
  transform: translateY(-1px);
}

/* ============================================================
   Rows (horizontal scrollers)
   ============================================================ */
.row { margin-bottom: 36px; }
.row-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.row-head h2 { font-size: 22px; font-weight: 700; }
.row-more {
  background: transparent; color: var(--fg-3); border: 0;
  font-size: 14px; cursor: pointer; padding: 6px 8px; border-radius: 6px;
  transition: color var(--dur);
}
.row-more:hover { color: var(--orange); }

.cards-row {
  display: grid; grid-auto-flow: column; grid-auto-columns: 180px;
  gap: 14px; overflow-x: auto; overflow-y: hidden;
  padding: 8px 4px 16px; scroll-snap-type: x mandatory;
  scrollbar-width: thin; scrollbar-color: var(--bg-3) transparent;
}
.cards-row::-webkit-scrollbar { height: 6px; }
.cards-row::-webkit-scrollbar-thumb { background: var(--bg-3); border-radius: 3px; }

/* ============================================================
   Grids
   ============================================================ */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 16px;
}
.grid-movies { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
.grid-anime  { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }

/* ============================================================
   Cards
   ============================================================ */
.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: transform var(--dur) var(--ease), box-shadow var(--dur);
  display: flex; flex-direction: column;
  scroll-snap-align: start;
  border: 2px solid transparent;
  position: relative;
}
.card:hover, .card.is-focused { transform: translateY(-4px); box-shadow: var(--shadow); border-color: var(--orange); }
.card.is-focused { transform: translateY(-6px) scale(1.05); box-shadow: var(--shadow-lg); z-index: 4; }
.card-img-wrap { aspect-ratio: 16/9; background: var(--bg-3); position: relative; overflow: hidden; }
.card-img-wrap.tall { aspect-ratio: 2/3; }
.card-img { width: 100%; height: 100%; object-fit: cover; transition: transform 400ms; }
.card:hover .card-img { transform: scale(1.06); }

/* Country cards (TV por país) */
.card-country .card-img-wrap.country-flag {
  aspect-ratio: 16/10;
  background: linear-gradient(135deg, rgba(255,107,26,0.12), rgba(0,0,0,0.4));
  display: grid;
  place-items: center;
}
.card-country .country-flag-big {
  font-size: 84px;
  line-height: 1;
  filter: drop-shadow(0 4px 12px rgba(0,0,0,0.6));
  transition: transform 300ms;
}
.card-country:hover .country-flag-big {
  transform: scale(1.15) rotate(-2deg);
}
.card-country .country-flag-count {
  position: absolute;
  bottom: 8px; right: 8px;
  background: rgba(0,0,0,0.75); color: #fff;
  padding: 3px 8px; border-radius: 12px;
  font-size: 11px; font-weight: 600;
  backdrop-filter: blur(4px);
}
.card-country .card-info {
  padding: 12px 14px;
}
.card-country .card-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--fg);
}
.countries-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 14px;
}
@media (max-width: 900px) {
  .countries-row { grid-template-columns: repeat(2, 1fr); }
}
.card-badge {
  position: absolute; top: 8px; left: 8px;
  background: var(--orange); color: #fff;
  padding: 3px 8px; border-radius: 4px;
  font-size: 11px; font-weight: 700;
}
.card-live {
  position: absolute; top: 8px; right: 8px;
  background: rgba(0,0,0,0.7); color: #fff;
  padding: 3px 8px; border-radius: 4px;
  font-size: 11px; font-weight: 600;
  display: flex; align-items: center; gap: 5px;
}
.card-live::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: #ef4444; box-shadow: 0 0 6px #ef4444; animation: pulse 1.5s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }
.card-info { padding: 10px 12px 12px; flex: 1; }
.card-title { font-size: 14px; font-weight: 600; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-sub { font-size: 12px; color: var(--fg-3); margin-top: 4px; display: flex; align-items: center; gap: 6px; }
.card-rating { color: var(--orange); font-weight: 700; }

/* Channel logo variant (square) */
.card-channel .card-img-wrap { aspect-ratio: 1; background: #fff; display: grid; place-items: center; padding: 16px; }
.card-channel .card-img { object-fit: contain; }
.card-channel .card-title { color: var(--fg); }
.card-channel .card-sub { color: var(--fg-3); }

/* ============================================================
   Page head / filters
   ============================================================ */
.page-head { margin-bottom: 24px; }
.page-head h1 { font-size: 32px; font-weight: 800; margin-bottom: 14px; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.chip {
  background: var(--bg-2); color: var(--fg-2);
  border: 1px solid var(--line);
  padding: 8px 16px; border-radius: 20px;
  font-size: 14px; font-weight: 500; cursor: pointer;
  transition: all var(--dur) var(--ease);
}
.chip:hover { background: var(--bg-3); color: var(--fg); }
.chip.is-active { background: var(--orange); color: #fff; border-color: var(--orange); }
.src-tag { font-size: 12px; color: var(--fg-3); margin-top: 4px; }

/* ============================================================
   TV Layout (Netflix-style: sidebar + sections)
   ============================================================ */
.tv-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 24px;
  min-height: calc(100vh - 200px);
}

/* Sidebar */
.tv-sidebar {
  position: sticky; top: 80px;
  align-self: start;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 12px;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
}
.tv-sidebar-section + .tv-sidebar-section { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); }
.tv-sidebar-label {
  font-size: 11px; font-weight: 700; letter-spacing: 1.5px;
  color: var(--fg-3); text-transform: uppercase;
  padding: 0 10px 8px;
}
.tv-nav { display: flex; flex-direction: column; gap: 2px; }
.tv-nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 8px;
  background: transparent; color: var(--fg-2);
  border: 0; cursor: pointer;
  font-size: 14px; font-weight: 500;
  text-align: left; width: 100%;
  transition: all var(--dur) var(--ease);
}
.tv-nav-item:hover { background: var(--bg-3); color: var(--fg); }
.tv-nav-item.is-active { background: var(--orange-soft); color: var(--orange); }
.tv-nav-item.is-active .tv-nav-icon { color: var(--orange); }
.tv-nav-icon { font-size: 16px; min-width: 20px; }
.tv-nav-count {
  margin-left: auto; font-size: 11px;
  color: var(--fg-3); background: var(--bg);
  padding: 1px 7px; border-radius: 10px; min-width: 24px; text-align: center;
}
.tv-nav-item.is-active .tv-nav-count { background: var(--orange); color: #fff; }
.tv-sidebar-foot { padding: 14px 10px 4px; border-top: 1px solid var(--line); margin-top: 16px; }

/* Hero */
.tv-content { min-width: 0; }
.tv-hero {
  position: relative;
  height: 220px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: linear-gradient(135deg, #2a1208 0%, #0a0a0a 100%);
  margin-bottom: 28px;
  transition: background 400ms var(--ease);
}
.tv-hero.is-deportes { background: linear-gradient(135deg, #1a3a1a 0%, #0a0a0a 100%); }
.tv-hero.is-infantiles { background: linear-gradient(135deg, #2a1a3a 0%, #0a0a0a 100%); }
.tv-hero.is-radio { background: linear-gradient(135deg, #2a2a0a 0%, #0a0a0a 100%); }
.tv-hero.is-musica { background: linear-gradient(135deg, #3a1a2a 0%, #0a0a0a 100%); }
.tv-hero.is-internacional { background: linear-gradient(135deg, #1a2a3a 0%, #0a0a0a 100%); }
.tv-hero.is-nacional { background: linear-gradient(135deg, #3a2a1a 0%, #0a0a0a 100%); }
.tv-hero-bg {
  position: absolute; inset: 0;
  background-size: cover; background-position: center;
  opacity: 0.25; filter: blur(20px); transform: scale(1.2);
  transition: opacity 400ms;
}
.tv-hero-shade {
  position: absolute; inset: 0;
  background: linear-gradient(90deg, rgba(10,10,10,0.95) 0%, rgba(10,10,10,0.6) 60%, transparent 100%);
}
.tv-hero-content { position: relative; padding: 36px 40px; max-width: 600px; }
.tv-hero-tag {
  display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: 2px;
  color: var(--orange); background: var(--orange-soft);
  padding: 5px 10px; border-radius: 4px; margin-bottom: 12px;
}
.tv-hero-title { font-size: 32px; font-weight: 800; line-height: 1.1; margin-bottom: 6px; }
.tv-hero-sub { font-size: 15px; color: var(--fg-2); }
.tv-hero-count {
  display: inline-block; margin-top: 10px;
  font-size: 12px; color: var(--fg-3);
}

/* Sections (rows horizontales) */
.tv-sections { display: flex; flex-direction: column; gap: 28px; }
.tv-section { animation: fadeIn 250ms var(--ease); }
.tv-section-head {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 12px; padding: 0 4px;
}
.tv-section-title {
  font-size: 18px; font-weight: 700;
  display: flex; align-items: center; gap: 8px;
}
.tv-section-title .icon { font-size: 20px; }
.tv-section-count {
  font-size: 12px; color: var(--fg-3);
  background: var(--bg-2); padding: 2px 8px; border-radius: 10px;
}
.tv-section-row {
  display: grid; grid-auto-flow: column; grid-auto-columns: 180px;
  gap: 12px; overflow-x: auto; overflow-y: hidden;
  padding: 6px 4px 12px;
  scroll-snap-type: x mandatory;
  scrollbar-width: thin; scrollbar-color: var(--bg-3) transparent;
}
.tv-section-row::-webkit-scrollbar { height: 6px; }
.tv-section-row::-webkit-scrollbar-thumb { background: var(--bg-3); border-radius: 3px; }
.tv-section-row .card { scroll-snap-align: start; }
.tv-section-more {
  margin-top: 12px; text-align: center;
}
.tv-section-more button {
  background: var(--bg-2); color: var(--fg-2);
  border: 1px solid var(--line);
  padding: 8px 20px; border-radius: 20px;
  font-size: 13px; cursor: pointer;
  transition: all var(--dur) var(--ease);
}
.tv-section-more button:hover { background: var(--bg-3); color: var(--fg); }

/* Grid view (cuando filtras por categoría) */
.tv-grid-view {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 14px;
}
.tv-grid-view .card-channel .card-img-wrap { aspect-ratio: 1; }

/* Responsive TV layout */
@media (max-width: 900px) {
  .tv-layout { grid-template-columns: 1fr; }
  .tv-sidebar { position: relative; top: 0; max-height: none; }
  .tv-nav { flex-direction: row; flex-wrap: wrap; }
  .tv-nav-item { flex: 1 1 auto; }
  .tv-sidebar-section + .tv-sidebar-section { display: none; }
  .tv-hero { height: 160px; }
  .tv-hero-content { padding: 22px 20px; }
  .tv-hero-title { font-size: 22px; }
  .tv-section-row { grid-auto-columns: 140px; }
}

/* ============================================================
   Skeleton loaders
   ============================================================ */
.skel {
  background: linear-gradient(90deg, var(--bg-2) 0%, var(--bg-3) 50%, var(--bg-2) 100%);
  background-size: 200% 100%;
  border-radius: var(--radius);
  aspect-ratio: 16/9;
  animation: shimmer 1.5s ease-in-out infinite;
}
.skel-tall { aspect-ratio: 2/3; }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ============================================================
   Player overlay
   ============================================================ */
.player-overlay {
  position: fixed; inset: 0; z-index: 500;
  background: #000;
  display: flex; flex-direction: column;
}
.player-bar {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 22px;
  background: linear-gradient(180deg, rgba(0,0,0,0.9) 0%, transparent 100%);
  position: absolute; top: 0; left: 0; right: 0;
  z-index: 2;
  transition: transform var(--dur) var(--ease);
}
.player-overlay.is-controls-hidden .player-bar { transform: translateY(-100%); }
.player-back, .player-fav, .player-fullscreen {
  background: rgba(255,255,255,0.08); color: #fff;
  border: 0; padding: 8px 14px; border-radius: 8px;
  font-size: 14px; font-weight: 600; cursor: pointer;
  transition: background var(--dur);
}
.player-back:hover, .player-fav:hover, .player-fullscreen:hover { background: rgba(255,255,255,0.15); }
.player-fav.is-on { background: var(--orange); }
.player-fullscreen { font-size: 18px; padding: 8px 12px; line-height: 1; }
.player-title { flex: 1; font-size: 16px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player-stage { flex: 1; display: grid; place-items: center; background: #000; }
.player-stage video, .player-stage iframe { width: 100%; height: 100%; max-height: 100vh; object-fit: contain; background: #000; }
.player-info { padding: 20px 28px; background: var(--bg-2); max-height: 50vh; overflow-y: auto; }
.player-meta { display: flex; gap: 14px; font-size: 13px; color: var(--fg-3); margin-bottom: 8px; flex-wrap: wrap; }
.player-meta .rating { color: var(--orange); font-weight: 700; }
.player-desc { font-size: 14px; color: var(--fg-2); line-height: 1.6; white-space: pre-wrap; }

/* Watch providers (Netflix, Amazon, etc.) */
.player-providers { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); }
.player-providers-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.player-providers-label { font-size: 12px; font-weight: 700; letter-spacing: 1.5px; color: var(--fg-3); text-transform: uppercase; }
.player-providers-link { color: var(--orange); text-decoration: none; font-size: 13px; font-weight: 600; }
.player-providers-link:hover { text-decoration: underline; }
.player-providers-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}
.provider-chip {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  background: var(--bg); border: 1px solid var(--line);
  border-radius: 10px;
  text-decoration: none; color: var(--fg);
  transition: all var(--dur) var(--ease);
  font-size: 13px;
  min-height: 48px;
}
.provider-chip:hover { background: var(--bg-3); border-color: var(--orange); transform: translateY(-1px); }
.provider-chip img { width: 28px; height: 28px; object-fit: contain; border-radius: 4px; flex-shrink: 0; }
.provider-chip .provider-name { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.provider-chip .provider-kind { display: block; font-size: 10px; color: var(--fg-3); text-transform: uppercase; letter-spacing: 0.5px; }
.player-providers-empty { font-size: 13px; color: var(--fg-3); }

/* ============================================================
   Modal (TMDB key)
   ============================================================ */
.modal {
  position: fixed; inset: 0; z-index: 600;
  background: rgba(0,0,0,0.85);
  backdrop-filter: blur(8px);
  display: grid; place-items: center;
  padding: 20px;
}
.modal-card {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 28px;
  max-width: 480px; width: 100%;
  box-shadow: var(--shadow-lg);
}
.modal-title { font-size: 20px; font-weight: 700; margin-bottom: 8px; }
.modal-desc { font-size: 14px; color: var(--fg-2); margin-bottom: 4px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }
.modal code { font-family: 'Courier New', monospace; }

/* ============================================================
   Toast
   ============================================================ */
.toast {
  position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--bg-3); color: var(--fg);
  padding: 12px 20px; border-radius: 8px;
  font-size: 14px; font-weight: 500;
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
  z-index: 1000;
  opacity: 0; transition: all 250ms var(--ease);
  pointer-events: none;
}
.toast.is-shown { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.is-success { border-color: var(--orange); }
.toast.is-error { border-color: #ef4444; }

/* ============================================================
   Footer
   ============================================================ */
.footer {
  text-align: center; padding: 20px 28px 28px;
  color: var(--fg-3); font-size: 12px;
  border-top: 1px solid var(--line);
  margin-top: 40px;
}

/* ============================================================
   Empty state
   ============================================================ */
.empty {
  text-align: center; padding: 60px 20px; color: var(--fg-3);
}
.empty-icon { font-size: 48px; margin-bottom: 16px; opacity: 0.4; }
.empty-text { font-size: 16px; margin-bottom: 8px; }
.empty-hint { font-size: 13px; }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 900px) {
  .topbar { padding: 10px 16px; }
  .topnav { gap: 0; }
  .nav-btn { padding: 8px 12px; font-size: 13px; }
  .main { padding: 16px 16px 60px; }
  .hero { height: 280px; }
  .hero-content { padding: 32px 24px; }
  .hero-title { font-size: 28px; }
  .hero-sub { font-size: 14px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
  .cards-row { grid-auto-columns: 140px; }
  .footer { display: none; }
}

@media (max-width: 600px) {
  .brand-text { display: none; }
  .net-indicator { display: none; }
  .page-head h1 { font-size: 24px; }
}
