/* ═══════════════════════════════════════════
   Tesla IPTV Player — Dark Professional UI
   ═══════════════════════════════════════════ */

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

:root {
  --bg-primary: #06060b;
  --bg-secondary: #0d0d14;
  --bg-surface: rgba(255, 255, 255, 0.04);
  --bg-surface-solid: #14141e;
  --bg-hover: rgba(255, 255, 255, 0.07);
  --bg-glass: rgba(255, 255, 255, 0.03);
  --text-primary: #eeeef3;
  --text-secondary: #6b6b82;
  --text-tertiary: #44445a;
  --accent: #8b5cf6;
  --accent-hover: #7c3aed;
  --accent-glow: rgba(139, 92, 246, 0.25);
  --accent-subtle: rgba(139, 92, 246, 0.08);
  --gradient-accent: linear-gradient(135deg, #8b5cf6, #6366f1);
  --gradient-surface: linear-gradient(180deg, rgba(255,255,255,0.05) 0%, rgba(255,255,255,0.02) 100%);
  --border: rgba(255, 255, 255, 0.06);
  --border-hover: rgba(255, 255, 255, 0.1);
  --highlight-bg: rgba(139, 92, 246, 0.2);
  --highlight-text: #c4b5fd;
  --error: #f43f5e;
  --success: #10b981;
  --warning: #f5c518;
  --radius: 16px;
  --radius-sm: 10px;
  --radius-xs: 6px;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 8px 32px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 16px 64px rgba(0, 0, 0, 0.4);
  --shadow-glow: 0 0 40px rgba(139, 92, 246, 0.15);
  --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  --toolbar-width: 52px;
}

/* ─── Reset ─────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }

/* ─── Scrollbar ─────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.14); }

/* ─── Spinner ───────────────────────────── */
.spinner {
  width: 36px; height: 36px;
  border: 3px solid rgba(255,255,255,0.08);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ═══════════════════════════════════════════
   App Shell — Toolbar + Content
   ═══════════════════════════════════════════ */
.app-shell {
  display: flex;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

/* ─── Icon Toolbar (left edge) ──────────── */
.icon-toolbar {
  width: var(--toolbar-width);
  min-width: var(--toolbar-width);
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  z-index: 100;
}
.toolbar-top, .toolbar-bottom {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.toolbar-btn {
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}
.toolbar-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.toolbar-btn.active { background: var(--accent-subtle); color: var(--accent); }
.toolbar-btn svg { flex-shrink: 0; }

/* ─── Main Content ──────────────────────── */
.app-content {
  flex: 1;
  overflow: hidden;
  position: relative;
}

/* ═══════════════════════════════════════════
   Home View — Content Type Cards
   ═══════════════════════════════════════════ */
.home-view {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px;
  gap: 40px;
}
.home-header {
  text-align: center;
}
.home-brand {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
}
.home-user {
  font-size: 14px;
  color: var(--text-secondary);
}
.home-cards {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  justify-content: center;
}
.home-card {
  width: 200px;
  height: 180px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--transition-base);
  user-select: none;
}
.home-card:hover {
  border-color: var(--accent);
  background: var(--accent-subtle);
  box-shadow: var(--shadow-glow);
  transform: translateY(-2px);
}
.home-card-icon {
  color: var(--text-primary);
  opacity: 0.85;
}
.home-card:hover .home-card-icon { opacity: 1; }
.home-card-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}
.home-card-count {
  font-size: 12px;
  color: var(--text-secondary);
  background: rgba(255,255,255,0.04);
  padding: 2px 10px;
  border-radius: 10px;
}

/* ─── Admin Section (superadmin dashboard) ─ */
.home-admin-section {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}
.home-card-admin {
  border-color: rgba(139,92,246,0.15);
  background: rgba(139,92,246,0.04);
}
.home-card-admin:hover {
  border-color: #a78bfa;
  background: rgba(139,92,246,0.1);
  box-shadow: 0 0 20px rgba(139,92,246,0.15);
}
.home-card-badge {
  background: rgba(139,92,246,0.15);
  color: #a78bfa;
}

/* ─── M3U URL Section (superadmin) ──────── */
.home-m3u {
  width: 100%;
  max-width: 600px;
}
.home-m3u-row {
  display: flex;
  gap: 8px;
}
.home-m3u-input {
  flex: 1;
  padding: 10px 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
}
.home-m3u-input:focus { border-color: var(--accent); }
.home-m3u-btn {
  padding: 10px 20px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-xs);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.home-m3u-btn:disabled { opacity: 0.5; }
.home-m3u-status {
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-secondary);
  text-align: center;
}
.home-m3u-status.success { color: var(--success); }
.home-m3u-status.error { color: var(--error); }

/* ═══════════════════════════════════════════
   Content View — 3-Column Layout
   ═══════════════════════════════════════════ */
.content-view {
  height: 100%;
  overflow: hidden;
}
.content-columns {
  display: flex;
  height: 100%;
}

/* Column 1: Categories */
.col-categories {
  width: 280px;
  min-width: 240px;
  border-right: 1px solid var(--border);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.cat-panel {
  height: 100%;
  display: flex;
  flex-direction: column;
}
.cat-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.cat-header-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.cat-list {
  flex: 1;
  overflow-y: auto;
  padding: 6px 0;
}
.cat-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  cursor: pointer;
  transition: all var(--transition-fast);
  border-left: 3px solid transparent;
}
.cat-item:hover { background: var(--bg-hover); }
.cat-item.active {
  background: var(--accent-subtle);
  border-left-color: var(--accent);
}
.cat-item-fav svg { color: var(--error); flex-shrink: 0; }
.cat-item-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.cat-item-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cat-item.active .cat-item-name { color: var(--accent); }
.cat-item-count {
  font-size: 11px;
  color: var(--text-tertiary);
}
.cat-empty {
  padding: 32px 16px;
  text-align: center;
  color: var(--text-tertiary);
  font-size: 13px;
}

/* Column 2: Channels */
.col-channels {
  width: 340px;
  min-width: 280px;
  border-right: 1px solid var(--border);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.ch-panel {
  height: 100%;
  display: flex;
  flex-direction: column;
}
.ch-header {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.ch-search-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  padding: 0 10px;
}
.ch-search-wrapper svg { color: var(--text-tertiary); flex-shrink: 0; }
.ch-search-input {
  flex: 1;
  padding: 8px 0;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
}
.ch-list {
  flex: 1;
  overflow-y: auto;
}
.ch-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  cursor: pointer;
  transition: all var(--transition-fast);
  border-bottom: 1px solid var(--border);
}
.ch-item:hover { background: var(--bg-hover); }
.ch-item.selected {
  background: var(--accent-subtle);
  border-left: 3px solid var(--accent);
}
.ch-logo-wrap {
  width: 36px; height: 36px;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.ch-logo {
  width: 36px; height: 36px;
  object-fit: contain;
  border-radius: var(--radius-xs);
}
.ch-logo-fallback {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-surface);
  border-radius: var(--radius-xs);
  font-size: 14px; font-weight: 700;
  color: var(--text-secondary);
}
.ch-info {
  flex: 1;
  min-width: 0;
}
.ch-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}
.ch-name mark {
  background: var(--highlight-bg);
  color: var(--highlight-text);
  border-radius: 2px;
  padding: 0 1px;
}
.ch-num {
  font-size: 12px;
  font-weight: 700;
  color: var(--bg-primary);
  background: var(--warning);
  border-radius: 10px;
  min-width: 28px;
  height: 22px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.ch-fav-btn {
  flex-shrink: 0;
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--text-tertiary);
  cursor: pointer;
  transition: var(--transition-fast);
}
.ch-fav-btn:hover { color: var(--error); }
.ch-fav-btn.fav-active { color: var(--error); }
.ch-fav-btn.fav-active svg { fill: var(--error); }
.ch-empty {
  padding: 32px 16px;
  text-align: center;
  color: var(--text-tertiary);
  font-size: 13px;
}
.ch-fav-cat-header {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 12px 4px;
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.5px; color: var(--accent);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 2;
  background: var(--bg-primary);
}
.ch-fav-cat-count {
  font-size: 10px; font-weight: 600; color: var(--text-tertiary);
  background: rgba(255,255,255,0.04); padding: 1px 6px; border-radius: 8px;
  margin-left: auto;
}
.ch-load-more-wrap { padding: 12px; text-align: center; }
.ch-load-more-btn {
  padding: 8px 20px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  color: var(--text-secondary);
  font-size: 12px;
  cursor: pointer;
}
.ch-load-more-btn:hover { border-color: var(--accent); color: var(--accent); }

