img.emoji { height: 1.1em; width: 1.1em; margin: 0 .05em 0 .1em; vertical-align: -0.15em; }

:root {
  --primary: #2563eb;
  --primary-dim: rgba(37, 99, 235, 0.08);
  --red: #d9383a;
  --green: #27ae60;
  --green-dim: rgba(39, 174, 96, 0.08);
  --bg: #f1f5f9;
  --card: #ffffff;
  --card-hover: #f8fafc;
  --border: rgba(148, 163, 184, 0.25);
  --text: #1e293b;
  --muted: #64748b;
  --header-bg-1: #ffffff;
  --header-bg-2: #f1f5f9;
  --sidebar-bg: rgba(226, 232, 240, 0.6);
  --quality-menu-bg: rgba(255, 255, 255, 0.75);
  --header-btn-bg: rgba(148, 163, 184, 0.12);
  --header-btn-border: rgba(148, 163, 184, 0.2);
}

body.dark-theme {
  --primary: #3b82f6;
  --primary-dim: rgba(59, 130, 246, 0.12);
  --bg: #0f172a;
  --card: #1e293b;
  --card-hover: #334155;
  --border: rgba(148, 163, 184, 0.12);
  --text: #f1f5f9;
  --muted: #94a3b8;
  --header-bg-1: #1e293b;
  --header-bg-2: #0f172a;
  --sidebar-bg: rgba(15, 23, 42, 0.35);
  --quality-menu-bg: rgba(30, 41, 59, 0.75);
  --header-btn-bg: rgba(255, 255, 255, 0.05);
  --header-btn-border: rgba(255, 255, 255, 0.08);
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', sans-serif;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: background 0.3s ease, color 0.3s ease;
}

.bangla { font-family: 'Tiro Bangla', serif; }

::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(100, 116, 139, 0.2); border-radius: 10px; }
body.dark-theme ::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.08); }
::-webkit-scrollbar-thumb:hover { background: var(--primary); }

/* HEADER */
header {
  background: linear-gradient(180deg, var(--header-bg-1) 0%, var(--header-bg-2) 100%);
  border-bottom: 1px solid var(--border);
  padding: 8px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 100;
  flex-shrink: 0;
  transition: background 0.3s, border 0.3s;
}

.badge-live {
  background: var(--red);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 1.2px;
  padding: 3px 8px;
  border-radius: 4px;
  animation: pulse-red 1.8s infinite;
}

@keyframes pulse-red {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.7; transform: scale(0.97); }
}

/* LAYOUT */
.main-layout { display: flex; flex: 1; min-height: 0; width: 100%; }
.left-pane { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.right-pane {
  width: 380px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--border);
  background: var(--sidebar-bg);
  backdrop-filter: blur(20px);
  transition: background 0.3s ease, border 0.3s;
  overflow: hidden;
}

/* PLAYER */
#player-wrap {
  background: #000;
  position: relative;
  width: 100%;
  aspect-ratio: 16/9;
  background: radial-gradient(circle, #1e293b 0%, #020617 100%);
  overflow: hidden;
}
#player-wrap video { width: 100%; height: 100%; display: block; object-fit: contain; cursor: pointer; }

#loading-overlay {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.95);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  z-index: 10;
  backdrop-filter: blur(8px);
  pointer-events: none;
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3.5px solid rgba(148, 163, 184, 0.2);
  border-top-color: var(--primary);
  border-right-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s cubic-bezier(0.5, 0.1, 0.1, 1) infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

#player-wrap.controls-visible #timeline-wrap { opacity: 1; }
#player-wrap.controls-visible ~ .now-playing-bar { opacity: 1; transform: translateY(0); }
#player-wrap.hide-cursor * { cursor: none !important; }

#error-overlay {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.98);
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  z-index: 11;
  backdrop-filter: blur(8px);
}

.retry-btn {
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  padding: 8px 20px;
  border-radius: 8px;
  font-size: 11px;
  cursor: pointer;
  border: none;
  transition: all 0.25s;
}
body:not(.dark-theme) .retry-btn { color: #fff; background: #1e293b; }

/* NOW PLAYING BAR */
.now-playing-bar {
  background: linear-gradient(90deg, var(--primary-dim), transparent);
  border-bottom: 1px solid var(--border);
  border-top: 1px solid var(--border);
  padding: 8px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.4s, transform 0.4s, border 0.3s;
}

.action-btn {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 5px 10px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s, background 0.3s, border 0.3s;
  display: flex;
  align-items: center;
  gap: 4px;
  height: 30px;
  flex-shrink: 0;
  white-space: nowrap;
}
.action-btn:hover { border-color: var(--primary); background: var(--card-hover); }

.volume-container { display: flex; align-items: center; gap: 6px; }
.volume-slider {
  width: 65px;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: rgba(128, 128, 128, 0.2);
  border-radius: 4px;
  outline: none;
  cursor: pointer;
  transition: all 0.2s;
}
.volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 6px var(--primary);
}

.notice-bar {
  padding: 6px 14px;
  font-size: 10.5px;
  color: var(--muted);
  line-height: 1.6;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  transition: border 0.3s;
}

