/* =====================================================
 * Gameday TV Box — Dark Cinema Design System
 * Netflix-inspired minimal IPTV interface
 ===================================================== */

:root {
  --ios-ui-bottom: 0px;

  /* Netflix-inspired palette */
  --color-bg-primary: #141414;
  --color-bg-secondary: #1a1a1a;
  --color-bg-tertiary: #2a2a2a;
  --color-bg-hover: #333333;
  --color-bg-active: #3d3d3d;
  --color-bg-card: #1f1f1f;

  --color-accent: #e50914;
  --color-accent-hover: #f40612;
  --color-accent-dim: rgba(229, 9, 20, 0.15);

  --color-success: #46d369;
  --color-warning: #f59e0b;
  --color-error: #e87c03;

  --color-text-primary: #ffffff;
  --color-text-secondary: #b3b3b3;
  --color-text-muted: #6b6b6b;

  --color-border: rgba(255, 255, 255, 0.1);
  --color-border-light: rgba(255, 255, 255, 0.15);

  --glass-bg: rgba(20, 20, 20, 0.95);
  --glass-border: rgba(255, 255, 255, 0.06);

  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;

  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 10px;
  --radius-full: 9999px;

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.6);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.7);
  --shadow-glow: 0 0 20px rgba(229, 9, 20, 0.4);

  --transition-fast: 150ms ease;
  --transition-normal: 250ms ease;
  --transition-slow: 350ms ease;

  --navbar-height: 64px;
  --sidebar-width: 300px;
  --epg-sidebar-width: 250px;

  --safe-area-inset-top: env(safe-area-inset-top, 0px);
  --safe-area-inset-right: env(safe-area-inset-right, 0px);
  --safe-area-inset-bottom: env(safe-area-inset-bottom, 0px);
  --safe-area-inset-left: env(safe-area-inset-left, 0px);
}

/* =====================================================
   Reset & Base
   ===================================================== */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--color-text-primary);
  background: var(--color-bg-primary);
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-overflow-scrolling: touch;
}

@media (hover: none) {
  * { -webkit-user-select: none; user-select: none; }
  input, textarea, .modal-body, .series-info, .movie-info, .epg-program-desc {
    -webkit-user-select: text; user-select: text;
  }
}

#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  height: -webkit-fill-available;
}

h1, h2, h3, h4, h5, h6 { font-weight: 600; line-height: 1.3; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.2rem; }
h4 { font-size: 1rem; }
.hint { color: var(--color-text-muted); font-size: 0.875rem; }
.hidden { display: none !important; }

/* =====================================================
   Navbar
   ===================================================== */
.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--navbar-height);
  padding: 0 var(--space-xl);
  padding-left: max(var(--space-xl), var(--safe-area-inset-left));
  padding-right: max(var(--space-xl), var(--safe-area-inset-right));
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--glass-border);
  z-index: 100;
  position: relative;
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  text-decoration: none;
  flex-shrink: 0;
}

.logo {
  display: flex;
  align-items: center;
  justify-content: center;
}

.logo svg {
  fill: var(--color-accent);
  filter: drop-shadow(0 0 8px rgba(229,9,20,0.4));
}

.brand-text {
  font-size: 1.5rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  color: var(--color-accent);
  text-transform: uppercase;
  line-height: 1;
  padding-top: 1px;
  font-family: 'Inter', sans-serif;
}

.brand-accent { color: var(--color-accent); }

.version-badge {
  font-size: 0.58rem;
  font-weight: 700;
  background: rgba(229, 9, 20, 0.15);
  color: var(--color-accent);
  padding: 2px 6px;
  border-radius: var(--radius-full);
  margin-left: 4px;
  letter-spacing: 0.04em;
  border: 1px solid rgba(229, 9, 20, 0.25);
}

.navbar-menu {
  display: flex;
  align-items: center;
  gap: 2px;
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
  display: none;
  flex-direction: column;
  justify-content: space-around;
  width: 28px;
  height: 28px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  z-index: 110;
}

.mobile-menu-toggle span {
  width: 100%;
  height: 2px;
  background: var(--color-text-primary);
  border-radius: 2px;
  transition: all 0.3s ease;
}

.mobile-menu-toggle.active span:nth-child(1) { transform: rotate(45deg) translate(7px, 7px); }
.mobile-menu-toggle.active span:nth-child(2) { opacity: 0; }
.mobile-menu-toggle.active span:nth-child(3) { transform: rotate(-45deg) translate(7px, -7px); }

/* Nav links */
.nav-link {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  color: var(--color-text-secondary);
  text-decoration: none;
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  font-size: 0.875rem;
  font-weight: 500;
  white-space: nowrap;
}

.nav-link:hover {
  color: var(--color-text-primary);
  background: rgba(255,255,255,0.07);
}

.nav-link.active {
  color: var(--color-text-primary);
  background: rgba(255,255,255,0.1);
}

.nav-icon {
  display: flex;
  align-items: center;
}

.nav-icon svg, .nav-icon .icon {
  width: 16px;
  height: 16px;
}

/* Now Playing Indicator */
.now-playing-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 14px;
  background: var(--color-accent);
  color: #fff;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 700;
  text-decoration: none;
  transition: all var(--transition-fast);
  letter-spacing: 0.02em;
  margin-right: 6px;
  text-transform: uppercase;
}

.now-playing-indicator:hover {
  background: var(--color-accent-hover);
  box-shadow: var(--shadow-glow);
}

.now-playing-icon { font-size: 0.65rem; animation: pulse-dot 1.5s ease infinite; }

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* =====================================================
   Main Content & Pages
   ===================================================== */
.main-content {
  flex: 1;
  overflow: hidden;
}

.page {
  display: none;
  height: 100%;
  overflow: hidden;
}

.page.active { display: block; }

/* Home page needs vertical scroll for dashboard sections */
#page-home {
  overflow-y: auto;
  overflow-x: hidden;
}

/* Empty State */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: var(--space-xl);
  text-align: center;
  color: var(--color-text-muted);
  gap: var(--space-sm);
}

/* Empty state inside horizontal scroll rows — don't stretch to full height */
.horizontal-scroll > .empty-state,
.horizontal-scroll > .loading-state {
  height: auto;
  min-height: 80px;
  width: 100%;
}

.loading-state {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--color-text-muted);
  font-size: 0.875rem;
}

/* =====================================================
   Home Page Layout (Live TV)
   ===================================================== */
.home-layout {
  display: flex;
  height: 100%;
  position: relative;
}

.main-content,
.page,
.home-layout,
.channel-sidebar,
.channel-list {
  min-height: 0;
}

/* Floating Channel Toggle (Mobile) */
.channel-toggle-btn {
  display: none;
  position: absolute;
  top: var(--space-md);
  left: var(--space-md);
  z-index: 60;
  padding: 7px 14px;
  background: rgba(0,0,0,0.8);
  backdrop-filter: blur(12px);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  color: var(--color-text-primary);
  font-weight: 600;
  font-size: 0.8rem;
  cursor: pointer;
  box-shadow: var(--shadow-lg);
  transition: all var(--transition-fast);
  align-items: center;
  gap: 6px;
}

.channel-toggle-btn:hover {
  background: var(--color-accent);
  border-color: var(--color-accent);
}

.channel-toggle-btn .icon { width: 1.1em; height: 1.1em; }

/* Channel Sidebar Overlay */
.channel-sidebar-overlay { display: none; }

/* Sidebar */
.channel-sidebar {
  width: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  background: var(--color-bg-secondary);
  border-right: 1px solid var(--color-border);
}

.sidebar-header {
  padding: var(--space-md);
  border-bottom: 1px solid var(--color-border);
}

.sidebar-header-row {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.sidebar-header-row .search-wrapper { flex: 1; }

.sidebar-collapse-btn {
  display: none;
  flex-shrink: 0;
  padding: var(--space-xs);
}

.sidebar-collapse-btn .icon { transition: transform 0.2s ease; }

@media (min-width: 769px) {
  .sidebar-collapse-btn { display: flex; }
}

.channel-sidebar.collapsed {
  width: 0;
  min-width: 0;
  overflow: hidden;
  border-right: none;
}

.channel-sidebar.collapsed .sidebar-header,
.channel-sidebar.collapsed .channel-list {
  opacity: 0;
  visibility: hidden;
}

.sidebar-expand-btn {
  display: none;
  position: absolute;
  left: 0;
  top: calc(var(--navbar-height) + var(--space-md));
  z-index: 50;
  background: rgba(0,0,0,0.8);
  backdrop-filter: blur(12px);
  border: 1px solid var(--color-border);
  border-left: none;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  padding: var(--space-sm);
  cursor: pointer;
  color: var(--color-text-primary);
  transition: opacity 0.3s ease, background var(--transition-fast);
  opacity: 0;
  pointer-events: none;
}

.sidebar-expand-btn:hover { background: var(--color-bg-hover); }
.sidebar-expand-btn .icon { width: 20px; height: 20px; }

.home-layout.sidebar-collapsed .sidebar-expand-btn { display: flex; }
.home-layout.sidebar-collapsed .sidebar-expand-btn.visible { opacity: 1; pointer-events: auto; }

@media (max-width: 768px) {
  .sidebar-expand-btn { display: none !important; }
}

.channel-sidebar { transition: width 0.2s ease, min-width 0.2s ease; }

/* Search & Inputs */
.search-input {
  width: 100%;
  padding: 8px 14px;
  background: var(--color-bg-tertiary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text-primary);
  font-size: 0.875rem;
  font-family: inherit;
  transition: border-color var(--transition-fast);
}

.search-input:focus { outline: none; border-color: rgba(255,255,255,0.25); }
.search-input::placeholder { color: var(--color-text-muted); }

.search-wrapper {
  position: relative;
  width: 100%;
  min-width: 150px;
}

.search-wrapper .search-input { padding-right: 30px; }

.search-clear {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--color-text-muted);
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  padding: 4px;
  opacity: 0;
  transition: opacity var(--transition-fast), color var(--transition-fast);
}

