/* =====================================================
  * LagTV — UniTV-inspired Wine/Red Theme
  * (refactor of NodeCast TV dark theme; same tokens,
  *  new palette so the whole app re-skins via vars)
   ===================================================== */

/* CSS Variables */
:root {
  /* iOS Safari toolbar compensation (set dynamically by JS) */
  --ios-ui-bottom: 0px;


  /* Colors — LagTV wine/red palette */
  --color-bg-primary: #1A0408;
  --color-bg-secondary: #2A0509;
  --color-bg-tertiary: #3D0810;
  --color-bg-hover: #4D0E18;
  --color-bg-active: #5C0F1A;

  --color-accent: #B22222;
  --color-accent-hover: #DC143C;
  --color-accent-light: #F06A6A;
  --color-accent-dim: rgba(178, 34, 34, 0.2);
  --color-accent-deep: #8B0000;   /* deeper wine for backdrops/badges */

  --color-success: #10b981;
  --color-warning: #f59e0b;
  --color-error: #ef4444;

  --color-text-primary: #FFFFFF;
  --color-text-secondary: #D4A5A5;
  --color-text-muted: #8B6B6B;

  --color-border: #3D1419;
  --color-border-light: #5C1F26;

  /* Glass effect */
  --glass-bg: rgba(42, 5, 9, 0.8);
  --glass-border: rgba(255, 255, 255, 0.1);

  /* LagTV: badge & overlay tokens */
  --color-rating-bg: #F5B342;
  --color-rating-text: #1A0408;
  --color-cc-bg: #E67E22;
  --color-cc-text: #FFFFFF;
  --color-bg-gradient-1: #5C0F1A;
  --color-bg-gradient-2: #2A0509;
  --color-card-overlay: rgba(0, 0, 0, 0.7);

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

  /* Border Radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 20px rgba(178, 34, 34, 0.4);

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

  /* Layout */
  --navbar-height: 122px; /* Actual navbar height on desktop */
  --sidebar-width: 320px;
  --epg-sidebar-width: 250px;

  /* Safe area insets for notched devices */
  --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;
  /* Prevent pull-to-refresh and overscroll bounce on mobile */
  overscroll-behavior: none;
  -webkit-overflow-scrolling: touch;
}

/* LagTV: subtle wine radial gradient behind everything */
body {
  background:
    radial-gradient(ellipse at 50% -10%,
      var(--color-bg-gradient-1) 0%,
      var(--color-bg-gradient-2) 45%,
      var(--color-bg-primary) 100%);
  background-attachment: fixed;
}

/* Prevent text selection on touch devices (improves UX) */
@media (hover: none) {
  * {
    -webkit-user-select: none;
    user-select: none;
  }

  /* Allow text selection in inputs and content areas */
  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;
  /* fallback */
  height: 100dvh;
  /* dynamic viewport height for modern browsers */
  height: -webkit-fill-available;
  /* iOS Safari fallback */
  min-height: 0;
}

/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-weight: 600;
  line-height: 1.3;
}

h2 {
  font-size: 1.5rem;
}

h3 {
  font-size: 1.25rem;
}

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-lg);
  padding-left: max(var(--space-lg), var(--safe-area-inset-left));
  padding-right: max(var(--space-lg), var(--safe-area-inset-right));
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--glass-border);
  z-index: 100;
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.logo {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
}

.logo svg {
  fill: var(--color-accent);
}

.brand-text {
  font-family: 'Century Gothic', sans-serif;
  font-size: 1.5rem;
  font-weight: 500;
  letter-spacing: -0.03em;
  color: #fff;
  /* Visual correction: shift text slightly down to align optically with icon center */
  padding-top: 2px;
}

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

.version-badge {
  font-size: 0.65rem;
  font-weight: 600;
  background: var(--color-accent);
  color: #fff;
  padding: 2px 6px;
  border-radius: 10px;
  margin-left: 8px;
  vertical-align: middle;
}

.navbar-menu {
  display: flex;
  gap: var(--space-xs);
}

/* Mobile Menu Toggle Button */
.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-link {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  color: var(--color-text-secondary);
  text-decoration: none;
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
}

.nav-link:hover {
  color: var(--color-text-primary);
  background: var(--color-bg-hover);
}

.nav-link.active {
  color: var(--color-accent);
  background: var(--color-accent-dim);
}

/* Anel de foco para navegação por controle remoto / teclado (Fire TV etc.).
   Deixa claro qual elemento está selecionado ao navegar com o D-pad. */
.tab-pill:focus,
.lagtv-navbar__util-btn:focus,
#navbar-brand:focus,
#now-playing-indicator:focus,
.tab:focus,
.btn:focus,
.chip-filter:focus,
.setting-toggle:focus,
.setting-row:focus,
input:focus,
select:focus,
textarea:focus,
.poster-card:focus,
.channel-item:focus,
.watch-btn:focus,
.watch-back-btn:focus,
.mini-player-btn:focus,
.action-bar__btn:focus,
.details-synopsis-toggle:focus,
.details-back-btn:focus,
.season-header:focus,
.episode-item:focus,
.watch-season-header:focus,
.watch-episode-item:focus,
.lagtv-movies__side-action:focus,
.lagtv-movies__cat:focus,
.modal-close:focus,
.lagtv-filter-modal__close:focus,
.overflow-menu-item:focus,
.captions-option:focus,
.context-item:focus,
.watch-room-panel button:focus,
.watch-room-panel input:focus,
[data-remote-focus]:focus {
  outline: 3px solid var(--color-accent-light, #F06A6A);
  outline-offset: 2px;
}

.tab-pill:focus {
  border-radius: 999px;
}

.nav-icon {
  font-size: 1.1rem;
}

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

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

.page.active {
  display: block;
}

/* 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);
}

/* =====================================================
   Home Page Layout
   ===================================================== */
.home-layout {
  display: flex;
  height: 100%;
  position: relative;
  min-width: 0;
  overflow: hidden;
}

/* Fix scroll sidebar on desktop (Safari / flex bug) */
.main-content,
.page,
.home-layout,
.channel-sidebar,
.channel-list {
  min-height: 0;
}

/* Floating Channel Toggle Button (Mobile) */
.channel-toggle-btn {
  display: none;
  position: absolute;
  top: var(--space-md);
  left: var(--space-md);
  z-index: 60;
  padding: var(--space-sm) var(--space-md);
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  color: var(--color-text-primary);
  font-weight: 500;
  cursor: pointer;
  box-shadow: var(--shadow-lg);
  transition: all var(--transition-fast);
  align-items: center;
  gap: var(--space-sm);
}

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

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

/* 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;
  /* Hidden on mobile */
  flex-shrink: 0;
  padding: var(--space-xs);
}

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

/* Desktop collapse button visibility */
@media (min-width: 769px) {
  .sidebar-collapse-btn {
    display: flex;
  }
}

/* Collapsed sidebar state (desktop only) */
.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;
}

/* Expand button when sidebar is collapsed */
.sidebar-expand-btn {
  display: none;
  position: absolute;
  left: 0;
  top: calc(var(--navbar-height) + var(--space-md));
  z-index: 50;
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  border: 1px solid var(--glass-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;
}

/* Show expand button when sidebar is collapsed */
.home-layout.sidebar-collapsed .sidebar-expand-btn {
  display: flex;
}

/* Fade in expand button with player controls */
.home-layout.sidebar-collapsed .sidebar-expand-btn.visible {
  opacity: 1;
  pointer-events: auto;
}

/* Hide expand button on mobile - mobile uses the floating toggle instead */
@media (max-width: 768px) {
  .sidebar-expand-btn {
    display: none !important;
  }
}

/* Smooth transitions */
.channel-sidebar {
  transition: width 0.2s ease, min-width 0.2s ease;
}

.search-input {
  width: 100%;
  padding: var(--space-sm) var(--space-md);
  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;
  transition: border-color var(--transition-fast);
}

.search-input:focus {
  outline: none;
  border-color: var(--color-accent);
}

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

/* Search wrapper for clear button */
.search-wrapper {
  position: relative;
  width: 100%;
  min-width: 150px;
}

.search-wrapper .search-input {
  padding-right: 30px;
  /* Room for clear button */
}

.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: var(--space-xs) var(--space-sm);
  background: var(--color-bg-tertiary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text-primary);
  font-size: 0.75rem;
}

.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-group {
  margin-bottom: var(--space-sm);
}

.group-header {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  background: var(--color-bg-tertiary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  user-select: none;
  transition: background var(--transition-fast);
}

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

.group-header.hidden {
  display: flex !important;
  opacity: 0.5;
}

.group-toggle {
  transition: transform var(--transition-fast);
}

.group-header.collapsed .group-toggle {
  transform: rotate(-90deg);
}

.group-name {
  flex: 1;
  font-weight: 500;
  font-size: 0.875rem;
}

.group-count {
  font-size: 0.75rem;
  color: var(--color-text-muted);
}

.group-channels {
  margin-top: var(--space-xs);
}

.group-header.collapsed+.group-channels {
  display: none;
}

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

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

.channel-item:focus-visible,
.channel-item.remote-holding {
  outline: 2px solid rgba(255, 255, 255, 0.85);
  outline-offset: 2px;
}

.channel-item.remote-holding {
  background: rgba(255, 255, 255, 0.12);
}

.channel-item.active {
  background: linear-gradient(90deg, rgba(178, 34, 34, 0.32) 0%, rgba(92, 15, 26, 0.18) 100%);
  border-left: 3px solid var(--color-accent);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
  position: relative;
}

.channel-item.active::after {
  content: '';
  position: absolute;
  top: 50%;
  right: 12px;
  transform: translateY(-50%);
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ff3030;
  box-shadow: 0 0 8px rgba(255, 48, 48, 0.8);
  animation: lagtv-pulse 1.4s ease-in-out infinite;
}

@keyframes lagtv-pulse {
  0%, 100% { opacity: 1; transform: translateY(-50%) scale(1); }
  50% { opacity: 0.55; transform: translateY(-50%) scale(0.85); }
}

.channel-item.active .channel-name {
  color: #fff;
  font-weight: 600;
}

.channel-item.hidden {
  display: flex !important;
  opacity: 0.5;
}

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

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

.channel-quality-count {
  flex-shrink: 0;
  padding: 3px 7px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--color-text-secondary);
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1;
}

.hidden-toggle {
  height: 32px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 8px;
  border-radius: 4px;
  color: var(--color-text-secondary);
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  user-select: none;
  background: rgba(255, 255, 255, 0.04);
}

.hidden-toggle input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.hidden-toggle__track {
  position: relative;
  width: 34px;
  height: 18px;
  flex-shrink: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.16);
  transition: background var(--transition-fast), border-color var(--transition-fast);
}

.hidden-toggle__track::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
  transition: transform var(--transition-fast), background var(--transition-fast);
}

.hidden-toggle input:checked + .hidden-toggle__track {
  background: rgba(255, 48, 48, 0.42);
  border-color: rgba(255, 48, 48, 0.72);
}

.hidden-toggle input:checked + .hidden-toggle__track::after {
  transform: translateX(16px);
  background: #fff;
}

.hidden-toggle:focus-within .hidden-toggle__track {
  outline: 2px solid rgba(255, 255, 255, 0.75);
  outline-offset: 2px;
}

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

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

/* =====================================================
   Video Player Section
   ===================================================== */
.player-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--color-bg-primary);
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}

.video-container {
  flex: 1;
  position: relative;
  background: #000;
  overflow: hidden;
  min-height: 0;
  min-width: 0;
  width: 100%;
  /* Allow flex child to shrink */
}

/* Live TV player controls overlay - iOS Safari safe positioning */
#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;
}

/* Favorites */
.group-header.favorites-group {
  background: linear-gradient(to right, rgba(239, 68, 68, 0.1), transparent);
  border-left: 3px solid var(--color-error);
}

.group-header.favorites-group .group-name {
  color: var(--color-error);
  font-weight: 600;
}

.favorite-btn {
  background: none;
  border: none;
  color: var(--color-text-muted);
  font-size: 1.25rem;
  padding: 0 var(--space-xs);
  cursor: pointer;
  opacity: 0;
  transition: all var(--transition-fast);
}

.channel-item:hover .favorite-btn,
.epg-channel-row:hover .favorite-btn,
.favorite-btn.active {
  opacity: 1;
}

.favorite-btn:hover,
.favorite-btn.active {
  color: var(--color-error);
  transform: scale(1.1);
}

#video-player {
  width: 100%;
  height: 100%;
  max-height: 100%;
  background: #000;
  object-fit: contain;
  /* Maintain aspect ratio without overflow */
}

/* Make video controls more touch-friendly on mobile */
@media (max-width: 768px) {
  #video-player::-webkit-media-controls-panel {
    padding: 8px;
  }

  #video-player::-webkit-media-controls-play-button,
  #video-player::-webkit-media-controls-fullscreen-button,
  #video-player::-webkit-media-controls-volume-slider {
    transform: scale(1.2);
  }
}

/* Custom Video Controls */
.video-controls {
  position: absolute;
  top: var(--space-md);
  right: var(--space-md);
  display: none;
  flex-direction: column;
  gap: var(--space-sm);
  z-index: 50;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.video-controls.show {
  pointer-events: auto;
}

.video-container:hover .video-controls,
.video-controls.show {
  opacity: 1;
}

.video-control-btn {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  color: var(--color-text-primary);
  cursor: pointer;
  transition: all var(--transition-fast);
  box-shadow: var(--shadow-md);
}

.video-control-btn:hover {
  background: var(--color-accent);
  border-color: var(--color-accent);
  transform: scale(1.05);
}

.video-control-btn:active {
  transform: scale(0.95);
}

.video-control-btn .icon {
  width: 24px;
  height: 24px;
}

.video-control-btn.muted .icon {
  color: var(--color-error);
}

/* Show custom controls on mobile as supplementary */
@media (max-width: 768px) {
  .video-controls {
    display: flex;
  }

  /* Make control buttons larger on mobile */
  .video-control-btn {
    width: 56px;
    height: 56px;
  }

  .video-control-btn .icon {
    width: 28px;
    height: 28px;
  }
}

/* Touch devices */
@media (hover: none) and (pointer: coarse) {
  .video-controls {
    display: flex;
  }
}

/* Closed Caption styling */
video::cue {
  background-color: rgba(0, 0, 0, 0.8);
  color: #fff;
  font-size: 1.2em;
  font-family: inherit;
  padding: 0.2em 0.5em;
}

.player-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at center, rgba(92, 15, 26, 0.45) 0%, rgba(15, 3, 5, 0.98) 100%);
  backdrop-filter: blur(8px);
  z-index: 5;
}

.player-overlay.hidden {
  display: none !important;
}

.overlay-content {
  text-align: center;
  max-width: 340px;
  padding: 32px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 50px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.1);
  backdrop-filter: blur(10px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
}

.premium-placeholder-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(178, 34, 34, 0.15);
  border: 1px solid rgba(178, 34, 34, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-accent);
  margin-bottom: var(--space-xs);
  box-shadow: 0 0 20px rgba(178, 34, 34, 0.2);
  animation: pulse-glow 3s infinite ease-in-out;
}

.premium-placeholder-icon svg {
  width: 32px;
  height: 32px;
}

.overlay-content h3 {
  font-family: 'Outfit', sans-serif;
  font-weight: 800;
  font-size: 24px;
  color: #fff;
  letter-spacing: 0.5px;
  margin: 0;
}

.overlay-content .text-accent {
  color: var(--color-accent);
}

.overlay-content p {
  font-size: 14px;
  color: var(--color-text-secondary);
  line-height: 1.4;
  margin: 0;
}

.placeholder-hint {
  font-size: 11px;
  color: var(--color-text-muted);
  margin-top: var(--space-xs);
}

.placeholder-hint kbd {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 1px 4px;
  font-size: 9px;
  vertical-align: middle;
}

@keyframes pulse-glow {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 0 20px rgba(178, 34, 34, 0.2);
  }
  50% {
    transform: scale(1.05);
    box-shadow: 0 0 35px rgba(178, 34, 34, 0.4);
  }
}

.overlay-content {
  text-align: center;
  color: var(--color-text-muted);
}

/* Now Playing Overlay — LagTV: centered above player controls */
.now-playing-overlay {
  position: absolute;
  bottom: 90px;
  top: auto !important;
  left: 50% !important;
  right: auto !important;
  transform: translateX(-50%) translateY(0);
  width: 90%;
  max-width: 420px;
  display: flex;
  flex-direction: column; /* ALWAYS column for cleaner TV box layout */
  gap: 8px;
  padding: 8px 12px;
  background: rgba(15, 3, 5, 0.70); /* Sleeker, more translucent wine/black background */
  backdrop-filter: blur(25px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-md);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6), 0 0 15px rgba(178, 34, 34, 0.15);
  z-index: 50;
  opacity: 1;
  transition: opacity 0.3s ease, transform 0.3s ease;
  pointer-events: auto;
  height: auto !important;
}

.now-playing-overlay.hidden {
  opacity: 0 !important;
  transform: translateX(-50%) translateY(20px) !important;
  pointer-events: none;
}

/* iOS safe area for now playing overlay */
@supports (bottom: env(safe-area-inset-bottom)) {
  .now-playing-overlay {
    bottom: calc(90px + env(safe-area-inset-bottom, 0px));
  }
}