/* MATCH SCHEDULE */
.section-title { font-size: 11px; font-weight: 800; letter-spacing: 2px; text-transform: uppercase; color: var(--muted); }
.day-group-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--primary);
  padding: 12px 4px 6px;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.day-group-title::after { content: ''; flex: 1; height: 1px; background: linear-gradient(90deg, var(--border), transparent); }

.match-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(5px);
  transition: all 0.2s ease, background 0.3s, border 0.3s;
}
.match-card::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; transition: all 0.25s; }
.match-card.upcoming::before { background: var(--primary); }
.match-card.today::before { background: var(--green); }
.match-card.past::before { background: var(--muted); }
.match-card.live::before { background: var(--red); animation: pulse-red 1.5s infinite; }
.match-card.live { border-color: var(--red); background: rgba(217, 56, 58, 0.05); }
.match-card:hover { border-color: var(--primary); background: var(--card-hover); transform: translateY(-1px); }
.match-card.past { opacity: 0.45; }

.match-time {
  background: var(--header-btn-bg);
  border: 1px solid var(--header-btn-border);
  border-radius: 8px;
  padding: 5px;
  text-align: center;
  line-height: 1.2;
  width: 52px;
  flex-shrink: 0;
}
.match-time .time-val { font-size: 10px; font-weight: 700; color: var(--text); }
.match-time .bst { font-size: 8px; font-weight: 700; color: var(--muted); letter-spacing: 0.5px; margin-top: 1px; }

.teams { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.team-row { display: flex; align-items: center; gap: 6px; min-width: 0; }
.team-name { font-size: 12px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.match-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; margin-left: auto; flex-shrink: 0; }
.group-tag { font-size: 9px; font-weight: 700; padding: 3px 6px; border-radius: 6px; background: var(--primary-dim); color: var(--primary); white-space: nowrap; }
.now-badge { font-size: 8px; font-weight: 800; color: #fff; background: var(--green); padding: 2px 6px; border-radius: 4px; letter-spacing: 0.5px; animation: pulse-red 1.5s infinite; }
.flag { font-size: 13px; line-height: 1; display: inline-block; width: 20px; text-align: center; }

.tab-btn {
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
}
.tab-btn.active { color: var(--primary); background: var(--primary-dim); border-color: var(--primary); }

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

/* CHANNEL SIDEBAR */
.ch-search { position: relative; margin: 10px 10px 6px; }
.ch-search input {
  width: 100%;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 10px 7px 30px;
  color: var(--text);
  font-size: 11px;
  outline: none;
  transition: border-color .2s;
}
.ch-search input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-dim); }
.ch-search input::placeholder { color: var(--muted); }
.ch-search .s-icon { position: absolute; left: 9px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 12px; }

.cat-tabs {
  display: flex;
  gap: 4px;
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  flex-wrap: nowrap;
  scrollbar-width: none;
  flex-shrink: 0;
}
.cat-tabs::-webkit-scrollbar { display: none; }
.cat-tab {
  font-size: 10px;
  padding: 3px 10px;
  border: 1px solid var(--border);
  border-radius: 20px;
  cursor: pointer;
  transition: all .15s;
  color: var(--muted);
  background: transparent;
  white-space: nowrap;
  flex-shrink: 0;
  font-weight: 600;
}
.cat-tab:hover, .cat-tab.active { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 700; }
.cat-tab.sports-tab { border-color: var(--green); color: var(--green); }
.cat-tab.sports-tab:hover, .cat-tab.sports-tab.active { background: var(--green); border-color: var(--green); color: #fff; }

.channel-list { overflow-y: auto; flex: 1; padding: 4px 6px; }
.ch-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  border-radius: 8px;
  cursor: pointer;
  transition: background .12s, border-color .12s;
  border: 1px solid transparent;
  margin-bottom: 2px;
  user-select: none;
}
.ch-item:hover { background: var(--card-hover); border-color: var(--border); }
.ch-item.active { background: var(--primary-dim); border-color: var(--primary); }
.ch-item.active .ch-name { color: var(--primary); font-weight: 700; }
.ch-logo { width: 72px; height: 36px; border-radius: 6px; object-fit: contain; background: var(--card); flex-shrink: 0; border: 1px solid var(--border); padding: 2px; }
.ch-info { min-width: 0; flex: 1; }
.ch-info .ch-name { font-size: 11px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ch-info .ch-cat { font-size: 9px; color: var(--muted); margin-top: 1px; }
.ch-num { display: none; }
.no-results { text-align: center; padding: 20px 10px; color: var(--muted); font-size: 11px; }
.ch-count-badge { font-size: 9px; font-weight: 700; padding: 2px 8px; border-radius: 10px; background: var(--primary-dim); color: var(--primary); flex-shrink: 0; }

/* RESPONSIVE */
@media(max-width: 900px) {
  body { overflow-y: auto; height: auto; }
  .main-layout { flex-direction: column; height: auto; overflow: visible; }
  .right-pane { width: 100%; border-left: none; border-top: 1px solid var(--border); height: auto; overflow: visible; background: transparent; }
  #schedule-list { max-height: none; overflow: visible; }
  .channel-list { max-height: 300px; }
}
@media(max-width: 640px) {
  header { padding: 6px 10px; }
  .now-playing-bar { padding: 6px 10px; gap: 6px; justify-content: space-between; }
  .volume-slider { display: block !important; width: 50px !important; }
  .right-pane { width: 100%; }
}
