/* style.css */

:root {
  /* Core Variables */
  --sidebar-width: 380px;
  --header-height: 70px;
  --font-main: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  
  /* Light Theme Colors */
  --bg-app: #f4f6f8;
  --bg-sidebar: #ffffff;
  --bg-surface: #ffffff;
  --bg-surface-hover: #f0f4f8;
  --bg-surface-active: #e2e8f0;
  --text-primary: #0f172a;
  --text-secondary: #64748b;
  --accent-primary: #3b82f6;
  --accent-glow: rgba(59, 130, 246, 0.4);
  --border-color: #e2e8f0;
  --input-bg: #f8fafc;
  --danger: #ef4444;
}

body.dark-mode {
  /* Dark Theme Colors */
  --bg-app: #090b10;
  --bg-sidebar: #11141d;
  --bg-surface: #1a1f2e;
  --bg-surface-hover: #23293b;
  --bg-surface-active: #2c344a;
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --accent-primary: #38bdf8;
  --accent-glow: rgba(56, 189, 248, 0.3);
  --border-color: #1e293b;
  --input-bg: #0f131c;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg-app);
  color: var(--text-primary);
  font-family: var(--font-main);
  height: 100vh;
  overflow: hidden;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Layout */
.container {
  display: flex;
  height: 100vh;
  width: 100vw;
  position: relative;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border-color);
  z-index: 100;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.3s;
}

.sidebar-header {
  padding: 0 24px;
  height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-color);
}

.brand { display: flex; align-items: center; gap: 10px; }
.brand-icon { font-size: 1.5rem; }
.brand h2 { margin: 0; font-size: 1.1rem; font-weight: 700; letter-spacing: 0.5px; }
.home-link { text-decoration: none; color: var(--accent-primary); font-size: 0.85rem; font-weight: 600; transition: opacity 0.2s;}
.home-link:hover { opacity: 0.8; }

/* Search Bar */
.search-wrapper {
  padding: 16px 24px;
  position: relative;
}
.search-icon {
  position: absolute;
  left: 38px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 14px;
  opacity: 0.5;
}
#search {
  width: 100%;
  padding: 12px 16px 12px 40px;
  background: var(--input-bg);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  border-radius: 12px;
  outline: none;
  font-size: 0.95rem;
  font-family: var(--font-main);
  transition: all 0.2s;
}
#search:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

/* Channel List */
#channelList {
  flex: 1;
  overflow-y: auto;
  padding: 0 16px 20px 16px;
}

.channel {
  background: transparent;
  border-radius: 12px;
  padding: 12px 16px;
  margin-bottom: 4px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.2s ease;
}
.channel:hover { background: var(--bg-surface-hover); }
.channel.active-match {
  background: var(--bg-surface-active);
  border-color: var(--border-color);
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.channel-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.channel-main-info {
  display: flex;
  align-items: center;
  gap: 12px;
}
.channel-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  color: #fff;
  background: linear-gradient(135deg, var(--accent-primary), #6366f1);
  box-shadow: 0 2px 8px var(--accent-glow);
}
.channel-name-text { font-size: 0.95rem; font-weight: 500; }
.fav-badge { font-size: 14px; animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275); }

/* Stream Links (Desktop) */
.links-container {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
  padding-left: 48px; /* Align with text */
}
.stream-link {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  padding: 4px 10px;
  border-radius: 20px;
  background: var(--input-bg);
  border: 1px solid var(--border-color);
  transition: all 0.2s;
}
.stream-link:hover { color: var(--text-primary); border-color: var(--text-secondary); }
.stream-link.active-link {
  background: var(--accent-primary);
  color: #fff;
  border-color: var(--accent-primary);
  box-shadow: 0 2px 8px var(--accent-glow);
}

/* Main Player Area */
.playerArea {
  flex: 1;
  background: var(--bg-app);
  display: flex;
  flex-direction: column;
  position: relative;
}

/* Top Navigation */
.top-nav {
  height: var(--header-height);
  padding: 0 30px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 10;
}
.nav-left, .nav-right { display: flex; align-items: center; gap: 12px; }

.now-playing-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: 0.3px;
}

/* Buttons */
.icon-btn {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  width: 40px;
  height: 40px;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn:hover { color: var(--accent-primary); border-color: var(--accent-primary); background: var(--bg-surface-hover); }

.pill-btn {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 0 16px;
  height: 40px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s;
}
.pill-btn:hover { background: var(--bg-surface-hover); }
.fav-btn.is-fav { border-color: var(--danger); background: rgba(239, 68, 68, 0.1); }
#favIcon { font-size: 14px; }

/* Cinematic Player Wrapper */
.cinematic-wrapper {
  flex: 1;
  padding: 0 30px 30px 30px;
  display: flex;
  flex-direction: column;
  height: calc(100vh - var(--header-height));
}

.video-container {
  flex: 1;
  width: 100%;
  background: #000;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0,0,0,0.2);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

#videoPlayer { width: 100%; height: 100%; background: #000; display: none; object-fit: contain; }

/* Custom Scrollbar */
.custom-scrollbar::-webkit-scrollbar { width: 6px; }
.custom-scrollbar::-webkit-scrollbar-track { background: transparent; }
.custom-scrollbar::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 10px; }
.custom-scrollbar::-webkit-scrollbar-thumb:hover { background: var(--text-secondary); }

/* YouTube Overlays */
.yt-play-overlay {
  position: absolute; width: 72px; height: 52px; 
  background: rgba(255,0,0,0.9); border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 20px rgba(255,0,0,0.3);
  transition: transform 0.2s;
}
.yt-thumb-container:hover .yt-play-overlay { transform: scale(1.1); }

@keyframes popIn { 0% { transform: scale(0); } 80% { transform: scale(1.2); } 100% { transform: scale(1); } }

/* Mobile Responsiveness */
.back-btn { display: none; }

@media (max-width: 850px) {
  .sidebar { position: absolute; width: 100%; height: 100%; left: 0; top: 0; padding-bottom: 20px;}
  .container.match-selected .sidebar { transform: translateX(-100%); }
  
  .back-btn { display: flex; }
  .top-nav { padding: 0 16px; }
  .now-playing-title { font-size: 0.9rem; max-width: 150px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  
  .cinematic-wrapper { padding: 0; border-radius: 0; }
  .video-container { border-radius: 0; box-shadow: none; align-items: flex-start; }
  #videoContainer iframe { height: 35vh; width: 100%; }
  #videoPlayer { max-height: 40vh; }
  
  .mobile-links-bar {
    display: flex; flex-wrap: wrap; justify-content: center; gap: 8px;
    padding: 12px; background: var(--bg-sidebar); border-bottom: 1px solid var(--border-color);
  }
  .mobile-links-bar .links-container { padding-left: 0; margin-top: 0; }
  #favText { display: none; }
}

@media (min-width: 851px) {
  .mobile-links-bar { display: none; }
}