/* Fullscreen mode for video container */
.video-container:fullscreen {
  width: 100%;
  height: 100%;
  background: #000;
}

.video-container:fullscreen #video-player {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.video-container:fullscreen .now-playing-overlay {
  bottom: 100px;
}

/* Safari fullscreen support (required for iOS) */
.video-container:-webkit-full-screen {
  width: 100%;
  height: 100%;
  background: #000;
}

.video-container:-webkit-full-screen #video-player {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.video-container:-webkit-full-screen .now-playing-overlay {
  bottom: 100px;
}

/* Fullscreen safe area for controls - especially for iOS */
.video-container:fullscreen .watch-bottom-bar,
.video-container:-webkit-full-screen .watch-bottom-bar {
  padding-bottom: calc(var(--space-lg) + env(safe-area-inset-bottom, 0px));
}

.video-container:fullscreen .watch-top-bar,
.video-container:-webkit-full-screen .watch-top-bar {
  padding-top: calc(var(--space-lg) + env(safe-area-inset-top, 0px));
}

.channel-nav {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.channel-nav .btn-icon {
  width: 36px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  background: var(--color-bg-tertiary);
  border: 1px solid var(--color-border);
}

.now-playing-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  width: 100%;
}

/* Now playing logo and titles */
.now-playing-header {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  width: 100%;
}

.now-playing-logo {
  width: 32px;
  height: 32px;
  object-fit: contain;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 3px;
  flex-shrink: 0;
}

.now-playing-logo.hidden {
  display: none !important;
}

.now-playing-titles {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.now-playing-titles .channel-name {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--color-accent-hover); /* Red/wine accent for brand feel */
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.now-playing-titles .program-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: #fff;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.program-time {
  font-size: 0.75rem;
  color: var(--color-text-muted);
}

/* EPG Timeline Progress Bar */
.program-progress-container {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 2px;
  width: 100%;
}

.program-progress-container.hidden {
  display: none !important;
}

.program-progress-bar {
  width: 100%;
  height: 3px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 2.5px;
  position: relative;
  overflow: visible; /* Show the handle */
}

.program-progress-fill {
  height: 100%;
  background: var(--color-accent); /* Wine/Red accent color */
  border-radius: 2px;
  width: 0%;
  position: relative;
  transition: width 0.3s ease;
}

.program-progress-handle {
  position: absolute;
  right: -3px; /* Center of the 6px handle */
  top: 50%;
  transform: translateY(-50%);
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 4px var(--color-accent);
}

.program-time-row {
  display: flex;
  justify-content: space-between;
  width: 100%;
  margin-top: -2px;
}

.program-time-start,
.program-time-end {
  font-size: 0.65rem;
  color: var(--color-text-muted);
  font-family: monospace;
}

/* Next program styling in EPG card */
.player-up-next {
  width: 100%;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-top: 6px;
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.player-up-next.hidden {
  display: none !important;
}

.player-up-next-label {
  font-size: 0.65rem;
  color: var(--color-text-muted);
  font-weight: 500;
  text-transform: uppercase;
}

.player-up-next-title {
  font-size: 0.75rem;
  color: var(--color-text-secondary);
  font-weight: 400;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.up-next {
  display: none;               /* LagTV: hidden by default in the compact overlay */
  width: 0;
}

.up-next h4 {
  font-size: 0.7rem;
  color: var(--color-text-muted);
  text-transform: uppercase;
  margin-bottom: 4px;
}

#up-next-list {
  list-style: none;
}

#up-next-list li {
  font-size: 0.8rem;
  padding: 2px 0;
  color: var(--color-text-secondary);
  border-bottom: 1px solid var(--color-border);
}

/* When viewport is wide enough, allow the "Up Next" column to come back inline */
@media (min-width: 1100px) {
  .now-playing-overlay {
    max-width: min(640px, 70vw);
  }
  .up-next {
    display: block;
    width: 200px;
  }
}

/* =====================================================
   EPG Guide
   ===================================================== */

.epg-limit-warning {
  background: var(--color-warning);
  color: var(--color-bg);
  padding: var(--space-sm) var(--space-md);
  text-align: center;
  font-weight: 500;
  margin-bottom: var(--space-sm);
  border-radius: var(--radius-sm);
}

.guide-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) var(--space-lg);
  background: linear-gradient(180deg, rgba(178, 34, 34, 0.18), rgba(15, 3, 5, 0.92));
  border-bottom: 1px solid rgba(178, 34, 34, 0.35);
  position: sticky;
  top: 0;
  z-index: 5;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

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

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

.guide-date {
  font-weight: 600;
}

#page-live.active {
  display: block;
  height: 100%;
  overflow: hidden;
}

#page-guide.active {
  display: flex !important;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.epg-grid {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  padding: 0;
  position: relative;
  display: flex;
  flex-direction: column;
}

.epg-grid > .epg-container {
  flex: 1;
  min-height: 0;
  height: 100%;
  overflow: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
}

.epg-scroll-container {
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  max-height: 100%;
  overflow: auto;
  position: relative;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.epg-spacer {
  position: relative;
}

.epg-channel-rows {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
}

.epg-time-header {
  display: flex;
  position: sticky;
  top: 0;
  background: var(--color-bg-secondary);
  z-index: 10;
}

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

.epg-time-slots {
  display: flex;
  flex: 1;
}

.epg-time-slot {
  padding: var(--space-sm) var(--space-md);
  text-align: center;
  font-size: 0.875rem;
  color: var(--color-text-muted);
  border-right: 1px solid var(--color-border);
  flex-shrink: 0;
}

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

.epg-channel-info {
  width: var(--epg-sidebar-width);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm);
  background: var(--color-bg-secondary);
  position: sticky;
  left: 0;
  z-index: 5;
  border-right: 1px solid var(--color-border);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.epg-channel-info:hover {
  background: var(--color-bg-hover);
}

.resize-handle {
  position: absolute;
  right: -8px;
  top: 0;
  bottom: 0;
  width: 16px;
  cursor: col-resize;
  background: transparent;
  z-index: 10;
  transition: background var(--transition-fast);
}

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

.epg-channel-logo {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  object-fit: contain;
}

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

.epg-programs {
  display: flex;
  flex: 1;
}

.epg-program {
  padding: var(--space-sm);
  background: var(--color-bg-tertiary);
  border-right: 1px solid var(--color-border);
  cursor: pointer;
  overflow: hidden;
  transition: background var(--transition-fast);
}

.epg-program:hover {
  background: var(--color-bg-hover);
}

.epg-program.current {
  background: linear-gradient(135deg, rgba(178, 34, 34, 0.55) 0%, rgba(92, 15, 26, 0.65) 100%);
  border-left: 3px solid var(--color-accent);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.epg-program.current .epg-program-title {
  color: #fff;
  font-weight: 600;
}

.epg-program.current .epg-program-time {
  color: rgba(255, 255, 255, 0.85);
}

.epg-program-title {
  font-weight: 500;
  font-size: 0.875rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.epg-program-time {
  font-size: 0.75rem;
  color: var(--color-text-muted);
}

/* Current time indicator */
.epg-now-line {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--color-error);
  z-index: 2;
}

/* =====================================================
   Settings Page
   ===================================================== */
.settings-container {
  max-width: 900px;
  margin: 0 auto;
  padding: var(--space-lg);
  height: calc(100vh - var(--navbar-height));
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.settings-container h2 {
  margin-bottom: var(--space-lg);
}

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

.tab {
  padding: var(--space-sm) var(--space-md);
  background: none;
  border: none;
  color: var(--color-text-secondary);
  font-size: 0.875rem;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all var(--transition-fast);
}

.tab:hover {
  color: var(--color-text-primary);
}

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

.tab-content {
  display: none;
}

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

/* Source Sections */
.source-section {
  margin-bottom: var(--space-xl);
}

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

.source-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

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

.source-item.disabled {
  opacity: 0.6;
  border-style: dashed;
}

.source-status-badge {
  display: inline-block;
  margin-left: var(--space-sm);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  vertical-align: middle;
}

.source-status-disabled {
  background: rgba(239, 68, 68, 0.15);
  color: var(--color-error, #ef4444);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.source-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.source-toggle-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.source-toggle-dot.is-on {
  background: #22c55e;
  box-shadow: 0 0 6px rgba(34, 197, 94, 0.6);
}

.source-toggle-dot.is-off {
  background: #ef4444;
}

.source-toggle-label {
  font-size: 0.8rem;
  font-weight: 500;
}

.source-icon {
  font-size: 1.5rem;
}

.source-info {
  flex: 1;
}

.source-name {
  font-weight: 500;
}

.source-url {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  word-break: break-all;
}

.source-actions {
  display: flex;
  gap: var(--space-xs);
}

/* Hidden Items */
.hidden-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.hidden-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md);
  background: var(--color-bg-secondary);
  border-radius: var(--radius-md);
}

.hidden-item-info {
  flex: 1;
}

.hidden-item-type {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  text-transform: uppercase;
}

/* Settings Sections */
.settings-section {
  margin-bottom: var(--space-xl);
}

.settings-section h3 {
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-sm);
  border-bottom: 1px solid var(--color-border);
}

.setting-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md);
  background: var(--color-bg-secondary);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-sm);
}

.setting-info {
  flex: 1;
}

.setting-label {
  display: block;
  font-weight: 500;
}

.setting-hint {
  display: block;
  font-size: 0.75rem;
  color: var(--color-text-muted);
  margin-top: var(--space-xs);
}

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

/* Toggle Switch */
.setting-toggle {
  position: relative;
  width: 48px;
  height: 26px;
}

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

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--color-bg-tertiary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  transition: background var(--transition-fast);
}

.toggle-slider::before {
  content: '';
  position: absolute;
  height: 20px;
  width: 20px;
  left: 2px;
  bottom: 2px;
  background: white;
  border-radius: 50%;
  transition: transform 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(22px);
}

/* Volume Slider */
.volume-slider-container {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  flex: 1;
}

.volume-slider {
  flex: 1;
  height: 8px;
  border-radius: 4px;
  background: var(--color-bg-tertiary);
  appearance: none;
  outline: none;
  cursor: pointer;
}

.volume-slider::-webkit-slider-thumb {
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--color-accent);
  cursor: pointer;
  transition: transform 0.1s ease;
}

.volume-slider::-webkit-slider-thumb:hover {
  transform: scale(1.15);
}

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

#volume-value {
  min-width: 40px;
  text-align: right;
  font-weight: 500;
  color: var(--color-text-secondary);
}

/* Keyboard Shortcuts */
.shortcuts-grid {
  display: grid;
  gap: var(--space-sm);
}

.shortcut {
  padding: var(--space-sm) var(--space-md);
  background: var(--color-bg-secondary);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
}

kbd {
  display: inline-block;
  padding: 2px 6px;
  background: var(--color-bg-tertiary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.75rem;
}

/* =====================================================
   Buttons
   ===================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  font-size: 0.875rem;
  font-weight: 500;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-primary {
  background: var(--color-accent);
  color: white;
}

.btn-primary:hover {
  background: var(--color-accent-hover);
  box-shadow: var(--shadow-glow);
}

.btn-secondary {
  background: var(--color-bg-tertiary);
  color: var(--color-text-primary);
  border: 1px solid var(--color-border);
}

.btn-secondary:hover {
  background: var(--color-bg-hover);
}

.btn-ghost {
  background: transparent;
  color: var(--color-text-secondary);
}

.btn-ghost:hover {
  background: var(--color-bg-hover);
  color: var(--color-text-primary);
}

.btn-danger {
  background: var(--color-error);
  color: white;
}

.btn-danger:hover {
  background: #dc2626;
}

.btn-icon {
  padding: var(--space-sm);
  border-radius: var(--radius-sm);
}

.btn-sm {
  padding: var(--space-xs) var(--space-sm);
  font-size: 0.75rem;
}

/* =====================================================
   Modal
   ===================================================== */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 8000;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
}

.modal.active {
  display: flex;
}

.modal-content {
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

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

.modal-close {
  background: none;
  border: none;
  color: var(--color-text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  transition: color var(--transition-fast);
}

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

.modal-body {
  padding: var(--space-lg);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

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

/* App-owned alert/confirm/prompt replacement */
.lagtv-dialog {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(8px);
}

.lagtv-dialog.active {
  display: flex;
}

.lagtv-dialog__panel {
  position: relative;
  width: min(520px, 100%);
  max-height: min(720px, calc(100svh - 40px));
  overflow: auto;
  padding: 24px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-bg-secondary);
  color: var(--color-text-primary);
  box-shadow: var(--shadow-lg);
}

.lagtv-dialog__close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--color-text-muted);
  font-size: 1.45rem;
  line-height: 1;
  cursor: pointer;
}

.lagtv-dialog__close:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--color-text-primary);
}

.lagtv-dialog__kicker {
  min-height: 16px;
  margin: 0 42px 8px 0;
  color: var(--color-text-muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.lagtv-dialog__title {
  margin: 0 42px 10px 0;
  font-size: 1.25rem;
  line-height: 1.25;
}

.lagtv-dialog__message,
.lagtv-dialog__details {
  margin: 0;
  color: var(--color-text-secondary);
  line-height: 1.55;
  white-space: pre-line;
}

.lagtv-dialog__details {
  margin-top: 12px;
  padding: 12px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--color-text-muted);
  font-size: 0.92rem;
}

.lagtv-dialog__input {
  width: 100%;
  margin-top: 16px;
  padding: 12px 14px;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  background: var(--color-bg-primary);
  color: var(--color-text-primary);
  font: inherit;
}

.lagtv-dialog__input:focus {
  outline: none;
  border-color: var(--color-primary);
}

.lagtv-dialog__error {
  margin: 10px 0 0;
  color: var(--color-error);
  font-size: 0.9rem;
}

.lagtv-dialog__actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 22px;
}

.lagtv-dialog--danger .lagtv-dialog__kicker {
  color: var(--color-error);
}

/* EPG Info Modal */
.epg-info-modal .channel-details {
  display: flex;
  gap: var(--space-md);
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--color-border);
}

.epg-info-modal .channel-logo {
  width: 64px;
  height: 64px;
  object-fit: contain;
  background: var(--color-bg-tertiary);
  border-radius: var(--radius-md);
}

.epg-info-modal .channel-meta p {
  margin: var(--space-xs) 0;
  font-size: 0.875rem;
  color: var(--color-text-secondary);
}

.epg-info-modal h4 {
  margin: var(--space-md) 0 var(--space-sm);
  font-size: 1rem;
  color: var(--color-text-primary);
}

.epg-program-list {
  max-height: 300px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.epg-program {
  padding: var(--space-sm);
  margin-bottom: var(--space-xs);
  background: var(--color-bg-tertiary);
  border-radius: var(--radius-sm);
}

.epg-program.current {
  background: linear-gradient(135deg, rgba(178, 34, 34, 0.55) 0%, rgba(92, 15, 26, 0.65) 100%);
  border-left: 3px solid var(--color-accent);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.epg-program.current .epg-program-title {
  color: #fff;
  font-weight: 600;
}

.epg-program.current .epg-program-time {
  color: rgba(255, 255, 255, 0.85);
}

.epg-program-time {
  font-size: 0.75rem;
  color: var(--color-text-muted);
}

.epg-program-title {
  font-weight: 500;
  color: var(--color-text-primary);
}

.epg-program-desc {
  font-size: 0.8rem;
  color: var(--color-text-secondary);
  margin-top: var(--space-xs);
}

.no-programs {
  color: var(--color-text-muted);
  text-align: center;
  padding: var(--space-lg);
}

/* Form Elements */
.form-group {
  margin-bottom: var(--space-md);
}

.form-group label {
  display: block;
  margin-bottom: var(--space-xs);
  font-size: 0.875rem;
  color: var(--color-text-secondary);
}

.form-input {
  width: 100%;
  padding: var(--space-sm) var(--space-md);
  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;
}

.form-input:focus {
  outline: none;
  border-color: var(--color-accent);
}

/* =====================================================
   Context Menu
   ===================================================== */
.context-menu {
  display: none;
  position: fixed;
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  min-width: 150px;
  overflow: hidden;
}

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

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

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

.context-item.hidden {
  display: none;
}

.context-item .icon,
.context-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* =====================================================
   Content Browser (Manage Content Tab)
   ===================================================== */
.content-browser {
  display: flex;
  flex-direction: column;
  height: calc(100vh - var(--navbar-height) - 200px);
}

.content-browser-header {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md);
  background: var(--color-bg-secondary);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-md);
  flex-wrap: wrap;
}

.content-type-toggle {
  display: flex;
  gap: var(--space-xs);
}

.content-type-toggle .btn {
  background: var(--color-bg-tertiary);
  color: var(--color-text-secondary);
}

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

.content-browser-header .source-select {
  flex: 1;
  max-width: 300px;
}

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

