/* ═══════════════════════════════════════════════════════════════
   SportZx Live — Premium Dark UI
   ═══════════════════════════════════════════════════════════════ */

:root {
  /* ── Palette ── */
  --bg-deep:        #0a0b0f;
  --bg-surface:     #12141a;
  --bg-card:        #181b24;
  --bg-card-hover:  #1e2230;
  --bg-elevated:    #222638;
  --border:         rgba(255, 255, 255, 0.06);
  --border-hover:   rgba(255, 255, 255, 0.12);

  --text-primary:   #f0f2f8;
  --text-secondary: #8b90a5;
  --text-muted:     #5a5f74;

  --accent:         #6c5ce7;
  --accent-glow:    rgba(108, 92, 231, 0.35);
  --accent-light:   #a29bfe;

  --hot:            #ff6b6b;
  --hot-glow:       rgba(255, 107, 107, 0.3);
  --live:           #00e676;
  --live-glow:      rgba(0, 230, 118, 0.3);
  --warn:           #ffd93d;

  --gradient-hero:  linear-gradient(135deg, #6c5ce7 0%, #a855f7 50%, #ec4899 100%);
  --gradient-card:  linear-gradient(145deg, rgba(108,92,231,0.08) 0%, rgba(168,85,247,0.04) 100%);
  --gradient-glass: linear-gradient(135deg, rgba(255,255,255,0.05) 0%, rgba(255,255,255,0.01) 100%);

  /* ── Layout ── */
  --nav-height:     64px;
  --radius-sm:      8px;
  --radius-md:      12px;
  --radius-lg:      16px;
  --radius-xl:      20px;

  /* ── Motion ── */
  --ease-out:       cubic-bezier(0.22, 1, 0.36, 1);
  --ease-spring:    cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-deep);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ─── Background Ambience ─── */
body::before {
  content: '';
  position: fixed;
  top: -50%; left: -50%;
  width: 200%; height: 200%;
  background: radial-gradient(ellipse at 20% 50%, rgba(108,92,231,0.06) 0%, transparent 50%),
              radial-gradient(ellipse at 80% 20%, rgba(168,85,247,0.04) 0%, transparent 40%),
              radial-gradient(ellipse at 50% 90%, rgba(236,72,153,0.03) 0%, transparent 40%);
  pointer-events: none;
  z-index: -1;
  animation: ambience 20s ease-in-out infinite alternate;
}

@keyframes ambience {
  0%   { transform: translate(0, 0) rotate(0deg); }
  100% { transform: translate(-2%, -1%) rotate(1deg); }
}

/* ═══════════════════════════════════════════════════════════════
   Navigation
   ═══════════════════════════════════════════════════════════════ */
#main-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 24px;
  height: var(--nav-height);
  padding: 0 24px;
  background: rgba(10, 11, 15, 0.82);
  backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--border);
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.brand-icon {
  font-size: 1.5rem;
  filter: drop-shadow(0 0 8px var(--accent-glow));
}

.brand-text {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.brand-accent {
  background: var(--gradient-hero);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.nav-tabs {
  display: flex;
  gap: 4px;
  flex: 1;
  justify-content: center;
}

.nav-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s var(--ease-out);
  position: relative;
}

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

.nav-tab.active {
  color: #fff;
  background: var(--accent);
  box-shadow: 0 2px 16px var(--accent-glow);
}

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

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

.status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: background 0.5s;
}

.status-dot.online {
  background: var(--live);
  box-shadow: 0 0 8px var(--live-glow);
  animation: pulse-dot 2s ease-in-out infinite;
}

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

.status-text {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* ═══════════════════════════════════════════════════════════════
   Main Content
   ═══════════════════════════════════════════════════════════════ */
#app-main {
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px 24px 80px;
  min-height: calc(100vh - var(--nav-height) - 60px);
}

.view { display: none; }
.view.active { display: block; animation: fadeSlideIn 0.4s var(--ease-out); }

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

