/* ═══════════════════════════════════════
   STREAMWORLD — PREMIUM UI
   ═══════════════════════════════════════ */

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

:root {
  --bg:       #0a0b0f;
  --bg2:      #111318;
  --bg3:      #1a1d26;
  --bg4:      #22263a;
  --border:   rgba(255,255,255,0.07);
  --border2:  rgba(255,255,255,0.12);
  --accent:   #ff4d4d;
  --accent2:  #ff7070;
  --text:     #f0f0f5;
  --muted:    #6b7094;
  --muted2:   #9094b4;
  --radius:   12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --sidebar-w: 210px;
  --topbar-h:  58px;
}

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'DM Sans', system-ui, sans-serif;
  font-size: 14px;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ── VPN BANNER ─────────────────── */
.vpn-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 20px;
  background: linear-gradient(90deg, #1a1200 0%, #251a00 100%);
  border-bottom: 1px solid rgba(255,180,0,0.15);
  font-size: 12px;
  color: #c8a64a;
}
.vpn-icon { font-size: 14px; }
.vpn-link {
  margin-left: auto;
  color: #f5c842;
  text-decoration: none;
  font-weight: 600;
  font-size: 12px;
  padding: 3px 10px;
  border: 1px solid rgba(245,200,66,0.3);
  border-radius: 6px;
  transition: all .2s;
}
.vpn-link:hover { background: rgba(245,200,66,0.1); }
.vpn-close {
  background: none; border: none; color: #7a6830;
  cursor: pointer; font-size: 14px; padding: 2px 4px; margin-left: 4px;
}

/* ── TOPBAR ─────────────────────── */
.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  height: var(--topbar-h);
  padding: 0 20px;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 200;
  backdrop-filter: blur(12px);
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  flex-shrink: 0;
}
.logo-icon {
  width: 32px; height: 32px;
  background: var(--accent);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
  color: #fff;
  font-weight: 700;
  flex-shrink: 0;
}
.logo-text {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.3px;
}
.logo-accent { color: var(--accent); }

.search-wrap {
  flex: 1;
  max-width: 440px;
  position: relative;
}
.search-icon {
  position: absolute;
  left: 12px; top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
  pointer-events: none;
}
.search-wrap input {
  width: 100%;
  padding: 9px 14px 9px 36px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: border-color .2s;
}
.search-wrap input::placeholder { color: var(--muted); }
.search-wrap input:focus { border-color: var(--accent); }

.top-tabs {
  display: flex;
  gap: 4px;
  background: var(--bg3);
  padding: 4px;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}
.top-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--muted2);
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all .2s;
  white-space: nowrap;
}
.top-tab .tab-icon { font-size: 14px; }
.top-tab:hover { color: var(--text); background: rgba(255,255,255,0.05); }
.top-tab.active { background: var(--accent); color: #fff; font-weight: 600; }

.topbar-right { margin-left: auto; flex-shrink: 0; }

.live-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 77, 77, 0.12);
  border: 1px solid rgba(255, 77, 77, 0.25);
  color: var(--accent2);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  padding: 5px 12px;
  border-radius: 20px;
  white-space: nowrap;
  text-transform: uppercase;
}
.live-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 1.4s ease-in-out infinite;
  flex-shrink: 0;
}
.live-dot.red { background: var(--accent); }
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: .4; transform: scale(.75); }
}

/* ── LAYOUT ─────────────────────── */
.layout {
  display: flex;
  height: calc(100vh - var(--topbar-h));
  overflow: hidden;
}