.content-tree {
  flex: 1;
  overflow-y: auto;
  background: var(--color-bg-secondary);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.content-group {
  margin-bottom: var(--space-xs);
}

.content-group-header {
  display: flex;
  align-items: center;
  padding: var(--space-xs);
  background: var(--color-surface-hover);
  border-radius: var(--radius-sm);
  cursor: pointer;
  user-select: none;
}

.content-group-header:hover {
  background: var(--color-surface-active);
}

.group-expander {
  margin-right: var(--space-sm);
  font-size: 0.8em;
  width: 20px;
  text-align: center;
  transition: transform 0.2s;
}

.content-group.collapsed .group-expander {
  transform: rotate(-90deg);
}

.content-channels {
  margin-left: 28px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

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

.checkbox-label.channel-item {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-xs) var(--space-sm);
  background: var(--color-bg-primary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.875rem;
  transition: background var(--transition-fast);
}

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

.content-categories {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.checkbox-label.category-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  background: var(--color-bg-tertiary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.9rem;
  transition: background var(--transition-fast);
}

.checkbox-label.category-item:hover {
  background: var(--color-bg-hover);
}

.checkbox-label.channel-item.is-hidden {
  opacity: 0.6;
  text-decoration: line-through;
  background: rgba(251, 191, 36, 0.1);
}

.checkbox-label.channel-item .channel-name {
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Checkbox styling */
.content-tree input[type="checkbox"] {
  accent-color: var(--color-accent);
  width: 16px;
  height: 16px;
  cursor: pointer;
}

/* =====================================================
   Scrollbar
   ===================================================== */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--color-bg-secondary);
}

::-webkit-scrollbar-thumb {
  background: var(--color-border-light);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--color-text-muted);
}

/* =====================================================
   Loading States
   ===================================================== */
.loading {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid var(--color-border);
  border-top-color: var(--color-accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.loading-state {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-xl);
  color: var(--color-text-muted);
  width: 100%;
}

.horizontal-scroll .empty-state {
  padding: var(--space-xl);
  min-height: 150px;
}

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

/* =====================================================
   Responsive
   ===================================================== */

/* Mobile-first responsive breakpoints */
@media (max-width: 1024px) {

  /* Tablet adjustments */
  :root {
    --sidebar-width: 280px;
    --epg-sidebar-width: 200px;
  }

  .movies-grid,
  .series-grid {
    gap: var(--space-sm);
    padding: var(--space-md);
  }
}

@media (max-width: 768px) {

  /* Tablet/Mobile landscape */
  :root {
    --navbar-height: 56px;
    --sidebar-width: 320px;
    --space-lg: 16px;
    --space-xl: 24px;
    --epg-sidebar-width: 180px;
  }

  /* Navigation - Hide text labels, show only icons */
  .navbar {
    padding: 0 var(--space-md);
  }

  .navbar-menu {
    flex: 1;
    justify-content: space-around;
    gap: 0;
  }

  /* Hide nav link text on mobile, but keep Now Playing visible */
  .navbar-menu .nav-link span:not(.nav-icon) {
    display: none;
  }

  .nav-link {
    padding: var(--space-sm);
    flex-direction: column;
    gap: 2px;
  }

  .nav-icon {
    font-size: 1.4rem;
  }

  /* Brand - Simplify on tablet */
  .brand-text {
    font-size: 1.25rem;
  }

  /* Home Layout - Full screen video with drawer */
  .home-layout {
    flex-direction: row;
  }

  /* Show floating channel toggle button */
  .channel-toggle-btn {
    display: flex;
  }

  /* Channel sidebar becomes a slide-out drawer */
  .channel-sidebar {
    position: fixed;
    top: var(--navbar-height);
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    height: auto;
    border-right: 1px solid var(--color-border);
    border-bottom: none;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    z-index: 90;
    box-shadow: var(--shadow-lg);
    visibility: hidden;
  }

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

  /* Overlay behind drawer */
  .channel-sidebar-overlay {
    display: none;
    position: fixed;
    top: var(--navbar-height);
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 80;
    opacity: 0;
    transition: opacity 0.3s ease;
  }

  .channel-sidebar-overlay.active {
    display: block;
    opacity: 1;
  }

  /* Video player takes full width */
  .player-section {
    width: 100%;
  }

  .sidebar-header {
    padding: var(--space-sm) var(--space-md);
  }

  .sidebar-controls {
    flex-wrap: wrap;
  }

  /* Video Player */
  .player-section {
    flex: 1;
    min-height: 0;
  }

  /* Now Playing Overlay - Stack vertically */
  .now-playing-overlay {
    flex-direction: column;
    bottom: 90px;
    padding: 8px 12px;
    gap: 6px;
  }

  .now-playing-info .channel-name {
    font-size: 0.75rem;
  }

  .program-title {
    font-size: 0.85rem;
  }

  .up-next {
    width: 100%;
  }

  .channel-nav {
    flex-direction: row;
    justify-content: center;
    width: 100%;
  }

  .channel-nav .btn-icon {
    width: 48px;
    height: 36px;
  }

  /* EPG Guide */
  .guide-header {
    flex-direction: column;
    gap: var(--space-md);
    align-items: stretch;
  }

  .guide-controls {
    flex-wrap: wrap;
    justify-content: center;
  }

  .epg-grid {
    height: calc(100vh - var(--navbar-height) - 120px);
  }

  .epg-channel-info {
    width: var(--epg-sidebar-width);
  }

  /* Movies & Series */
  .movies-header,
  .series-header {
    flex-direction: column;
    gap: var(--space-md);
    align-items: stretch;
    padding: var(--space-md);
  }

  .movies-controls,
  .series-controls {
    flex-wrap: wrap;
    gap: var(--space-sm);
  }

  .movies-controls .source-select,
  .series-controls .source-select,
  .movies-controls .search-wrapper,
  .series-controls .search-wrapper {
    flex: 1;
    min-width: 140px;
  }

  .movies-grid,
  .series-grid {
    padding: var(--space-md);
    gap: var(--space-md);
    height: calc(100vh - var(--navbar-height) - 140px);
  }

  .movie-card,
  .series-card {
    flex: 0 0 140px;
    width: 140px;
  }

  .movie-poster,
  .series-poster,
  .series-card .series-poster {
    width: 140px;
    height: 210px;
  }

  /* Settings */
  .settings-container {
    padding: var(--space-md);
  }

  .tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .source-item {
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-sm);
  }

  .source-actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-xs);
    justify-content: stretch;
  }

  .source-actions .btn {
    flex: 1;
    min-width: 44px;
    justify-content: center;
  }

  /* Modal */
  .modal-content {
    max-width: 90%;
    margin: var(--space-md);
  }

  /* Series Details */
  .series-details-header {
    flex-direction: column;
    align-items: center;
  }

  .series-details-header .series-poster {
    width: 180px;
    height: 270px;
  }
}

@media (max-width: 640px) {

  /* Mobile portrait - phones */
  :root {
    --navbar-height: 52px;
    --space-md: 12px;
    --space-lg: 16px;
    --space-xl: 20px;
  }

  body {
    font-size: 13px;
  }

  /* Navigation - Compact with hamburger menu */
  .navbar {
    padding: 0 var(--space-sm);
    height: 52px;
  }

  .logo {
    font-size: 1.5rem;
  }

  .brand-text {
    font-size: 1.1rem;
  }

  /* Show mobile menu toggle */
  .mobile-menu-toggle {
    display: flex;
  }

  /* Mobile dropdown menu */
  .navbar-menu {
    position: fixed;
    top: 52px;
    left: 0;
    right: 0;
    flex-direction: column;
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--glass-border);
    padding: 0;
    gap: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
    z-index: 100;
    visibility: hidden;
  }

  .navbar-menu.active {
    max-height: 400px;
    padding: var(--space-sm) 0;
    box-shadow: var(--shadow-lg);
    visibility: visible;
  }

  .nav-link {
    padding: var(--space-md) var(--space-lg);
    width: 100%;
    flex-direction: row;
    justify-content: flex-start;
    gap: var(--space-md);
    border-radius: 0;
  }

  .nav-link span:not(.nav-icon) {
    display: inline !important;
  }

  .nav-icon {
    font-size: 1.3rem;
  }

  /* Hide "TV" from brand on very small screens */
  .brand-accent {
    display: none;
  }

  /* Channel Sidebar - Drawer on mobile */
  .channel-sidebar {
    width: 85%;
    max-width: 320px;
  }

  .channel-toggle-btn {
    top: var(--space-sm);
    left: var(--space-sm);
    padding: var(--space-xs) var(--space-sm);
    font-size: 0.875rem;
  }

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

  .sidebar-header {
    padding: var(--space-sm);
  }

  .channel-item {
    padding: var(--space-xs) var(--space-sm);
  }

  .channel-logo {
    width: 32px;
    height: 32px;
  }

  .channel-name {
    font-size: 0.875rem;
  }

  .group-header {
    padding: var(--space-xs) var(--space-sm);
  }

  /* Now Playing Overlay - Compact */
  .now-playing-overlay {
    padding: 8px 12px;
    bottom: 80px;
  }

  .now-playing-info .channel-name {
    font-size: 0.75rem;
    margin-bottom: 2px;
  }

  .program-title {
    font-size: 0.85rem;
  }

  .program-time {
    font-size: 0.65rem;
  }

  .up-next {
    display: none;
    /* Hide "Up Next" on very small screens */
  }

  /* EPG Guide - Mobile optimized */
  .guide-header {
    padding: var(--space-sm);
  }

  .guide-header h2 {
    font-size: 1.25rem;
  }

  .guide-controls {
    gap: var(--space-xs);
  }

  .guide-controls .btn {
    padding: var(--space-xs) var(--space-sm);
    font-size: 0.75rem;
  }

  .epg-channel-info {
    width: 140px;
    padding: var(--space-xs);
  }

  .epg-channel-logo {
    width: 24px;
    height: 24px;
  }

  .epg-channel-name {
    font-size: 0.75rem;
  }

  .epg-time-slot {
    min-width: 140px;
    padding: var(--space-xs) var(--space-sm);
    font-size: 0.75rem;
  }

  .epg-program {
    padding: var(--space-xs);
  }

  .epg-program-title {
    font-size: 0.75rem;
  }

  .epg-program-time {
    font-size: 0.65rem;
  }

  /* Movies & Series Grid - Smaller cards */
  .movies-header h2,
  .series-header h2 {
    font-size: 1.25rem;
  }

  .movies-controls .btn,
  .series-controls .btn {
    font-size: 0.75rem;
    padding: var(--space-xs) var(--space-sm);
  }

  .movies-grid,
  .series-grid {
    padding: var(--space-sm);
    gap: var(--space-sm);
    justify-content: space-around;
  }

  .movie-card,
  .series-card {
    flex: 0 0 calc(50% - 8px);
    width: calc(50% - 8px);
    max-width: 160px;
  }

  .movie-poster,
  .series-poster,
  .series-card .series-poster {
    width: 100%;
    height: auto;
    aspect-ratio: 2/3;
  }

  .movie-title,
  .series-title {
    font-size: 0.8rem;
  }

  .movie-meta,
  .series-meta {
    font-size: 0.7rem;
  }

  /* Favorite button - always visible on mobile */
  .movie-poster .favorite-btn,
  .series-poster .favorite-btn {
    width: 28px;
    height: 28px;
    top: 6px;
    right: 6px;
  }

  .fav-icon {
    font-size: 1rem;
  }

  /* Settings Page - Mobile optimized */
  .settings-container {
    padding: var(--space-sm);
    height: calc(100vh - var(--navbar-height));
  }

  .settings-container h2 {
    font-size: 1.25rem;
    margin-bottom: var(--space-md);
  }

  .settings-section h3 {
    font-size: 1rem;
  }

  .tabs {
    gap: 2px;
    margin-bottom: var(--space-md);
  }

  .tab {
    padding: var(--space-xs) var(--space-sm);
    font-size: 0.8rem;
    white-space: nowrap;
  }

  .setting-item {
    flex-direction: column;
    align-items: stretch;
    padding: var(--space-sm);
    gap: var(--space-sm);
  }

  .setting-info {
    order: -1;
    /* Move label to top */
  }

  .setting-label {
    font-size: 0.875rem;
  }

  .setting-hint {
    font-size: 0.7rem;
  }

  .source-item {
    padding: var(--space-sm);
  }

  .source-name {
    font-size: 0.875rem;
  }

  .source-url {
    font-size: 0.7rem;
  }

  .btn {
    font-size: 0.8rem;
    padding: var(--space-xs) var(--space-sm);
  }

  .btn-sm {
    font-size: 0.7rem;
    padding: 4px var(--space-xs);
  }

  /* Content Browser */
  .content-browser-header {
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-sm);
  }

  .content-type-toggle {
    justify-content: center;
  }

  .content-actions {
    margin-left: 0;
    justify-content: space-between;
  }

  /* Series Details */
  .series-details {
    padding: var(--space-sm);
  }

  .series-back-btn {
    padding: var(--space-xs) var(--space-sm);
    margin-bottom: var(--space-md);
    font-size: 0.875rem;
  }

  .series-details-header .series-poster {
    width: 160px;
    height: 240px;
  }

  .series-info h3 {
    font-size: 1.25rem;
  }

  .series-info p {
    font-size: 0.875rem;
  }

  .season-header {
    padding: var(--space-sm);
  }

  .season-name {
    font-size: 0.875rem;
  }

  .episode-item {
    padding: var(--space-xs) var(--space-sm);
  }

  .episode-number {
    width: 32px;
    font-size: 0.875rem;
  }

  .episode-title {
    font-size: 0.875rem;
  }

  .episode-duration {
    font-size: 0.75rem;
  }

  /* Modal - Full screen on mobile */
  .modal-content {
    max-width: 95%;
    max-height: 95vh;
  }

  .modal-header h3 {
    font-size: 1.1rem;
  }

  .modal-body {
    padding: var(--space-md);
  }

  /* Forms */
  .form-input {
    font-size: 0.875rem;
    padding: var(--space-xs) var(--space-sm);
  }

  /* Keyboard shortcuts - Hide on mobile since they're not relevant */
  .shortcuts-grid {
    display: none;
  }
}

@media (max-width: 480px) {

  /* Extra small phones */
  :root {
    --navbar-height: 48px;
  }

  .navbar {
    height: 48px;
  }

  .brand-text {
    font-size: 1rem;
  }

  .channel-sidebar {
    width: 90%;
    max-width: 300px;
  }

  /* Single column for very small screens */
  .movie-card,
  .series-card {
    flex: 0 0 calc(50% - 6px);
    width: calc(50% - 6px);
  }

  .now-playing-overlay {
    padding: 6px 10px;
  }

  .now-playing-info .channel-name {
    font-size: 0.75rem;
  }

  .epg-channel-info {
    width: 120px;
  }

  .epg-time-slot {
    min-width: 120px;
  }
}

/* Landscape orientation adjustments for phones */
@media (max-width: 896px) and (orientation: landscape) {
  .channel-sidebar {
    width: 280px;
  }

  .navbar-menu {
    gap: 4px;
  }

  .now-playing-overlay {
    bottom: 65px;
    padding: 6px 10px;
  }

  .now-playing-info .channel-name {
    font-size: 0.75rem;
    margin-bottom: 2px;
  }

  .program-title {
    font-size: 0.8rem;
  }

  .channel-nav {
    display: none;
    /* Hide channel nav in landscape to save space */
  }
}

/* Touch-friendly improvements */
@media (hover: none) and (pointer: coarse) {

  /* Increase touch target sizes */
  .btn,
  .nav-link,
  .channel-item,
  .movie-card,
  .series-card,
  .tab {
    min-height: 44px;
    /* iOS recommended touch target */
  }

  .channel-item {
    padding: var(--space-sm);
  }

  /* Always show favorite buttons on touch devices */
  .favorite-btn {
    opacity: 1 !important;
  }

  /* Remove hover effects */
  .channel-item:hover,
  .movie-card:hover,
  .series-card:hover {
    transform: none;
  }

  /* Show play overlay by default on touch */
  .movie-play-overlay,
  .series-play-overlay {
    opacity: 0.3;
  }
}

/* =====================================================
   Movies Page
   ===================================================== */

.movies-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) var(--space-lg);
  background: var(--color-bg-secondary);
  border-bottom: 1px solid var(--color-border);
}

.movies-header h2 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 600;
}

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



/* Favorites Button */
/* Favorites Button Base */
.favorite-btn {
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  z-index: 5;
  padding: 0;
}

/* Poster Favorites (Movies/Series) */
.movie-poster .favorite-btn,
.series-poster .favorite-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: rgba(255, 255, 255, 0.9);
  opacity: 1;
}

/* Channel List Favorites */
.channel-item .favorite-btn {
  position: relative;
  width: 24px;
  height: 24px;
  background: transparent;
  color: var(--color-text-muted);
  font-size: 1.2rem;
  opacity: 0;
  /* Hide by default in list until hover or active */
  margin-left: var(--space-xs);
}

.channel-item:hover .favorite-btn,
.channel-item .favorite-btn.active {
  opacity: 1;
}

.favorite-btn:hover {
  transform: scale(1.1);
}

.movie-poster .favorite-btn:hover,
.series-poster .favorite-btn:hover {
  background: rgba(0, 0, 0, 0.8);
  color: white;
}

.favorite-btn.active {
  color: #ef4444;
}

.movie-poster .favorite-btn.active,
.series-poster .favorite-btn.active {
  background: rgba(255, 255, 255, 0.9);
}

.movie-poster .favorite-btn.active:hover,
.series-poster .favorite-btn.active:hover {
  background: white;
}

.fav-icon {
  font-size: 1.2rem;
  line-height: 1;
}