.search-wrapper:hover .search-clear,
.search-input:focus ~ .search-clear { opacity: 0.6; }

.search-clear:hover { opacity: 1; color: var(--color-text-primary); }

.sidebar-controls {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-top: var(--space-sm);
}

.source-select {
  flex: 1;
  padding: 6px 10px;
  background: var(--color-bg-tertiary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text-primary);
  font-size: 0.8rem;
  font-family: inherit;
  cursor: pointer;
}

.source-select:focus { outline: none; border-color: rgba(255,255,255,0.25); }

.toggle-hidden {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  font-size: 0.75rem;
  color: var(--color-text-muted);
  cursor: pointer;
}

.toggle-hidden input { accent-color: var(--color-accent); }

/* Channel List */
.channel-list {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-sm);
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.channel-list::-webkit-scrollbar { width: 4px; }
.channel-list::-webkit-scrollbar-track { background: transparent; }
.channel-list::-webkit-scrollbar-thumb { background: var(--color-bg-active); border-radius: 2px; }

.channel-group { margin-bottom: 4px; }

.group-header {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 7px 10px;
  background: transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  user-select: none;
  transition: background var(--transition-fast);
  color: var(--color-text-muted);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.group-header:hover { background: var(--color-bg-tertiary); color: var(--color-text-secondary); }
.group-toggle { transition: transform var(--transition-fast); }
.group-header.collapsed .group-toggle { transform: rotate(-90deg); }
.group-name { flex: 1; }
.group-count { font-size: 0.68rem; opacity: 0.7; }
.group-channels { margin-top: 2px; }
.group-header.collapsed + .group-channels { display: none; }

.channel-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.channel-item:hover { background: var(--color-bg-tertiary); }

.channel-item.active {
  background: rgba(229,9,20,0.1);
  border-left: 2px solid var(--color-accent);
  padding-left: 8px;
}

.channel-item.hidden { opacity: 0.35; }

.channel-logo {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--color-bg-tertiary);
  object-fit: contain;
  flex-shrink: 0;
}

.channel-info { flex: 1; min-width: 0; }

.channel-name {
  font-weight: 500;
  font-size: 0.875rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.channel-program {
  font-size: 0.72rem;
  color: var(--color-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Favorites group */
.group-header.favorites-group { color: #f59e0b; }

/* =====================================================
   Video Player Section
   ===================================================== */
.player-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: #000;
}

.video-container {
  flex: 1;
  position: relative;
  background: #000;
  overflow: hidden;
  min-height: 0;
}

#player-controls-overlay {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(env(safe-area-inset-bottom, 0px) + var(--ios-ui-bottom, 0px));
  box-sizing: border-box;
}

.player-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.5);
  color: var(--color-text-muted);
}

.overlay-content { text-align: center; }

/* Watch overlay */
.watch-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    rgba(0,0,0,0.9) 0%,
    rgba(0,0,0,0.3) 25%,
    transparent 50%,
    rgba(0,0,0,0.4) 100%
  );
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: var(--space-lg);
  transition: opacity var(--transition-normal);
}

.watch-overlay.hidden { opacity: 0; pointer-events: none; }

.watch-top-bar {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.watch-title-overlay {
  font-size: 1rem;
  font-weight: 700;
  text-shadow: 0 1px 4px rgba(0,0,0,0.8);
  flex: 1;
}

.player-badges { display: flex; gap: 6px; align-items: center; }

.transcode-status {
  font-size: 0.68rem;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: rgba(229,9,20,0.2);
  color: var(--color-accent);
  border: 1px solid rgba(229,9,20,0.3);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.quality-badge {
  font-size: 0.68rem;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: rgba(255,255,255,0.1);
  color: var(--color-text-secondary);
  border: 1px solid rgba(255,255,255,0.12);
  font-weight: 600;
}

.watch-center-play {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 3;
  width: 66px;
  height: 66px;
  border-radius: 50%;
  background: rgba(255,255,255,0.12);
  border: 2px solid rgba(255,255,255,0.4);
  backdrop-filter: blur(8px);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  color: #fff;
  opacity: 0;
  pointer-events: none;
}

.watch-center-play.show {
  opacity: 1;
  pointer-events: auto;
}

.watch-center-play:hover {
  background: rgba(229,9,20,0.7);
  border-color: var(--color-accent);
  transform: translate(-50%, -50%) scale(1.08);
}

.watch-center-play .icon { width: 32px; height: 32px; margin-left: 4px; }

/* Loading spinner */
.watch-loading {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 2;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.watch-loading.show {
  opacity: 1;
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(255,255,255,0.12);
  border-top-color: var(--color-accent);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}

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

.watch-bottom-bar {
  padding-bottom: max(var(--space-sm), var(--safe-area-inset-bottom));
}

.watch-controls {
  display: flex;
  align-items: center;
  gap: 2px;
}

.watch-spacer { flex: 1; }

.watch-btn {
  background: none;
  border: none;
  color: rgba(255,255,255,0.85);
  cursor: pointer;
  padding: 8px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.watch-btn:hover { color: #fff; background: rgba(255,255,255,0.1); }
.watch-btn-lg { padding: 10px; }
.watch-btn-lg .icon { width: 28px; height: 28px; }
.watch-btn .icon { width: 22px; height: 22px; }

.watch-volume {
  width: 90px;
  accent-color: #fff;
  cursor: pointer;
}

/* Seek bar */
.seek-bar-wrapper {
  width: 100%;
  margin-bottom: 8px;
  padding: 0 2px;
}

.seek-bar {
  width: 100%;
  height: 4px;
  accent-color: var(--color-accent);
  cursor: pointer;
}

.time-display {
  font-size: 0.75rem;
  color: var(--color-text-secondary);
  min-width: 90px;
  text-align: center;
}

/* Captions */
.watch-captions-wrapper { position: relative; }

.watch-captions-menu {
  position: absolute;
  bottom: calc(100% + 8px);
  right: 0;
  min-width: 180px;
  background: rgba(15,15,15,0.97);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  backdrop-filter: blur(16px);
}

.captions-menu-title {
  padding: 10px 14px 6px;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-muted);
}

.captions-option {
  display: block;
  width: 100%;
  padding: 8px 14px;
  background: none;
  border: none;
  color: var(--color-text-secondary);
  text-align: left;
  cursor: pointer;
  font-size: 0.875rem;
  font-family: inherit;
  transition: all var(--transition-fast);
}

.captions-option:hover { background: var(--color-bg-hover); color: var(--color-text-primary); }
.captions-option.active { color: var(--color-accent); }

/* Player overflow */
.player-overflow-wrapper { position: relative; }

.player-overflow-menu {
  position: absolute;
  bottom: calc(100% + 8px);
  right: 0;
  min-width: 200px;
  background: rgba(15,15,15,0.97);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  backdrop-filter: blur(16px);
}

.overflow-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 14px;
  background: none;
  border: none;
  color: var(--color-text-secondary);
  text-align: left;
  cursor: pointer;
  font-size: 0.875rem;
  font-family: inherit;
  transition: all var(--transition-fast);
}

.overflow-menu-item:hover { background: var(--color-bg-hover); color: var(--color-text-primary); }
.overflow-menu-item .icon { width: 16px; height: 16px; flex-shrink: 0; }

/* Now Playing Overlay */
.now-playing-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.95) 0%, transparent 100%);
  padding: var(--space-xl) var(--space-lg) var(--space-lg);
  display: flex;
  gap: var(--space-xl);
}

.now-playing-info h3 { font-size: 1rem; margin-bottom: 4px; }
.now-playing-info p { font-size: 0.78rem; color: var(--color-text-secondary); }
.up-next h4 { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--color-text-muted); margin-bottom: 6px; }
.up-next ul { list-style: none; display: flex; flex-direction: column; gap: 4px; }
.up-next li { font-size: 0.78rem; color: var(--color-text-secondary); }

/* =====================================================
   TV Guide
   ===================================================== */
#page-guide {
  display: none;
  flex-direction: column;
  overflow: hidden;
}

#page-guide.active { display: flex; }

.guide-header {
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  gap: var(--space-md);
  flex-wrap: wrap;
  background: var(--color-bg-secondary);
  flex-shrink: 0;
}

