/* ══════════════════════════════════════════════════
   SilvaStream — Live TV Page
   ══════════════════════════════════════════════════ */

body { background: var(--bg); color: var(--text); min-height: 100vh; }

/* ── Page Header / Hero ─────────────────────────── */
.tv-hero {
  background: linear-gradient(135deg, #040714 0%, #0c0f20 60%, #14172b 100%);
  padding: calc(var(--nav-h,72px) + 40px) clamp(16px,4vw,60px) 40px;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.tv-hero-title {
  font-size: clamp(28px, 5vw, 52px); font-weight: 900; margin: 0 0 10px;
  background: linear-gradient(135deg, #fff 0%, var(--accent) 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
.tv-hero-sub { font-size: 16px; color: var(--text-2); margin: 0 0 28px; }

/* TV Search */
.tv-search-bar {
  display: flex; align-items: center; gap: 0;
  background: var(--bg-card); border: 1px solid rgba(255,255,255,.1);
  border-radius: 12px; max-width: 480px; overflow: hidden;
  transition: border-color .25s;
}
.tv-search-bar:focus-within { border-color: var(--accent); }
.tv-search-bar input {
  flex: 1; background: none; border: none; outline: none;
  color: var(--text); font-family: inherit; font-size: 15px;
  padding: 14px 18px;
}
.tv-search-bar input::placeholder { color: var(--text-muted); }
.tv-search-bar button {
  background: var(--accent); border: none; color: #fff;
  padding: 14px 20px; cursor: pointer; font-size: 15px;
  transition: background .2s;
}
.tv-search-bar button:hover { background: #f40612; }

/* ── Country Section ────────────────────────────── */
.tv-section { padding: 0 clamp(16px,4vw,60px) 50px; }
.tv-section-title {
  font-size: 20px; font-weight: 800; margin: 36px 0 18px;
  display: flex; align-items: center; gap: 10px;
}
.tv-section-title::before {
  content: ''; display: block; width: 4px; height: 22px;
  background: var(--accent); border-radius: 2px;
}

/* Popular country tabs */
.country-tabs {
  display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 28px;
}
.country-tab {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 18px; border-radius: 30px;
  background: var(--bg-card); border: 1px solid rgba(255,255,255,.08);
  cursor: pointer; transition: all .2s; font-size: 14px; font-weight: 500;
  white-space: nowrap;
}
.country-tab:hover { background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.2); }
.country-tab.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.country-flag { font-size: 18px; line-height: 1; }

/* All countries list */
.all-countries-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px; margin-bottom: 40px;
}
.all-countries-btn {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; border-radius: 10px;
  background: var(--bg-card); border: 1px solid rgba(255,255,255,.06);
  cursor: pointer; transition: all .2s; font-size: 13px; font-weight: 500;
  color: var(--text);
}
.all-countries-btn:hover { background: rgba(255,255,255,.07); border-color: rgba(255,255,255,.15); }
.all-countries-btn.active { background: rgba(229,9,20,.1); border-color: rgba(229,9,20,.3); color: var(--accent); }

/* ── Channel Grid ───────────────────────────────── */
.channels-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.channels-count { font-size: 14px; color: var(--text-muted); }

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

.channel-card {
  background: var(--bg-card); border: 1px solid rgba(255,255,255,.06);
  border-radius: 12px; overflow: hidden; cursor: pointer;
  transition: all .25s; display: flex; flex-direction: column;
}
.channel-card:hover {
  transform: translateY(-4px);
  border-color: rgba(229,9,20,.4);
  box-shadow: 0 8px 30px rgba(0,0,0,.4);
}
.channel-card.playing {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(229,9,20,.3);
}

.channel-logo-wrap {
  aspect-ratio: 16/9; background: var(--bg-3);
  display: flex; align-items: center; justify-content: center;
  padding: 16px; position: relative; overflow: hidden;
}
.channel-logo {
  max-width: 80%; max-height: 70%; object-fit: contain;
  filter: brightness(.9);
}
.channel-logo-ph {
  font-size: 32px; color: var(--text-muted);
}
.channel-play-ov {
  position: absolute; inset: 0; background: rgba(229,9,20,.8);
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; color: #fff; opacity: 0; transition: opacity .2s;
}
.channel-card:hover .channel-play-ov { opacity: 1; }
.channel-card.playing .channel-play-ov { opacity: 1; }

.channel-info { padding: 10px 12px; }
.channel-name {
  font-size: 13px; font-weight: 600; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
}
.channel-group { font-size: 11px; color: var(--text-muted); margin-top: 3px; }

/* Live indicator */
.live-badge {
  position: absolute; top: 8px; left: 8px;
  background: var(--accent); color: #fff; font-size: 9px;
  font-weight: 800; padding: 3px 7px; border-radius: 4px;
  letter-spacing: .5px;
}

/* Verified badge on featured channels */
.verified-badge {
  position: absolute; bottom: 8px; left: 8px;
  background: rgba(34,197,94,.15); color: #22c55e;
  font-size: 9px; font-weight: 700; padding: 3px 7px;
  border-radius: 4px; letter-spacing: .3px;
  border: 1px solid rgba(34,197,94,.3);
  backdrop-filter: blur(4px);
}

/* ── Embedded Player ────────────────────────────── */
.tv-player-section {
  position: sticky; top: var(--nav-h, 72px); z-index: 50;
  background: #000; display: none;
}
.tv-player-section.show { display: block; }

.tv-player-wrap {
  position: relative; width: 100%; padding-top: min(42.85%, 480px); max-height: 480px;
  background: #000;
}
.tv-player-wrap video, .tv-player-wrap iframe {
  position: absolute; inset: 0; width: 100%; height: 100%;
}
.tv-player-bar {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--bg-2); padding: 10px 16px;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.tv-playing-name {
  font-size: 14px; font-weight: 700; display: flex; align-items: center; gap: 8px;
}
.tv-close-btn {
  background: var(--bg-card); border: 1px solid rgba(255,255,255,.1);
  color: var(--text); padding: 6px 14px; border-radius: 6px;
  font-size: 12px; cursor: pointer; transition: background .2s;
}
.tv-close-btn:hover { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ── Skeleton / Loading ─────────────────────────── */
.channel-skeleton {
  background: var(--bg-card); border-radius: 12px; overflow: hidden;
  animation: shimmer 1.6s infinite;
}
.channel-skeleton-img { height: 90px; background: var(--bg-3); }
.channel-skeleton-txt { padding: 10px 12px; }
.channel-skeleton-line {
  height: 12px; background: var(--bg-3); border-radius: 6px; margin-bottom: 8px;
}
.channel-skeleton-line.short { width: 60%; }

@keyframes shimmer {
  0%,100% { opacity: 1; }
  50% { opacity: .5; }
}

/* ── Empty State ────────────────────────────────── */
.tv-empty {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; padding: 80px 40px; text-align: center;
  color: var(--text-muted); gap: 12px;
}
.tv-empty i { font-size: 48px; color: var(--bg-3); }
.tv-empty h3 { font-size: 18px; margin: 0; }

/* ── Load More ──────────────────────────────────── */
#load-more-wrap {
  display: flex; justify-content: center;
  padding: 28px 0 8px;
}
.load-more-btn {
  display: inline-flex; align-items: center; gap: 10px;
  background: var(--bg-card); color: var(--text);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 50px; padding: 12px 32px; font-size: 15px;
  font-weight: 600; cursor: pointer; transition: all .2s;
  font-family: inherit;
}
.load-more-btn:hover {
  background: var(--accent); border-color: var(--accent);
  color: #fff; transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(229,9,20,.3);
}
.load-more-btn i { font-size: 16px; }
.load-more-count { font-size: 13px; opacity: .7; font-weight: 400; }

/* All Channels special tab */
.all-channels-tab {
  background: linear-gradient(135deg, #1a1d2e, #14172b);
  border: 1px solid rgba(255,255,255,.15) !important;
}
.all-channels-tab.active,
.all-channels-tab:hover {
  background: linear-gradient(135deg, var(--accent), #b91c1c) !important;
  border-color: var(--accent) !important;
}

/* ── Responsive ─────────────────────────────────── */
@media (max-width: 640px) {
  .channels-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
  .country-tabs { gap: 6px; }
  .country-tab { padding: 7px 14px; font-size: 13px; }
  .all-countries-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
}
