/* ============================================
   NUHA TV — Netflix-Style Design System
   ============================================ */

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

/* --- CSS Variables --- */
:root {
  --bg-primary: #141414;
  --bg-secondary: #1a1a1a;
  --bg-tertiary: #222;
  --bg-elevated: #2a2a2a;
  --surface: rgba(30, 30, 30, 0.9);
  --surface-hover: rgba(50, 50, 50, 0.9);
  --accent: #e50914;
  --accent-hover: #f40612;
  --accent-dark: #b20710;
  --white: #ffffff;
  --text-primary: #e5e5e5;
  --text-secondary: #999;
  --text-muted: #666;
  --border-color: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(255, 255, 255, 0.5);
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --shadow-card: 0 2px 8px rgba(0, 0, 0, 0.6);
  --shadow-card-hover: 0 8px 40px rgba(0, 0, 0, 0.8);
  --shadow-glow: 0 0 20px rgba(229, 9, 20, 0.3);
  --transition-fast: 0.15s ease;
  --transition-normal: 0.3s ease;
  --transition-slow: 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  --header-height: 68px;
  --category-bar-height: 50px;
}

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

html {
  font-size: 16px;
  -webkit-tap-highlight-color: transparent;
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.4;
  overflow-x: hidden;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

/* ============================================
   LOGIN SCREEN — Premium Glassmorphism
   ============================================ */
.login-overlay {
  position: fixed;
  inset: 0;
  background: linear-gradient(135deg, #0a0a0f 0%, #141428 30%, #0d0d1a 60%, #141414 100%);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease;
}

.login-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

.login-container {
  width: 92%;
  max-width: 400px;
  padding: 48px 36px 36px;
  background: linear-gradient(165deg, rgba(30, 30, 50, 0.8) 0%, rgba(20, 20, 35, 0.9) 100%);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 28px;
  text-align: center;
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(40px);
  -webkit-backdrop-filter: blur(40px);
  box-shadow:
    0 25px 60px rgba(0, 0, 0, 0.7),
    0 0 100px rgba(229, 9, 20, 0.05),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
  animation: loginSlideUp 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes loginSlideUp {
  from { transform: translateY(30px) scale(0.95); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

.login-glow {
  position: absolute;
  top: -60px;
  left: 50%;
  transform: translateX(-50%);
  width: 250px;
  height: 250px;
  background: radial-gradient(circle, rgba(229, 9, 20, 0.2) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
}

.login-logo {
  width: 80px;
  height: 80px;
  border-radius: 20px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  margin-bottom: 20px;
  position: relative;
  z-index: 1;
  animation: iconFloat 3s ease-in-out infinite;
}

.login-title {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--white);
  margin-bottom: 6px;
  position: relative;
  z-index: 1;
  letter-spacing: -0.5px;
}

.login-subtitle {
  font-size: 0.88rem;
  color: rgba(255, 255, 255, 0.45);
  margin-bottom: 32px;
  position: relative;
  z-index: 1;
}

.login-form {
  position: relative;
  z-index: 1;
}

.login-input-group {
  position: relative;
  margin-bottom: 16px;
}

.login-input-group svg {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--text-muted);
  pointer-events: none;
  transition: color 0.2s;
  z-index: 2;
}

.login-input-group:focus-within svg {
  color: var(--accent);
}

.login-input {
  width: 100%;
  padding: 14px 16px 14px 48px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  color: var(--white);
  font-family: inherit;
  font-size: 0.95rem;
  outline: none;
  transition: all 0.3s ease;
}

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

.login-input:focus {
  border-color: var(--accent);
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 0 0 3px rgba(229, 9, 20, 0.15);
}

.login-error {
  font-size: 0.82rem;
  color: #ff4757;
  min-height: 20px;
  margin-bottom: 8px;
  transition: all 0.2s;
}

.login-btn {
  width: 100%;
  padding: 14px 24px;
  background: linear-gradient(135deg, var(--accent) 0%, #ff1a2d 100%);
  color: var(--white);
  border: none;
  border-radius: 14px;
  font-family: inherit;
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.25s ease;
  outline: none;
  box-shadow: 0 4px 20px rgba(229, 9, 20, 0.35);
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.login-btn:hover {
  background: linear-gradient(135deg, #ff1a2d 0%, #ff3344 100%);
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(229, 9, 20, 0.5);
}

.login-btn:active {
  transform: translateY(0);
}

.login-btn:focus-visible,
.login-btn.tv-focus {
  outline: 2px solid var(--white);
  outline-offset: 4px;
}

.login-btn-spinner {
  display: none;
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: var(--white);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

.login-btn.loading .login-btn-text {
  opacity: 0.5;
}

.login-btn.loading .login-btn-spinner {
  display: block;
}

.login-footer {
  margin-top: 28px;
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.2);
  position: relative;
  z-index: 1;
}

/* ============================================
   KICKED OUT MODAL
   ============================================ */
.kicked-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 2100;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
}

.kicked-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

.kicked-modal {
  width: 90%;
  max-width: 380px;
  padding: 40px 32px;
  background: linear-gradient(165deg, #1e1e2e 0%, #151520 100%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 24px;
  text-align: center;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.7);
  animation: loginSlideUp 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.kicked-icon {
  width: 56px;
  height: 56px;
  color: #ff4757;
  margin-bottom: 20px;
}

.kicked-modal h2 {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--white);
  margin-bottom: 12px;
}

.kicked-modal p {
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.55);
  line-height: 1.6;
  margin-bottom: 4px;
}

.kicked-sub {
  font-size: 0.78rem !important;
  color: rgba(255, 255, 255, 0.3) !important;
  margin-bottom: 24px !important;
}

.kicked-btn {
  width: 100%;
  padding: 14px 24px;
  background: linear-gradient(135deg, var(--accent) 0%, #ff1a2d 100%);
  color: var(--white);
  border: none;
  border-radius: 14px;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.25s ease;
  outline: none;
  box-shadow: 0 4px 20px rgba(229, 9, 20, 0.35);
}

.kicked-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(229, 9, 20, 0.5);
}

.kicked-btn:focus-visible {
  outline: 2px solid var(--white);
  outline-offset: 4px;
}

/* ============================================
   HEADER — Clean 3-column navbar
   ============================================ */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.92) 0%, rgba(0, 0, 0, 0.75) 60%, transparent 100%);
  display: flex;
  align-items: center;
  padding: 0 4%;
  z-index: 100;
  transition: background var(--transition-normal);
  gap: 16px;
}

.header.scrolled {
  background: rgba(12, 12, 12, 0.98);
  box-shadow: 0 1px 12px rgba(0, 0, 0, 0.5);
}

/* --- Logo with white background --- */
.header-logo {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  background: #ffffff !important;
  border-radius: 10px;
  padding: 6px 12px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(255, 255, 255, 0.15);
  transition: all var(--transition-normal);
  cursor: pointer;
}

.header-logo:hover {
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
}

.header-banner-logo {
  height: 36px;
  width: auto;
  object-fit: contain;
  display: block;
  transition: all var(--transition-fast);
}

/* --- Always-visible Search Bar (center) --- */
.search-bar {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
}

.search-bar-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  pointer-events: none;
  transition: color var(--transition-fast);
  z-index: 2;
}

.search-bar:focus-within .search-bar-icon {
  color: var(--white);
}

.search-bar-input {
  width: 100%;
  padding: 9px 14px 9px 38px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 100px;
  color: var(--white);
  font-family: inherit;
  font-size: 0.85rem;
  outline: none;
  transition: all var(--transition-normal);
}

.search-bar-input::placeholder {
  color: var(--text-muted);
  font-weight: 400;
}

.search-bar-input:focus,
.search-bar-input.tv-focus {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.35);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.06);
}