/* Column 3: Player */
.col-player {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: #000;
}

/* ═══════════════════════════════════════════
   Player Section
   ═══════════════════════════════════════════ */
.player-section {
  height: 100%;
  display: flex;
  flex-direction: column;
  position: relative;
}
.player-section:fullscreen {
  background: #000;
}
.player-section:fullscreen .player-controls,
.player-section:fullscreen .player-info-bar,
.player-section:fullscreen .player-seek,
.player-section:fullscreen .iptv-codec-overlay {
  display: none;
}
.player-section:fullscreen .player-wrapper {
  flex: 1;
}

.player-wrapper {
  flex: 1;
  position: relative;
  background: #000;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.player-video-wrap {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
}
.iptv-video {
  width: 100%; height: 100%;
  object-fit: contain;
  background: #000;
}

/* Play/Pause animation */
.player-play-pause-anim {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 15;
  opacity: 0;
}
.player-play-pause-anim.anim {
  animation: playPauseFlash 0.5s ease-out forwards;
}
.player-play-pause-anim svg {
  background: rgba(0,0,0,0.5);
  border-radius: 50%;
  padding: 16px;
  filter: drop-shadow(0 2px 8px rgba(0,0,0,0.4));
}
@keyframes playPauseFlash {
  0% { opacity: 0.9; transform: scale(0.8); }
  50% { opacity: 0.7; transform: scale(1.1); }
  100% { opacity: 0; transform: scale(1.2); }
}