/* Filter Button Active State */
.btn-ghost.active {
  background: var(--color-accent);
  color: white;
  border-color: var(--color-accent);
}

.movies-controls .search-input {
  min-width: 150px;
}

.movies-grid {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-md);
  padding: var(--space-lg);
  overflow-y: auto;
  height: calc(100vh - 120px);
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  justify-content: center;
  align-content: flex-start;
}

.movie-card {
  flex: 0 0 160px;
  width: 160px;
  background: var(--color-bg-tertiary);
  border-radius: var(--radius-md);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.movie-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.movie-poster {
  position: relative;
  width: 160px;
  height: 240px;
  /* 2:3 ratio (160 * 1.5 = 240) */
  background: var(--color-bg-primary);
  overflow: hidden;
}

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

.movie-play-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.6);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.movie-card:hover .movie-play-overlay {
  opacity: 1;
}

.play-icon {
  font-size: 3rem;
  color: white;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

.movie-info {
  padding: var(--space-sm);
}

.movie-title {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.movie-meta {
  display: flex;
  gap: var(--space-sm);
  font-size: 0.75rem;
  color: var(--color-text-muted);
  margin-top: var(--space-xs);
}

.movies-loader {
  grid-column: 1 / -1;
  display: flex;
  justify-content: center;
  padding: var(--space-lg);
}

/* =====================================================
   Series Page
   ===================================================== */
#page-series.active {
  display: flex;
  flex-direction: column;
}

.series-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) var(--space-lg);
  background: var(--color-bg-secondary);
  border-bottom: 1px solid var(--color-border);
}

.series-header h2 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 600;
}

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

/* Unified Control Sizing */
.guide-controls .source-select,
.movies-controls .source-select,
.series-controls .source-select {
  min-width: 150px;
}

.guide-controls .search-wrapper,
.movies-controls .search-wrapper,
.series-controls .search-wrapper {
  width: 220px;
}

.series-content {
  flex: 1;
  overflow: hidden;
  position: relative;
}

.series-grid {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-md);
  padding: var(--space-lg);
  overflow-y: auto;
  height: calc(100vh - 120px);
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  justify-content: center;
  align-content: flex-start;
}

.series-card {
  flex: 0 0 160px;
  width: 160px;
  background: var(--color-bg-tertiary);
  border-radius: var(--radius-md);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.series-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.series-poster,
.series-card .series-poster {
  position: relative;
  width: 160px;
  height: 240px;
  background: var(--color-bg-primary);
  overflow: hidden;
}

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

.series-play-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.6);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.series-card:hover .series-play-overlay {
  opacity: 1;
}

.series-card-info {
  padding: var(--space-sm);
}

.series-title {
  font-size: 0.9rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.series-meta {
  display: flex;
  gap: var(--space-sm);
  font-size: 0.75rem;
  color: var(--color-text-muted);
  margin-top: var(--space-xs);
}

.series-loader {
  width: 100%;
  display: flex;
  justify-content: center;
  padding: var(--space-lg);
}

/* Series Details Panel */
.series-details {
  position: absolute;
  inset: 0;
  background: var(--color-bg-primary);
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  overflow-y: auto;
  padding: var(--space-lg);
}

.series-details.hidden {
  display: none;
}

.series-back-btn {
  background: var(--color-bg-tertiary);
  border: none;
  color: var(--color-text-primary);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-md);
  cursor: pointer;
  margin-bottom: var(--space-lg);
  transition: background var(--transition-fast);
}

.series-back-btn:hover {
  background: var(--color-bg-hover);
}

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

.series-details-header .series-poster {
  flex-shrink: 0;
  width: 200px;
  height: 300px;
  border-radius: var(--radius-md);
  overflow: hidden;
}

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

.series-info h3 {
  font-size: 1.5rem;
  margin: 0 0 var(--space-md) 0;
}

.series-info p {
  color: var(--color-text-secondary);
  line-height: 1.6;
  max-height: 200px;
  overflow-y: auto;
}

/* Seasons and Episodes */
.series-seasons {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.season-group {
  background: var(--color-bg-secondary);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.season-header {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-md);
  cursor: pointer;
  background: var(--color-bg-tertiary);
  transition: background var(--transition-fast);
}

.season-header:hover {
  background: var(--color-bg-hover);
}

.season-expander {
  width: 20px;
  text-align: center;
  transition: transform 0.2s;
}

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

.season-name {
  font-weight: 500;
}

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

.season-group.collapsed .episode-list {
  display: none;
}

.episode-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-sm) var(--space-md);
  cursor: pointer;
  transition: background var(--transition-fast);
  border-bottom: 1px solid var(--color-border);
}

.episode-item:last-child {
  border-bottom: none;
}

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

.season-header:focus,
.season-header:focus-visible {
  background: linear-gradient(90deg, rgba(211, 35, 35, 0.38), rgba(255, 255, 255, 0.08));
  box-shadow: inset 4px 0 0 var(--color-accent-light, #F06A6A), 0 0 0 2px rgba(240, 106, 106, 0.45);
  color: #fff;
}

.episode-item:focus,
.episode-item:focus-visible {
  background: linear-gradient(90deg, rgba(211, 35, 35, 0.34), rgba(255, 255, 255, 0.07));
  box-shadow: inset 4px 0 0 var(--color-accent-light, #F06A6A), 0 0 0 2px rgba(240, 106, 106, 0.4);
  color: #fff;
}

.episode-item:focus .episode-title,
.episode-item:focus-visible .episode-title {
  color: #fff;
}

.episode-item.active {
  background: rgba(178, 34, 34, 0.18);
  border-left: 3px solid var(--color-accent);
}

.episode-number {
  flex-shrink: 0;
  width: 40px;
  font-weight: 500;
  color: var(--color-accent);
}

/* Selo de "concluído" — escondido por padrão, aparece quando o episódio está
   marcado como concluído. */
.episode-check {
  flex-shrink: 0;
  display: none;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--color-success, #10b981);
  color: #fff;
}

.episode-check svg {
  width: 15px;
  height: 15px;
}

.episode-item.completed .episode-check {
  display: inline-flex;
}

.episode-item.completed .episode-title {
  color: var(--color-text-muted);
}

.episode-title {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

/* Icons */
.icon {
  width: 1.25em;
  height: 1.25em;
  display: inline-block;
  vertical-align: middle;
  fill: currentColor;
}

.nav-link .icon {
  width: 1.5em;
  height: 1.5em;
}

.icon.text-warning {
  color: var(--color-warning);
}

/* Animation Utilities */
@keyframes spin {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

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

/* User Management Styles */
.user-list-container {
  margin: var(--space-lg) 0;
  overflow-x: auto;
}

.user-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--color-bg-secondary);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.user-table thead {
  background: var(--color-bg-tertiary);
}

.user-table th {
  padding: var(--space-md);
  text-align: left;
  font-weight: 600;
  color: var(--color-text-primary);
  border-bottom: 1px solid var(--color-border);
}

.user-table td {
  padding: var(--space-md);
  color: var(--color-text-secondary);
  border-bottom: 1px solid var(--color-border);
}

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

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

.user-table .btn {
  padding: var(--space-xs) var(--space-sm);
  margin: 0 var(--space-xs);
  font-size: 14px;
}

.add-user-section {
  margin-top: var(--space-2xl);
  padding: var(--space-lg);
  background: var(--color-bg-secondary);
  border-radius: var(--radius-md);
}

.user-form {
  display: grid;
  gap: var(--space-md);
  max-width: 500px;
}

.form-group {
  display: flex;
  flex-direction: column;
}

.form-group label {
  margin-bottom: var(--space-xs);
  color: var(--color-text-primary);
  font-weight: 500;
}

/* =====================================================
   Watch Page (VOD Player)
   ===================================================== */

/* Page Container */
.watch-page {
  height: 100%;
  min-height: 0;
  overflow: hidden;
  overflow-x: hidden;
  background: var(--color-bg-primary);
}

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

/* Video Section - fills the already-measured page area below the navbar */
.watch-video-section {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 0;
  background: #000;
  overflow: hidden;
}

#watch-video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}

/* Player Overlay */
.watch-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: linear-gradient(to bottom,
      rgba(0, 0, 0, 0.7) 0%,
      transparent 20%,
      transparent 75%,
      rgba(0, 0, 0, 0.8) 100%);
  opacity: 1;
  transition: opacity 0.3s ease;
  pointer-events: auto;
  z-index: 10;
}

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

/* iOS safe area support for landscape mode (notched devices) */
@supports (padding: env(safe-area-inset-left)) {
  .watch-overlay {
    padding-left: env(safe-area-inset-left, 0px);
    padding-right: env(safe-area-inset-right, 0px);
  }
}

/* Top Bar */
.watch-top-bar {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-lg);
  padding-top: calc(var(--space-lg) + var(--safe-area-inset-top));
  pointer-events: none;
  z-index: 20;
  width: 100%;
  box-sizing: border-box;
}

.watch-top-bar>* {
  pointer-events: auto;
}

/* Live TV Header: Left Title & Right Status */
.watch-top-bar.live-header {
  justify-content: space-between;
}

/* VOD Header: Spaced (Back Btn - Title - Status) */
.watch-top-bar.vod-header {
  justify-content: space-between;
}

.watch-back-btn {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  border-radius: var(--radius-full);
  color: #fff;
  cursor: pointer;
  transition: background var(--transition-fast);
  flex-shrink: 0;
}

.watch-back-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

.watch-back-btn .icon {
  width: 24px;
  height: 24px;
}

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

.watch-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: #fff;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.watch-subtitle {
  font-size: 0.875rem;
  color: rgba(255, 255, 255, 0.7);
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Center Play Button */
.watch-center-play {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 80px;
  height: 80px;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.6);
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: var(--radius-full);
  color: #fff;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.watch-center-play:hover {
  background: rgba(0, 0, 0, 0.8);
  border-color: rgba(255, 255, 255, 0.5);
  transform: translate(-50%, -50%) scale(1.1);
}

.watch-center-play.show {
  display: flex;
}

.watch-center-play .icon {
  width: 40px;
  height: 40px;
}

/* Loading Spinner */
.watch-loading {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 14px;
  background: rgba(0, 0, 0, 0.72);
  z-index: 15;
  color: #fff;
  font-weight: 800;
}

.watch-loading.show {
  display: flex;
}

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

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

/* Seek Preview Indicator (feedback de tempo ao avançar/voltar) */
.watch-seek-indicator {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 24px;
  background: rgba(0, 0, 0, 0.72);
  border-radius: var(--radius-full);
  color: #fff;
  z-index: 16;
  pointer-events: none;
  font-variant-numeric: tabular-nums;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.5);
}

.watch-seek-indicator.hidden {
  display: none;
}

.watch-seek-arrow {
  font-size: 1.5rem;
  line-height: 1;
}

.watch-seek-time {
  font-size: 1.75rem;
  font-weight: 800;
}

.watch-seek-total {
  font-size: 1rem;
  color: rgba(255, 255, 255, 0.7);
}

.watch-info-panel {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(560px, calc(100% - 48px));
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  border-radius: var(--radius-md);
  background: rgba(10, 2, 4, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: var(--shadow-lg);
  z-index: 18;
}

.watch-info-panel.hidden {
  display: none;
}

.watch-info-panel img {
  width: 64px;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  border-radius: var(--radius-sm);
  background: #000;
  flex: 0 0 auto;
}

.watch-info-panel p,
.watch-info-panel h4,
.watch-info-panel span {
  margin: 0;
}

.watch-info-panel p {
  color: var(--color-accent-light);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.watch-info-panel h4 {
  color: #fff;
  font-size: 20px;
  line-height: 1.15;
}

.watch-info-panel span {
  color: var(--color-text-secondary);
  font-size: 13px;
}

/* Bottom Bar */
.watch-bottom-bar {
  position: relative;
  padding: var(--space-md) var(--space-lg);
  padding-bottom: calc(var(--space-lg) + var(--safe-area-inset-bottom));
}

.watch-tv-thumbnail {
  position: absolute;
  left: var(--space-lg);
  bottom: calc(100% + 8px);
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: min(360px, 42vw);
  padding: 8px 10px;
  border-radius: var(--radius-md);
  background: rgba(0, 0, 0, 0.64);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.watch-tv-thumbnail.hidden {
  display: none;
}

.watch-tv-thumbnail img {
  width: 42px;
  height: 58px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  background: #000;
}

.watch-tv-thumbnail div {
  min-width: 0;
}

.watch-tv-thumbnail span {
  display: block;
  color: var(--color-text-muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.watch-tv-thumbnail strong {
  display: block;
  color: #fff;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Progress Container */
.watch-progress-container {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
}

.watch-remote-hints {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px 18px;
  margin-bottom: var(--space-sm);
  color: rgba(255, 255, 255, 0.74);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.watch-remote-hints kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  height: 20px;
  margin-right: 5px;
  padding: 0 5px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font: inherit;
  font-size: 11px;
}

.watch-remote-hints--live {
  margin-bottom: 10px;
}

/* Quando as dicas ficam logo abaixo da linha de botões (igual à TV ao vivo),
   joga o espaçamento para cima em vez de empurrar o conteúdo para baixo. */
.watch-controls + .watch-remote-hints {
  margin-top: var(--space-sm);
  margin-bottom: 0;
}

/* Botão de velocidade (acelerar) do player de filmes/séries */
.watch-speed-label {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.3px;
}

.watch-btn--active {
  color: var(--color-accent);
}

.watch-time {
  font-size: 0.875rem;
  color: rgba(255, 255, 255, 0.8);
  min-width: 50px;
  font-variant-numeric: tabular-nums;
}

.watch-time:last-child {
  text-align: right;
}

.watch-progress {
  flex: 1;
  height: 6px;
  -webkit-appearance: none;
  appearance: none;
  /* Vermelho (cor do sistema) = já reproduzido; cinza claro = já bufferizado/
     transcodificado; cinza escuro = ainda não carregado. --progress e --buffered
     são atualizados pelo JS. */
  background: linear-gradient(
    to right,
    var(--color-accent) var(--progress, 0%),
    rgba(255, 255, 255, 0.42) var(--progress, 0%),
    rgba(255, 255, 255, 0.42) var(--buffered, 0%),
    rgba(255, 255, 255, 0.16) var(--buffered, 0%)
  );
  border-radius: 3px;
  cursor: pointer;
}

.watch-progress::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 3px;
  background: transparent;
}

/* Firefox: parte preenchida nativa */
.watch-progress::-moz-range-progress {
  height: 6px;
  border-radius: 3px;
  background: var(--color-accent);
}

.watch-progress::-moz-range-track {
  height: 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.3);
}

.watch-progress::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  background: var(--color-accent);
  border-radius: 50%;
  cursor: pointer;
  margin-top: -5px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
  transition: transform var(--transition-fast);
}

.watch-progress:hover::-webkit-slider-thumb {
  transform: scale(1.2);
}

/* Control Buttons */
.watch-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
}

.watch-btn {
  position: relative;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: #fff;
  cursor: pointer;
  border-radius: var(--radius-md);
  transition: background var(--transition-fast);
}

.watch-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

.watch-btn .icon {
  width: 24px;
  height: 24px;
}

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

.watch-captions-menu,
.watch-quality-menu {
  position: absolute;
  bottom: 100%;
  right: 0;
  margin-bottom: var(--space-sm);
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  min-width: 160px;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  z-index: 30;
}

.watch-captions-menu.hidden,
.watch-quality-menu.hidden {
  display: none;
}

.quality-btn-label {
  min-width: 34px;
  max-width: 78px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.78rem;
  font-weight: 800;
}

#player-quality-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4px 8px;
  min-height: 38px;
  line-height: 1.1;
}

.quality-btn-sublabel {
  font-size: 0.65rem;
  font-weight: 500;
  opacity: 0.75;
  margin-top: 1px;
}

.quality-btn-sublabel:empty {
  display: none;
}

.watch-btn.hidden {
  display: none;
}

.captions-menu-title {
  padding: var(--space-sm) var(--space-md);
  font-size: 0.75rem;
  text-transform: uppercase;
  color: var(--color-text-muted);
  border-bottom: 1px solid var(--glass-border);
}

.captions-menu-list {
  max-height: 200px;
  overflow-y: auto;
}

.captions-option {
  display: block;
  width: 100%;
  padding: var(--space-sm) var(--space-md);
  background: none;
  border: none;
  color: var(--color-text-primary);
  text-align: left;
  font-size: 0.875rem;
  cursor: pointer;
  transition: background var(--transition-fast);
}

.captions-option:hover {
  background: rgba(255, 255, 255, 0.1);
}

.captions-option.active {
  color: var(--color-accent);
}

.captions-option.active::before {
  content: "✓ ";
}

.watch-btn-lg {
  width: 64px;
  height: 64px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-full);
}

.watch-btn-lg:hover {
  background: rgba(255, 255, 255, 0.2);
}

.watch-btn-lg .icon {
  width: 32px;
  height: 32px;
}

.skip-label {
  position: absolute;
  bottom: 2px;
  font-size: 0.625rem;
  font-weight: 600;
}

.watch-spacer {
  flex: 1;
}

/* Volume Slider */
.watch-volume {
  width: 80px;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 2px;
  cursor: pointer;
}