.guide-header h2 { font-size: 1rem; font-weight: 700; flex-shrink: 0; }

.guide-controls {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex-wrap: wrap;
  flex: 1;
}

.guide-date {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-text-secondary);
  min-width: 60px;
  text-align: center;
}

.epg-grid {
  flex: 1;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.epg-channel-row {
  display: flex;
  border-bottom: 1px solid var(--color-border);
  min-height: 52px;
}

.epg-channel-name {
  width: var(--epg-sidebar-width);
  flex-shrink: 0;
  padding: 8px 14px;
  background: var(--color-bg-secondary);
  border-right: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  font-weight: 500;
  position: sticky;
  left: 0;
  z-index: 2;
}

.epg-channel-logo {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  object-fit: contain;
  background: var(--color-bg-tertiary);
  flex-shrink: 0;
}

.epg-programs {
  flex: 1;
  display: flex;
  position: relative;
  min-width: max-content;
}

.epg-program {
  position: absolute;
  top: 3px;
  bottom: 3px;
  background: var(--color-bg-tertiary);
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  padding: 4px 8px;
  cursor: pointer;
  overflow: hidden;
  transition: all var(--transition-fast);
  box-sizing: border-box;
}

.epg-program:hover { background: var(--color-bg-hover); border-color: rgba(255,255,255,0.18); z-index: 1; }
.epg-program.current { border-color: var(--color-accent); background: rgba(229,9,20,0.1); }

/* Skeleton loader shown while EPG data is being fetched lazily */
@keyframes epg-shimmer {
  0%   { background-position: -400px 0; }
  100% { background-position:  400px 0; }
}
.epg-program.epg-skeleton {
  background: linear-gradient(90deg,
    var(--color-bg-tertiary) 25%,
    var(--color-bg-hover)    50%,
    var(--color-bg-tertiary) 75%);
  background-size: 800px 100%;
  animation: epg-shimmer 1.4s infinite linear;
  cursor: default;
  border-color: transparent;
}
.epg-program.epg-skeleton .epg-program-title {
  color: var(--color-text-muted);
  font-style: italic;
}

.epg-program-title { font-size: 0.75rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.epg-program-time { font-size: 0.65rem; color: var(--color-text-muted); white-space: nowrap; }

.epg-time-header {
  display: flex;
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  background: var(--color-bg-primary);
  z-index: 3;
}

.epg-time-spacer {
  width: var(--epg-sidebar-width);
  flex-shrink: 0;
  border-right: 1px solid var(--color-border);
  background: var(--color-bg-secondary);
  position: sticky;
  left: 0;
  z-index: 4;
}

.epg-time-slot {
  position: absolute;
  font-size: 0.7rem;
  color: var(--color-text-muted);
  padding: 6px 8px;
  border-left: 1px solid var(--color-border);
  white-space: nowrap;
}

.epg-time-row {
  flex: 1;
  position: relative;
  height: 32px;
  min-width: max-content;
}

.epg-now-line {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--color-accent);
  z-index: 5;
  pointer-events: none;
}

.epg-now-line::before {
  content: '';
  position: absolute;
  top: -4px;
  left: -4px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--color-accent);
}

/* =====================================================
   Movies & Series Grid
   ===================================================== */
#page-movies, #page-series {
  display: none;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}

#page-movies.active, #page-series.active { display: flex; }

.movies-header, .series-header {
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  gap: var(--space-md);
  flex-wrap: wrap;
  background: var(--color-bg-secondary);
  flex-shrink: 0;
}

.movies-header h2, .series-header h2 { font-size: 1rem; font-weight: 700; flex-shrink: 0; }

.movies-controls, .series-controls {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex-wrap: wrap;
  flex: 1;
}

/* Grids */
.movies-grid, .series-grid {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-lg);
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: var(--space-md);
  align-content: start;
  -webkit-overflow-scrolling: touch;
}

.movies-grid::-webkit-scrollbar,
.series-grid::-webkit-scrollbar { width: 4px; }

.movies-grid::-webkit-scrollbar-thumb,
.series-grid::-webkit-scrollbar-thumb { background: var(--color-bg-active); border-radius: 2px; }

/* Content Cards */
.movie-card, .series-card {
  position: relative;
  cursor: pointer;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--color-bg-card);
  transition: transform var(--transition-normal), box-shadow var(--transition-normal);
  aspect-ratio: 2/3;
}

.movie-card:hover, .series-card:hover {
  transform: scale(1.05);
  box-shadow: 0 16px 40px rgba(0,0,0,0.8);
  z-index: 2;
}

.movie-poster {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.movie-poster img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.series-card .series-poster {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.series-card .series-poster img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.series-poster-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.movie-poster-placeholder, .series-poster-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-bg-tertiary);
  color: var(--color-text-muted);
  font-size: 0.72rem;
  text-align: center;
  padding: var(--space-sm);
}

.movie-info-overlay, .series-info-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.97) 0%, rgba(0,0,0,0.6) 50%, transparent 100%);
  padding: 32px 10px 10px;
  opacity: 0;
  transition: opacity var(--transition-normal);
}

.movie-card:hover .movie-info-overlay,
.series-card:hover .series-info-overlay { opacity: 1; }

.movie-title, .series-title {
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 3px;
}

.movie-meta, .series-meta {
  font-size: 0.68rem;
  color: var(--color-text-secondary);
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.movie-meta .icon, .series-meta .icon {
  width: 12px;
  height: 12px;
  vertical-align: middle;
  display: inline-block;
  flex-shrink: 0;
}

/* Play overlay */
.card-play-btn {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.8);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(229,9,20,0.85);
  border: 2px solid rgba(255,255,255,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: all var(--transition-fast);
  color: #fff;
}

.movie-card:hover .card-play-btn,
.series-card:hover .card-play-btn {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.card-play-btn .icon { width: 18px; height: 18px; margin-left: 2px; }

/* Favorite badge */
.favorite-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(0,0,0,0.65);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity var(--transition-fast);
  cursor: pointer;
  color: #f59e0b;
}

.movie-card:hover .favorite-badge,
.series-card:hover .favorite-badge { opacity: 1; }

.favorite-badge.active { opacity: 1; }
.favorite-badge .icon { width: 14px; height: 14px; }

/* Series Details */
.series-content {
  flex: 1;
  overflow: hidden;
  position: relative;
  min-height: 0;
}

.series-details {
  position: absolute;
  inset: 0;
  background: var(--color-bg-primary);
  overflow-y: auto;
  padding: var(--space-lg);
  -webkit-overflow-scrolling: touch;
  z-index: 10;
}

.series-details::-webkit-scrollbar { width: 4px; }
.series-details::-webkit-scrollbar-thumb { background: var(--color-bg-active); border-radius: 2px; }

.series-back-btn {
  background: none;
  border: 1px solid var(--color-border);
  color: var(--color-text-primary);
  padding: 7px 16px;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 0.875rem;
  font-family: inherit;
  margin-bottom: var(--space-lg);
  transition: all var(--transition-fast);
}

.series-back-btn:hover { background: var(--color-bg-hover); border-color: rgba(255,255,255,0.2); }

.series-details-header {
  display: flex;
  gap: var(--space-xl);
  margin-bottom: var(--space-xl);
}

#series-poster {
  width: 150px;
  height: 225px;
  object-fit: cover;
  border-radius: var(--radius-md);
  flex-shrink: 0;
}

.series-info h3 { font-size: 1.5rem; font-weight: 800; margin-bottom: 10px; }
.series-info p { color: var(--color-text-secondary); line-height: 1.6; font-size: 0.875rem; }

.season-header {
  padding: 12px 0;
  font-weight: 700;
  font-size: 0.875rem;
  cursor: pointer;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  gap: 8px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-secondary);
}

.episodes-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: var(--space-sm);
  padding: var(--space-md) 0;
}

.episode-card {
  background: var(--color-bg-card);
  border-radius: var(--radius-md);
  padding: 12px;
  cursor: pointer;
  transition: all var(--transition-fast);
  border: 1px solid var(--color-border);
}

.episode-card:hover { background: var(--color-bg-hover); border-color: rgba(255,255,255,0.15); }

.episode-title { font-weight: 600; font-size: 0.875rem; margin-bottom: 4px; }
.episode-meta { font-size: 0.72rem; color: var(--color-text-muted); }
.episode-plot { font-size: 0.8rem; color: var(--color-text-secondary); margin-top: 6px; line-height: 1.5; }

/* =====================================================
   Watch Page
   ===================================================== */
#page-watch {
  background: #000;
  position: relative;
}

#page-watch { display: none; }
#page-watch.active { display: block; }

#video-player {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background: #000;
}

/* =====================================================
   Home Dashboard Page
   ===================================================== */
#page-home {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

#page-home::-webkit-scrollbar { width: 4px; }
#page-home::-webkit-scrollbar-thumb { background: var(--color-bg-active); border-radius: 2px; }

/* =====================================================
   Settings Page
   ===================================================== */
#page-settings {
  display: none;
  flex-direction: column;
  overflow: hidden;
}

#page-settings.active { display: flex; }