/* --- Header Logout Button --- */
.header-logout-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-normal);
}

.header-logout-btn:hover {
  background: rgba(255, 71, 87, 0.15);
  border-color: rgba(255, 71, 87, 0.3);
  color: #ff4757;
  transform: translateY(-1px);
}

.header-logout-btn:focus-visible,
.header-logout-btn.tv-focus {
  outline: 2px solid var(--white);
  outline-offset: 2px;
}

.header-logout-btn svg {
  width: 18px;
  height: 18px;
}

/* --- Header Install App Button (right) --- */
.header-install-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent) 0%, #ff1a2d 100%);
  border: none;
  color: var(--white);
  cursor: pointer;
  transition: all var(--transition-normal);
  box-shadow: 0 2px 10px rgba(229, 9, 20, 0.3);
  position: relative;
  overflow: hidden;
}

.header-install-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(255,255,255,0.15) 0%, transparent 50%);
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.header-install-btn:hover {
  transform: translateY(-2px) scale(1.08);
  box-shadow: 0 6px 20px rgba(229, 9, 20, 0.45);
}

.header-install-btn:hover::before {
  opacity: 1;
}

.header-install-btn:active {
  transform: translateY(0) scale(0.96);
}

.header-install-btn:focus-visible,
.header-install-btn.tv-focus {
  outline: 2px solid var(--white);
  outline-offset: 2px;
}