/* Paused indicator */
.player-paused-indicator {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 14;
}
.player-paused-indicator svg {
  background: rgba(0,0,0,0.45);
  border-radius: 50%;
  padding: 22px;
  width: 64px;
  height: 64px;
  opacity: 0.85;
}

/* Loading & Error */
.player-loading, .player-error {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--text-secondary);
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(6px);
  z-index: 10;
}
.player-loading span { font-size: 13px; font-weight: 500; }
.player-error span { font-size: 14px; color: var(--error); }
.btn-retry {
  padding: 8px 20px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-xs);
  font-size: 13px;
  cursor: pointer;
}

/* Idle state (no channel selected) */
.player-idle {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  z-index: 5;
}
.player-idle-text {
  font-size: 14px;
  color: rgba(255,255,255,0.12);
  font-weight: 500;
  letter-spacing: 0.3px;
}

/* Codec overlay */
.iptv-codec-overlay {
  position: absolute;
  top: 8px; right: 8px;
  display: flex; gap: 6px;
  z-index: 5;
  opacity: 0.7;
}
.iptv-codec-badge {
  font-size: 10px;
  padding: 2px 6px;
  background: rgba(0,0,0,0.6);
  border-radius: 3px;
  color: var(--text-secondary);
}
.iptv-codec-badge b { color: var(--text-primary); font-weight: 600; }

/* Subtitle overlay */
.iptv-subtitle-overlay {
  position: absolute;
  bottom: 12px; left: 50%;
  transform: translateX(-50%);
  max-width: 80%;
  text-align: center;
  font-size: 18px;
  color: #fff;
  text-shadow: 0 1px 4px rgba(0,0,0,0.9);
  z-index: 8;
  pointer-events: none;
}

/* ─── Inline Controls (non-fullscreen) ──── */
.player-controls {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.ctrl-btn {
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  border: none; border-radius: var(--radius-xs);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition-fast);
}
.ctrl-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.ctrl-spacer { flex: 1; }
.player-vol-group {
  display: flex; align-items: center; gap: 4px;
}
.player-vol-slider {
  width: 80px; height: 4px;
  -webkit-appearance: none; appearance: none;
  background: rgba(255,255,255,0.1);
  border-radius: 2px;
  outline: none;
}
.player-vol-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--text-primary);
  cursor: pointer;
}