.settings-container {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-xl) var(--space-2xl);
  max-width: 900px;
  width: 100%;
  margin: 0 auto;
  -webkit-overflow-scrolling: touch;
}

.settings-container::-webkit-scrollbar { width: 4px; }
.settings-container::-webkit-scrollbar-thumb { background: var(--color-bg-active); border-radius: 2px; }

.settings-container > h2 {
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: var(--space-xl);
  letter-spacing: -0.01em;
}

/* Tabs */
.tabs {
  display: flex;
  gap: 2px;
  margin-bottom: var(--space-xl);
  border-bottom: 1px solid var(--color-border);
}

.tab {
  padding: 10px 18px;
  background: none;
  border: none;
  color: var(--color-text-muted);
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all var(--transition-fast);
  font-family: inherit;
}

.tab:hover { color: var(--color-text-primary); }
.tab.active { color: var(--color-text-primary); border-bottom-color: var(--color-accent); }

.tab-content { display: none; }
.tab-content.active { display: block; }

/* Settings Sections */
.settings-section {
  margin-bottom: var(--space-lg);
  background: var(--color-bg-secondary);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  border: 1px solid var(--color-border);
}

.settings-section > h3 {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-muted);
  margin-bottom: var(--space-md);
}

.setting-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: 12px 0;
  border-bottom: 1px solid var(--color-border);
}

.setting-item:last-child { border-bottom: none; padding-bottom: 0; }
.setting-item:first-child { padding-top: 0; }

.setting-info { flex: 1; }
.setting-label { display: block; font-size: 0.875rem; font-weight: 500; }
.setting-hint { display: block; font-size: 0.75rem; color: var(--color-text-muted); margin-top: 2px; line-height: 1.5; }

/* Toggle switch */
.setting-toggle {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.setting-toggle input { opacity: 0; width: 0; height: 0; }

.toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: var(--color-bg-active);
  border-radius: var(--radius-full);
  transition: background var(--transition-fast);
  border: 1px solid var(--color-border);
}

.toggle-slider::before {
  content: '';
  position: absolute;
  left: 3px;
  top: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--color-text-muted);
  transition: all var(--transition-fast);
}

.setting-toggle input:checked + .toggle-slider {
  background: var(--color-accent);
  border-color: var(--color-accent);
}

.setting-toggle input:checked + .toggle-slider::before {
  transform: translateX(20px);
  background: #fff;
}

/* Form elements */
.form-input {
  background: var(--color-bg-tertiary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text-primary);
  padding: 8px 12px;
  font-size: 0.875rem;
  font-family: inherit;
  transition: border-color var(--transition-fast);
}

.form-input:focus { outline: none; border-color: rgba(255,255,255,0.25); }
.form-input::placeholder { color: var(--color-text-muted); }

.setting-number { width: 80px; text-align: center; }

/* Volume slider */
.volume-slider-container { display: flex; align-items: center; gap: var(--space-sm); }
.volume-slider { width: 160px; accent-color: var(--color-accent); cursor: pointer; }

/* Shortcuts grid */
.shortcuts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 6px;
}

.shortcut { font-size: 0.8rem; color: var(--color-text-secondary); padding: 5px 0; }

kbd {
  display: inline-block;
  padding: 2px 6px;
  background: var(--color-bg-tertiary);
  border: 1px solid var(--color-border);
  border-radius: 4px;
  font-size: 0.72rem;
  font-family: monospace;
  color: var(--color-text-primary);
}

/* Source sections */
.source-section {
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  margin-bottom: var(--space-md);
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-md);
}

.section-header h3 {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-muted);
}

.source-list { display: flex; flex-direction: column; gap: 8px; }

.source-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: 12px 14px;
  background: var(--color-bg-tertiary);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  transition: border-color var(--transition-fast);
}

.source-item:hover { border-color: rgba(255,255,255,0.15); }
.source-item-info { flex: 1; min-width: 0; }
.source-item-name { font-weight: 500; font-size: 0.875rem; }
.source-item-url { font-size: 0.72rem; color: var(--color-text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.source-item-actions { display: flex; gap: 6px; }
.source-status { font-size: 0.68rem; padding: 2px 8px; border-radius: var(--radius-full); font-weight: 700; letter-spacing: 0.03em; }
.source-status.ok { background: rgba(70,211,105,0.12); color: var(--color-success); border: 1px solid rgba(70,211,105,0.25); }
.source-status.error { background: rgba(229,9,20,0.12); color: var(--color-accent); border: 1px solid rgba(229,9,20,0.25); }
.source-status.loading { background: rgba(255,255,255,0.06); color: var(--color-text-muted); border: 1px solid var(--color-border); }

/* HW Info */
.hw-info-container { display: flex; flex-direction: column; gap: 8px; }

.hw-info-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--color-bg-tertiary);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  border: 1px solid var(--color-border);
}

.hw-status-badge {
  font-size: 0.68rem;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-weight: 700;
  letter-spacing: 0.04em;
}

.hw-status-badge.available { background: rgba(70,211,105,0.12); color: var(--color-success); }
.hw-status-badge.unavailable { background: rgba(255,255,255,0.06); color: var(--color-text-muted); }

/* User management */
.users-list { display: flex; flex-direction: column; gap: 8px; }

.user-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: 12px 14px;
  background: var(--color-bg-tertiary);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--color-accent-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.875rem;
  color: var(--color-accent);
  flex-shrink: 0;
}

.user-name { font-weight: 500; font-size: 0.875rem; }
.user-role { font-size: 0.72rem; color: var(--color-text-muted); }
.user-actions { display: flex; gap: 6px; margin-left: auto; }

.role-badge {
  font-size: 0.62rem;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.role-badge.admin { background: rgba(229,9,20,0.12); color: var(--color-accent); border: 1px solid rgba(229,9,20,0.25); }
.role-badge.viewer { background: rgba(255,255,255,0.06); color: var(--color-text-secondary); border: 1px solid var(--color-border); }

/* EPG last refreshed */
#epg-last-refreshed { font-size: 0.8rem; color: var(--color-text-secondary); }

/* =====================================================
   Buttons
   ===================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 600;
  font-family: inherit;
  transition: all var(--transition-fast);
  text-decoration: none;
  white-space: nowrap;
  line-height: 1;
}

.btn-primary { background: var(--color-accent); color: #fff; }
.btn-primary:hover { background: var(--color-accent-hover); box-shadow: 0 4px 16px rgba(229,9,20,0.3); }

.btn-secondary {
  background: rgba(255,255,255,0.1);
  color: var(--color-text-primary);
  border: 1px solid var(--color-border);
}
.btn-secondary:hover { background: rgba(255,255,255,0.15); border-color: rgba(255,255,255,0.2); }

.btn-ghost {
  background: transparent;
  color: var(--color-text-secondary);
  border: 1px solid var(--color-border);
}
.btn-ghost:hover { background: var(--color-bg-hover); color: var(--color-text-primary); border-color: rgba(255,255,255,0.2); }

.btn-danger { background: rgba(229,9,20,0.12); color: var(--color-accent); border: 1px solid rgba(229,9,20,0.25); }
.btn-danger:hover { background: rgba(229,9,20,0.22); }

.btn-sm { padding: 5px 12px; font-size: 0.78rem; }
.btn-icon { padding: 7px; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn .icon { width: 15px; height: 15px; }
.btn-sm .icon { width: 13px; height: 13px; }

/* =====================================================
   Modals
   ===================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: var(--space-lg);
}

.modal-overlay.active {
  display: flex;
  animation: fadeIn 0.15s ease;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  max-width: 520px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.2s ease;
  overflow: hidden;
}

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

.modal-header {
  padding: var(--space-lg) var(--space-xl);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h3 { font-size: 1rem; font-weight: 700; }

.modal-close {
  background: none;
  border: none;
  color: var(--color-text-muted);
  cursor: pointer;
  padding: 4px 6px;
  border-radius: var(--radius-sm);
  font-size: 1.3rem;
  line-height: 1;
  transition: all var(--transition-fast);
}

.modal-close:hover { color: var(--color-text-primary); background: var(--color-bg-hover); }

.modal-body {
  padding: var(--space-xl);
  max-height: 70vh;
  overflow-y: auto;
}

.modal-footer {
  padding: var(--space-md) var(--space-xl);
  border-top: 1px solid var(--color-border);
  display: flex;
  justify-content: flex-end;
  gap: var(--space-sm);
}

.form-group { margin-bottom: var(--space-md); }

.form-group label {
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--color-text-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.form-group .form-input { width: 100%; padding: 10px 14px; font-size: 0.9rem; }
.form-hint { font-size: 0.72rem; color: var(--color-text-muted); margin-top: 4px; }

/* =====================================================
   Toasts
   ===================================================== */
.toast-container {
  position: fixed;
  bottom: max(var(--space-lg), var(--safe-area-inset-bottom));
  right: var(--space-lg);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 11px 16px;
  font-size: 0.875rem;
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.2s ease;
  max-width: 320px;
  pointer-events: auto;
}

.toast.success { border-left: 3px solid var(--color-success); }
.toast.error { border-left: 3px solid var(--color-accent); }
.toast.info { border-left: 3px solid rgba(255,255,255,0.25); }

@keyframes toastIn {
  from { transform: translateX(16px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* =====================================================
   Confirm dialog
   ===================================================== */
.confirm-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  backdrop-filter: blur(6px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-lg);
}

.confirm-dialog {
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  max-width: 400px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.2s ease;
}

.confirm-dialog h3 { font-size: 1rem; font-weight: 700; margin-bottom: 8px; }
.confirm-dialog p { color: var(--color-text-secondary); font-size: 0.875rem; margin-bottom: var(--space-lg); line-height: 1.6; }
.confirm-actions { display: flex; gap: var(--space-sm); justify-content: flex-end; }

/* =====================================================
   Scrollbar
   ===================================================== */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--color-bg-active); border-radius: 2px; }
::-webkit-scrollbar-thumb:hover { background: var(--color-bg-hover); }

/* =====================================================
   Utilities
   ===================================================== */
.text-muted { color: var(--color-text-muted); }
.text-accent { color: var(--color-accent); }
.icon { display: inline-block; }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-1 { flex: 1; }
.gap-sm { gap: var(--space-sm); }

/* Live badge */
.live-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #fff;
  background: var(--color-accent);
  padding: 2px 7px;
  border-radius: var(--radius-full);
}