.header-install-btn svg {
  width: 20px;
  height: 20px;
  position: relative;
  z-index: 1;
}

/* Subtle pulse animation when install is available */
.header-install-btn.pulse {
  animation: installPulse 2s ease-in-out infinite;
}

@keyframes installPulse {
  0%, 100% { box-shadow: 0 2px 10px rgba(229, 9, 20, 0.3); }
  50% { box-shadow: 0 2px 20px rgba(229, 9, 20, 0.6), 0 0 0 6px rgba(229, 9, 20, 0.1); }
}

/* Hide install button when app is installed */
.header-install-btn.hidden {
  display: none;
}

/* Installed state — shows checkmark, no pulse */
.header-install-btn.installed {
  background: linear-gradient(135deg, #1db954 0%, #1ed760 100%);
  box-shadow: 0 2px 10px rgba(29, 185, 84, 0.3);
  animation: none;
  pointer-events: none;
}

/* ============================================
   CATEGORY BAR — Netflix row selector
   ============================================ */
.category-bar {
  position: fixed;
  top: var(--header-height);
  left: 0;
  right: 0;
  height: var(--category-bar-height);
  background: linear-gradient(to bottom, rgba(20, 20, 20, 0.95) 0%, rgba(20, 20, 20, 0.8) 80%, transparent 100%);
  display: flex;
  align-items: center;
  padding: 0 4%;
  gap: 6px;
  overflow-x: auto;
  overflow-y: hidden;
  z-index: 99;
  scrollbar-width: none;
}

.category-bar::-webkit-scrollbar {
  display: none;
}

.category-pill {
  padding: 6px 16px;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 100px;
  color: var(--text-primary);
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition-normal);
  user-select: none;
  flex-shrink: 0;
  outline: none;
  letter-spacing: 0.3px;
}

.category-pill:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.4);
  color: var(--white);
}

.category-pill.active {
  background: var(--white);
  color: #000;
  border-color: var(--white);
  font-weight: 600;
}

.category-pill:focus-visible,
.category-pill.tv-focus {
  outline: 2px solid var(--white);
  outline-offset: 2px;
}

/* ============================================
   CHANNEL GRID — Netflix card layout
   ============================================ */
.main-content {
  padding-top: calc(var(--header-height) + var(--category-bar-height) + 12px);
  padding-bottom: 60px;
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

.channel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 6px;
  padding: 0 4%;
  max-width: 1920px;
  margin: 0 auto;
}

.channel-card {
  position: relative;
  aspect-ratio: 16 / 9;
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  overflow: hidden;
  transition: all var(--transition-normal), transform 0.35s cubic-bezier(0.25, 0.1, 0.25, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  outline: none;
  border: none;
  transform-origin: center;
}

.channel-card:hover {
  transform: scale(1.15);
  z-index: 10;
  box-shadow: var(--shadow-card-hover);
  border-radius: var(--radius-md);
}

/* Subtle white border on hover */
.channel-card:hover::after {
  content: '';
  position: absolute;
  inset: 0;
  border: 2px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-md);
  pointer-events: none;
  z-index: 3;
}

/* TV Focus state — HIGHLY VISIBLE for remote navigation */
.channel-card:focus-visible,
.channel-card.tv-focus {
  outline: none;
  transform: scale(1.18);
  z-index: 10;
  box-shadow: 0 0 0 3px var(--white), 0 0 20px rgba(255, 255, 255, 0.2), var(--shadow-card-hover);
  border-radius: var(--radius-md);
}

.channel-logo {
  width: 55%;
  height: 55%;
  object-fit: contain;
  position: relative;
  z-index: 1;
  filter: brightness(0.95);
  transition: all var(--transition-normal);
}

.channel-card:hover .channel-logo,
.channel-card.tv-focus .channel-logo {
  filter: brightness(1.1);
  transform: scale(1.05);
}

