/* ============================================================
   WorldTV Live - Main Stylesheet
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Bebas+Neue&family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
  --bg: #0a0c10;
  --bg2: #111318;
  --bg3: #181c24;
  --card: #13161d;
  --border: #1e2330;
  --accent: #e63946;
  --accent2: #ff6b35;
  --gold: #ffd60a;
  --text: #e8eaf0;
  --text2: #8b92a8;
  --text3: #555d75;
  --live: #22c55e;
  --radius: 12px;
  --shadow: 0 4px 24px rgba(0,0,0,0.4);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'Outfit', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; height: auto; }

/* ---- SCROLLBAR ---- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg2); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* ---- HEADER ---- */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(10,12,16,0.92);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  max-width: 1400px; margin: 0 auto;
  padding: 0 24px;
  display: flex; align-items: center; gap: 24px;
  height: 64px;
}
.logo {
  display: flex; align-items: center; gap: 10px;
  font-family: 'Bebas Neue', sans-serif;
  font-size: 28px;
  letter-spacing: 2px;
}
.logo-icon {
  width: 36px; height: 36px;
  background: var(--accent);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
}
.logo span { color: var(--accent); }
.header-search {
  flex: 1; max-width: 400px; margin-left: auto;
  position: relative;
}
.header-search input {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 9px 40px 9px 16px;
  font-family: 'Outfit', sans-serif;
  font-size: 14px;
  outline: none;
  transition: border-color .2s;
}
.header-search input:focus { border-color: var(--accent); }
.header-search button {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  background: none; border: none; color: var(--text2); cursor: pointer; font-size: 16px;
}
.header-nav { display: flex; gap: 4px; }
.header-nav a {
  padding: 7px 14px;
  border-radius: 7px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text2);
  transition: all .2s;
}
.header-nav a:hover, .header-nav a.active { background: var(--bg3); color: var(--text); }

/* ---- LIVE BADGE ---- */
.live-badge {
  display: inline-flex; align-items: center; gap: 5px;
  background: var(--live);
  color: #fff;
  font-size: 11px; font-weight: 700; letter-spacing: 1px;
  padding: 3px 8px;
  border-radius: 4px;
}
.live-dot {
  width: 6px; height: 6px;
  background: #fff; border-radius: 50%;
  animation: pulse 1.4s infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.8); }
}

/* ---- HERO ---- */
.hero {
  background: linear-gradient(135deg, #0d1017 0%, #111827 50%, #0a0c10 100%);
  padding: 56px 24px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at 50% 0%, rgba(230,57,70,0.12) 0%, transparent 60%);
}
.hero-content { position: relative; max-width: 700px; margin: 0 auto; }
.hero h1 {
  font-family: 'Bebas Neue', sans-serif;
  font-size: clamp(42px, 7vw, 80px);
  letter-spacing: 3px;
  line-height: 1;
  margin-bottom: 16px;
}
.hero h1 em { color: var(--accent); font-style: normal; }
.hero p { color: var(--text2); font-size: 17px; margin-bottom: 32px; }
.hero-stats {
  display: flex; justify-content: center; gap: 40px;
}
.hero-stat strong {
  display: block;
  font-family: 'Bebas Neue', sans-serif;
  font-size: 36px; color: var(--accent);
  letter-spacing: 2px;
}
.hero-stat span { font-size: 13px; color: var(--text3); text-transform: uppercase; letter-spacing: 1px; }

/* ---- LAYOUT ---- */
.main-layout {
  max-width: 1400px; margin: 0 auto;
  padding: 32px 24px;
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 32px;
}
@media (max-width: 900px) {
  .main-layout { grid-template-columns: 1fr; }
  .sidebar { display: none; }
}