.live-dot {
  width: 5px;
  height: 5px;
  background: #fff;
  border-radius: 50%;
  animation: pulse-dot 1.5s ease infinite;
}

/* =====================================================
   Mobile Responsive
   ===================================================== */
@media (max-width: 768px) {
  .navbar {
    padding: 0 var(--space-md);
  }

  .navbar-menu {
    display: none;
    position: fixed;
    top: var(--navbar-height);
    left: 0;
    right: 0;
    background: rgba(10,10,10,0.98);
    backdrop-filter: blur(20px);
    flex-direction: column;
    padding: var(--space-md);
    gap: 2px;
    border-bottom: 1px solid var(--color-border);
    z-index: 99;
  }

  .navbar-menu.active { display: flex; }
  .mobile-menu-toggle { display: flex; }

  .nav-link {
    padding: 12px 16px;
    border-radius: var(--radius-md);
    font-size: 0.95rem;
  }

  .channel-sidebar {
    position: fixed;
    top: var(--navbar-height);
    left: 0;
    bottom: 0;
    z-index: 70;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    width: 85vw;
    max-width: 320px;
    box-shadow: var(--shadow-lg);
  }

  .channel-sidebar.active { transform: translateX(0); }

  .channel-sidebar-overlay {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.65);
    z-index: 69;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
  }

  .channel-sidebar-overlay.active { opacity: 1; pointer-events: auto; }

  .channel-toggle-btn { display: flex; }

  .movies-grid, .series-grid {
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    padding: var(--space-md);
    gap: 8px;
  }

  .settings-container {
    padding: var(--space-lg) var(--space-md);
  }

  .series-details-header { flex-direction: column; }

  #series-poster { width: 110px; height: 165px; }

  .modal-body { max-height: 60vh; }

  .watch-content-info { flex-direction: column; }
  .watch-poster { width: 120px; height: 180px; }
  .watch-details-section { padding: var(--space-md); }
  .watch-recommended-grid { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); }
}

/* =====================================================
   Generic Modal Template (id="modal")
   ===================================================== */
#modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  backdrop-filter: blur(6px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: var(--space-lg);
}

#modal.active {
  display: flex;
  animation: fadeIn 0.15s ease;
}

#modal .modal-content {
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  max-width: 520px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.2s ease;
  overflow: hidden;
}

/* =====================================================
   Modal Form Groups
   ===================================================== */
.modal-form-group {
  margin-bottom: var(--space-lg);
}

.modal-form-group label {
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--color-text-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.modal-form-group .form-input {
  width: 100%;
  padding: 10px 14px;
  font-size: 0.9rem;
}

.modal-form-group select.form-input {
  cursor: pointer;
}

.modal-form-group:last-child {
  margin-bottom: 0;
}

/* =====================================================
   User Table & Management
   ===================================================== */
.user-list-container {
  margin-bottom: var(--space-xl);
  overflow-x: auto;
}

.user-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.user-table thead th {
  text-align: left;
  padding: 10px 14px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-muted);
  border-bottom: 1px solid var(--color-border);
  white-space: nowrap;
}

.user-table tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--color-border);
  vertical-align: middle;
}

.user-table tbody tr:hover {
  background: var(--color-bg-tertiary);
}

.user-table tbody tr:last-child td {
  border-bottom: none;
}

.user-badge {
  display: inline-block;
  font-size: 0.62rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  vertical-align: middle;
}

.user-badge-admin { background: rgba(229,9,20,0.12); color: var(--color-accent); border: 1px solid rgba(229,9,20,0.25); }
.user-badge-viewer { background: rgba(255,255,255,0.06); color: var(--color-text-secondary); border: 1px solid var(--color-border); }
.user-badge-sso { background: rgba(99,102,241,0.12); color: #818cf8; border: 1px solid rgba(99,102,241,0.25); }
.user-badge-local { background: rgba(70,211,105,0.1); color: var(--color-success); border: 1px solid rgba(70,211,105,0.2); }

.btn-error {
  background: rgba(229,9,20,0.12);
  color: var(--color-accent);
  border: 1px solid rgba(229,9,20,0.25);
}

.btn-error:hover { background: rgba(229,9,20,0.22); }

/* Add User Section */
.add-user-section {
  margin-top: var(--space-xl);
  padding-top: var(--space-xl);
  border-top: 1px solid var(--color-border);
}

.add-user-section h4 {
  font-size: 0.875rem;
  font-weight: 700;
  margin-bottom: var(--space-lg);
}

.user-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-md);
  align-items: end;
}

.user-form .form-group {
  margin-bottom: 0;
}

.user-form .btn {
  align-self: end;
}

@media (max-width: 768px) {
  .user-form {
    grid-template-columns: 1fr;
  }
}

/* =====================================================
   Content Browser (Manage Content Tab)
   ===================================================== */
.content-browser {
  /* Full height layout for content management */
}

.content-browser-header {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex-wrap: wrap;
  margin-bottom: var(--space-md);
}

.content-type-toggle {
  display: flex;
  gap: 2px;
  background: var(--color-bg-tertiary);
  padding: 2px;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
}

.content-type-toggle .btn {
  border: none;
  background: transparent;
  color: var(--color-text-muted);
  font-size: 0.78rem;
  padding: 5px 12px;
  border-radius: var(--radius-sm);
}

.content-type-toggle .btn.active {
  background: var(--color-accent);
  color: #fff;
}

.content-actions {
  display: flex;
  gap: var(--space-sm);
  margin-left: auto;
}

.content-tree {
  max-height: 500px;
  overflow-y: auto;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-bg-primary);
  -webkit-overflow-scrolling: touch;
}

.content-tree::-webkit-scrollbar { width: 4px; }
.content-tree::-webkit-scrollbar-thumb { background: var(--color-bg-active); border-radius: 2px; }

.content-group-header {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 10px 14px;
  background: var(--color-bg-secondary);
  border-bottom: 1px solid var(--color-border);
  cursor: pointer;
  user-select: none;
  font-weight: 600;
  font-size: 0.875rem;
  transition: background var(--transition-fast);
}

.content-group-header:hover { background: var(--color-bg-tertiary); }

.content-group-header input[type="checkbox"] {
  accent-color: var(--color-accent);
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.content-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 7px 14px 7px 36px;
  border-bottom: 1px solid var(--color-border);
  font-size: 0.8rem;
  transition: background var(--transition-fast);
}

.content-item:hover { background: rgba(255,255,255,0.03); }

.content-item input[type="checkbox"] {
  accent-color: var(--color-accent);
  width: 14px;
  height: 14px;
  cursor: pointer;
}

.content-item-name { flex: 1; }

.content-item-badge {
  font-size: 0.65rem;
  padding: 1px 6px;
  border-radius: var(--radius-full);
  background: rgba(255,255,255,0.06);
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
}

/* =====================================================
   Context Menu
   ===================================================== */
.context-menu {
  position: fixed;
  z-index: 9000;
  display: none;
  background: rgba(15,15,15,0.97);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 4px 0;
  min-width: 160px;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(16px);
}

.context-menu.active { display: block; }

.context-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 14px;
  background: none;
  border: none;
  color: var(--color-text-secondary);
  text-align: left;
  cursor: pointer;
  font-size: 0.875rem;
  font-family: inherit;
  transition: all var(--transition-fast);
}

.context-item:hover { background: var(--color-bg-hover); color: var(--color-text-primary); }
.context-item .icon { width: 16px; height: 16px; flex-shrink: 0; }

/* =====================================================
   Watch Page — Full Layout
   ===================================================== */
.watch-page {
  position: relative;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.watch-video-section {
  position: relative;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  background: #000;
  flex-shrink: 0;
}

.watch-video-section video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}