.view-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.view-header h1 {
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: var(--gradient-hero);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ── Filter Bar ── */
.filter-bar {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  flex: 1;
  justify-content: flex-end;
}

.filter-chip {
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.25s var(--ease-out);
  white-space: nowrap;
}

.filter-chip:hover {
  border-color: var(--accent);
  color: var(--text-primary);
}

.filter-chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 2px 12px var(--accent-glow);
}

/* ── Search ── */
.search-input {
  padding: 10px 18px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.9rem;
  outline: none;
  width: 280px;
  transition: all 0.3s var(--ease-out);
}

.search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

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

/* ═══════════════════════════════════════════════════════════════
   Card Grid — Events & Highlights
   ═══════════════════════════════════════════════════════════════ */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 16px;
}

.event-card {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  cursor: pointer;
  transition: all 0.35s var(--ease-out);
  overflow: hidden;
}

.event-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--gradient-card);
  opacity: 0;
  transition: opacity 0.35s;
  pointer-events: none;
}

.event-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-3px);
  box-shadow: 0 8px 32px rgba(0,0,0,0.3), 0 2px 8px var(--accent-glow);
}

.event-card:hover::before { opacity: 1; }

.event-card .card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  position: relative;
}

.card-cat {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(108, 92, 231, 0.15);
  color: var(--accent-light);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.card-live {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(0, 230, 118, 0.12);
  color: var(--live);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  animation: pulse-live 1.5s ease-in-out infinite;
}

@keyframes pulse-live {
  0%, 100% { box-shadow: 0 0 0 0 var(--live-glow); }
  50%      { box-shadow: 0 0 0 6px rgba(0,230,118,0); }
}

.card-hot {
  background: rgba(255, 107, 107, 0.12);
  color: var(--hot);
}

.event-matchup {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 14px;
  position: relative;
}

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

.team-flag {
  width: 48px; height: 48px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--bg-elevated);
  border: 2px solid var(--border);
  transition: transform 0.3s var(--ease-spring);
}

.event-card:hover .team-flag { transform: scale(1.08); }

.team-name {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-align: center;
  max-width: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.matchup-vs {
  font-size: 0.7rem;
  font-weight: 800;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 2px;
  flex-shrink: 0;
}

.card-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 8px;
  position: relative;
}

.card-time {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.card-formats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  position: relative;
}

.format-tag {
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 0.72rem;
  font-weight: 500;
  transition: all 0.2s;
}

.event-card:hover .format-tag {
  border-color: var(--accent);
  color: var(--accent-light);
}

/* ═══════════════════════════════════════════════════════════════
   Category Grid
   ═══════════════════════════════════════════════════════════════ */
.cat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}

.cat-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 20px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.3s var(--ease-out);
  text-align: center;
}

.cat-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(0,0,0,0.2), 0 0 12px var(--accent-glow);
}

.cat-image {
  width: 56px; height: 56px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--bg-elevated);
  border: 2px solid var(--border);
  transition: transform 0.3s var(--ease-spring);
}

.cat-card:hover .cat-image { transform: scale(1.1); }

.cat-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
}

/* ═══════════════════════════════════════════════════════════════
   Channel List
   ═══════════════════════════════════════════════════════════════ */
.channel-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.channel-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.3s var(--ease-out);
}

.channel-item:hover {
  border-color: var(--accent);
  background: var(--bg-card-hover);
  box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}

.channel-logo {
  width: 42px; height: 42px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  background: var(--bg-elevated);
  flex-shrink: 0;
}

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

.channel-name {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 2px;
}