/* Fallback — styled letter */
.channel-logo-fallback {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #333 0%, #555 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--white);
  position: relative;
  z-index: 1;
  letter-spacing: -1px;
}

/* Empty state */
.grid-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 100px 20px;
  color: var(--text-muted);
}

.grid-empty svg {
  width: 56px;
  height: 56px;
  margin-bottom: 16px;
  opacity: 0.3;
}

.grid-empty p {
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--text-secondary);
}

/* Skeleton loading */
.channel-skeleton {
  aspect-ratio: 16 / 9;
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  position: relative;
  overflow: hidden;
}

.channel-skeleton::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 25%, rgba(255,255,255,0.02) 50%, transparent 75%);
  animation: shimmer 1.8s infinite;
}

@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* ============================================
   VIDEO PLAYER OVERLAY — Cinematic
   ============================================ */
.player-overlay {
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 200;
  display: none;
  flex-direction: column;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.player-overlay.active {
  display: flex;
  opacity: 1;
}

.player-video-container {
  position: relative;
  width: 100%;
  height: 100%;
  background: #000;
}

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

/* Player Info — top gradient */
.player-info {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  padding: 20px 4%;
  background: linear-gradient(to bottom, rgba(0,0,0,0.8) 0%, rgba(0,0,0,0.4) 60%, transparent 100%);
  display: flex;
  align-items: center;
  gap: 14px;
  opacity: 0;
  transform: translateY(-8px);
  transition: all var(--transition-slow);
  z-index: 5;
}

.player-overlay.show-controls .player-info {
  opacity: 1;
  transform: translateY(0);
}

.player-info-text h2 {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--white);
  margin-bottom: 1px;
}

.player-info-text span {
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.5);
  font-weight: 400;
}

.player-back-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  flex-shrink: 0;
  outline: none;
}

.player-back-btn:hover,
.player-back-btn:focus-visible {
  background: rgba(255, 255, 255, 0.25);
  transform: scale(1.1);
}

/* Player Controls — bottom */
.player-controls {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 20px 4%;
  background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0.4) 60%, transparent 100%);
  display: flex;
  align-items: center;
  gap: 10px;
  opacity: 0;
  transform: translateY(8px);
  transition: all var(--transition-slow);
  z-index: 5;
}

.player-overlay.show-controls .player-controls {
  opacity: 1;
  transform: translateY(0);
}

.ctrl-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: transparent;
  border: none;
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  outline: none;
  flex-shrink: 0;
}

.ctrl-btn:hover,
.ctrl-btn:focus-visible {
  background: rgba(255, 255, 255, 0.15);
  transform: scale(1.15);
}

.ctrl-btn svg {
  width: 22px;
  height: 22px;
}

.ctrl-spacer {
  flex: 1;
}

/* Volume */
.volume-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.volume-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 70px;
  height: 3px;
  background: rgba(255, 255, 255, 0.25);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
  opacity: 0;
  width: 0;
  transition: all 0.3s ease;
}

.volume-group:hover .volume-slider {
  opacity: 1;
  width: 70px;
}

.volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
}

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

/* Reconnecting indicator */
.player-reconnecting {
  position: absolute;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 10px 24px;
  border-radius: 100px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  z-index: 10;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.player-reconnecting.visible {
  opacity: 1;
}

.player-reconnecting span {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.7);
  font-weight: 500;
}

.reconnect-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.15);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

/* Channel switch toast */
.channel-switch-toast {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.85);
  background: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-lg);
  padding: 28px 48px;
  text-align: center;
  z-index: 300;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.channel-switch-toast.visible {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.channel-switch-toast h3 {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--white);
  margin-bottom: 4px;
}

.channel-switch-toast p {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.4);
  font-weight: 400;
}

/* Loading spinner */
.player-loading {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 4;
}

