:root {
  --atheer-bg-primary: #070b13;
  --atheer-bg-secondary: #0e1626;
  --atheer-bg-card: rgba(17, 26, 45, 0.75);
  --atheer-blue: #00d2ff;
  --atheer-blue-glow: rgba(0, 210, 255, 0.35);
  --atheer-gold: #fbbf24;
  --atheer-gold-glow: rgba(251, 191, 36, 0.35);
  --atheer-danger: #ef4444;
  --atheer-text: #f8fafc;
  --atheer-muted: #94a3b8;
  --atheer-border: rgba(255, 255, 255, 0.08);
  --atheer-radius: 14px;
  --atheer-radius-pill: 9999px;
}

#player-channels-list::-webkit-scrollbar { width: 6px; height: 6px; }
#player-channels-list::-webkit-scrollbar-track { background: transparent; }
#player-channels-list::-webkit-scrollbar-thumb { background: rgba(148, 163, 184, 0.3); border-radius: 3px; }
#player-channels-list::-webkit-scrollbar-thumb:hover { background: var(--atheer-blue); }

.ambient-glow-blue, .ambient-glow-gold {
  position: fixed; pointer-events: none; z-index: 0;
  filter: blur(60px); opacity: 0.9;
}
.ambient-glow-blue {
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(0, 210, 255, 0.12) 0%, rgba(0,0,0,0) 70%);
  top: -100px; left: -100px;
}
.ambient-glow-gold {
  width: 450px; height: 450px;
  background: radial-gradient(circle, rgba(245, 158, 11, 0.09) 0%, rgba(0,0,0,0) 70%);
  bottom: 10%; right: -50px;
}

.glass-panel {
  background: var(--atheer-bg-card);
  border: 1px solid var(--atheer-border);
  border-radius: var(--atheer-radius);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}
@supports ((backdrop-filter: blur(16px)) or (-webkit-backdrop-filter: blur(16px))) {
  .glass-panel { backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); }
}

.glass-nav {
  background: rgba(7, 11, 19, 0.88);
  border-bottom: 1px solid var(--atheer-border);
}
@supports ((backdrop-filter: blur(20px)) or (-webkit-backdrop-filter: blur(20px))) {
  .glass-nav { backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); }
}