.watch-volume::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 12px;
  height: 12px;
  background: #fff;
  border-radius: 50%;
  cursor: pointer;
}

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

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

@keyframes bounce {

  0%,
  100% {
    transform: translateX(-50%) translateY(0);
  }

  50% {
    transform: translateX(-50%) translateY(8px);
  }
}

/* Next Episode Panel */
.watch-next-episode {
  position: absolute;
  bottom: 160px;
  right: var(--space-lg);
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md) var(--space-lg);
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  animation: slideInRight 0.3s ease;
  z-index: 50;
  pointer-events: auto;
}

.watch-next-episode.hidden {
  display: none;
}

@keyframes slideInRight {
  from {
    transform: translateX(100px);
    opacity: 0;
  }

  to {
    transform: translateX(0);
    opacity: 1;
  }
}

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

.next-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  color: var(--color-text-muted);
  margin: 0 0 var(--space-xs) 0;
}

.next-info h4 {
  color: #fff;
  margin: 0;
  font-size: 0.875rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}

.next-countdown {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-accent);
  min-width: 30px;
  text-align: center;
}

/* ===== Details Section ===== */
.watch-details-section {
  padding: var(--space-xl) var(--space-lg);
  padding-bottom: var(--space-2xl);
  max-width: 1200px;
  margin: 0 auto;
}

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

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

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

.watch-meta h2 {
  font-size: 2rem;
  margin-bottom: var(--space-sm);
  color: var(--color-text-primary);
}

.watch-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-md);
  color: var(--color-text-secondary);
  margin-bottom: var(--space-md);
  font-size: 0.875rem;
}

.watch-rating {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  color: var(--color-warning);
}

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

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

.watch-actions .btn {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.watch-actions .btn .icon {
  width: 18px;
  height: 18px;
}

.watch-actions .btn .icon-fav-filled {
  color: var(--color-error);
}

/* Recommended Movies Grid */
.watch-recommended h3,
.watch-episodes h3 {
  margin-bottom: var(--space-lg);
  font-size: 1.25rem;
  color: var(--color-text-primary);
}

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

.watch-recommended-card {
  cursor: pointer;
  transition: transform var(--transition-fast);
}

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

.watch-recommended-card img {
  width: 100%;
  aspect-ratio: 2/3;
  object-fit: cover;
  border-radius: var(--radius-sm);
  background: var(--color-bg-tertiary);
}

.watch-recommended-card p {
  margin-top: var(--space-xs);
  font-size: 0.813rem;
  color: var(--color-text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Series Episodes */
.watch-season-group {
  margin-bottom: var(--space-sm);
}

.watch-season-header {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  background: var(--color-bg-tertiary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  user-select: none;
  transition: background var(--transition-fast);
}

.watch-season-header:hover {
  background: var(--color-bg-hover);
}

.watch-season-header .icon {
  width: 20px;
  height: 20px;
  color: var(--color-text-muted);
  transition: transform var(--transition-fast);
}

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

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

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

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

.watch-episode-list {
  padding: var(--space-xs) 0 var(--space-xs) var(--space-lg);
}

.watch-episode-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition-fast);
}

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

.watch-episode-item.active {
  background: var(--color-accent-dim);
  border-left: 3px solid var(--color-accent);
}

.watch-episode-item.watched {
  opacity: 0.65;
}

.watch-episode-item.watched .watch-episode-num,
.watch-episode-item.watched .watch-episode-title {
  color: var(--color-text-muted);
}

.watch-episode-item.in-progress {
  position: relative;
}

/* Episode badges (Assistido / % progresso) */
.ep-badge {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 20px;
  flex-shrink: 0;
  white-space: nowrap;
}

.ep-badge--watched {
  background: rgba(80, 200, 120, 0.15);
  color: #50c878;
  border: 1px solid rgba(80, 200, 120, 0.3);
}

.ep-badge--progress {
  background: rgba(var(--color-accent-rgb, 180, 20, 50), 0.15);
  color: var(--color-accent);
  border: 1px solid rgba(var(--color-accent-rgb, 180, 20, 50), 0.3);
}

/* Mini progress bar under in-progress episodes */
.ep-progress-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: rgba(255,255,255,0.08);
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  overflow: hidden;
}

.ep-progress-fill {
  height: 100%;
  background: var(--color-accent);
  border-radius: inherit;
  transition: width 0.3s ease;
}

.watch-episode-num {
  width: 32px;
  color: var(--color-text-muted);
  font-weight: 600;
  font-size: 0.875rem;
  flex-shrink: 0;
}

.watch-episode-title {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

/* Mobile Responsive */
@media (max-width: 768px) {
  .watch-content-info {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .watch-poster {
    width: 150px;
    height: 225px;
  }

  .watch-meta h2 {
    font-size: 1.5rem;
  }

  .watch-meta-row {
    justify-content: center;
  }

  .watch-description {
    text-align: left;
  }

  .watch-actions {
    justify-content: center;
  }

  .watch-scroll-hint {
    display: none;
  }

  .watch-volume {
    display: none;
  }

  .watch-next-episode {
    left: var(--space-md);
    right: var(--space-md);
    bottom: calc(120px + env(safe-area-inset-bottom, 0px));
    flex-wrap: wrap;
  }

  .next-info {
    flex: 1;
  }

  .next-info h4 {
    max-width: none;
  }

  .watch-bottom-bar {
    padding-bottom: calc(var(--space-lg) + env(safe-area-inset-bottom, 0px));
  }
}

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

.player-overflow-menu {
  position: absolute;
  bottom: 100%;
  right: 0;
  margin-bottom: var(--space-sm);
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  min-width: 180px;
  overflow: hidden;
  z-index: 100;
}

.overflow-menu-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  width: 100%;
  padding: var(--space-sm) var(--space-md);
  background: transparent;
  border: none;
  color: var(--color-text-primary);
  font-size: 0.875rem;
  cursor: pointer;
  transition: background var(--transition-fast);
}

.overflow-menu-item:hover {
  background: var(--color-bg-hover);
}

.overflow-menu-item .icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

/* Hardware Info Grid (Transcoding Tab) */
.hw-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--space-sm);
}

.hw-info-item {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-sm);
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
}

.hw-info-item.hw-available {
  border-color: var(--color-success);
  background: rgba(16, 185, 129, 0.1);
}

.hw-info-item.hw-unavailable {
  opacity: 0.6;
}

.hw-badge {
  font-weight: 600;
  font-size: 0.875rem;
}

.hw-info-item.hw-available .hw-badge {
  color: var(--color-success);
}

.hw-info-item.hw-unavailable .hw-badge {
  color: var(--color-text-muted);
}

.hw-name {
  font-size: 0.75rem;
  color: var(--color-text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Transcode Status Indicator */
.transcode-status {
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: 600;
  background: rgba(0, 0, 0, 0.5);
  color: white;
  display: inline-flex;
  align-items: center;
  backdrop-filter: blur(4px);
  transition: opacity 0.3s ease;
}

.transcode-status.transcoding {
  background: rgba(255, 68, 68, 0.8);
  /* Red for Transcoding */
  box-shadow: 0 0 10px rgba(255, 68, 68, 0.3);
}

.transcode-status.remuxing {
  background: rgba(255, 153, 0, 0.8);
  /* Orange for Remux */
}

.transcode-status.direct {
  background: rgba(76, 175, 80, 0.8);
  /* Green for Direct */
}

.transcode-status.upscaling {
  background: rgba(156, 39, 176, 0.8);
  /* Purple for Upscaling */
  box-shadow: 0 0 10px rgba(156, 39, 176, 0.4);
}

.transcode-status.hidden {
  opacity: 0;
  pointer-events: none;
}

/* Badge Container for right alignment */
.player-badges {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  /* Fallback for cases without flex-grow middle element */
}

/* Quality Badge */
.quality-badge {
  display: inline-block;
  background: rgba(158, 158, 158, 0.8);
  color: white;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
}

.quality-badge.hidden {
  display: none;
}

.bandwidth-badge {
  display: inline-block;
  padding: 4px 8px;
  background: rgba(16, 185, 129, 0.18);
  color: #7CF5BE;
  border: 1px solid rgba(124, 245, 190, 0.22);
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
}

.bandwidth-badge.hidden {
  display: none;
}

/* Watch Header Bar (Title + Transcode Status) */
/* Moved to original definition around line 3311 */

.watch-title-overlay {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
  color: white;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 60%;
}

/* =====================================================
   Edit User Modal
   ===================================================== */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  z-index: 10000;
  align-items: center;
  justify-content: center;
}

.modal-overlay.active {
  display: flex;
}

.modal-overlay .modal {
  display: block;
  position: relative;
  inset: auto;
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 500px;
  max-height: 90vh;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  animation: modalFadeIn 0.2s ease;
}

@keyframes modalFadeIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

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

.modal-overlay .modal-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--color-text-primary);
  margin: 0;
}

.modal-overlay .modal-close {
  background: none;
  border: none;
  color: var(--color-text-muted);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  transition: color 0.2s;
}

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

.modal-overlay .modal-body {
  padding: var(--space-lg);
}

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

/* Modal Form Styles */
.modal-overlay .modal-form-group {
  margin-bottom: var(--space-md);
}

.modal-overlay .modal-form-group label {
  display: block;
  margin-bottom: var(--space-xs);
  color: var(--color-text-secondary);
  font-size: 0.875rem;
}

.modal-overlay .modal-form-group .form-input {
  width: 100%;
  padding: var(--space-sm);
  background: var(--color-bg-primary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text-primary);
}

.modal-overlay .modal-form-group .form-input:focus {
  outline: none;
  border-color: var(--color-accent);
}

.modal-overlay .modal-form-group .form-input:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  background: var(--color-bg-tertiary);
}

/* =====================================================
   User Management Badges
   ===================================================== */
.user-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-radius: 12px;
  white-space: nowrap;
}

.user-badge-sso {
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  color: #fff;
  box-shadow: 0 2px 4px rgba(99, 102, 241, 0.3);
}

.user-badge-local {
  background: rgba(255, 255, 255, 0.08);
  color: var(--color-text-secondary);
  border: 1px solid var(--color-border);
}

.user-badge-admin {
  background: linear-gradient(135deg, #f59e0b 0%, #f97316 100%);
  color: #000;
  box-shadow: 0 2px 4px rgba(245, 158, 11, 0.3);
}

.user-badge-viewer {
  background: rgba(255, 255, 255, 0.05);
  color: var(--color-text-muted);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

/* =====================================================
   Now Playing Indicator (Header)
   ===================================================== */

.now-playing-indicator {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  padding: 0;
  margin-right: 0;
  background: linear-gradient(135deg, var(--color-accent) 0%, #8b5cf6 100%);
  border-radius: 50%;
  color: white;
  text-decoration: none;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.4);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
  animation: now-playing-pulse 2s ease-in-out infinite;
}

.now-playing-indicator:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.5);
}

.now-playing-indicator.hidden {
  display: none;
}

/* Já estamos na watch page — esconde o badge "now playing" da navbar
   para não sobrepor o título centralizado "ASSISTINDO". */
body[data-page="watch"] .now-playing-indicator {
  display: none !important;
}

.now-playing-icon {
  font-size: 13px;
  line-height: 1;
  transform: translateX(1px);
}

.now-playing-text {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@keyframes now-playing-pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.85;
  }
}

/* Mobile responsive - show in dropdown menu */
@media (max-width: 768px) {
  .now-playing-indicator {
    width: 36px;
    height: 36px;
    margin: 0;
    border-radius: 50%;
  }
}

/* =====================================================
   Home Dashboard Styles
   ===================================================== */

#page-home {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.dashboard-content {
  padding: 24px;
  max-width: 1400px;
  margin: 0 auto;
}

.dashboard-section {
  margin-bottom: 40px;
}

.dashboard-section.hidden {
  display: none;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.section-header h2 {
  font-family: 'Outfit', sans-serif;
  font-size: 1.5rem;
  color: var(--color-text-bright);
}

/* Scroll Wrapper with Navigation Arrows */
.scroll-wrapper {
  position: relative;
}

.scroll-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  backdrop-filter: blur(8px);
}

.scroll-arrow:hover {
  background: rgba(0, 0, 0, 0.9);
  border-color: var(--color-accent);
  transform: translateY(-50%) scale(1.1);
}

.scroll-arrow svg {
  width: 24px;
  height: 24px;
}

.scroll-arrow.scroll-left {
  left: -8px;
}

.scroll-arrow.scroll-right {
  right: -8px;
}

.scroll-arrow.hidden {
  opacity: 0;
  pointer-events: none;
}

/* Hide arrows on touch devices (they can swipe) */
@media (hover: none) {
  .scroll-arrow {
    display: none;
  }
}

.horizontal-scroll {

  display: flex;
  gap: 20px;
  overflow-x: auto;
  padding-bottom: 12px;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
}

/* Hide scrollbar by default, show on hover */
.horizontal-scroll::-webkit-scrollbar {
  height: 6px;
}

.horizontal-scroll::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}

.horizontal-scroll:hover::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
}

.dashboard-card {
  flex: 0 0 calc(50% - 10px);
  /* 2 per view on small screens */
  max-width: 240px;
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
  scroll-snap-align: start;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

/* 4 per view on medium screens */
@media (min-width: 768px) {
  .dashboard-card {
    flex: 0 0 calc(25% - 15px);
  }
}

/* 6 per view on large screens */
@media (min-width: 1200px) {
  .dashboard-card {
    flex: 0 0 calc(16.66% - 17px);
  }
}

.dashboard-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-lg);
  border-color: var(--color-accent-dim);
}

.card-image {
  position: relative;
  aspect-ratio: 2/3;
  overflow: hidden;
}

.card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.dashboard-card:hover .card-image img {
  transform: scale(1.05);
}

.progress-bar-container {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: rgba(0, 0, 0, 0.5);
}

.progress-bar {
  height: 100%;
  background: var(--color-accent);
  box-shadow: 0 0 10px var(--color-accent);
}

.play-icon-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.4);
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.play-icon-overlay svg {
  width: 48px;
  height: 48px;
  color: white;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.5));
}

.dashboard-card:hover .play-icon-overlay {
  opacity: 1;
}

.card-info {
  padding: 12px;
}

.card-title {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--color-text-bright);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}

.card-subtitle {
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

.loading-state,
.empty-state {
  padding: 40px;
  text-align: center;
  color: var(--color-text-muted);
  width: 100%;
  background: rgba(255, 255, 255, 0.02);
  border-radius: var(--radius-lg);
  border: 1px dashed rgba(255, 255, 255, 0.1);
}

/* =====================================================
   Channel Tile Styles (Favorite Channels)
   ===================================================== */

.channel-tiles {
  gap: 16px;
}

.channel-tile {
  flex: 0 0 100px;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  padding: 12px 8px;
  border-radius: var(--radius-md);
  transition: transform var(--transition-fast), background var(--transition-fast);
  scroll-snap-align: start;
}

.channel-tile:hover {
  transform: translateY(-4px);
  background: rgba(255, 255, 255, 0.05);
}

.tile-logo {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--color-surface);
  border: 2px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.channel-tile:hover .tile-logo {
  border-color: var(--color-accent);
  box-shadow: 0 0 16px rgba(var(--color-accent-rgb), 0.3);
}

.tile-logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.tile-name {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--color-text-secondary);
  text-align: center;
  max-width: 90px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.channel-tile:hover .tile-name {
  color: var(--color-text-bright);
}

/* Responsive: smaller tiles on mobile */
@media (max-width: 480px) {
  .channel-tile {
    flex: 0 0 80px;
    padding: 8px 4px;
  }

  .tile-logo {
    width: 52px;
    height: 52px;
  }

  .tile-name {
    font-size: 0.7rem;
    max-width: 70px;
  }
}

/* =====================================================
 * LagTV — UniTV-inspired Component Library
 * Components used across redesigned pages
 * (HomePage, MoviesPage, SeriesPage, SportsPage, etc.)
 * ===================================================== */

/* ---------- .tab-pill — navbar tab in pill shape ---------- */

.tab-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 26px;
  border-radius: 999px;
  border: 2px solid transparent;
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: 16px;
  letter-spacing: 0.4px;
  color: var(--color-text-secondary);
  text-decoration: none;
  text-transform: uppercase;
  cursor: pointer;
  transition: color var(--transition-fast), border-color var(--transition-fast), background var(--transition-fast);
  white-space: nowrap;
}

.tab-pill:hover {
  color: var(--color-text-primary);
}

.tab-pill--active,
.tab-pill.active {
  color: var(--color-text-primary);
  border-color: var(--color-text-primary);
  background: rgba(255, 255, 255, 0.04);
}

/* "KIDS" tab in colorful comic style */
.tab-pill--kids {
  font-family: 'Outfit', 'Comic Sans MS', sans-serif;
  font-weight: 800;
  background: linear-gradient(90deg, #FFB347 0%, #FF6961 25%, #77DD77 50%, #AEC6CF 75%, #C39BD3 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  text-transform: none;
  font-size: 18px;
}

.tab-pill--kids:hover,
.tab-pill--kids.active {
  background: linear-gradient(90deg, #FFB347 0%, #FF6961 25%, #77DD77 50%, #AEC6CF 75%, #C39BD3 100%) !important;
  -webkit-background-clip: text !important;
  background-clip: text !important;
  -webkit-text-fill-color: transparent !important;
  border-color: rgba(255, 255, 255, 0.2);
}

/* ---------- .poster-card — vertical poster with rating + CC ---------- */

.poster-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
  cursor: pointer;
  user-select: none;
  transition: transform var(--transition-fast);
}

.poster-card:hover,
.poster-card:focus-within {
  transform: scale(1.04);
}

.poster-card__media {
  position: relative;
  width: 100%;
  aspect-ratio: 2 / 3;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--color-bg-secondary);
  box-shadow: var(--shadow-md);
}