/* Channel info bar */
.player-info-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.player-info-logo {
  width: 28px; height: 28px;
  object-fit: contain;
  border-radius: 4px;
}
.player-info-text { flex: 1; min-width: 0; }
.player-info-name {
  font-size: 13px; font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.player-info-cat {
  font-size: 11px;
  color: var(--text-secondary);
}
.player-live-badge {
  font-size: 10px; font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
  background: var(--error);
  color: #fff;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  flex-shrink: 0;
}

/* VOD seek bar */
.player-seek {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.player-time {
  font-size: 11px;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
  min-width: 40px;
}
.player-seek-slider {
  flex: 1; height: 4px;
  -webkit-appearance: none; appearance: none;
  background: rgba(255,255,255,0.1);
  border-radius: 2px;
  outline: none;
}
.player-seek-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
}

/* ─── Tracks Panel ──────────────────────── */
.iptv-tracks-panel {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
}
.iptv-tracks-inner {
  background: var(--bg-surface-solid);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  min-width: 220px;
  max-width: 320px;
}
.iptv-tracks-section { margin-bottom: 16px; }
.iptv-tracks-section:last-child { margin-bottom: 0; }
.iptv-tracks-title {
  font-size: 11px; font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}
.iptv-tracks-list { display: flex; flex-direction: column; gap: 4px; }
.iptv-track-item {
  padding: 8px 12px;
  border-radius: var(--radius-xs);
  font-size: 13px;
  color: var(--text-primary);
  cursor: pointer;
  transition: var(--transition-fast);
}
.iptv-track-item:hover { background: var(--bg-hover); }
.iptv-track-item.active {
  background: var(--accent-subtle);
  color: var(--accent);
  font-weight: 600;
}

/* ═══════════════════════════════════════════
   Fullscreen Overlay
   ═══════════════════════════════════════════ */
.player-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  z-index: 20;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--transition-base);
}
.player-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

/* Top info bar */
.overlay-top {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  background: linear-gradient(to bottom, rgba(0,0,0,0.7), transparent);
}
.overlay-logo {
  width: 48px; height: 48px;
  object-fit: contain;
  border-radius: var(--radius-xs);
  background: rgba(255,255,255,0.05);
}
.overlay-info { flex: 1; min-width: 0; }
.overlay-name {
  font-size: 18px; font-weight: 700;
  color: #fff;
  display: block;
}
.overlay-cat {
  font-size: 13px;
  color: rgba(255,255,255,0.6);
  display: block;
}
.overlay-res {
  font-size: 12px;
  color: rgba(255,255,255,0.5);
  font-weight: 500;
}

/* Bottom controls */
.overlay-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: linear-gradient(to top, rgba(0,0,0,0.8), transparent);
}
.overlay-left, .overlay-right {
  display: flex;
  align-items: center;
  gap: 8px;
}
.overlay-btn {
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  border: none; border-radius: var(--radius-xs);
  background: rgba(255,255,255,0.1);
  color: #fff;
  cursor: pointer;
  transition: var(--transition-fast);
}
.overlay-btn:hover { background: rgba(255,255,255,0.2); }
.overlay-aspect-label {
  font-size: 12px;
  color: rgba(255,255,255,0.7);
  background: rgba(255,255,255,0.1);
  padding: 4px 10px;
  border-radius: var(--radius-xs);
  font-weight: 600;
}
.overlay-volume-group {
  display: flex; align-items: center; gap: 6px;
}
.overlay-volume {
  width: 90px; height: 4px;
  -webkit-appearance: none; appearance: none;
  background: rgba(255,255,255,0.2);
  border-radius: 2px;
  outline: none;
}
.overlay-volume::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: #fff;
  cursor: pointer;
}

/* ═══════════════════════════════════════════
   Favorites View
   ═══════════════════════════════════════════ */
.favorites-view {
  height: 100%;
  overflow-y: auto;
  padding: 24px;
}
.favorites-panel { max-width: 900px; margin: 0 auto; }
.favorites-title { font-size: 20px; font-weight: 700; color: var(--text-primary); margin-bottom: 20px; }
.favorites-list { display: flex; flex-direction: column; gap: 20px; }
.favorites-empty { color: var(--text-tertiary); text-align: center; padding: 60px 0; font-size: 14px; }