/* VOD header */
.vod-header {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.live-header {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.watch-back-btn {
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  padding: 8px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.watch-back-btn:hover { background: rgba(255,255,255,0.1); }
.watch-back-btn .icon { width: 24px; height: 24px; }

.watch-title-info { flex: 1; min-width: 0; }

.watch-title {
  font-size: 1rem;
  font-weight: 700;
  text-shadow: 0 1px 4px rgba(0,0,0,0.8);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.watch-subtitle {
  font-size: 0.78rem;
  color: var(--color-text-secondary);
  text-shadow: 0 1px 4px rgba(0,0,0,0.8);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Progress Bar */
.watch-progress-container {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
  padding: 0 2px;
}

.watch-progress {
  flex: 1;
  height: 4px;
  accent-color: var(--color-accent);
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  background: rgba(255,255,255,0.15);
  border-radius: 2px;
  outline: none;
}

.watch-progress::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--color-accent);
  cursor: pointer;
  border: none;
  box-shadow: 0 0 4px rgba(0,0,0,0.5);
}

.watch-progress::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--color-accent);
  cursor: pointer;
  border: none;
}

.watch-time {
  font-size: 0.72rem;
  color: rgba(255,255,255,0.7);
  min-width: 40px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

/* Skip labels */
.skip-label {
  position: absolute;
  bottom: -2px;
  font-size: 0.55rem;
  font-weight: 700;
  color: rgba(255,255,255,0.6);
  pointer-events: none;
}

.watch-btn { position: relative; }

/* Scroll Hint */
.watch-scroll-hint {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: rgba(255,255,255,0.4);
  font-size: 0.72rem;
  animation: bounceHint 2s ease infinite;
  pointer-events: none;
}

.watch-scroll-hint .icon { width: 16px; height: 16px; }

@keyframes bounceHint {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50% { transform: translateX(-50%) translateY(6px); }
}

/* Next Episode Panel */
.watch-next-episode {
  position: absolute;
  bottom: 90px;
  right: var(--space-lg);
  background: rgba(15,15,15,0.95);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-md) var(--space-lg);
  display: flex;
  align-items: center;
  gap: var(--space-md);
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.3s ease;
  z-index: 10;
}

.next-info { flex: 1; min-width: 0; }

.next-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-muted);
  margin-bottom: 2px;
}

.next-info h4 {
  font-size: 0.875rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.next-countdown {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--color-accent);
  min-width: 28px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

/* =====================================================
   Watch Details Section (below video)
   ===================================================== */
.watch-details-section {
  background: var(--color-bg-primary);
  padding: var(--space-xl) var(--space-2xl);
  min-height: 40vh;
}

.watch-content-info {
  display: flex;
  gap: var(--space-xl);
  margin-bottom: var(--space-xl);
}

.watch-poster {
  width: 150px;
  height: 225px;
  object-fit: cover;
  border-radius: var(--radius-md);
  flex-shrink: 0;
  background: var(--color-bg-card);
}

.watch-meta { flex: 1; min-width: 0; }

.watch-meta h2 {
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 8px;
  letter-spacing: -0.01em;
}

.watch-meta-row {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin-bottom: var(--space-md);
  flex-wrap: wrap;
}

.watch-year, .watch-duration {
  font-size: 0.8rem;
  color: var(--color-text-secondary);
}

.watch-rating {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.1);
  color: var(--color-text-primary);
  border: 1px solid var(--color-border);
}

.watch-description {
  font-size: 0.875rem;
  color: var(--color-text-secondary);
  line-height: 1.7;
  margin-bottom: var(--space-lg);
  max-width: 700px;
}

.watch-actions {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

/* Recommended Section */
.watch-recommended {
  margin-top: var(--space-xl);
}

.watch-recommended h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: var(--space-md);
}

.watch-recommended-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: var(--space-sm);
}

/* Episodes Section */
.watch-episodes {
  margin-top: var(--space-xl);
}

.watch-episodes h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: var(--space-md);
}

.watch-seasons {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* =====================================================
   Home Page Content Sections (scroll rows)
   ===================================================== */
.home-section {
  margin-bottom: var(--space-xl);
}

.home-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-lg);
  margin-bottom: var(--space-md);
}

.home-section-title {
  font-size: 1.1rem;
  font-weight: 700;
}

.home-section-link {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  text-decoration: none;
  cursor: pointer;
  transition: color var(--transition-fast);
}

.home-section-link:hover { color: var(--color-text-primary); }

/* Horizontal scroll row */
.home-scroll-row {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 0 var(--space-lg) var(--space-sm);
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.home-scroll-row::-webkit-scrollbar { display: none; }

/* Scroll arrows */
.scroll-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 5;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(15,15,15,0.9);
  border: 1px solid var(--color-border);
  color: var(--color-text-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  opacity: 0;
  pointer-events: none;
}

.scroll-arrow:hover { background: var(--color-accent); border-color: var(--color-accent); }
.scroll-arrow.visible { opacity: 1; pointer-events: auto; }
.scroll-arrow.left { left: 4px; }
.scroll-arrow.right { right: 4px; }
.scroll-arrow .icon { width: 18px; height: 18px; }

/* Scroll row container */
.scroll-row-container {
  position: relative;
}

/* HW Info Grid */
.hw-info-grid {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.hw-info-item.hw-available {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: rgba(70,211,105,0.06);
  border: 1px solid rgba(70,211,105,0.15);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
}

.hw-badge {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--color-success);
}

.hw-name {
  color: var(--color-text-secondary);
  font-size: 0.8rem;
}

.error {
  color: var(--color-accent) !important;
}

/* =====================================================
   Dashboard / Home Page Cards
   ===================================================== */
.dashboard-section {
  padding: var(--space-md) 0;
}

.dashboard-section .section-header {
  padding: 0 var(--space-lg);
}

.dashboard-section .section-header h2 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--color-text-primary);
}

.dashboard-content {
  padding: 0;
  padding-bottom: var(--space-xl);
}

.dashboard-card {
  flex-shrink: 0;
  width: 160px;
  cursor: pointer;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--color-bg-card);
  transition: transform var(--transition-normal), box-shadow var(--transition-normal);
}

.dashboard-card:hover {
  transform: scale(1.05);
  box-shadow: 0 12px 32px rgba(0,0,0,0.7);
}

/* Generic card classes (from HomePage.js) */
.card-image {
  position: relative;
  width: 100%;
  aspect-ratio: 2/3;
  overflow: hidden;
  background: var(--color-bg-tertiary);
}

.card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.card-info {
  padding: 8px 10px;
}

.card-title {
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
}

.card-subtitle {
  font-size: 0.68rem;
  color: var(--color-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Scroll wrapper — positioned parent for arrows */
.scroll-wrapper {
  position: relative;
  padding: 0 var(--space-lg);
}

.scroll-wrapper:hover .scroll-arrow:not(.hidden) {
  opacity: 1;
  pointer-events: auto;
}

/* Horizontal scroll — the actual scrollable row of cards */
.horizontal-scroll {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.horizontal-scroll::-webkit-scrollbar { display: none; }

/* Channel tiles row in horizontal scroll */
.horizontal-scroll.channel-tiles {
  gap: 0;
}

.scroll-row-container {
  position: relative;
}

.scroll-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 5;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(15,15,15,0.9);
  border: 1px solid var(--color-border);
  color: var(--color-text-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  opacity: 0;
  pointer-events: none;
}

.scroll-arrow:hover { background: var(--color-accent); border-color: var(--color-accent); }
.scroll-arrow.visible { opacity: 1; pointer-events: auto; }
.scroll-arrow.scroll-left { left: 4px; }
.scroll-arrow.scroll-right { right: 4px; }
.scroll-arrow .icon { width: 18px; height: 18px; }

/* =====================================================
   Movie/Series Card Variants (from JS)
   ===================================================== */
.movie-info, .series-card-info {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.95) 0%, transparent 100%);
  padding: 24px 10px 10px;
  z-index: 2;
}

.movie-title, .series-title {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.movie-play-overlay, .series-play-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.8);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(229,9,20,0.85);
  border: 2px solid rgba(255,255,255,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: all var(--transition-fast);
  color: #fff;
}

.movie-card:hover .movie-play-overlay,
.series-card:hover .series-play-overlay {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.play-icon, .play-icon-overlay {
  display: flex;
  align-items: center;
  justify-content: center;
}

.play-icon .icon, .play-icon-overlay .icon {
  width: 18px;
  height: 18px;
  margin-left: 2px;
}

/* Play overlay on dashboard cards */
.card-image .play-icon-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.8);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(229,9,20,0.85);
  border: 2px solid rgba(255,255,255,0.5);
  opacity: 0;
  transition: all var(--transition-fast);
  color: #fff;
}

.card-image .play-icon-overlay svg {
  width: 20px;
  height: 20px;
  margin-left: 2px;
}

.dashboard-card:hover .play-icon-overlay {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

/* Progress bar inside card images */
.card-image .progress-bar-container {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  margin-top: 0;
}

/* Favorite btn on cards */
.favorite-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(0,0,0,0.65);
  backdrop-filter: blur(4px);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity var(--transition-fast);
  cursor: pointer;
  color: var(--color-text-muted);
  z-index: 3;
}