.channel-type {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

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

.ch-copy-btn {
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s var(--ease-out);
  white-space: nowrap;
}

.ch-copy-btn:hover {
  border-color: var(--accent);
  color: var(--accent-light);
  background: rgba(239, 68, 68, 0.1);
}

.ch-copy-key {
  border-color: rgba(234, 179, 8, 0.3);
  color: #eab308;
}

.ch-copy-key:hover {
  border-color: #eab308;
  background: rgba(234, 179, 8, 0.1);
}

.ch-copy-btn.copied {
  border-color: #22c55e;
  color: #22c55e;
  background: rgba(34, 197, 94, 0.1);
}

.channel-play {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  color: #fff;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.25s var(--ease-spring);
  box-shadow: 0 2px 12px var(--accent-glow);
}

.channel-play:hover {
  transform: scale(1.12);
  box-shadow: 0 4px 20px var(--accent-glow);
}

/* ── Back Button ── */
.btn-back {
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.25s var(--ease-out);
}

.btn-back:hover {
  border-color: var(--accent);
  color: var(--text-primary);
}

/* ── Empty State ── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 80px 24px;
  color: var(--text-muted);
}

.empty-icon { font-size: 3rem; opacity: 0.4; }
.empty-state p { font-size: 0.95rem; }

/* ═══════════════════════════════════════════════════════════════
   Stream Modal
   ═══════════════════════════════════════════════════════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  animation: fadeIn 0.25s var(--ease-out);
}

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

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

.modal-content {
  position: relative;
  width: min(90vw, 640px);
  max-height: 80vh;
  overflow-y: auto;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 32px;
  box-shadow: 0 24px 80px rgba(0,0,0,0.5);
  animation: modalSlide 0.35s var(--ease-spring);
}

@keyframes modalSlide {
  from { opacity: 0; transform: scale(0.92) translateY(20px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-close {
  position: absolute;
  top: 16px; right: 16px;
  width: 32px; height: 32px;
  border-radius: 50%;
  border: none;
  background: var(--bg-elevated);
  color: var(--text-secondary);
  font-size: 0.9rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.modal-close:hover {
  background: var(--hot);
  color: #fff;
}

#modal-title {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 20px;
  padding-right: 40px;
}

.modal-field {
  margin-bottom: 14px;
}

.modal-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.modal-value {
  display: block;
  padding: 10px 14px;
  background: var(--bg-deep);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-family: 'Courier New', monospace;
  color: var(--accent-light);
  word-break: break-all;
  user-select: all;
  cursor: text;
}

.modal-copy-btn {
  margin-top: 6px;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--accent);
  background: transparent;
  color: var(--accent-light);
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.modal-copy-btn:hover {
  background: var(--accent);
  color: #fff;
}

/* ═══════════════════════════════════════════════════════════════
   Loading
   ═══════════════════════════════════════════════════════════════ */
.loading-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 100px 24px;
}

.loading-screen.hidden { display: none; }

.loader-ring {
  width: 48px; height: 48px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.loader-text {
  font-size: 0.9rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* ═══════════════════════════════════════════════════════════════
   Footer
   ═══════════════════════════════════════════════════════════════ */
#app-footer {
  border-top: 1px solid var(--border);
  padding: 16px 24px;
  background: rgba(10, 11, 15, 0.6);
  backdrop-filter: blur(12px);
}

.footer-inner {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.footer-brand {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
}

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

/* ═══════════════════════════════════════════════════════════════
   Responsive
   ═══════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  .nav-tabs { gap: 2px; }
  .nav-tab { padding: 6px 12px; font-size: 0.8rem; }
  .tab-icon { display: none; }
  .card-grid { grid-template-columns: 1fr; }
  .cat-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .view-header { flex-direction: column; align-items: flex-start; }
  .filter-bar { justify-content: flex-start; }
  .search-input { width: 100%; }
}

@media (max-width: 480px) {
  #main-nav { padding: 0 12px; gap: 8px; }
  .brand-text { font-size: 1rem; }
  #app-main { padding: 16px 12px 60px; }
  .event-card { padding: 14px; }
  .modal-content { padding: 20px; }
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--text-muted); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-secondary); }