.poster-card:hover .poster-card__media {
  box-shadow: var(--shadow-glow);
}

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

.poster-card__title {
  font-size: 14px;
  font-weight: 500;
  color: var(--color-text-primary);
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.poster-card__remove {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.6);
  border: none;
  border-radius: 50%;
  color: #fff;
  cursor: pointer;
  z-index: 10;
  opacity: 0;
  transition: opacity var(--transition-fast), background var(--transition-fast);
}

.poster-card:hover .poster-card__remove {
  opacity: 1;
}

.poster-card__remove:hover {
  background: var(--color-error);
}

.poster-card__remove svg {
  width: 16px;
  height: 16px;
}

.poster-card__watchlist-add {
  position: absolute;
  top: 6px;
  left: 6px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.6);
  border: none;
  border-radius: 50%;
  color: #fff;
  cursor: pointer;
  z-index: 10;
  opacity: 0;
  transition: opacity var(--transition-fast), background var(--transition-fast);
}

.poster-card:hover .poster-card__watchlist-add {
  opacity: 1;
}

.poster-card__watchlist-add:hover {
  background: var(--color-accent);
}

.poster-card__watchlist-add svg {
  width: 16px;
  height: 16px;
}

.poster-card__type-badge {
  position: absolute;
  bottom: 6px;
  right: 6px;
  background: rgba(0,0,0,0.7);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  color: #aaa;
  text-transform: uppercase;
}

/* badge: rating (golden) */
.badge-rating {
  position: absolute;
  bottom: 6px;
  left: 6px;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--color-rating-bg);
  color: var(--color-rating-text);
  font-size: 12px;
  font-weight: 700;
  font-family: 'Inter', sans-serif;
  letter-spacing: 0.5px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
  z-index: 2;
}

/* badge: closed-captions (orange) */
.badge-cc {
  position: absolute;
  bottom: 6px;
  right: 6px;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--color-cc-bg);
  color: var(--color-cc-text);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  z-index: 2;
}

/* badge: year (subtle muted) */
.badge-year {
  position: absolute;
  top: 6px;
  left: 6px;
  right: auto;
  bottom: auto;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.78);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
  z-index: 2;
}

/* badge: type (Film / Série) — centered at the top of the poster */
.badge-type {
  position: absolute;
  top: 6px;
  left: 50%;
  transform: translateX(-50%);
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--color-accent);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  white-space: nowrap;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
  z-index: 2;
}

/* Premium placeholder icon for Live TV idle state */
.premium-placeholder-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 72px;
  margin: 0 auto var(--space-md);
  border-radius: 50%;
  background: linear-gradient(135deg, var(--color-accent-dim), rgba(178, 34, 34, 0.15));
  border: 2px solid rgba(178, 34, 34, 0.3);
  animation: placeholder-pulse 3s ease-in-out infinite;
}

.premium-placeholder-icon svg {
  width: 36px;
  height: 36px;
  fill: var(--color-accent);
}

@keyframes placeholder-pulse {
  0%, 100% { transform: scale(1); opacity: 0.8; }
  50% { transform: scale(1.05); opacity: 1; }
}

/* Utility: accent color text */
.text-accent {
  color: var(--color-accent);
}

/* Hint text below Live TV overlay */
.placeholder-hint {
  display: block;
  margin-top: var(--space-sm);
  font-size: 0.75rem;
  color: var(--color-text-muted);
  opacity: 0.7;
}

.placeholder-hint kbd {
  padding: 1px 5px;
  font-size: 0.65rem;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 3px;
  background: rgba(255,255,255,0.05);
  font-family: inherit;
}

/* hero variant — big banner cards on Destaques (Home) */
.poster-card--hero .poster-card__media {
  aspect-ratio: 2 / 3;
  border-radius: var(--radius-lg);
}

.poster-card--hero .poster-card__title {
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  font-size: 18px;
}

/* ---------- .chip-filter — filter chip (genre/year/country) ---------- */

.chip-filter {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  border: none;
  background: transparent;
  color: var(--color-text-secondary);
  font-family: 'Inter', sans-serif;
  font-weight: 500;
  font-size: 14px;
  cursor: pointer;
  border-radius: 999px;
  transition: color var(--transition-fast), background var(--transition-fast);
  white-space: nowrap;
}

.chip-filter:hover {
  color: var(--color-text-primary);
}

.chip-filter--active,
.chip-filter.active {
  color: var(--color-accent);
  font-weight: 700;
}

.chip-filter__order {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--color-accent);
  color: #fff;
  font-size: 10px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  margin-left: 6px;
  font-weight: 700;
  vertical-align: middle;
}

/* ---------- .action-bar — row of action buttons in details view ---------- */

.action-bar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin: var(--space-lg) 0;
}

.action-bar__btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border: 1px solid var(--glass-border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--color-text-primary);
  font-family: 'Inter', sans-serif;
  font-weight: 500;
  font-size: 14px;
  cursor: pointer;
  transition: background var(--transition-fast), border-color var(--transition-fast);
}

.action-bar__btn:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: var(--color-text-primary);
}

.action-bar__btn svg.icon {
  width: 18px;
  height: 18px;
}

.action-bar__btn--primary {
  background: var(--color-accent);
  border-color: var(--color-accent);
}

.action-bar__btn--primary:hover {
  background: var(--color-accent-hover);
  border-color: var(--color-accent-hover);
}

/* ---------- .lagtv-navbar — top bar wrapper (logo + utility + tabs) ---------- */

.lagtv-navbar {
  position: relative;
  z-index: 100;
  display: flex;
  flex-direction: column;
  flex: 0 0 auto;
  gap: 16px;
  padding: 18px 32px 8px;
  background: linear-gradient(180deg,
    rgba(92, 15, 26, 0.85) 0%,
    rgba(42, 5, 9, 0.6) 80%,
    transparent 100%);
  backdrop-filter: blur(10px);
}

.lagtv-navbar__row {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.lagtv-navbar__left-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.lagtv-navbar__page-title {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  max-width: min(42vw, 520px);
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  font-size: 20px;
  color: var(--color-text-primary);
  text-transform: uppercase;
  letter-spacing: 1px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  pointer-events: none;
  z-index: 10;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
}

@media (max-width: 768px) {
  .lagtv-navbar__page-title {
    font-size: 16px;
    letter-spacing: 0.5px;
  }
}

@media (max-width: 480px) {
  .lagtv-navbar__page-title {
    display: none;
  }
}

.lagtv-navbar__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: 'Outfit', sans-serif;
  font-weight: 800;
  font-size: 22px;
  letter-spacing: 0.5px;
  color: var(--color-text-primary);
  cursor: pointer;
  user-select: none;
  border-radius: var(--radius-md);
  padding: 2px 6px;
  margin-left: -6px;
  transition: opacity var(--transition-fast), background var(--transition-fast);
}

.lagtv-navbar__brand:hover {
  background: rgba(255, 255, 255, 0.06);
}

.lagtv-navbar__brand:hover svg {
  color: var(--color-accent-hover);
}

.lagtv-navbar__brand:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.lagtv-navbar__brand svg {
  width: 24px;
  height: 24px;
  color: var(--color-accent);
}

.lagtv-navbar__utility {
  display: flex;
  align-items: center;
  gap: 18px;
}

.lagtv-navbar__util-btn {
  background: transparent;
  border: none;
  color: var(--color-text-secondary);
  cursor: pointer;
  padding: 6px;
  border-radius: 50%;
  transition: color var(--transition-fast), background var(--transition-fast);
}

.lagtv-navbar__util-btn:hover {
  color: var(--color-text-primary);
  background: rgba(255, 255, 255, 0.08);
}

.lagtv-navbar__util-btn svg {
  width: 20px;
  height: 20px;
  display: block;
}

.lagtv-navbar__clock {
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: 14px;
  color: var(--color-text-primary);
  font-variant-numeric: tabular-nums;
  margin-left: 4px;
}

.lagtv-navbar__tabs {
  display: flex;
  align-items: center;
  justify-content: center;
  /* "safe center": em telas onde as abas não cabem (TV com overscan), alinha ao
     início em vez de centralizar — assim a 1ª aba não fica cortada/inalcançável.
     Navegadores sem suporte ignoram e mantêm o center acima. */
  justify-content: safe center;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  /* Deixa uma margem ao rolar uma aba para a vista (D-pad). */
  scroll-padding-inline: 24px;
}

.lagtv-navbar__tabs::-webkit-scrollbar {
  display: none;
}

/* Hamburger button — only visible on mobile */
.lagtv-navbar__hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 4px;
  width: 36px;
  height: 36px;
  padding: 0;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s ease;
}

.lagtv-navbar__hamburger:hover {
  background: rgba(255, 255, 255, 0.08);
}

.lagtv-navbar__hamburger span {
  display: block;
  width: 18px;
  height: 2px;
  background: #fff;
  border-radius: 2px;
  transition: transform 0.25s ease, opacity 0.25s ease;
}

.lagtv-navbar__hamburger.is-open span:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
}

.lagtv-navbar__hamburger.is-open span:nth-child(2) {
  opacity: 0;
}

.lagtv-navbar__hamburger.is-open span:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
}

/* Responsive: condense navbar on mobile */
@media (max-width: 768px) {
  :root {
    --navbar-height: 74px; /* Actual navbar height on mobile */
  }

  .lagtv-navbar {
    padding: 12px 16px 6px;
  }

  /* Permite que o grupo da esquerda encolha (marca trunca se faltar espaço)
     para que o relógio à direita nunca seja empurrado para fora da tela. */
  .lagtv-navbar__left-group {
    min-width: 0;
    flex: 0 1 auto;
  }

  .lagtv-navbar__brand {
    font-size: 18px;
    min-width: 0;
  }

  .lagtv-navbar__brand span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .lagtv-navbar__brand svg {
    flex-shrink: 0;
  }

  .lagtv-navbar__utility {
    gap: 10px;
    flex-shrink: 0;
  }

  .lagtv-navbar__clock {
    flex-shrink: 0;
  }

  .lagtv-navbar__hamburger {
    display: inline-flex;
  }

  .tab-pill {
    padding: 8px 18px;
    font-size: 14px;
  }

  /* Hide tabs row by default — open as drawer */
  .lagtv-navbar__tabs {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    padding: 12px 16px 16px;
    background: #100204;
    border-top: 1px solid rgba(178, 34, 34, 0.3);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.7);
    z-index: 60;
    overflow-x: hidden;
  }

  .lagtv-navbar__tabs.is-open {
    display: flex;
  }

  .lagtv-navbar__tabs .tab-pill {
    text-align: left;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 15px;
  }
}


/* ---------- .lagtv-placeholder — empty state for upcoming pages ---------- */

.lagtv-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 50vh;
  text-align: center;
  padding: var(--space-2xl);
  gap: var(--space-md);
}

.lagtv-placeholder h2 {
  font-family: 'Outfit', sans-serif;
  font-weight: 800;
  font-size: 48px;
  color: var(--color-text-primary);
  margin: 0;
}

.lagtv-placeholder p {
  font-size: 16px;
  color: var(--color-text-secondary);
  max-width: 480px;
  margin: 0;
}

/* version badge inside brand */
.lagtv-navbar__brand .version-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--color-accent);
  color: var(--color-text-primary);
  letter-spacing: 0.5px;
}


/* =====================================================
 * LagTV — Destaques (HomePage) layout
 * ===================================================== */

.lagtv-home {
  padding: 24px 32px 48px;
  display: flex;
  flex-direction: column;
  gap: 40px;
  overflow-y: auto;
  height: 100%;
}

/* ----- Hero row (5 large posters) ----- */

.lagtv-home__hero-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 16px;
}

.lagtv-home__hero-grid .poster-card--hero {
  width: 100%;
}

.lagtv-home__hero-grid .poster-card__media {
  aspect-ratio: 2 / 3;
}

/* ----- Standard rows ----- */

.lagtv-home__row {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.lagtv-home__row.hidden {
  display: none;
}

.lagtv-home__row-title {
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  font-size: 22px;
  color: var(--color-text-primary);
  margin: 0;
  letter-spacing: 0.3px;
}

.lagtv-home__row-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 14px;
}

.lagtv-home__row-grid--large {
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 18px;
}

/* ----- Empty state inside hero ----- */

.lagtv-home__empty {
  grid-column: 1 / -1;
  padding: 48px;
  text-align: center;
  color: var(--color-text-secondary);
  font-size: 14px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: var(--radius-lg);
}

/* ----- Skeleton state while loading ----- */

.poster-card--skeleton {
  pointer-events: none;
}

.poster-card--skeleton .poster-card__media {
  background: linear-gradient(90deg,
    rgba(255, 255, 255, 0.04) 0%,
    rgba(255, 255, 255, 0.08) 50%,
    rgba(255, 255, 255, 0.04) 100%);
  background-size: 200% 100%;
  animation: lagtv-skeleton 1.4s infinite;
}

.poster-card--skeleton .poster-card__title {
  background: rgba(255, 255, 255, 0.06);
  border-radius: 4px;
  color: transparent;
}

@keyframes lagtv-skeleton {
  0%   { background-position:  100% 50%; }
  100% { background-position: -100% 50%; }
}

/* ----- Progress overlay in continue-watching cards ----- */

.poster-card__progress {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  background: rgba(0, 0, 0, 0.5);
  z-index: 2;
}

.poster-card__progress span {
  display: block;
  height: 100%;
  background: var(--color-accent);
}

/* ----- Responsive ----- */

@media (max-width: 1100px) {
  .lagtv-home__hero-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  .lagtv-home__hero-grid .poster-card--hero:nth-child(5) { display: none; }
}

@media (max-width: 768px) {
  .lagtv-home {
    padding: 16px 16px 32px;
    gap: 28px;
  }
  .lagtv-home__hero-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .lagtv-home__hero-grid .poster-card--hero:nth-child(4),
  .lagtv-home__hero-grid .poster-card--hero:nth-child(5) { display: none; }
  .lagtv-home__row-title {
    font-size: 18px;
  }
  .lagtv-home__row-grid {
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 10px;
  }
  .lagtv-home__row-grid--large {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
  }
}

@media (max-width: 480px) {
  .lagtv-home__hero-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}


/* =====================================================
 * LagTV — MoviesPage (sidebar + grid + filter modal)
 * ===================================================== */

/* ───── Custom Scrollbar (Modern & Discrete) ───── */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  border: 3px solid transparent;
  background-clip: content-box;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.25);
  background-clip: content-box;
}

/* Firefox support */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}

.lagtv-movies {
  display: grid;
  grid-template-columns: 210px 1fr;
  gap: 20px;
  height: 100%;
  padding: 0 32px 0 0; /* Padding lateral direito para afastar do scrollbar da janela */
  overflow: hidden;
  box-sizing: border-box;
}

/* ───── Sidebar ───── */

.lagtv-movies__sidebar {
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
  padding: 24px 16px 24px 32px;
  box-sizing: border-box;
}

/* ───── Main column ───── */

.lagtv-movies__main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow-y: auto;
  padding: 24px 20px 24px 8px; /* Padding direito para o scrollbar não cobrir os títulos */
  box-sizing: border-box;
  scroll-behavior: smooth;
}

.lagtv-movies__side-action {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--color-text-primary);
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  border-radius: 999px;
  text-align: left;
  transition: background var(--transition-fast), border-color var(--transition-fast);
}

.lagtv-movies__side-action:hover {
  background: rgba(255,255,255,0.06);
}

.lagtv-movies__filter-btn {
  border-color: var(--color-text-primary);
}

.lagtv-movies__side-action svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.lagtv-movies__search-wrap {
  margin: 4px 0;
}

.lagtv-movies__search-wrap input {
  width: 100%;
  padding: 8px 12px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text-primary);
  font-family: inherit;
  font-size: 13px;
}

.lagtv-movies__search-wrap input:focus {
  outline: none;
  border-color: var(--color-accent);
}

.lagtv-movies__sep {
  border: none;
  border-top: 1px solid var(--color-border);
  margin: 8px 0 4px;
}

.lagtv-movies__cats {
  display: flex;
  flex-direction: column;
}

.lagtv-movies__cat {
  display: block;
  padding: 8px 16px;
  color: var(--color-text-secondary);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  border-left: 2px solid transparent;
  transition: color var(--transition-fast), border-color var(--transition-fast);
}

.lagtv-movies__cat:hover {
  color: var(--color-text-primary);
}

.lagtv-movies__cat--active {
  color: var(--color-accent);
  font-weight: 700;
  border-left-color: var(--color-accent);
}

/* ───── Main column ───── */

.lagtv-movies__main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow-y: auto;
  padding-right: 16px; /* Adicionado espaço para a barra de rolagem não cobrir o conteúdo */
  scrollbar-width: thin;
  scroll-behavior: smooth;
}