/* Content type group */
.fav-type-group { }
.fav-type-header {
  display: flex; align-items: center; gap: 8px;
  font-size: 16px; font-weight: 700; color: var(--text-primary);
  padding-bottom: 10px; margin-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.fav-type-header svg { color: var(--accent); flex-shrink: 0; }
.fav-type-count {
  font-size: 11px; font-weight: 600; color: var(--text-tertiary);
  background: rgba(255,255,255,0.04); padding: 2px 8px; border-radius: 10px;
  margin-left: auto;
}

/* Category group */
.fav-cat-group { margin-left: 8px; }
.fav-cat-header {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 8px; cursor: pointer; user-select: none;
  border-radius: var(--radius-xs);
  transition: background var(--transition-fast);
}
.fav-cat-header:hover { background: var(--bg-hover); }
.fav-cat-chevron {
  flex-shrink: 0; transition: transform 0.2s ease;
  color: var(--text-tertiary);
}
.fav-cat-name { font-size: 13px; font-weight: 600; color: var(--text-secondary); }
.fav-cat-count {
  font-size: 11px; color: var(--text-tertiary);
  background: rgba(255,255,255,0.04); padding: 1px 6px; border-radius: 8px;
  margin-left: auto;
}
.fav-cat-items {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px;
  padding: 4px 0 12px 22px;
}
.fav-cat-group.collapsed .fav-cat-chevron { transform: rotate(-90deg); }
.fav-cat-group.collapsed .fav-cat-items { display: none; }

/* Fav card */
.fav-card {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}
.fav-card:hover { border-color: var(--accent); background: var(--accent-subtle); }
.fav-logo { width: 32px; height: 32px; border-radius: var(--radius-xs); object-fit: contain; flex-shrink: 0; }
.fav-info { flex: 1; min-width: 0; }
.fav-name { font-size: 13px; font-weight: 600; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fav-remove {
  flex-shrink: 0; width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  border: none; border-radius: 50%;
  background: transparent; color: var(--text-tertiary);
  cursor: pointer;
}
.fav-remove:hover { background: rgba(244,63,94,0.1); color: var(--error); }

/* ═══════════════════════════════════════════
   Admin View
   ═══════════════════════════════════════════ */
.admin-view {
  height: 100%;
  overflow-y: auto;
  padding: 24px;
}
.admin-panel { padding: 8px 0; }
.admin-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.admin-title { font-size: 20px; font-weight: 700; color: var(--text-primary); }
.admin-add-btn {
  padding: 8px 16px;
  background: var(--accent); color: #fff;
  border: none; border-radius: var(--radius-xs);
  font-size: 13px; font-weight: 600; cursor: pointer;
}
.admin-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.admin-table th {
  text-align: left; padding: 10px 12px;
  color: var(--text-secondary); font-weight: 600;
  font-size: 11px; text-transform: uppercase;
  letter-spacing: 0.5px; border-bottom: 1px solid var(--border);
}
.admin-table td { padding: 12px; color: var(--text-primary); border-bottom: 1px solid var(--border); }
.admin-table tr:hover td { background: var(--bg-hover); }
.admin-role-badge { font-size: 11px; padding: 3px 8px; border-radius: 4px; font-weight: 600; text-transform: capitalize; }
.admin-role-superadmin { background: rgba(139,92,246,0.15); color: #a78bfa; }
.admin-role-admin { background: rgba(59,130,246,0.15); color: #60a5fa; }
.admin-role-user { background: rgba(75,85,99,0.15); color: #9ca3af; }
.admin-actions-cell { white-space: nowrap; }
.admin-edit-btn, .admin-del-btn {
  padding: 4px 10px; border: 1px solid var(--border);
  border-radius: 4px; background: transparent;
  color: var(--text-secondary); font-size: 12px;
  cursor: pointer; margin-right: 4px;
}
.admin-edit-btn:hover { border-color: var(--accent); color: var(--accent); }
.admin-del-btn:hover { border-color: var(--error); color: var(--error); }
.admin-modal {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
}
.admin-modal-card {
  background: var(--bg-surface-solid);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px; width: 100%; max-width: 400px;
}
.admin-modal-title { font-size: 17px; font-weight: 700; color: var(--text-primary); margin-bottom: 20px; }
.admin-field { margin-bottom: 14px; }
.admin-field label { display: block; font-size: 12px; font-weight: 600; color: var(--text-secondary); margin-bottom: 5px; }
.admin-field input, .admin-field select {
  width: 100%; padding: 9px 12px;
  background: var(--bg-primary); border: 1px solid var(--border);
  border-radius: var(--radius-xs); color: var(--text-primary); font-size: 14px;
}
.admin-hint { font-weight: 400; color: var(--text-tertiary); font-size: 11px; }
.admin-modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 20px; }
.admin-cancel-btn {
  padding: 8px 16px; background: transparent;
  border: 1px solid var(--border); border-radius: var(--radius-xs);
  color: var(--text-secondary); cursor: pointer; font-size: 13px;
}
.admin-save-btn {
  padding: 8px 20px; background: var(--accent);
  border: none; border-radius: var(--radius-xs);
  color: #fff; cursor: pointer; font-size: 13px; font-weight: 600;
}
.admin-form-error { color: var(--error); font-size: 12px; text-align: center; margin-top: 10px; }
.admin-empty { color: var(--text-tertiary); text-align: center; padding: 40px 0; }
.admin-tabs { display: flex; gap: 0; margin-bottom: 24px; border-bottom: 1px solid var(--border); }
.admin-tab {
  padding: 10px 20px; background: transparent;
  border: none; border-bottom: 2px solid transparent;
  color: var(--text-secondary); font-size: 14px;
  font-weight: 600; cursor: pointer; transition: var(--transition-fast);
}
.admin-tab:hover { color: var(--text-primary); }
.admin-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.admin-settings-form { max-width: 480px; }
.admin-settings-preview {
  font-size: 12px; color: var(--text-tertiary);
  padding: 10px 12px; background: var(--bg-primary);
  border: 1px solid var(--border); border-radius: var(--radius-xs);
  margin-top: 8px; margin-bottom: 8px;
  word-break: break-all; min-height: 20px;
}
.admin-settings-success { color: var(--success); font-size: 13px; text-align: center; margin-top: 10px; }

/* ═══════════════════════════════════════════
   Global Search Overlay
   ═══════════════════════════════════════════ */
.search-overlay {
  position: fixed; inset: 0; z-index: 2000;
  background: rgba(0,0,0,0.8);
  backdrop-filter: blur(8px);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 60px 24px 24px;
}
.search-overlay-inner {
  width: 100%; max-width: 800px;
  max-height: calc(100vh - 100px);
  display: flex; flex-direction: column;
}
.search-overlay-header { margin-bottom: 16px; }
.search-overlay-input-wrap {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 18px;
  background: var(--bg-surface-solid);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color var(--transition-fast);
}
.search-overlay-input-wrap:focus-within { border-color: var(--accent); }
.search-overlay-input-wrap > svg { flex-shrink: 0; color: var(--text-tertiary); }
.search-overlay-input {
  flex: 1; background: none; border: none; outline: none;
  color: var(--text-primary); font-size: 18px; font-weight: 500;
}
.search-overlay-input::placeholder { color: var(--text-tertiary); font-weight: 400; }
.search-overlay-close {
  flex-shrink: 0; background: none; border: none;
  color: var(--text-tertiary); cursor: pointer; padding: 4px;
  border-radius: 4px; transition: all var(--transition-fast);
}
.search-overlay-close:hover { color: var(--text-primary); background: var(--bg-hover); }
.search-overlay-scope {
  display: inline-block; margin-top: 8px; padding-left: 2px;
  font-size: 12px; color: var(--text-tertiary); font-weight: 600;
  letter-spacing: 0.3px;
}
.search-overlay-results {
  flex: 1; overflow-y: auto;
  background: var(--bg-surface-solid);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
}
.search-overlay-empty {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 12px; padding: 60px 0;
  color: var(--text-tertiary); font-size: 14px;
}
.search-section-title {
  font-size: 12px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.5px; color: var(--accent);
  padding: 8px 4px 6px; margin-top: 8px;
  border-bottom: 1px solid var(--border);
}
.search-section-title:first-child { margin-top: 0; }

/* Live channels — list view */
.search-list-view { display: flex; flex-direction: column; }
.search-list-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 8px;
  border-bottom: 1px solid var(--border);
  cursor: pointer; transition: background var(--transition-fast);
}
.search-list-item:last-child { border-bottom: none; }
.search-list-item:hover { background: var(--bg-hover); }
.search-item-logo-wrap { flex-shrink: 0; width: 36px; height: 36px; }
.search-item-logo {
  width: 36px; height: 36px; border-radius: 6px;
  object-fit: contain; background: rgba(255,255,255,0.04);
}
.search-item-logo-fb {
  width: 36px; height: 36px; border-radius: 6px;
  background: var(--bg-hover); color: var(--text-tertiary);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700;
}
.search-item-name {
  flex: 1; font-size: 14px; font-weight: 600;
  color: var(--text-primary); white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.search-item-name mark { background: rgba(139,92,246,0.3); color: inherit; border-radius: 2px; }
.search-item-cat {
  flex-shrink: 0; font-size: 11px; font-weight: 600;
  color: var(--text-tertiary); background: rgba(255,255,255,0.06);
  padding: 3px 8px; border-radius: 4px; white-space: nowrap;
}

/* VOD — poster/card view */
.search-poster-view {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 14px; padding: 8px 0;
}
.search-poster-card {
  cursor: pointer; transition: transform var(--transition-fast);
}
.search-poster-card:hover { transform: translateY(-3px); }
.search-poster-img-wrap {
  position: relative; width: 100%;
  aspect-ratio: 2/3; border-radius: var(--radius-sm);
  overflow: hidden; background: var(--bg-hover);
}
.search-poster-img-wrap.no-poster {
  display: flex; align-items: center; justify-content: center;
}
.search-poster-img-wrap.no-poster::after {
  content: '🎬'; font-size: 32px; opacity: 0.3;
}
.search-poster-img {
  width: 100%; height: 100%; object-fit: cover;
}
.search-poster-fav-btn {
  position: absolute; top: 6px; right: 6px;
  width: 30px; height: 30px; border-radius: 50%;
  background: rgba(0,0,0,0.6); color: rgba(255,255,255,0.7);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: all var(--transition-fast);
  opacity: 0;
}
.search-poster-card:hover .search-poster-fav-btn { opacity: 1; }
.search-poster-fav-btn:hover { background: rgba(0,0,0,0.8); color: #fff; }
.search-poster-fav-btn.fav-active { opacity: 1; color: var(--error); }
.search-poster-fav-btn.fav-active svg { fill: var(--error); }
.search-poster-title {
  margin-top: 8px; font-size: 12px; font-weight: 600;
  color: var(--text-primary); line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden;
}
.search-poster-title mark { background: rgba(139,92,246,0.3); color: inherit; border-radius: 2px; }

/* ═══════════════════════════════════════════
   Responsive
   ═══════════════════════════════════════════ */
@media (max-width: 900px) {
  .content-columns { flex-direction: column; }
  .col-categories { width: 100%; min-width: 0; max-height: 35vh; border-right: none; border-bottom: 1px solid var(--border); }
  .col-channels { width: 100%; min-width: 0; max-height: 35vh; border-right: none; border-bottom: 1px solid var(--border); }
  .col-player { flex: 1; }
  .home-cards { flex-direction: column; align-items: center; }
  .home-card { width: 100%; max-width: 300px; height: 120px; flex-direction: row; gap: 16px; padding: 16px 20px; }
  .home-card-icon svg { width: 40px; height: 40px; }
}

@media (max-width: 600px) {
  .icon-toolbar { width: 44px; min-width: 44px; }
  .toolbar-btn { width: 34px; height: 34px; }
  .col-categories { max-height: 30vh; }
  .col-channels { max-height: 30vh; }
}