.player-spinner {
  width: 44px;
  height: 44px;
  border: 3px solid rgba(255, 255, 255, 0.08);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

/* ============================================
   VOLUME OSD — TV Remote Display
   ============================================ */
.volume-osd {
  position: fixed;
  top: 50%;
  right: 40px;
  transform: translateY(-50%) translateX(20px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  padding: 20px 16px;
  z-index: 310;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.volume-osd.visible {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}

.volume-osd-icon {
  width: 28px;
  height: 28px;
  color: var(--white);
}

.volume-osd-bar {
  width: 6px;
  height: 100px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 3px;
  overflow: hidden;
  position: relative;
  transform: rotate(180deg);
}

.volume-osd-fill {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 100%;
  width: 100%;
  background: linear-gradient(to top, var(--accent) 0%, #ff4757 100%);
  border-radius: 3px;
  transition: height 0.15s ease;
}

.volume-osd-value {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--white);
}

/* ============================================
   PWA INSTALL POPUP — Large Centered Modal
   ============================================ */

/* Dark overlay backdrop */
.install-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 499;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
}

.install-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

/* The modal popup */
.install-popup {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.8);
  width: 92%;
  max-width: 420px;
  background: linear-gradient(165deg, #1e1e2e 0%, #151520 50%, #1a1a2e 100%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 24px;
  padding: 40px 32px 32px;
  z-index: 500;
  opacity: 0;
  pointer-events: none;
  transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
  text-align: center;
  box-shadow:
    0 25px 60px rgba(0, 0, 0, 0.7),
    0 0 80px rgba(229, 9, 20, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

.install-popup.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, -50%) scale(1);
}

/* Decorative glow behind icon */
.install-popup-glow {
  position: absolute;
  top: -40px;
  left: 50%;
  transform: translateX(-50%);
  width: 200px;
  height: 200px;
  background: radial-gradient(circle, rgba(229, 9, 20, 0.25) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
}

/* Close button */
.install-close-btn {
  position: absolute;
  top: 12px;
  right: 14px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.5);
  font-size: 1.4rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  z-index: 2;
  line-height: 1;
}

.install-close-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--white);
  transform: rotate(90deg);
}

.install-close-btn:focus-visible,
.install-close-btn.tv-focus {
  outline: 2px solid var(--white);
  outline-offset: 2px;
  background: rgba(255, 255, 255, 0.12);
}

/* App icon */
.install-popup-icon {
  width: 88px;
  height: 88px;
  border-radius: 20px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.08);
  margin-bottom: 20px;
  position: relative;
  z-index: 1;
  animation: iconFloat 3s ease-in-out infinite;
}

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

/* Title */
.install-popup-title {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--white);
  margin-bottom: 10px;
  position: relative;
  z-index: 1;
  letter-spacing: -0.5px;
}

/* Description */
.install-popup-desc {
  font-size: 0.88rem;
  color: rgba(255, 255, 255, 0.55);
  line-height: 1.6;
  margin-bottom: 24px;
  position: relative;
  z-index: 1;
  max-width: 320px;
  margin-left: auto;
  margin-right: auto;
}

/* Feature badges */
.install-popup-features {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-bottom: 28px;
  position: relative;
  z-index: 1;
}

.install-feature {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.install-feature svg {
  width: 28px;
  height: 28px;
  color: var(--accent);
  padding: 8px;
  background: rgba(229, 9, 20, 0.1);
  border-radius: 12px;
  width: 44px;
  height: 44px;
  box-sizing: border-box;
}

.install-feature span {
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.45);
  font-weight: 500;
  letter-spacing: 0.3px;
}

/* Primary install button */
.install-btn-primary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 16px 24px;
  background: linear-gradient(135deg, var(--accent) 0%, #ff1a2d 100%);
  color: var(--white);
  border: none;
  border-radius: 14px;
  font-family: inherit;
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.25s ease;
  outline: none;
  position: relative;
  z-index: 1;
  box-shadow: 0 4px 20px rgba(229, 9, 20, 0.35);
  letter-spacing: 0.3px;
}

.install-btn-primary svg {
  width: 22px;
  height: 22px;
}