.btn-electric, .btn-gold, .btn-outline {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 0.5rem; padding: 0.7rem 1.6rem;
  border-radius: var(--atheer-radius-pill);
  border: none; font-weight: 700; font-size: 0.95rem; line-height: 1;
  cursor: pointer; white-space: nowrap; user-select: none; text-decoration: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.btn-electric {
  background: linear-gradient(135deg, var(--atheer-blue) 0%, #0077ff 100%);
  color: #030712;
  box-shadow: 0 4px 20px var(--atheer-blue-glow);
}
.btn-electric:hover { transform: translateY(-2px); box-shadow: 0 6px 28px rgba(0, 210, 255, 0.5); }
.btn-gold {
  background: linear-gradient(135deg, var(--atheer-gold) 0%, #d97706 100%);
  color: #000;
  box-shadow: 0 4px 20px var(--atheer-gold-glow);
}
.btn-gold:hover { transform: translateY(-2px); box-shadow: 0 6px 28px rgba(251, 191, 36, 0.5); }
.btn-outline {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--atheer-border);
  color: var(--atheer-text);
  padding: 0.65rem 1.4rem;
}
.btn-outline:hover { background: rgba(255, 255, 255, 0.12); border-color: var(--atheer-blue); color: var(--atheer-blue); }

.category-chip {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.6rem 1.2rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--atheer-border);
  border-radius: var(--atheer-radius-pill);
  color: var(--atheer-text); font-size: 0.9rem; font-weight: 500;
  cursor: pointer; white-space: nowrap;
  transition: all 0.15s ease;
}
.category-chip:hover, .category-chip.active {
  background: rgba(0, 210, 255, 0.12);
  border-color: var(--atheer-blue);
  color: var(--atheer-blue);
  box-shadow: 0 0 15px var(--atheer-blue-glow);
}

.badge-live {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(239, 68, 68, 0.2); color: var(--atheer-danger);
  border: 1px solid rgba(239, 68, 68, 0.4);
  padding: 3px 10px; border-radius: var(--atheer-radius-pill);
  font-size: 0.72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.5px; white-space: nowrap;
}
.badge-live::before {
  content: ''; width: 7px; height: 7px; background: var(--atheer-danger);
  border-radius: 50%; flex-shrink: 0;
  animation: atheer-pulse 1.6s ease-in-out infinite;
}
@keyframes atheer-pulse {
  0%, 100% { transform: scale(0.9); opacity: 0.8; }
  50% { transform: scale(1.3); opacity: 1; box-shadow: 0 0 10px var(--atheer-danger); }
}

.badge-quality {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 2px 8px; border-radius: 4px;
  font-size: 0.72rem; font-weight: 700; font-family: monospace;
  letter-spacing: 0.5px; white-space: nowrap; line-height: 1.4;
}
.badge-quality-4k, .badge-quality-2160p {
  background: linear-gradient(135deg, var(--atheer-gold) 0%, #d97706 100%);
  color: #000; box-shadow: 0 0 10px var(--atheer-gold-glow);
}
.badge-quality-fhd, .badge-quality-fullhd, .badge-quality-1080p {
  background: rgba(0, 210, 255, 0.2);
  color: var(--atheer-blue);
  border: 1px solid var(--atheer-blue);
}
.badge-quality-hd, .badge-quality-720p {
  background: rgba(255, 255, 255, 0.1);
  color: #e2e8f0;
  border: 1px solid rgba(255, 255, 255, 0.15);
}
.badge-quality-sd, .badge-quality-480p {
  background: rgba(100, 116, 139, 0.3);
  color: var(--atheer-muted);
  border: 1px solid rgba(100, 116, 139, 0.4);
}

.player-container {
  position: relative; width: 100%; background: #000;
  border-radius: var(--atheer-radius); overflow: hidden;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8), 0 0 30px rgba(0, 210, 255, 0.1);
  border: 1px solid var(--atheer-border);
}
.video-wrapper {
  position: relative; width: 100%; aspect-ratio: 16 / 9; background: #000;
}
@supports not (aspect-ratio: 16 / 9) {
  .video-wrapper { padding-top: 56.25%; height: 0; }
}
.video-wrapper video {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: contain; background: #000;
}
.video-wrapper video.aspect-fit { object-fit: contain; }
.video-wrapper video.aspect-fill { object-fit: fill; }
.video-wrapper video.aspect-zoom { object-fit: cover; transform: scale(1.15); }
.video-wrapper video.aspect-4-3 { object-fit: contain; width: 75%; right: 12.5%; }

.player-controls-overlay {
  position: absolute; bottom: 0; left: 0; right: 0;
  padding: 1.2rem 1.2rem 0.8rem;
  background: linear-gradient(to top, rgba(0,0,0,0.92) 0%, rgba(0,0,0,0.5) 60%, rgba(0,0,0,0) 100%);
  display: flex; flex-direction: column; gap: 0.6rem;
  opacity: 0; transition: opacity 0.3s ease;
  z-index: 10; pointer-events: none;
}
.player-container:hover .player-controls-overlay,
.player-container.touch-active .player-controls-overlay,
.player-container:focus-within .player-controls-overlay {
  opacity: 1; pointer-events: auto;
}

.player-progress-bar {
  width: 100%; height: 4px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 2px; position: relative; cursor: pointer;
  transition: height 0.15s ease;
}
.player-progress-bar:hover { height: 6px; }
.player-progress-filled {
  height: 100%; background: var(--atheer-blue); width: 100%;
  border-radius: 2px; box-shadow: 0 0 10px var(--atheer-blue);
}

.channel-item { transition: background 0.2s ease, border-color 0.2s ease; cursor: pointer; }
.channel-item:hover { background: rgba(255, 255, 255, 0.07); }
.channel-item.active {
  background: rgba(0, 210, 255, 0.14);
  border-color: rgba(0, 210, 255, 0.4) !important;
  border-right: 3px solid var(--atheer-blue);
}

.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(3, 7, 18, 0.82);
  z-index: 999;
  display: flex; align-items: center; justify-content: center;
  padding: 1rem; overscroll-behavior: contain;
}
@supports ((backdrop-filter: blur(8px)) or (-webkit-backdrop-filter: blur(8px))) {
  .modal-backdrop { backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
}

#toast-container {
  position: fixed; bottom: 25px; left: 25px;
  z-index: 9999; display: flex; flex-direction: column; gap: 10px;
  pointer-events: none;
  max-width: min(380px, calc(100vw - 50px));
}
.toast-msg {
  background: var(--atheer-bg-secondary); color: #fff;
  border: 1px solid var(--atheer-border);
  border-right: 4px solid var(--atheer-blue);
  padding: 12px 18px; border-radius: 8px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
  display: flex; align-items: center; gap: 12px;
  font-size: 0.9rem; pointer-events: auto;
  animation: atheer-toast 0.3s ease forwards;
}
.toast-msg.gold { border-right-color: var(--atheer-gold); }
@keyframes atheer-toast {
  from { transform: translateX(-40px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

#app-loader {
  position: fixed; inset: 0;
  background: var(--atheer-bg-primary);
  z-index: 10000;
  display: flex; align-items: center; justify-content: center;
  transition: opacity 0.4s ease;
}
#app-loader.hidden { opacity: 0; pointer-events: none; }
.spinner {
  width: 56px; height: 56px;
  border: 3px solid #1e293b;
  border-top-color: var(--atheer-blue);
  border-radius: 50%;
  animation: atheer-spin 0.9s linear infinite;
}
@keyframes atheer-spin { to { transform: rotate(360deg); } }

.fade-in { animation: atheer-fade 0.3s ease-out; }
@keyframes atheer-fade {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

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

.line-clamp-1, .line-clamp-2, .line-clamp-3 {
  display: -webkit-box; -webkit-box-orient: vertical; overflow: hidden;
}
.line-clamp-1 { -webkit-line-clamp: 1; line-clamp: 1; }
.line-clamp-2 { -webkit-line-clamp: 2; line-clamp: 2; }
.line-clamp-3 { -webkit-line-clamp: 3; line-clamp: 3; }

:focus-visible { outline: 2px solid var(--atheer-blue); outline-offset: 2px; }

@media (max-width: 768px) {
  .modal-backdrop { padding: 0.5rem; align-items: flex-end; }
  .modal-backdrop > * { max-height: 92vh; }
  #toast-container { bottom: 16px; left: 16px; right: 16px; max-width: none; }
  .ambient-glow-blue, .ambient-glow-gold { opacity: 0.5; }
  .video-wrapper video.aspect-4-3 { width: 100%; right: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .badge-live::before { animation: none; }
}