.lagtv-movies__crumb {
  display: flex;
  align-items: baseline;
  gap: 14px;
  margin-bottom: 18px;
}

.lagtv-movies__crumb h1 {
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  font-size: 24px;
  color: var(--color-text-primary);
  margin: 0;
  letter-spacing: 0.4px;
}

.lagtv-movies__count {
  color: var(--color-text-muted);
  font-size: 13px;
}

.lagtv-movies__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 18px;
}

.lagtv-movies__empty {
  grid-column: 1 / -1;
  padding: 48px;
  text-align: center;
  color: var(--color-text-secondary);
  font-size: 14px;
}

.lagtv-movies__loader {
  height: 32px;
  margin: 24px 0;
  display: block;
}

/* favorito sobreposto no poster */
.poster-card__fav {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.55);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  color: var(--color-text-secondary);
  z-index: 3;
  transition: color var(--transition-fast), background var(--transition-fast);
}

.poster-card__fav svg {
  width: 16px;
  height: 16px;
}

.poster-card__fav:hover {
  background: rgba(0,0,0,0.8);
}

.poster-card__fav.is-fav {
  color: var(--color-accent);
}

/* ───── Filter modal ───── */

.lagtv-filter-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(26, 4, 8, 0.85);
  backdrop-filter: blur(4px);
}

.lagtv-filter-modal__panel {
  position: relative;
  width: min(1100px, 92vw);
  max-height: 86vh;
  overflow-y: auto;
  padding: 32px 28px 24px;
  background: linear-gradient(135deg, #5C0F1A 0%, #3D0810 100%);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}

.lagtv-filter-modal__close {
  position: absolute;
  top: 12px;
  right: 16px;
  background: transparent;
  border: none;
  color: var(--color-text-primary);
  font-size: 28px;
  cursor: pointer;
}

.lagtv-filter-modal__rows {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.lagtv-filter-row {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 12px;
  align-items: start;
}

.lagtv-filter-row__label {
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: 14px;
  color: var(--color-text-primary);
  padding-top: 6px;
}

.lagtv-filter-row__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.lagtv-filter-modal__actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--color-border);
}

/* ───── Responsive ───── */

@media (max-width: 900px) {
  .lagtv-movies {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 8px 12px;
    overflow: hidden;
    gap: 8px;
  }

  .lagtv-movies__sidebar {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none; /* Firefox */
    gap: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    flex-shrink: 0;
  }

  .lagtv-movies__sidebar::-webkit-scrollbar {
    display: none; /* Safari/Chrome */
  }

  .lagtv-movies__side-action {
    flex-shrink: 0;
    padding: 6px 12px;
    height: 32px;
    font-size: 13px;
    border-radius: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .lagtv-movies__search-wrap {
    flex-shrink: 0;
    width: 150px;
    margin: 0;
  }

  .lagtv-movies__search-wrap input {
    width: 100%;
    padding: 6px 10px;
    font-size: 13px;
  }

  .lagtv-movies__sep {
    display: none;
  }

  .lagtv-movies__cats {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 4px;
    overflow-x: visible;
  }

  .lagtv-movies__cat {
    padding: 6px 12px;
    font-size: 13px;
    white-space: nowrap;
    border-left: none;
    border-bottom: none;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.05);
    transition: background 0.2s, color 0.2s;
  }

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

  .lagtv-movies__cat--active {
    background: var(--color-accent);
    color: var(--color-text-primary) !important;
    font-weight: 700;
  }

  .lagtv-movies__main {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
  }

  .lagtv-movies__crumb {
    margin-bottom: 12px;
  }

  .lagtv-movies__crumb h1 {
    font-size: 18px;
  }

  .lagtv-movies__grid {
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 12px;
  }

  .lagtv-filter-row {
    grid-template-columns: 80px 1fr;
  }
}

/* =====================================================
   LagTV Details Page (Fase 5)
   ===================================================== */
.details-page {
  position: relative;
  height: 100%;
  padding-bottom: 50px;
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--color-bg-primary);
}

.details-backdrop {
  position: fixed;
  top: var(--navbar-height);
  left: 0;
  width: 100%;
  height: calc(100vh - var(--navbar-height));
  background-size: cover;
  background-position: center 20%;
  opacity: 0.6;
  z-index: 1;
  pointer-events: none;
  filter: blur(2px) saturate(1.1);
  transition: background-image 0.5s ease;
}

.details-mask {
  position: fixed;
  top: var(--navbar-height);
  left: 0;
  width: 100%;
  height: calc(100vh - var(--navbar-height));
  background:
    linear-gradient(90deg, rgba(12, 2, 5, 0.88) 0%, rgba(26, 4, 8, 0.45) 50%, rgba(26, 4, 8, 0.08) 100%),
    linear-gradient(180deg, rgba(12, 2, 5, 0.05) 0%, rgba(26, 4, 8, 0.7) 82%, #1A0408 100%);
  z-index: 2;
  pointer-events: none;
}

.details-container {
  position: relative;
  z-index: 3;
  max-width: 1300px;
  margin: 0 auto;
  padding: 40px 24px;
  display: flex;
  flex-direction: column;
  gap: 40px;
}

.details-columns {
  display: grid;
  grid-template-columns: 60% 40%;
  gap: 40px;
  align-items: start;
}

.details-main-info {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.details-back-btn {
  align-self: flex-start;
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 99px;
  color: #fff;
  padding: 8px 18px;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.details-back-btn:hover {
  background: rgba(255, 255, 255, 0.18);
  transform: translateX(-4px);
}

.details-back-btn .icon {
  width: 16px;
  height: 16px;
}

.details-title-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

.details-title {
  font-family: 'Inter', sans-serif;
  font-size: 2.75rem;
  font-weight: 800;
  margin: 0;
  color: #fff;
  line-height: 1.08;
  text-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.details-rating-badge {
  /* Sobrescreve .badge-rating (que é absolute) — aqui é badge inline ao lado do título */
  position: static;
  bottom: auto;
  left: auto;
  font-family: 'Outfit', sans-serif;
  font-size: 16px;
  padding: 4px 10px;
  background: var(--color-rating-bg);
  color: #1A0408;
  font-weight: 800;
  border-radius: var(--radius-sm);
  display: inline-block;
  box-shadow: 0 2px 6px rgba(245, 179, 66, 0.4);
}

.details-meta-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 600;
  color: rgba(255, 232, 232, 0.82);
}

.details-meta-row span:not(:last-child)::after {
  content: "•";
  margin-left: 12px;
  color: var(--color-text-dim);
}

.details-genres {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.details-genres .chip-filter {
  background: rgba(211, 35, 35, 0.18);
  border: 1px solid rgba(255, 95, 95, 0.32);
  color: rgba(255, 232, 232, 0.86);
  cursor: default;
  pointer-events: none;
}

.details-crew {
  font-family: 'Inter', sans-serif;
  font-size: 14.5px;
  color: rgba(255, 226, 226, 0.82);
  display: flex;
  flex-direction: column;
  gap: 7px;
  max-width: 720px;
}

.details-crew p {
  margin: 0;
}

.details-crew strong {
  color: #fff;
  font-weight: 700;
}

.details-synopsis {
  font-family: 'Inter', sans-serif;
  font-size: 16px;
  line-height: 1.65;
  color: rgba(255, 236, 236, 0.86);
  margin: 10px 0;
  max-width: 90%;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
}

.details-synopsis.is-collapsed {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.details-synopsis-toggle {
  align-self: flex-start;
  background: transparent;
  border: 0;
  color: #fff;
  cursor: pointer;
  font: 700 14px/1 'Inter', sans-serif;
  margin: -2px 0 10px;
  padding: 6px 0;
}

.details-synopsis-toggle:hover,
.details-synopsis-toggle:focus-visible {
  color: #ff6b7d;
  outline: none;
}

.details-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 10px;
}

.details-actions .action-bar__btn {
  font-size: 14px;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.details-actions .action-bar__btn svg {
  width: 18px;
  height: 18px;
}

/* Right Column: Preview */
.details-preview {
  width: 100%;
}

.details-preview-box {
  position: relative;
  width: 100%;
  aspect-ratio: 16/9;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, 0.1);
  background: #000;
  box-shadow: var(--shadow-lg);
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.details-preview-box:hover {
  border-color: var(--color-accent);
  box-shadow: 0 0 15px rgba(178, 34, 34, 0.4), var(--shadow-lg);
  transform: scale(1.02);
}

#details-preview-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.details-preview-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--color-text-muted);
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  background: rgba(0, 0, 0, 0.7);
  z-index: 5;
  transition: opacity 0.3s ease;
}

.details-preview-placeholder.hidden {
  opacity: 0;
  pointer-events: none;
}

.details-resume-modal {
  position: fixed;
  inset: 0;
  z-index: 5000;
  display: grid;
  place-items: center;
  padding: 24px;
}

.details-resume-modal.hidden {
  display: none;
}

.details-resume-modal__scrim {
  position: absolute;
  inset: 0;
  background: rgba(8, 1, 3, 0.72);
  backdrop-filter: blur(10px);
}

.details-resume-modal__panel {
  position: relative;
  width: min(520px, 100%);
  padding: 24px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: linear-gradient(180deg, rgba(42, 5, 9, 0.98), rgba(18, 5, 7, 0.98));
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(178, 34, 34, 0.2);
}

.details-resume-modal__eyebrow {
  display: block;
  margin-bottom: 8px;
  color: var(--color-accent-light);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.details-resume-modal__panel h2 {
  margin: 0;
  color: #fff;
  font-family: 'Outfit', sans-serif;
  font-size: 1.75rem;
  line-height: 1.1;
}

.details-resume-modal__panel p {
  margin: 12px 0 0;
  color: var(--color-text-secondary);
  line-height: 1.5;
}

.details-resume-modal__actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 24px;
}

.details-resume-modal__actions .action-bar__btn {
  min-width: 150px;
  justify-content: center;
}

.details-resume-modal__actions .action-bar__btn:focus-visible {
  outline: 2px solid var(--color-accent-light);
  outline-offset: 3px;
}

@media (max-width: 560px) {
  .details-resume-modal__actions {
    flex-direction: column;
  }

  .details-resume-modal__actions .action-bar__btn {
    width: 100%;
  }
}

/* Episodes Panel inside Details */
.details-episodes {
  margin-top: 20px;
}

/* Episódios na coluna da direita (séries em telas grandes): alinha ao topo,
   junto da coluna de texto, em vez de ficar lá embaixo. */
.details-episodes--aside {
  margin-top: 0;
  min-width: 0;
}

.details-episodes h3 {
  font-family: 'Outfit', sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 20px;
  color: #fff;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 8px;
}

/* Recommended Cards */
.details-recommended {
  margin-top: 20px;
}

.details-recommended h3 {
  font-family: 'Outfit', sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 20px;
  color: #fff;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 8px;
}

.details-recommended-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 20px;
}

.details-recommended-grid .poster-card {
  width: 100%;
  margin: 0;
}

/* Responsive details layout */
@media (max-width: 900px) {
  .details-columns {
    grid-template-columns: 1fr;
    gap: 30px;
  }
  .details-title {
    font-size: 2.2rem;
  }
  .details-synopsis {
    max-width: 100%;
  }
  /* Em telas estreitas o grid vira 1 coluna: os episódios empilham abaixo do
     texto, então devolve o espaçamento superior. */
  .details-episodes--aside {
    margin-top: 20px;
  }
}

/* Release Year Badge — unified into the single .badge-year above */

.tmdb-attribution {
  margin-top: 32px;
  padding: 14px 16px;
  border-top: 1px solid var(--color-border);
  color: var(--color-text-muted);
  font-size: 12px;
  text-align: center;
}

.tmdb-attribution a {
  color: var(--color-accent-light);
  text-decoration: none;
}

.tmdb-attribution a:hover {
  text-decoration: underline;
}

/* ─── TMDb job control (Settings → Metadados) ──────────────────────── */

.tmdb-config-status {
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--color-text-muted);
}

.tmdb-config-status.is-ok {
  background: rgba(50, 205, 100, 0.15);
  color: #5fd47e;
}

.tmdb-config-status.is-err {
  background: rgba(220, 60, 60, 0.18);
  color: #ff7a7a;
}

.tmdb-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: flex-end;
  margin: 18px 0 22px;
}

.tmdb-controls .setting-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: var(--color-text-secondary);
}

.tmdb-controls .setting-row input {
  width: 130px;
  padding: 8px 10px;
  background: var(--color-bg-primary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text-primary);
  font-size: 14px;
}