.movie-card:hover .favorite-btn,
.series-card:hover .favorite-btn,
.dashboard-card:hover .favorite-btn { opacity: 1; }

.favorite-btn.active { opacity: 1; color: #f59e0b; }
.fav-icon { width: 14px; height: 14px; }

/* =====================================================
   Channel Tiles (from ChannelList.js)
   ===================================================== */
.channel-tile {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.channel-tile:hover { background: var(--color-bg-tertiary); }

.tile-logo {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--color-bg-tertiary);
  flex-shrink: 0;
}

.tile-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.tile-name {
  font-size: 0.875rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.channel-checkbox {
  accent-color: var(--color-accent);
  width: 15px;
  height: 15px;
  cursor: pointer;
}

.channel-details {
  flex: 1;
  min-width: 0;
}

.channel-meta {
  font-size: 0.72rem;
  color: var(--color-text-muted);
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  cursor: pointer;
  font-size: 0.8rem;
  transition: background var(--transition-fast);
}

.checkbox-label:hover { background: rgba(255,255,255,0.03); }

.checkbox-label input[type="checkbox"] {
  accent-color: var(--color-accent);
  width: 14px;
  height: 14px;
  cursor: pointer;
}

/* =====================================================
   Source Items (from SourceManager.js)
   ===================================================== */
.source-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  color: var(--color-text-muted);
}

.source-info {
  flex: 1;
  min-width: 0;
}

.source-name {
  font-weight: 500;
  font-size: 0.875rem;
  margin-bottom: 2px;
}

.source-url {
  font-size: 0.72rem;
  color: var(--color-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.source-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-shrink: 0;
}

.source-item.disabled {
  opacity: 0.5;
}

.spin {
  animation: spin 1s linear infinite;
}

/* =====================================================
   EPG Guide (from EpgGuide.js)
   ===================================================== */
.epg-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.epg-scroll-container {
  flex: 1;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  position: relative;
}

.epg-scroll-container::-webkit-scrollbar { width: 4px; height: 4px; }
.epg-scroll-container::-webkit-scrollbar-thumb { background: var(--color-bg-active); border-radius: 2px; }

.epg-header-corner {
  width: var(--epg-sidebar-width);
  flex-shrink: 0;
  background: var(--color-bg-secondary);
  border-right: 1px solid var(--color-border);
  position: sticky;
  left: 0;
  z-index: 4;
}

.epg-spacer {
  width: var(--epg-sidebar-width);
  flex-shrink: 0;
  border-right: 1px solid var(--color-border);
  position: sticky;
  left: 0;
  z-index: 2;
  background: var(--color-bg-secondary);
}

.epg-channel-rows {
  position: relative;
}

.epg-channel-info {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.epg-channel-info span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.epg-time-slots {
  flex: 1;
  display: flex;
  position: relative;
  min-width: max-content;
}

.epg-program-list {
  flex: 1;
  display: flex;
  position: relative;
  min-width: max-content;
  min-height: 48px;
}

.epg-program-desc {
  font-size: 0.72rem;
  color: var(--color-text-secondary);
  line-height: 1.5;
  max-height: 60px;
  overflow: hidden;
}

.no-programs {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  padding: 0 8px;
  font-size: 0.72rem;
  color: var(--color-text-muted);
  white-space: nowrap;
}

.epg-info-modal {
  position: fixed;
  z-index: 9000;
  background: rgba(15,15,15,0.97);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  min-width: 280px;
  max-width: 380px;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(16px);
  animation: slideUp 0.15s ease;
}

.epg-info-modal h4 { font-size: 1rem; margin-bottom: 6px; }
.epg-info-modal .epg-program-time { font-size: 0.78rem; color: var(--color-text-secondary); margin-bottom: 8px; }

/* =====================================================
   Watch Episodes (from WatchPage.js)
   ===================================================== */
.watch-episode-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--color-bg-card);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  border: 1px solid transparent;
}

.watch-episode-item:hover {
  background: var(--color-bg-hover);
  border-color: var(--color-border);
}

.watch-episode-item.active {
  border-color: var(--color-accent);
  background: rgba(229,9,20,0.08);
}

.watch-episode-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.watch-episode-num {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  background: var(--color-bg-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--color-text-muted);
  flex-shrink: 0;
}

.watch-episode-item.active .watch-episode-num {
  background: var(--color-accent);
  color: #fff;
}

.watch-episode-title {
  flex: 1;
  font-size: 0.875rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.watch-episode-duration {
  font-size: 0.72rem;
  color: var(--color-text-muted);
  flex-shrink: 0;
}

.watch-season-group {
  margin-bottom: var(--space-md);
}

.watch-season-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 0;
  cursor: pointer;
  user-select: none;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: var(--space-sm);
}

.watch-season-header.collapsed + .watch-episode-list {
  display: none;
}

.watch-season-name {
  font-weight: 700;
  font-size: 0.875rem;
  flex: 1;
}

.watch-season-count {
  font-size: 0.72rem;
  color: var(--color-text-muted);
}

.season-expander {
  transition: transform var(--transition-fast);
}

.watch-season-header.collapsed .season-expander {
  transform: rotate(-90deg);
}

/* Watch recommended cards */
.watch-recommended-card {
  cursor: pointer;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--color-bg-card);
  transition: transform var(--transition-normal);
  aspect-ratio: 2/3;
}

.watch-recommended-card:hover {
  transform: scale(1.05);
}

/* Season groups in series details */
.season-group {
  margin-bottom: var(--space-md);
}

.season-name {
  flex: 1;
  font-weight: 700;
}

.season-expander .icon {
  width: 16px;
  height: 16px;
}

/* Episode items in series details */
.episode-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: var(--color-bg-card);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  border: 1px solid transparent;
  margin-bottom: 4px;
}

.episode-item:hover { background: var(--color-bg-hover); border-color: var(--color-border); }

.episode-number {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--color-text-muted);
  min-width: 24px;
  text-align: center;
}

.episode-title {
  flex: 1;
  font-weight: 500;
  font-size: 0.875rem;
}

.episode-duration {
  font-size: 0.72rem;
  color: var(--color-text-muted);
}

.episode-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: var(--space-sm) 0;
}

/* =====================================================
   Content Browser Groups (from SourceManager.js)
   ===================================================== */
.content-group {
  border-bottom: 1px solid var(--color-border);
}

.content-group.collapsed .content-channels {
  display: none;
}

.content-channels {
  /* Container for channel items within a group */
}

/* =====================================================
   Warning Modal (from SourceManager.js)
   ===================================================== */
.warning-modal-content {
  text-align: center;
  padding: var(--space-md) 0;
}

.warning-icon {
  font-size: 2.5rem;
  margin-bottom: var(--space-md);
  display: block;
}

.warning-message {
  font-size: 0.875rem;
  color: var(--color-text-secondary);
  margin-bottom: var(--space-md);
  line-height: 1.6;
}

.warning-details {
  font-size: 0.78rem;
  color: var(--color-text-muted);
  background: var(--color-bg-tertiary);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  margin-bottom: var(--space-md);
  text-align: left;
}

/* =====================================================
   Progress Bars
   ===================================================== */
.progress-bar-container {
  width: 100%;
  height: 3px;
  background: var(--color-bg-tertiary);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 6px;
}

.progress-bar {
  height: 100%;
  background: var(--color-accent);
  border-radius: 2px;
  transition: width 0.3s ease;
}

/* =====================================================
   Resize Handle (EPG)
   ===================================================== */
.resize-handle {
  width: 4px;
  cursor: col-resize;
  background: transparent;
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  z-index: 3;
  transition: background var(--transition-fast);
}

.resize-handle:hover { background: var(--color-accent); }

/* =====================================================
   Loading States
   ===================================================== */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-xl);
  color: var(--color-text-muted);
}

.syncing {
  opacity: 0.6;
  pointer-events: none;
}

/* =====================================================
   Text Utilities
   ===================================================== */
.text-warning { color: var(--color-warning); }

/* Nav active (non-link navigation highlight) */
.channel-item.nav-active {
  outline: 1px solid var(--color-accent);
  outline-offset: -1px;
}

/* Group checkbox in content browser */
.group-checkbox {
  accent-color: var(--color-accent);
  width: 16px;
  height: 16px;
  cursor: pointer;
}

/* =====================================================
   Global Search Bar (Navbar)
   ===================================================== */
.global-search {
  flex: 1;
  max-width: 520px;
  margin: 0 var(--space-lg);
  min-width: 0;
}

.global-search-inner {
  position: relative;
  display: flex;
  align-items: center;
  background: rgba(255,255,255,0.06);
  border: 1px solid transparent;
  border-radius: var(--radius-full);
  padding: 0 var(--space-sm);
  transition: all var(--transition-fast);
  height: 38px;
}

.global-search.focused .global-search-inner {
  background: rgba(255,255,255,0.1);
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(229,9,20,0.15);
}

.global-search-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  margin-left: 6px;
  color: var(--color-text-muted);
  transition: color var(--transition-fast);
}

.global-search.focused .global-search-icon {
  color: var(--color-accent);
}