/* ---- SIDEBAR ---- */
.sidebar { display: flex; flex-direction: column; gap: 24px; }
.sidebar-box {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.sidebar-title {
  padding: 14px 18px;
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 1.5px;
  color: var(--text3);
  border-bottom: 1px solid var(--border);
}
.sidebar-list a {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 18px;
  font-size: 14px;
  border-bottom: 1px solid var(--border);
  transition: background .15s;
}
.sidebar-list a:last-child { border-bottom: none; }
.sidebar-list a:hover { background: var(--bg3); }
.sidebar-list a.active { background: rgba(230,57,70,0.1); color: var(--accent); }
.sidebar-list .count {
  margin-left: auto;
  font-size: 11px; color: var(--text3);
  background: var(--bg3);
  padding: 2px 7px; border-radius: 20px;
}

/* ---- CHANNEL GRID ---- */
.content-area {}
.section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px;
}
.section-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 24px; letter-spacing: 2px;
}
.section-title small {
  font-family: 'Outfit', sans-serif;
  font-size: 13px; font-weight: 400;
  color: var(--text3); letter-spacing: 0; margin-left: 8px;
}
.filter-bar {
  display: flex; gap: 8px; flex-wrap: wrap;
  margin-bottom: 24px;
}
.filter-btn {
  padding: 7px 16px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--text2);
  font-family: 'Outfit', sans-serif;
  font-size: 13px;
  cursor: pointer;
  transition: all .2s;
}
.filter-btn:hover, .filter-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.channel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}
.channel-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform .2s, box-shadow .2s, border-color .2s;
  cursor: pointer;
}
.channel-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 32px rgba(230,57,70,0.15);
  border-color: var(--accent);
}
.channel-thumb {
  aspect-ratio: 16/9;
  background: var(--bg3);
  display: flex; align-items: center; justify-content: center;
  position: relative;
  overflow: hidden;
}
.channel-thumb img { width: 100%; height: 100%; object-fit: cover; }
.channel-thumb .play-btn {
  position: absolute;
  width: 44px; height: 44px;
  background: rgba(230,57,70,0.9);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  opacity: 0;
  transition: opacity .2s;
}
.channel-card:hover .play-btn { opacity: 1; }
.channel-thumb .no-logo {
  font-size: 36px;
  font-family: 'Bebas Neue', sans-serif;
  color: var(--text3);
}
.channel-info { padding: 12px 14px; }
.channel-name {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 4px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.channel-meta {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--text2);
}
.channel-type-badge {
  font-size: 10px; font-weight: 700;
  padding: 2px 6px; border-radius: 4px;
  text-transform: uppercase; letter-spacing: 1px;
}
.badge-embed { background: rgba(59,130,246,0.2); color: #60a5fa; }
.badge-m3u { background: rgba(34,197,94,0.2); color: #4ade80; }
.badge-ts { background: rgba(168,85,247,0.2); color: #c084fc; }
.badge-hls { background: rgba(245,158,11,0.2); color: #fbbf24; }
.channel-featured {
  position: absolute; top: 8px; left: 8px;
  background: var(--gold); color: #000;
  font-size: 9px; font-weight: 800;
  padding: 2px 6px; border-radius: 4px;
  text-transform: uppercase; letter-spacing: 1px;
}

/* ---- WATCH PAGE ---- */
.watch-layout {
  max-width: 1400px; margin: 0 auto;
  padding: 24px;
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 24px;
}
@media (max-width: 1024px) { .watch-layout { grid-template-columns: 1fr; } }
.player-wrap {
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
  aspect-ratio: 16/9;
  position: relative;
}
.player-wrap iframe, .player-wrap video {
  width: 100%; height: 100%;
  border: none;
}
/* Video Player States */
#video-player {
  background: black;
}
.player-container::before {
  content: 'Loading stream...';
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  color: var(--text3);
  font-size: 14px;
  z-index: 0;
}
.player-container.is-playing::before {
  display: none;
}

.embed-responsive {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.embed-responsive iframe, 
.embed-responsive object, 
.embed-responsive embed,
.embed-responsive video {
  position: absolute;
  top: 0; left: 0;
  width: 100% !important;
  height: 100% !important;
  border: none;
  object-fit: contain;
}
/* Ad Containers */
.ad-container { margin: 20px 0; display: flex; flex-direction: column; align-items: center; gap: 15px; }
.ad-sidebar { margin: 0 0 24px 0; }
.ad-overlay {
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  pointer-events: none; /* Let clicks pass through to player unless it's the ad */
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
}
.ad-overlay .ad-unit { pointer-events: auto; }
.ad-pre_roll {
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  z-index: 40;
  background: rgba(0,0,0,0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
}
.ad-close {
  position: absolute;
  top: 15px; right: 15px;
  background: var(--accent);
  color: white;
  padding: 5px 12px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  z-index: 50;
  box-shadow: 0 2px 10px rgba(0,0,0,0.3);
  transition: transform 0.2s;
}
.ad-countdown {
  position: absolute;
  top: 15px; right: 15px;
  background: rgba(0,0,0,0.6);
  color: white;
  padding: 5px 12px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  z-index: 45;
  border: 1px solid rgba(255,255,255,0.1);
}
.ad-close:hover { transform: scale(1.05); }
.ad-overlay .ad-close {
  top: 5px; right: 5px;
  padding: 2px 8px;
  background: rgba(0,0,0,0.5);
  border: 1px solid rgba(255,255,255,0.2);
}

.player-overlay-ad {
  position: absolute; bottom: 60px; right: 16px;
  background: rgba(0,0,0,0.85);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  max-width: 300px;
  font-size: 13px;
}
.player-overlay-ad .close-ad {
  position: absolute; top: 4px; right: 8px;
  cursor: pointer; color: var(--text3); font-size: 16px;
}
.channel-detail {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px;
  margin-top: 16px;
}
.channel-detail h1 { font-size: 22px; font-weight: 700; margin-bottom: 8px; }
.channel-detail-meta { display: flex; gap: 12px; flex-wrap: wrap; font-size: 13px; color: var(--text2); }
.related-channels h3 {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 20px; letter-spacing: 1px;
  margin-bottom: 14px;
}
.related-list { display: flex; flex-direction: column; gap: 8px; }
.related-item {
  display: flex; gap: 10px; align-items: center;
  padding: 10px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: 9px;
  transition: border-color .15s;
}
.related-item:hover { border-color: var(--accent); }
.related-thumb {
  width: 64px; height: 36px;
  background: var(--bg3); border-radius: 6px;
  flex-shrink: 0; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
}
.related-thumb img { width: 100%; height: 100%; object-fit: cover; }
.related-name { font-size: 13px; font-weight: 500; }
.related-country { font-size: 11px; color: var(--text3); }

/* ---- PAGINATION ---- */
.pagination {
  display: flex; justify-content: center; gap: 6px;
  margin-top: 32px;
}
.pagination a, .pagination span {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  background: var(--card); border: 1px solid var(--border);
  border-radius: 8px; font-size: 14px;
  transition: all .15s;
}
.pagination a:hover { border-color: var(--accent); color: var(--accent); }
.pagination .current { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ---- ADS ---- */
.ad-container { margin: 16px 0; text-align: center; }
.ad-container.ad-banner_top { margin-bottom: 24px; }
.ad-unit { display: inline-block; max-width: 100%; }

/* ---- FOOTER ---- */
.site-footer {
  background: var(--bg2);
  border-top: 1px solid var(--border);
  margin-top: 64px;
  padding: 48px 24px 24px;
}
.footer-inner {
  max-width: 1400px; margin: 0 auto;
  display: grid; grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 40px;
}
@media (max-width: 768px) { .footer-inner { grid-template-columns: 1fr 1fr; } }
.footer-brand .logo { margin-bottom: 12px; }
.footer-brand p { font-size: 14px; color: var(--text2); line-height: 1.6; }
.footer-col h4 {
  font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 1.5px;
  color: var(--text3); margin-bottom: 14px;
}
.footer-col a {
  display: block; font-size: 14px;
  color: var(--text2); margin-bottom: 8px;
  transition: color .15s;
}
.footer-col a:hover { color: var(--accent); }
.footer-bottom {
  max-width: 1400px; margin: 32px auto 0;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
  font-size: 13px; color: var(--text3);
}
@media (max-width: 600px) { .footer-bottom { flex-direction: column; gap: 8px; } }

/* ---- UTILITIES ---- */
.container { max-width: 1400px; margin: 0 auto; padding: 0 24px; }
.text-accent { color: var(--accent); }
.text-muted { color: var(--text2); }
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 8px; border-radius: 5px;
  font-size: 11px; font-weight: 600; letter-spacing: 0.5px;
}
.no-results {
  text-align: center; padding: 64px 24px;
  color: var(--text3);
}
.no-results h2 { font-size: 28px; margin-bottom: 8px; }

/* ---- RESPONSIVE ---- */
@media (max-width: 600px) {
  .hero { padding: 36px 16px; }
  .hero-stats { gap: 20px; }
  .channel-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
  .header-inner { padding: 0 14px; gap: 12px; }
  .header-nav { display: none; }
}