.tmdb-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.tmdb-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.tmdb-stat {
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.tmdb-stat__label {
  font-size: 11px;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.tmdb-stat strong {
  font-size: 22px;
  font-family: 'Outfit', sans-serif;
  color: var(--color-text-primary);
}

.tmdb-stat--ok strong { color: #5fd47e; }
.tmdb-stat--warn strong { color: #f5b342; }
.tmdb-stat--muted strong { color: var(--color-text-muted); }
.tmdb-stat--err strong { color: #ff7a7a; }

.tmdb-danger-zone {
  border-color: rgba(239, 68, 68, 0.28);
  background: linear-gradient(180deg, rgba(239, 68, 68, 0.08), rgba(255, 255, 255, 0.02));
}

.tmdb-danger-zone .hint {
  color: rgba(255, 210, 210, 0.78);
}

/* Manual review: filter chips + list */
.tmdb-filters {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0 12px;
}

.tmdb-search-inline {
  display: flex;
  gap: 6px;
  margin-left: auto;
}

.tmdb-search-inline input {
  min-width: 220px;
  padding: 7px 12px;
  background: var(--color-bg-primary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text-primary);
  font-size: 13px;
}

.tmdb-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.tmdb-row {
  display: grid;
  grid-template-columns: 56px 1fr auto auto;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
}

.tmdb-row__poster {
  width: 56px;
  height: 84px;
  object-fit: cover;
  border-radius: 4px;
  background: var(--color-bg-tertiary);
}

.tmdb-row__poster--empty {
  background: linear-gradient(135deg, rgba(255,255,255,0.04), rgba(255,255,255,0.08));
}

.tmdb-row__name {
  font-weight: 500;
  color: var(--color-text-primary);
  font-size: 14px;
}

.tmdb-row__matched {
  font-size: 12px;
  color: var(--color-text-secondary);
  margin-top: 2px;
}

.tmdb-row__err {
  font-size: 11px;
  color: #ff8585;
  margin-top: 3px;
  font-family: monospace;
}

.tmdb-config-status.is-warn {
  background: rgba(245, 179, 66, 0.18);
  color: #f5b342;
}

.tmdb-config-status.is-muted {
  background: rgba(255, 255, 255, 0.06);
  color: var(--color-text-muted);
}

.tmdb-row__actions {
  display: flex;
  gap: 6px;
}

.tmdb-pagination {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: center;
  margin-top: 14px;
  color: var(--color-text-muted);
  font-size: 13px;
}

/* TMDb picker modal */
.tmdb-picker-results {
  max-height: 60vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tmdb-picker__row {
  display: grid;
  grid-template-columns: 56px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
}

.tmdb-picker__row img {
  width: 56px;
  height: 84px;
  object-fit: cover;
  border-radius: 4px;
}

/* ─── Edit user modal: expiration + welcome fields ─────────────────── */

.form-divider {
  border: 0;
  border-top: 1px solid var(--color-border);
  margin: 20px 0 12px;
}

.expires-row {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.expires-row input[type="datetime-local"] {
  flex: 1;
  min-width: 200px;
}

.expires-infinite {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--color-text-secondary);
  cursor: pointer;
}

.user-badge-error {
  background: rgba(220, 60, 60, 0.18);
  color: #ff7a7a;
}

/* ─── Welcome modal ────────────────────────────────────────────────── */

#lagtv-welcome-modal .lagtv-welcome__block {
  margin-bottom: 18px;
}

#lagtv-welcome-modal .lagtv-welcome__block:last-child {
  margin-bottom: 0;
}

#lagtv-welcome-modal h4 {
  margin: 0 0 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-accent-light);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

#lagtv-welcome-modal p {
  margin: 0;
  white-space: pre-wrap;
  line-height: 1.5;
  color: var(--color-text-primary);
}

/* Episode progress bar in details seasons list */
.episode-item {
  position: relative;
}

.episode-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
}

.episode-progress span {
  display: block;
  height: 100%;
  background: var(--color-accent, #B22222);
}

/* LagTV Sports */
.lagtv-sports {
  padding: 28px clamp(16px, 3vw, 40px) 44px;
  min-height: calc(100vh - 130px);
}

.lagtv-sports__top {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 12px;
}

.lagtv-sports__eyebrow {
  margin: 0 0 4px;
  color: var(--color-accent-light);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.lagtv-sports__top h1 {
  margin: 0;
  color: #fff;
  font-family: 'Outfit', sans-serif;
  font-size: 34px;
  line-height: 1;
}

.lagtv-sports__controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.lagtv-sports__date {
  height: 38px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(0, 0, 0, 0.28);
  color: #fff;
  padding: 0 10px;
  font: inherit;
}

.lagtv-sports__meta {
  color: var(--color-text-muted);
  font-size: 13px;
  margin-bottom: 22px;
}

.lagtv-sports__content {
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.lagtv-sports__league {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.lagtv-sports__league-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.lagtv-sports__league-head img {
  width: 28px;
  height: 28px;
  object-fit: contain;
}

.lagtv-sports__league-head h2 {
  margin: 0;
  color: #fff;
  font-size: 20px;
  line-height: 1.2;
}

.lagtv-sports__league-head span {
  min-width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  color: var(--color-text-muted);
  font-size: 12px;
  font-weight: 800;
}

.lagtv-sports__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 12px;
}

.lagtv-sports-card {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 14px;
  padding: 14px;
  border-radius: var(--radius-md);
  background: rgba(24, 4, 8, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.22);
}

.lagtv-sports-card__time {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 96px;
  border-radius: var(--radius-sm);
  background: rgba(178, 34, 34, 0.16);
  border: 1px solid rgba(178, 34, 34, 0.24);
}

.lagtv-sports-card__time strong {
  color: #fff;
  font-size: 18px;
}

.lagtv-sports-card__time span {
  color: var(--color-text-muted);
  font-size: 12px;
}

.lagtv-sports-card__teams,
.lagtv-sports-card__channel,
.lagtv-sports-card__watch {
  grid-column: 2;
}

.lagtv-sports-card__teams {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
}

.lagtv-sports-card__team {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.lagtv-sports-card__team:last-child {
  justify-content: flex-end;
  text-align: right;
}

.lagtv-sports-card__team img {
  width: 32px;
  height: 32px;
  object-fit: contain;
  flex: 0 0 auto;
}

.lagtv-sports-card__team span {
  color: #fff;
  font-weight: 800;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.lagtv-sports-card__versus {
  color: var(--color-text-dim);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.lagtv-sports-card__channel {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  padding: 10px 0 2px;
}

.lagtv-sports-card__channel span {
  color: var(--color-accent-light);
  font-size: 12px;
  font-weight: 800;
}

.lagtv-sports-card__channel strong {
  color: #fff;
  font-size: 14px;
}

.lagtv-sports-card__channel small {
  color: var(--color-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lagtv-sports-card__watch {
  width: max-content;
  min-width: 108px;
  justify-content: center;
}

.lagtv-sports-card__watch:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.lagtv-sports__empty,
.lagtv-sports__skeleton {
  border-radius: var(--radius-md);
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.lagtv-sports__empty {
  padding: 28px;
  color: var(--color-text-muted);
}

.lagtv-sports__skeleton {
  height: 126px;
  overflow: hidden;
  position: relative;
}

.lagtv-sports__skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.08), transparent);
  animation: lagtv-skeleton 1.15s infinite;
}

@media (max-width: 760px) {
  .watch-remote-hints {
    display: none;
  }

  .watch-tv-thumbnail {
    max-width: calc(100vw - 32px);
    right: 16px;
    left: 16px;
  }

  .watch-info-panel {
    width: calc(100% - 28px);
  }

  .lagtv-sports__top {
    align-items: flex-start;
    flex-direction: column;
  }

  .lagtv-sports__controls {
    justify-content: flex-start;
  }

  .lagtv-sports__grid {
    grid-template-columns: 1fr;
  }

  .lagtv-sports-card {
    grid-template-columns: 1fr;
  }

  .lagtv-sports-card__teams,
  .lagtv-sports-card__channel,
  .lagtv-sports-card__watch {
    grid-column: 1;
  }

  .lagtv-sports-card__time {
    min-height: 54px;
    flex-direction: row;
    gap: 8px;
  }
}

@media (max-height: 820px) {
  .watch-bottom-bar {
    padding-top: 8px;
    padding-bottom: calc(10px + var(--safe-area-inset-bottom));
  }

  .watch-tv-thumbnail {
    display: none;
  }

  .watch-progress-container {
    margin-bottom: 6px;
  }

  .watch-remote-hints {
    gap: 6px 12px;
    margin-bottom: 6px;
    font-size: 11px;
  }

  .watch-btn {
    width: 38px;
    height: 38px;
  }

  .watch-btn-lg {
    width: 54px;
    height: 54px;
  }
}

/* ===== Mini-player (preview flutuante) =====
   - body.has-mini-vod  → episódio/filme tocando no canto inferior direito
   - body.has-mini-live → canal de TV ao vivo no canto inferior direito
*/

.mini-player-frame {
  display: none;
}

/* === VOD mini (#page-watch) === */
body.has-mini-vod #page-watch {
  display: block !important;
  position: fixed !important;
  bottom: 16px;
  right: 16px;
  width: 340px;
  max-width: 60vw;
  height: auto;
  aspect-ratio: 16 / 9;
  z-index: 9000;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: #000;
  cursor: pointer;
}

body.has-mini-vod #page-watch .watch-video-section {
  position: relative;
  width: 100% !important;
  height: 100% !important;
  padding: 0 !important;
  margin: 0 !important;
}

body.has-mini-vod #page-watch video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

body.has-mini-vod #page-watch .watch-overlay,
body.has-mini-vod #page-watch .watch-details-section,
body.has-mini-vod #page-watch .watch-next-episode,
body.has-mini-vod #page-watch .watch-info-panel,
body.has-mini-vod #page-watch #watch-scroll-hint,
body.has-mini-vod #page-watch .watch-bottom-bar,
body.has-mini-vod #page-watch .watch-top-bar {
  display: none !important;
}

body.has-mini-vod #page-watch .mini-player-frame { display: flex; }

/* === Live mini (#page-live) === */
body.has-mini-live #page-live {
  display: block !important;
  position: fixed !important;
  bottom: 16px;
  right: 16px;
  width: 340px;
  max-width: 60vw;
  height: auto;
  aspect-ratio: 16 / 9;
  z-index: 9000;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: #000;
  cursor: pointer;
}

body.has-mini-live #page-live .home-layout,
body.has-mini-live #page-live .home-layout > * {
  display: none !important;
}

body.has-mini-live #page-live .home-layout .player-section,
body.has-mini-live #page-live .home-layout {
  display: block !important;
}

body.has-mini-live #page-live .channel-sidebar,
body.has-mini-live #page-live .channel-sidebar-overlay,
body.has-mini-live #page-live .channel-toggle-btn,
body.has-mini-live #page-live .sidebar-expand-btn {
  display: none !important;
}

body.has-mini-live #page-live .player-section {
  position: relative;
  width: 100% !important;
  height: 100% !important;
  padding: 0 !important;
  margin: 0 !important;
}

body.has-mini-live #page-live .video-container {
  width: 100% !important;
  height: 100% !important;
  border-radius: 0 !important;
  overflow: hidden;
}

body.has-mini-live #page-live #video-player {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

body.has-mini-live #page-live #player-controls-overlay,
body.has-mini-live #page-live #player-overlay,
body.has-mini-live #page-live #now-playing {
  display: none !important;
}

body.has-mini-live #page-live .mini-player-frame { display: flex; }

/* === Moldura comum (título + botões) === */
.mini-player-frame {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: none;
  align-items: center;
  gap: 8px;
  padding: 6px 8px 6px 12px;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.85) 0%, rgba(0, 0, 0, 0.5) 70%, transparent 100%);
  z-index: 10;
  pointer-events: none;
}

.mini-player-title {
  flex: 1;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}

.mini-player-btn {
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.55);
  border: none;
  border-radius: 50%;
  color: #fff;
  cursor: pointer;
  padding: 0;
  pointer-events: auto;
  flex-shrink: 0;
}

.mini-player-btn:hover {
  background: var(--color-accent);
}

.mini-player-btn svg {
  width: 15px;
  height: 15px;
}

/* Esconde a "now playing" pill da navbar quando algum mini está ativo,
   já que o título passa a ser exibido dentro da moldura do mini. */
body.has-mini-vod .now-playing-indicator,
body.has-mini-live .now-playing-indicator {
  display: none !important;
}

@media (max-width: 768px) {
  body.has-mini-vod #page-watch,
  body.has-mini-live #page-live {
    width: 200px;
    bottom: 80px;
    right: 12px;
  }
  .mini-player-title { font-size: 11px; }
}

/* ===== History / Minhas Listas page (reusa o layout sidebar+grid de Filmes/Séries) ===== */

/* Em telas touch, mostrar o botão remover sempre (sem depender de hover) */
@media (hover: none), (max-width: 768px) {
  #page-history .poster-card__remove {
    opacity: 1;
  }
}

/* Subtítulo (T1 • E5) e texto de progresso ("Parou em 40min de 1:20h") */
.poster-card__sub {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--color-text-secondary);
  letter-spacing: 0.3px;
}

.poster-card__progress-text {
  margin: 4px 0 0;
  font-size: 11px;
  color: var(--color-accent);
  font-weight: 500;
}

/* Selo da lista de origem (mostrado quando há busca cross-list) */
.badge-source {
  position: absolute;
  top: 6px;
  left: 6px;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: #fff;
  background: rgba(0, 0, 0, 0.7);
  z-index: 3;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}

.badge-source--history    { background: rgba(178, 34, 34, 0.92); }   /* accent (vinho) */
.badge-source--favorites  { background: rgba(245, 179, 66, 0.92); color: #1A0408; }
.badge-source--watchlist  { background: rgba(99, 102, 241, 0.92); }  /* indigo */


/* =====================================================
   Live Timeline (TV Split-View EPG Timeline under Player)
   ===================================================== */
.live-timeline {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--color-bg-secondary);
  border-top: 1px solid var(--color-border);
  padding: 10px 16px;
  flex-shrink: 0;
  z-index: 10;
  box-shadow: var(--shadow-lg);
  transition: all var(--transition-normal);
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  box-sizing: border-box;
}

/* Hide timeline when empty (no channel selected) */
.live-timeline.is-empty {
  display: none !important;
}

.live-timeline__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
}

.live-timeline__channel {
  color: var(--color-accent-hover);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.live-timeline__now {
  color: var(--color-text-muted);
  font-family: monospace;
  font-weight: 500;
}

.live-timeline__track {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  overflow-y: hidden;
  position: relative;
  padding: 4px 0 8px;
  user-select: none;
  min-width: 0;
  max-width: 100%;
  cursor: grab;
  scroll-behavior: auto;
  overscroll-behavior-x: contain;
  touch-action: pan-x;
  scrollbar-width: thin;
  scrollbar-color: var(--color-border-light) transparent;
}

.live-timeline__track.is-dragging {
  cursor: grabbing;
}

.live-timeline__track.is-dragging .live-timeline__block {
  pointer-events: none;
}

/* Scrollbar styling */
.live-timeline__track::-webkit-scrollbar {
  height: 6px;
}

.live-timeline__track::-webkit-scrollbar-thumb {
  background: var(--color-border-light);
  border-radius: var(--radius-full);
}

.live-timeline__track::-webkit-scrollbar-track {
  background: transparent;
}

/* EPG Block in Timeline */
.live-timeline__block {
  flex-shrink: 0;
  height: 48px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
  overflow: hidden;
}

.live-timeline__block:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--color-border-light);
  transform: translateY(-1px);
}

.live-timeline__block.is-past {
  opacity: 0.45;
}

.live-timeline__block.is-current {
  background: linear-gradient(135deg, var(--color-accent-deep), var(--color-accent));
  border-color: var(--color-accent-hover);
  box-shadow: 0 0 12px rgba(178, 34, 34, 0.4);
}

.live-timeline__block.is-current .live-timeline__block-title {
  color: #FFFFFF;
  font-weight: 600;
}

.live-timeline__block.is-current .live-timeline__block-time {
  color: rgba(255, 255, 255, 0.75);
}

.live-timeline__block.has-reminder {
  border-color: var(--color-warning);
}

.live-timeline__block.has-reminder::after {
  content: '🔔';
  position: absolute;
  top: 4px;
  right: 6px;
  font-size: 0.65rem;
}

.live-timeline__block-title {
  font-size: 0.82rem;
  color: var(--color-text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}

.live-timeline__block-time {
  font-size: 0.68rem;
  color: var(--color-text-muted);
  margin-top: 2px;
  font-family: monospace;
}

.live-timeline__empty {
  width: 100%;
  padding: 12px 0;
  text-align: center;
  color: var(--color-text-muted);
  font-style: italic;
  font-size: 0.85rem;
}

/* Vertical Current-Time Indicator Line */
.live-timeline__now-line {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--color-accent-hover);
  box-shadow: 0 0 8px var(--color-accent-hover);
  pointer-events: none;
  z-index: 5;
}

/* Watch Rooms */
.watch-room-panel {
  position: fixed;
  top: 96px;
  right: 16px;
  width: min(360px, calc(100vw - 32px));
  max-height: calc(100vh - 128px);
  z-index: 1700;
  color: var(--color-text-primary);
  pointer-events: none;
}

.watch-room-panel__body {
  pointer-events: auto;
  background: rgba(12, 12, 16, 0.94);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xl);
  overflow: hidden;
  backdrop-filter: blur(18px);
}

.watch-room-panel header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--color-border);
}

.watch-room-panel__eyebrow {
  display: block;
  font-size: 0.7rem;
  text-transform: uppercase;
  color: var(--color-text-muted);
  letter-spacing: 0.08em;
}

.watch-room-panel h3,
.watch-room-panel h4 {
  margin: 0;
  line-height: 1.2;
}

.watch-room-panel h3 {
  font-size: 1rem;
}

.watch-room-panel h4 {
  font-size: 0.8rem;
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.watch-room-panel__close,
.watch-room-panel__toggle,
.watch-room-panel__invite {
  border: 0;
  color: var(--color-text-primary);
  background: rgba(255, 255, 255, 0.08);
  cursor: pointer;
}

.watch-room-panel__actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.watch-room-panel__invite {
  min-height: 32px;
  border-radius: var(--radius-sm);
  padding: 0 10px;
  background: var(--color-accent);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 700;
}

.watch-room-panel__close {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  font-size: 1.4rem;
  line-height: 1;
}

.watch-room-panel__toggle {
  display: none;
  pointer-events: auto;
  margin-left: auto;
  padding: 10px 14px;
  border-radius: var(--radius-full);
  background: var(--color-accent);
  font-weight: 700;
  box-shadow: var(--shadow-lg);
}

.watch-room-panel.is-collapsed .watch-room-panel__body {
  display: none;
}

.watch-room-panel.is-collapsed .watch-room-panel__toggle {
  display: block;
}

.watch-room-section {
  padding: 12px 16px;
  border-bottom: 1px solid var(--color-border);
}

.watch-room-section:last-child {
  border-bottom: 0;
}

/* Histórico comprimido: cabeçalho clicável que expande/recolhe a lista. */
.watch-room-history-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--color-text-secondary);
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  cursor: pointer;
}

.watch-room-history-caret {
  transition: transform var(--transition-fast);
}

.watch-room-section--history:not(.is-collapsed) .watch-room-history-caret {
  transform: rotate(90deg);
}

.watch-room-section--history.is-collapsed #watch-room-events {
  display: none;
}

#watch-room-participants,
#watch-room-events,
#watch-room-messages {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}

#watch-room-events,
#watch-room-messages {
  max-height: 150px;
  overflow: auto;
  scrollbar-width: thin;
}

.watch-room-participant,
.watch-room-message,
.watch-room-event {
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.05);
  padding: 8px 10px;
}

.watch-room-participant {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.watch-room-participant strong,
.watch-room-message strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.watch-room-participant span,
.watch-room-event {
  color: var(--color-text-muted);
  font-size: 0.82rem;
}

.watch-room-control {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--color-text-secondary);
  font-size: 0.82rem;
  white-space: nowrap;
}

.watch-room-message {
  display: grid;
  gap: 4px;
}

.watch-room-message span {
  color: var(--color-text-secondary);
  overflow-wrap: anywhere;
}

.watch-room-message__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.watch-room-message__time {
  flex-shrink: 0;
  color: var(--color-accent);
  font-size: 0.72rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

#watch-room-chat-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  margin-top: 10px;
}

#watch-room-chat-input {
  min-width: 0;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.07);
  color: var(--color-text-primary);
  padding: 9px 10px;
}

#watch-room-chat-form button {
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--color-accent);
  color: #fff;
  padding: 0 12px;
  font-weight: 700;
  cursor: pointer;
}

.watch-room-toast {
  position: fixed;
  top: max(24px, env(safe-area-inset-top, 0px) + 16px);
  right: 24px;
  z-index: 2500;
  width: min(340px, calc(100vw - 48px));
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: rgba(10, 10, 14, 0.9);
  border: 1px solid var(--color-border-light);
  color: var(--color-text-primary);
  box-shadow: var(--shadow-xl);
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity var(--transition-fast), transform var(--transition-fast);
  pointer-events: none;
}

.watch-room-toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.watch-room-toast strong,
.watch-room-toast span {
  display: block;
}

.watch-room-toast span {
  margin-top: 3px;
  color: var(--color-text-secondary);
  overflow-wrap: anywhere;
}

.watch-room-share {
  display: grid;
  gap: 14px;
}

.watch-room-share img {
  width: 240px;
  height: 240px;
  justify-self: center;
  border-radius: var(--radius-sm);
  background: #fff;
  padding: 10px;
}

@media (max-width: 768px) {
  .watch-room-panel {
    top: auto;
    right: 10px;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 10px);
    width: calc(100vw - 20px);
    max-height: min(70vh, 620px);
  }

  .watch-room-panel__body {
    max-height: min(70vh, 620px);
    overflow: auto;
  }
}