.global-search-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--color-text-primary);
  font-size: 0.85rem;
  padding: 8px 10px;
  font-family: inherit;
  min-width: 0;
}

.global-search-input::placeholder {
  color: var(--color-text-muted);
}

.global-search-filters {
  display: flex;
  gap: 2px;
  flex-shrink: 0;
  margin-right: 4px;
}

.search-filter-btn {
  padding: 4px 10px;
  border: none;
  border-radius: var(--radius-full);
  background: transparent;
  color: var(--color-text-muted);
  font-size: 0.7rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  font-family: inherit;
}

.search-filter-btn:hover {
  color: var(--color-text-primary);
  background: rgba(255,255,255,0.06);
}

.search-filter-btn.active {
  color: #fff;
  background: var(--color-accent);
}

.global-search-clear {
  width: 24px;
  height: 24px;
  border: none;
  background: rgba(255,255,255,0.1);
  color: var(--color-text-secondary);
  border-radius: 50%;
  cursor: pointer;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all var(--transition-fast);
}

.global-search-clear:hover {
  background: rgba(255,255,255,0.2);
  color: #fff;
}

/* =====================================================
   Discover Page Layout
   ===================================================== */
#page-discover {
  overflow-y: auto;
  overflow-x: hidden;
}

.discover-layout {
  display: flex;
  min-height: 100%;
}

.discover-main {
  flex: 1;
  min-width: 0;
  padding-bottom: var(--space-2xl);
}

/* --- A-Z Quick Filter Strip --- */
.az-filter {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: var(--space-md) var(--space-lg);
  overflow-x: auto;
  scrollbar-width: none;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-bg-secondary);
  position: sticky;
  top: 0;
  z-index: 10;
}

.az-filter::-webkit-scrollbar { display: none; }

.az-btn {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--color-text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  font-family: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
}

.az-btn:hover {
  color: var(--color-text-primary);
  background: rgba(255,255,255,0.06);
  border-color: var(--color-border);
}

.az-btn.active {
  color: #fff;
  background: var(--color-accent);
  border-color: var(--color-accent);
}

/* --- Discover Sections --- */
.discover-section {
  padding: var(--space-lg) 0 0;
}

.discover-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-lg);
  margin-bottom: var(--space-md);
}

.discover-section-header h2 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--color-text-primary);
}

.discover-result-count {
  font-size: 0.78rem;
  color: var(--color-text-muted);
  font-weight: 500;
}

.discover-see-all {
  font-size: 0.78rem;
  color: var(--color-text-muted);
  text-decoration: none;
  font-weight: 500;
  transition: color var(--transition-fast);
}

.discover-see-all:hover { color: var(--color-accent); }

/* --- Horizontal Content Rows --- */
.discover-row-wrapper {
  position: relative;
  padding: 0 var(--space-lg);
}

.discover-row-wrapper:hover .discover-arrow:not(.hidden) {
  opacity: 1;
}

.discover-row {
  display: flex;
  gap: var(--space-md);
  overflow-x: auto;
  padding-bottom: var(--space-sm);
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.discover-row::-webkit-scrollbar { display: none; }

.discover-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 5;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(15,15,15,0.92);
  border: 1px solid var(--color-border);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: all var(--transition-fast);
}

.discover-arrow svg { width: 20px; height: 20px; }
.discover-arrow:hover { background: var(--color-accent); border-color: var(--color-accent); }
.discover-arrow-left { left: 8px; }
.discover-arrow-right { right: 8px; }

/* --- Discover Cards (Row Variant) --- */
.discover-card {
  flex-shrink: 0;
  width: 165px;
  cursor: pointer;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--color-bg-card);
  transition: transform var(--transition-normal), box-shadow var(--transition-normal);
}

.discover-card:hover {
  transform: scale(1.06);
  box-shadow: 0 14px 36px rgba(0,0,0,0.75);
  z-index: 2;
}

.discover-card-featured {
  width: 200px;
}

.discover-card-poster {
  position: relative;
  width: 100%;
  aspect-ratio: 2/3;
  overflow: hidden;
  background: var(--color-bg-tertiary);
}

.discover-card-poster img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform var(--transition-normal);
}

.discover-card:hover .discover-card-poster img {
  transform: scale(1.08);
}

.discover-card-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, transparent 50%);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.discover-card:hover .discover-card-overlay { opacity: 1; }

.discover-card-play {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(229,9,20,0.9);
  border: 2px solid rgba(255,255,255,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  transform: scale(0.8);
  transition: transform var(--transition-fast);
}

.discover-card:hover .discover-card-play { transform: scale(1); }
.discover-card-play svg { width: 22px; height: 22px; margin-left: 2px; color: #fff; }

.discover-card-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  background: rgba(229,9,20,0.85);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  backdrop-filter: blur(4px);
}

.discover-card-type {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  background: rgba(0,0,0,0.7);
  color: var(--color-text-secondary);
  font-size: 0.6rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  backdrop-filter: blur(4px);
}

.discover-card-info {
  padding: 10px 12px;
}

.discover-card-title {
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 3px;
  color: var(--color-text-primary);
}

.discover-card-meta {
  display: flex;
  gap: 8px;
  font-size: 0.68rem;
  color: var(--color-text-muted);
}

.discover-card-meta span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* --- Grid Layout (for search/AZ results) --- */
.discover-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: var(--space-md);
  padding: 0 var(--space-lg);
}

.discover-grid .discover-card {
  width: auto;
}

.discover-load-more {
  display: flex;
  justify-content: center;
  padding: var(--space-lg) 0;
}

/* --- Filter Sidebar --- */
.discover-sidebar {
  width: 260px;
  flex-shrink: 0;
  background: var(--color-bg-secondary);
  border-left: 1px solid var(--color-border);
  padding: var(--space-lg);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

.discover-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.discover-sidebar-header h3 {
  font-size: 0.95rem;
  font-weight: 700;
}

.discover-filter-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.discover-filter-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-muted);
}

.discover-filter-options {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.discover-chip {
  padding: 5px 12px;
  border-radius: var(--radius-full);
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--color-border);
  color: var(--color-text-secondary);
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  font-family: inherit;
}

.discover-chip input { display: none; }

.discover-chip:hover {
  background: rgba(255,255,255,0.1);
  color: var(--color-text-primary);
}

.discover-chip.active {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: #fff;
}

.discover-sort-select {
  background: var(--color-bg-tertiary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 8px 12px;
  color: var(--color-text-primary);
  font-size: 0.8rem;
  font-family: inherit;
}

.discover-genre-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 400px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--color-bg-active) transparent;
}

.discover-genre-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 10px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-text-secondary);
  font-size: 0.78rem;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-align: left;
  font-family: inherit;
}

.discover-genre-item:hover {
  background: rgba(255,255,255,0.06);
  color: var(--color-text-primary);
}

.discover-genre-item.active {
  background: var(--color-accent-dim);
  color: var(--color-accent);
  font-weight: 600;
}

.genre-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.genre-count { font-size: 0.68rem; color: var(--color-text-muted); margin-left: 8px; flex-shrink: 0; }

.discover-sidebar-toggle {
  display: none;
  margin-left: auto;
}

/* =====================================================
   Discover — Responsive
   ===================================================== */
@media (max-width: 1024px) {
  .discover-sidebar {
    position: fixed;
    right: -280px;
    top: var(--navbar-height);
    bottom: 0;
    z-index: 90;
    width: 270px;
    transition: right var(--transition-normal);
    box-shadow: -4px 0 24px rgba(0,0,0,0.4);
  }

  .discover-sidebar.open {
    right: 0;
  }

  .discover-sidebar-toggle {
    display: flex;
  }

  .discover-card-featured { width: 170px; }
}

@media (max-width: 768px) {
  .global-search {
    position: fixed;
    top: var(--navbar-height);
    left: 0;
    right: 0;
    margin: 0;
    max-width: none;
    z-index: 95;
    padding: var(--space-sm) var(--space-md);
    background: var(--glass-bg);
    border-bottom: 1px solid var(--glass-border);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
  }

  .global-search-filters {
    display: none;
  }

  .global-search.focused .global-search-filters {
    display: flex;
    position: absolute;
    top: calc(100% + 4px);
    left: var(--space-md);
    right: var(--space-md);
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: var(--space-xs);
    gap: 2px;
    box-shadow: var(--shadow-md);
  }

  .global-search.focused .search-filter-btn {
    flex: 1;
    padding: 6px 4px;
    font-size: 0.72rem;
    text-align: center;
  }

  #page-discover {
    padding-top: 56px;
  }

  .az-filter {
    gap: 1px;
    padding: var(--space-sm) var(--space-sm);
  }

  .az-btn {
    width: 28px;
    height: 28px;
    font-size: 0.68rem;
  }

  .discover-section-header { padding: 0 var(--space-md); }
  .discover-row-wrapper { padding: 0 var(--space-md); }
  .discover-grid { padding: 0 var(--space-md); gap: var(--space-sm); grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }

  .discover-card { width: 135px; }
  .discover-card-featured { width: 155px; }
  .discover-card-info { padding: 8px 10px; }
  .discover-card-title { font-size: 0.72rem; }
}