/* ── SIDEBAR ─────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--bg2);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 16px 0 24px;
  scrollbar-width: thin;
  scrollbar-color: var(--bg4) transparent;
}
.sidebar::-webkit-scrollbar { width: 3px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--bg4); border-radius: 4px; }

.sidebar-group { margin-bottom: 6px; }

.sidebar-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--muted);
  padding: 12px 16px 6px;
}

.sidebar-search {
  display: block;
  width: calc(100% - 24px);
  margin: 0 12px 6px;
  padding: 6px 10px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 12px;
  font-family: inherit;
  outline: none;
}
.sidebar-search:focus { border-color: var(--accent); }

.filter-list { display: flex; flex-direction: column; }

.filter-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 16px;
  border: none;
  background: none;
  color: var(--muted2);
  font-size: 13px;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  border-left: 2px solid transparent;
  transition: all .15s;
  position: relative;
}
.filter-btn:hover {
  background: rgba(255,255,255,0.04);
  color: var(--text);
}
.filter-btn.active {
  background: rgba(255,77,77,0.08);
  color: var(--text);
  border-left-color: var(--accent);
  font-weight: 500;
}

.filter-count {
  font-size: 10px;
  background: var(--bg3);
  color: var(--muted);
  padding: 2px 6px;
  border-radius: 10px;
  font-weight: 400;
  min-width: 24px;
  text-align: center;
}

/* ── MAIN CONTENT ─────────────────── */
.main-content {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  scrollbar-width: thin;
  scrollbar-color: var(--bg4) transparent;
}
.main-content::-webkit-scrollbar { width: 4px; }
.main-content::-webkit-scrollbar-thumb { background: var(--bg4); border-radius: 4px; }

/* ── PLAYER ─────────────────────── */
.player-section { flex-shrink: 0; }

.player-wrapper {
  position: relative;
  background: #000;
  border-radius: var(--radius-lg);
  overflow: hidden;
  aspect-ratio: 16/6;
  max-height: 290px;
  border: 1px solid var(--border);
  box-shadow: 0 0 0 1px rgba(255,77,77,0.05);
}

#videoPlayer {
  width: 100%; height: 100%;
  display: block;
  background: #000;
}

.player-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  gap: 14px;
  transition: opacity .3s;
}
.player-overlay.hidden { opacity: 0; pointer-events: none; }

.overlay-play {
  width: 60px; height: 60px;
  border-radius: 50%;
  border: 2px solid rgba(255,77,77,0.3);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  color: var(--accent);
  background: rgba(255,77,77,0.08);
}
.overlay-hint {
  color: var(--muted2);
  font-size: 13px;
  text-align: center;
}

.player-bar {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  padding: 10px 16px;
  background: linear-gradient(to top, rgba(0,0,0,.9) 0%, transparent 100%);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.now-playing { display: flex; flex-direction: column; gap: 2px; }
.np-label { font-size: 9px; font-weight: 700; letter-spacing: 1.5px; color: var(--accent); text-transform: uppercase; }
.np-name { font-size: 14px; font-weight: 600; color: #fff; font-family: 'Space Grotesk', sans-serif; }
.np-country { font-size: 11px; color: rgba(255,255,255,0.5); }

.live-indicator {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 1px;
}

/* ── VIEW HEADER ─────────────────── */
.view-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 0 4px;
}

.result-count {
  font-size: 13px;
  color: var(--muted2);
  font-weight: 500;
}

.sort-select {
  appearance: none;
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 6px 28px 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-family: inherit;
  outline: none;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%236b7094'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  transition: border-color .2s;
}
.sort-select:focus { border-color: var(--accent); }

/* ── CHANNEL GRID ─────────────────── */
.channel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(155px, 1fr));
  gap: 10px;
}
.channel-grid.grouped {
  display: flex;
  flex-direction: column;
  gap: 32px;
}

/* ── CHANNEL CARD ─────────────────── */
.channel-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  cursor: pointer;
  transition: all .18s ease;
  display: flex;
  align-items: center;
  gap: 10px;
  position: relative;
  overflow: hidden;
}
.channel-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,77,77,0.04) 0%, transparent 60%);
  opacity: 0;
  transition: opacity .18s;
}
.channel-card:hover {
  border-color: rgba(255,77,77,0.35);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.3);
}
.channel-card:hover::before { opacity: 1; }
.channel-card.playing {
  border-color: var(--accent);
  background: #160e0e;
}
.channel-card.playing::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--accent);
}