.install-btn-primary:hover {
  background: linear-gradient(135deg, #ff1a2d 0%, #ff3344 100%);
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(229, 9, 20, 0.5);
}

.install-btn-primary:active {
  transform: translateY(0);
  box-shadow: 0 2px 10px rgba(229, 9, 20, 0.3);
}

.install-btn-primary:focus-visible,
.install-btn-primary.tv-focus {
  outline: 2px solid var(--white);
  outline-offset: 4px;
}

/* Secondary dismiss button */
.install-btn-secondary {
  display: block;
  width: 100%;
  margin-top: 12px;
  padding: 12px;
  background: transparent;
  color: rgba(255, 255, 255, 0.35);
  border: none;
  border-radius: 10px;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  outline: none;
  position: relative;
  z-index: 1;
}

.install-btn-secondary:hover {
  color: rgba(255, 255, 255, 0.6);
  background: rgba(255, 255, 255, 0.04);
}

.install-btn-secondary:focus-visible,
.install-btn-secondary.tv-focus {
  outline: 2px solid var(--white);
  outline-offset: 2px;
  background: rgba(255, 255, 255, 0.04);
}

/* ============================================
   LOADING SCREEN
   ============================================ */
.loading-screen {
  position: fixed;
  inset: 0;
  background: var(--bg-primary);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  transition: opacity 0.5s ease;
}

.loading-screen.hidden {
  opacity: 0;
  pointer-events: none;
}

.loading-logo {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-md);
  margin-bottom: 20px;
  animation: loading-pulse 1.4s ease-in-out infinite;
}

@keyframes loading-pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.06); opacity: 0.6; }
}

.loading-text {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 400;
  letter-spacing: 1px;
  text-transform: uppercase;
}

/* ============================================
   ERROR SCREEN
   ============================================ */
.error-screen {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px;
  text-align: center;
  min-height: 300px;
}

.error-screen.active {
  display: flex;
}

.error-screen svg {
  width: 48px;
  height: 48px;
  color: var(--accent);
  margin-bottom: 16px;
  opacity: 0.6;
}

.error-screen h3 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.error-screen p {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 24px;
}