.card-logo {
  width: 44px; height: 44px;
  border-radius: var(--radius-sm);
  background: var(--bg3);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
  border: 1px solid var(--border);
}
.card-logo img {
  width: 100%; height: 100%;
  object-fit: contain;
}
.logo-fallback {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted2);
  font-family: 'Space Grotesk', sans-serif;
  letter-spacing: 0.5px;
}

.card-info { flex: 1; min-width: 0; }
.card-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}
.card-meta {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}
.card-country { font-size: 10px; color: var(--muted2); }

.card-cat {
  font-size: 9px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.cat-sports       { background: #0f2214; color: #4dba6a; }
.cat-news         { background: #0d1526; color: #4d82ba; }
.cat-movies       { background: #200e22; color: #ba4da0; }
.cat-comedy       { background: #22190a; color: #ba9d4d; }
.cat-kids         { background: #0f2014; color: #7bba4d; }
.cat-music        { background: #220e12; color: #ba4d60; }
.cat-documentary  { background: #0a1e1e; color: #4dbaba; }
.cat-entertainment{ background: #180e22; color: #8d4dba; }
.cat-religious    { background: #1e160a; color: #ba9040; }
.cat-general      { background: #141720; color: #7882a8; }

/* ── FAV BTN ─────────────────────── */
.fav-btn {
  background: none; border: none; cursor: pointer;
  font-size: 14px; padding: 2px; flex-shrink: 0;
  opacity: 0.4; transition: all .18s; line-height: 1;
}
.fav-btn:hover, .fav-btn.active { opacity: 1; transform: scale(1.2); }

/* ── CATEGORY SECTIONS ───────────── */
.cat-section { display: flex; flex-direction: column; gap: 12px; }

.cat-section-header {
  display: flex; align-items: center; justify-content: space-between;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.cat-section-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  font-family: 'Space Grotesk', sans-serif;
}
.cat-section-count { font-size: 12px; color: var(--muted); }

.cat-section-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(155px, 1fr));
  gap: 10px;
}

/* ── SPORT SECTIONS ─────────────── */
.sport-subsection { margin-top: 16px; }
.sport-sub-header {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted2);
  margin-bottom: 10px;
  display: flex; align-items: center; gap: 8px;
}

/* ── MATCH CARDS ─────────────────── */
.match-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  cursor: pointer;
  transition: all .18s;
  position: relative;
  overflow: hidden;
}
.match-card:hover {
  border-color: rgba(255,77,77,0.35);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.3);
}
.match-card.playing { border-color: var(--accent); background: #160e0e; }
.match-card.playing::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; height: 2px;
  background: var(--accent);
}

.teams-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  gap: 8px;
}
.team { display: flex; align-items: center; gap: 6px; flex: 1; }
.team:last-child { flex-direction: row-reverse; }
.team-logo {
  width: 28px; height: 28px;
  border-radius: 50%;
  object-fit: contain;
  background: var(--bg3);
}
.team-name { font-size: 12px; font-weight: 600; color: var(--text); }
.vs { font-size: 10px; color: var(--muted); flex-shrink: 0; font-weight: 700; }

.match-title {
  font-size: 13px; font-weight: 600;
  color: var(--text); margin-bottom: 8px; line-height: 1.4;
}
.match-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

.live-tag {
  background: var(--accent);
  color: #fff;
  font-size: 9px; font-weight: 700;
  padding: 2px 7px; border-radius: 4px;
  text-transform: uppercase; letter-spacing: 0.5px;
}
.upcoming-tag {
  background: var(--bg3);
  color: var(--muted2);
  font-size: 9px; padding: 2px 7px; border-radius: 4px;
  text-transform: uppercase; letter-spacing: 0.5px;
}
.hd-tag {
  background: #0a1e10;
  color: #4dba6a;
  font-size: 9px; font-weight: 700;
  padding: 2px 7px; border-radius: 4px;
  text-transform: uppercase; letter-spacing: 0.5px;
}

/* ── STREAM SELECTOR ─────────────── */
.stream-selector {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 0 6px; flex-wrap: wrap;
}
.stream-label { color: var(--muted); font-size: 12px; }
#streamBtns { display: flex; gap: 6px; flex-wrap: wrap; }

.stream-btn {
  padding: 5px 14px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  transition: all .15s;
}
.stream-btn:hover, .stream-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* ── PAGINATION ─────────────────── */
.pagination {
  display: flex; justify-content: center;
  gap: 6px; padding: 8px 0 24px; flex-wrap: wrap;
}
.page-btn {
  padding: 7px 13px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--muted2);
  cursor: pointer;
  font-size: 13px;
  font-family: inherit;
  transition: all .15s;
}
.page-btn:hover { background: var(--bg3); color: var(--text); }
.page-btn.active {
  background: var(--accent); color: #fff;
  border-color: var(--accent); font-weight: 600;
}

/* ── EMPTY / LOADING ─────────────── */
.empty-state {
  grid-column: 1/-1;
  text-align: center;
  color: var(--muted);
  padding: 60px 20px;
  display: flex; flex-direction: column;
  align-items: center; gap: 14px;
  font-size: 14px;
}
.spinner {
  width: 28px; height: 28px;
  border: 2px solid var(--bg4);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── SPORTS COUNTDOWN ──────────────── */
.countdown-text { color: var(--muted2); font-size: 13px; }

/* ── SPORT IFRAME ─────────────────── */
.sport-iframe {
  width: 100%; height: 100%; border: none;
  position: absolute; inset: 0; border-radius: var(--radius-lg);
}

/* ═══════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════ */
@media (max-width: 900px) {
  :root { --sidebar-w: 190px; }
}

@media (max-width: 768px) {
  :root { --topbar-h: 52px; }

  .topbar {
    padding: 0 12px; gap: 8px;
    flex-wrap: nowrap;
  }
  .logo-text { display: none; }
  .logo-icon { width: 28px; height: 28px; font-size: 11px; }

  .search-wrap { max-width: none; }
  .search-wrap input { font-size: 12px; padding: 8px 12px 8px 32px; }

  .top-tabs { gap: 2px; }
  .top-tab { padding: 5px 10px; font-size: 11px; }
  .top-tab .tab-icon { font-size: 13px; }

  .live-pill { font-size: 10px; padding: 4px 8px; }

  .topbar-right { display: none; }

  .layout {
    flex-direction: column;
    height: auto;
    overflow: visible;
  }

  .sidebar {
    width: 100%;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--border);
    display: flex;
    flex-direction: row;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 6px 0;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .sidebar::-webkit-scrollbar { display: none; }
  .sidebar-group { min-width: max-content; }
  .sidebar-label { display: none; }
  .sidebar-search { display: none; }
  .filter-list { flex-direction: row; flex-wrap: nowrap; padding: 0 8px; gap: 3px; }
  .filter-btn {
    white-space: nowrap;
    border-left: none;
    border-bottom: 2px solid transparent;
    border-radius: 6px;
    padding: 5px 10px;
    font-size: 12px;
  }
  .filter-btn.active {
    border-left-color: transparent;
    border-bottom-color: var(--accent);
    background: rgba(255,77,77,0.08);
  }
  .filter-count { display: none; }

  .main-content { padding: 12px; gap: 14px; }

  .player-wrapper {
    aspect-ratio: 16/9;
    max-height: none;
    border-radius: var(--radius);
  }

  .channel-grid,
  .cat-section-grid {
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 8px;
  }

  .vpn-banner { display: none; }
}

@media (max-width: 480px) {
  .channel-grid,
  .cat-section-grid {
    grid-template-columns: 1fr 1fr;
  }
  .top-tab span:not(.tab-icon) { display: none; }
}

/* ── SITE FOOTER ─────────────────── */
.site-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  background: var(--bg2);
  flex-wrap: wrap;
}
.site-footer a {
  color: var(--muted);
  text-decoration: none;
  font-size: 12px;
  transition: color .2s;
}
.site-footer a:hover { color: var(--text); }
.footer-copy { color: var(--muted); font-size: 12px; margin-left: auto; }

@media (max-width: 768px) {
  .footer-copy { margin-left: 0; }
}