.retry-btn {
  padding: 10px 32px;
  background: var(--accent);
  color: var(--white);
  border: none;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.retry-btn:hover {
  background: var(--accent-hover);
  transform: translateY(-2px);
}

/* ============================================
   RESPONSIVE
   ============================================ */

/* Large TV */
@media (min-width: 1800px) {
  .header {
    padding: 0 5%;
    gap: 24px;
  }

  .header-logo {
    padding: 8px 16px;
    border-radius: 12px;
  }

  .header-banner-logo {
    height: 44px;
  }

  .search-bar-input {
    padding: 12px 18px 12px 44px;
    font-size: 1rem;
  }

  .search-bar-icon {
    width: 20px;
    height: 20px;
    left: 14px;
  }

  .header-install-btn,
  .header-logout-btn {
    width: 48px;
    height: 48px;
  }

  .header-install-btn svg,
  .header-logout-btn svg {
    width: 24px;
    height: 24px;
  }

  .channel-grid {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 8px;
  }

  .channel-card.tv-focus {
    transform: scale(1.2);
    box-shadow: 0 0 0 4px var(--white), 0 0 30px rgba(255, 255, 255, 0.25), var(--shadow-card-hover);
  }

  .volume-osd {
    right: 60px;
  }

  .channel-switch-toast {
    padding: 36px 64px;
  }

  .channel-switch-toast h3 {
    font-size: 2rem;
  }
}

/* Desktop */
@media (min-width: 1200px) and (max-width: 1799px) {
  .header {
    padding: 0 4%;
    gap: 20px;
  }

  .header-logo {
    padding: 7px 14px;
    border-radius: 10px;
  }

  .header-banner-logo {
    height: 38px;
  }

  .search-bar-input {
    padding: 10px 16px 10px 42px;
    font-size: 0.92rem;
  }

  .search-bar-icon {
    width: 18px;
    height: 18px;
    left: 14px;
  }

  .header-install-btn,
  .header-logout-btn {
    width: 44px;
    height: 44px;
  }

  .header-install-btn svg,
  .header-logout-btn svg {
    width: 22px;
    height: 22px;
  }

  .channel-grid {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 6px;
  }
}

/* Tablet */
@media (max-width: 768px) {
  .header {
    padding: 0 3%;
    height: 56px;
    gap: 10px;
  }

  .header-logo {
    padding: 4px 8px;
    border-radius: 6px;
  }

  .header-banner-logo {
    height: 26px;
  }

  .search-bar {
    max-width: 100%;
  }

  .search-bar-input {
    padding: 8px 12px 8px 34px;
    font-size: 0.82rem;
  }

  .search-bar-icon {
    width: 14px;
    height: 14px;
    left: 10px;
  }

  .header-install-btn,
  .header-logout-btn {
    width: 36px;
    height: 36px;
  }

  .header-install-btn svg,
  .header-logout-btn svg {
    width: 18px;
    height: 18px;
  }

  .category-bar {
    top: 56px;
    padding: 0 3%;
    height: 44px;
  }

  .main-content {
    padding-top: calc(56px + 44px + 8px);
  }

  .channel-grid {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 4px;
    padding: 0 3%;
  }

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

  .player-info {
    padding: 16px 3%;
  }

  .player-controls {
    padding: 14px 3%;
  }

  .volume-osd {
    right: 20px;
  }
}

/* Mobile */
@media (max-width: 480px) {
  .header {
    padding: 0 10px;
    height: 50px;
    gap: 8px;
  }

  .header-logo {
    padding: 3px 6px;
    border-radius: 5px;
  }

  .header-banner-logo {
    height: 22px;
  }

  .search-bar-input {
    padding: 7px 10px 7px 30px;
    font-size: 0.78rem;
  }

  .search-bar-icon {
    width: 13px;
    height: 13px;
    left: 9px;
  }

  .header-install-btn,
  .header-logout-btn {
    width: 34px;
    height: 34px;
  }

  .header-install-btn svg,
  .header-logout-btn svg {
    width: 16px;
    height: 16px;
  }

  .category-bar {
    top: 50px;
    padding: 0 10px;
    height: 40px;
    gap: 5px;
  }

  .category-pill {
    padding: 5px 12px;
    font-size: 0.72rem;
  }

  .main-content {
    padding-top: calc(50px + 40px + 6px);
  }

  .channel-grid {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 3px;
    padding: 0 8px;
  }

  .channel-card:hover {
    transform: scale(1.03);
  }

  .channel-logo-fallback {
    width: 40px;
    height: 40px;
    font-size: 1.1rem;
  }

  .player-info-text h2 {
    font-size: 0.95rem;
  }

  .install-popup {
    padding: 32px 20px 24px;
    width: 94%;
    border-radius: 20px;
  }

  .install-popup-icon {
    width: 72px;
    height: 72px;
    border-radius: 16px;
  }

  .install-popup-title {
    font-size: 1.3rem;
  }

  .install-popup-desc {
    font-size: 0.82rem;
  }

  .install-popup-features {
    gap: 12px;
  }

  .install-feature svg {
    width: 38px;
    height: 38px;
    padding: 7px;
  }

  .login-container {
    padding: 36px 24px 28px;
    border-radius: 22px;
  }

  .login-logo {
    width: 64px;
    height: 64px;
  }

  .login-title {
    font-size: 1.5rem;
  }

  .volume-osd {
    right: 12px;
    padding: 14px 12px;
  }

  .volume-osd-bar {
    height: 70px;
  }
}

/* Focus for mouse users — hide ring */
.channel-card:focus:not(:focus-visible):not(.tv-focus) {
  outline: none;
  box-shadow: none;
  transform: none;
}

/* ============================================
   TV-SPECIFIC STYLES
   ============================================ */
body.is-tv {
  cursor: none !important;
}

body.is-tv * {
  cursor: none !important;
}

body.is-tv .header-install-btn {
  display: none;
}

body.is-tv .search-bar {
  display: none;
}

body.is-tv .channel-card.tv-focus {
  transform: scale(1.2);
  box-shadow: 0 0 0 4px var(--white), 0 0 25px rgba(255, 255, 255, 0.2), var(--shadow-card-hover);
}

body.is-tv .category-pill.tv-focus {
  transform: scale(1.1);
}

/* ============================================
   ANIMATIONS
   ============================================ */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.channel-card {
  animation: fadeIn 0.35s ease forwards;
  opacity: 0;
}

.channel-card:nth-child(1) { animation-delay: 0.02s; }
.channel-card:nth-child(2) { animation-delay: 0.04s; }
.channel-card:nth-child(3) { animation-delay: 0.06s; }
.channel-card:nth-child(4) { animation-delay: 0.08s; }
.channel-card:nth-child(5) { animation-delay: 0.10s; }
.channel-card:nth-child(6) { animation-delay: 0.12s; }
.channel-card:nth-child(7) { animation-delay: 0.14s; }
.channel-card:nth-child(8) { animation-delay: 0.16s; }
.channel-card:nth-child(9) { animation-delay: 0.18s; }
.channel-card:nth-child(10) { animation-delay: 0.20s; }
.channel-card:nth-child(n+11) { animation-delay: 0.22s; }

/* Hide server status element */
.server-status {
  display: none !important;
}
