/* ═══════════════════════════════════════════════════════════
   DOOBALL LIVE — beIN Sports inspired design
   Dark premium • Purple accent • Card-based layout
   ═══════════════════════════════════════════════════════════ */

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

:root {
  --bg: #0c0c10;
  --bg-card: #16161b;
  --bg-card-hover: #1e1e24;
  --bg-header: linear-gradient(180deg, #1a1a22 0%, #12121a 100%);
  --bg-league: #121216;

  --text: #eeeef0;
  --text-2: #9d9da7;
  --text-3: #5a5a66;

  --purple: #8c52ff;
  --purple-dim: rgba(140,82,255,0.12);
  --purple-glow: rgba(140,82,255,0.25);
  --green: #2ee66a;
  --green-dim: rgba(46,230,106,0.1);
  --green-glow: rgba(46,230,106,0.2);
  --red: #ff4060;
  --orange: #ffaa2e;
  --blue: #4488ff;

  --border: rgba(255,255,255,0.06);
  --border-hover: rgba(255,255,255,0.1);

  --r: 12px;
  --r-sm: 8px;
  --r-lg: 16px;
  --r-pill: 100px;

  --font: 'Plus Jakarta Sans', system-ui, sans-serif;
  --ease: cubic-bezier(.25, .8, .25, 1);
}

/* ─── Reset ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
}

/* ─── Layout ────────────────────────────────────────────── */
.app-container {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 0.75rem;
}

/* ═══════════════════════════════════════════════════════════
   HEADER — beIN style top bar
   ═══════════════════════════════════════════════════════════ */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
  background: var(--bg-header);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(16px) saturate(1.4);
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  color: var(--text);
}

.header-logo {
  font-size: 1.4rem;
  filter: drop-shadow(0 0 8px var(--purple-glow));
}

.header-title {
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.header-title span {
  color: var(--purple);
}

.header-meta {
  display: flex;
  align-items: center;
  gap: 0.625rem;
}

.live-indicator {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.25rem 0.65rem;
  background: rgba(255,64,96,0.1);
  border: 1px solid rgba(255,64,96,0.18);
  border-radius: var(--r-pill);
  font-size: 0.62rem;
  font-weight: 800;
  color: var(--red);
  letter-spacing: 0.1em;
}

.live-dot {
  width: 6px; height: 6px;
  background: var(--red);
  border-radius: 50%;
  box-shadow: 0 0 6px rgba(255,64,96,0.6);
  animation: blink 1.3s ease-in-out infinite;
}

@keyframes blink {
  0%,100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.match-count {
  font-size: 0.72rem;
  color: var(--text-3);
  font-weight: 600;
}

.match-count strong {
  color: var(--purple);
  font-weight: 800;
}

/* ═══════════════════════════════════════════════════════════
   LOADING / ERROR / EMPTY
   ═══════════════════════════════════════════════════════════ */
.loading-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 5rem 2rem;
  gap: 1rem;
}

.loading-spinner {
  width: 38px; height: 38px;
  border: 2.5px solid rgba(140,82,255,0.15);
  border-top-color: var(--purple);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

.loading-text {
  font-size: 0.82rem;
  color: var(--text-3);
  animation: breathe 2s ease-in-out infinite;
}

@keyframes breathe {
  0%,100% { opacity: 0.4; }
  50% { opacity: 1; }
}

.error-container, .empty-state {
  text-align: center;
  padding: 4rem 2rem;
}

.error-icon, .empty-icon {
  font-size: 2.5rem;
  margin-bottom: 0.625rem;
}

.error-title, .empty-title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.error-message, .empty-text {
  color: var(--text-3);
  font-size: 0.82rem;
  margin-bottom: 1.25rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.5rem 1.25rem;
  border: none;
  border-radius: var(--r-sm);
  font-family: var(--font);
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s var(--ease);
}

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

.btn-primary:hover {
  box-shadow: 0 4px 24px var(--purple-glow);
  transform: translateY(-1px);
}

/* ═══════════════════════════════════════════════════════════
   LEAGUE SECTION
   ═══════════════════════════════════════════════════════════ */
.league-section {
  margin-bottom: 0.25rem;
  animation: slideIn 0.45s var(--ease) both;
}

.league-section:nth-child(2) { animation-delay: 40ms; }
.league-section:nth-child(3) { animation-delay: 80ms; }
.league-section:nth-child(4) { animation-delay: 120ms; }

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

.league-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1rem;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-2);
  background: var(--bg-league);
  border-left: 3px solid var(--purple);
  border-radius: 0;
  letter-spacing: 0.01em;
  margin-top: 0.75rem;
}

.league-icon { font-size: 0.9rem; }

.league-badge {
  margin-left: auto;
  padding: 0.125rem 0.45rem;
  font-size: 0.58rem;
  font-weight: 700;
  background: var(--purple-dim);
  border: none;
  border-radius: var(--r-pill);
  color: var(--purple);
}

/* ═══════════════════════════════════════════════════════════
   MATCH CARD — beIN style
   ═══════════════════════════════════════════════════════════ */
.match-card {
  display: grid;
  grid-template-columns: 52px 1fr auto;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.2s var(--ease);
  text-decoration: none;
  color: inherit;
}

.match-card:last-child {
  border-bottom: none;
}

.match-card:hover {
  background: var(--bg-card-hover);
}

.match-card:active {
  background: var(--bg-card);
}

/* ─── Time ──────────────────────────────────────────────── */
.mc-time {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

/* ─── Versus ────────────────────────────────────────────── */
.mc-versus {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  min-width: 0;
}

.mc-team {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex: 1;
  min-width: 0;
}

.mc-team:last-of-type {
  justify-content: flex-end;
  flex-direction: row-reverse;
}

.mc-logo {
  width: 30px; height: 30px;
  object-fit: contain;
  flex-shrink: 0;
  transition: transform 0.3s var(--ease);
}

.match-card:hover .mc-logo {
  transform: scale(1.08);
}

.mc-logo-placeholder {
  width: 30px; height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-card-hover);
  border-radius: 50%;
  font-size: 0.75rem;
  flex-shrink: 0;
}

.mc-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mc-vs {
  font-size: 0.6rem;
  font-weight: 800;
  color: var(--text-3);
  flex-shrink: 0;
  width: 24px;
  text-align: center;
}

/* ─── Action button ─────────────────────────────────────── */
.mc-live {
  padding: 0.3rem 0.7rem;
  background: var(--purple-dim);
  border-radius: var(--r-pill);
  font-size: 0.6rem;
  font-weight: 700;
  color: var(--purple);
  letter-spacing: 0.02em;
  transition: all 0.2s var(--ease);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  border: none;
}

.mc-live--upcoming {
  background: transparent;
  color: var(--text-3);
}

.match-card:hover .mc-live {
  background: var(--purple-dim);
  color: var(--purple);
}

.match-action-dot {
  width: 4px; height: 4px;
  background: currentColor;
  border-radius: 50%;
  opacity: 0.5;
}

/* ─── LIVE state ────────────────────────────────────────── */
.match-card--live {
  background: linear-gradient(90deg, rgba(46,230,106,0.05), var(--bg-card));
  border-left: 3px solid var(--green);
}

.match-card--live:hover {
  background: linear-gradient(90deg, rgba(46,230,106,0.08), var(--bg-card-hover));
}

.match-card--live .mc-time {
  color: var(--green);
}

.match-card--live .mc-live {
  background: var(--green);
  color: #000;
  font-weight: 800;
}

.match-card--live .mc-live .match-action-dot {
  background: #000;
  animation: blink 1.3s ease-in-out infinite;
}

.match-card--live:hover .mc-live {
  box-shadow: 0 0 16px var(--green-glow);
}

/* ─── Badges ────────────────────────────────────────────── */
.mc-live-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 1px 6px;
  background: var(--green-dim);
  border-radius: var(--r-pill);
  font-size: 0.5rem;
  font-weight: 800;
  color: var(--green);
  letter-spacing: 0.08em;
}

.mc-live-dot {
  width: 4px; height: 4px;
  background: var(--green);
  border-radius: 50%;
  animation: blink 1.3s ease-in-out infinite;
}

.mc-hot-badge {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 1px 6px;
  background: rgba(255,170,46,0.1);
  border-radius: var(--r-pill);
  font-size: 0.5rem;
  font-weight: 800;
  color: var(--orange);
  letter-spacing: 0.04em;
}

/* ═══════════════════════════════════════════════════════════
   PLAYER PAGE
   ═══════════════════════════════════════════════════════════ */
.player-container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 0.75rem;
}

.player-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  margin-bottom: 0.75rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r);
  backdrop-filter: blur(16px);
}

.back-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px; height: 34px;
  background: rgba(140,82,255,0.1);
  border: 1px solid rgba(140,82,255,0.15);
  border-radius: var(--r-sm);
  color: var(--purple);
  text-decoration: none;
  font-size: 1rem;
  transition: all 0.2s var(--ease);
}

.back-btn:hover {
  background: rgba(140,82,255,0.18);
  color: white;
}

.player-info { flex: 1; }

.player-match-name {
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0;
}

.player-league-name {
  font-size: 0.72rem;
  color: var(--text-3);
}

.player-status {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.72rem;
  font-weight: 700;
}

.player-status.live { color: var(--green); }
.player-status.loading { color: var(--orange); }
.player-status.error { color: var(--red); }

/* ─── Video ─────────────────────────────────────────────── */
.video-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 16/9;
  background: #000;
  border-radius: var(--r);
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}

.video-wrapper video {
  width: 100%; height: 100%;
  object-fit: contain;
}

.video-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: rgba(12,12,16,0.92);
  backdrop-filter: blur(20px);
  transition: opacity 0.3s var(--ease);
  z-index: 10;
}

.video-overlay.hidden { opacity: 0; pointer-events: none; }
.video-overlay-icon { font-size: 2rem; }

.video-overlay-text {
  font-size: 0.8rem;
  color: var(--text-3);
  text-align: center;
}

/* ─── Stream Info (hidden) ──────────────────────────────── */


/* ─── Footer ────────────────────────────────────────────── */
.footer {
  text-align: center;
  padding: 2rem 1rem;
  font-size: 0.65rem;
  color: var(--text-3);
  border-top: 1px solid var(--border);
  margin-top: 1rem;
}

/* ═══════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════ */
@media (max-width: 640px) {
  .app-container, .player-container { padding: 0 0.375rem; }

  .header {
    padding: 0.75rem 1rem;
    flex-direction: column;
    gap: 0.5rem;
    position: relative;
  }

  .match-card {
    grid-template-columns: 42px 1fr auto;
    padding: 0.625rem 0.625rem;
    gap: 0.5rem;
  }

  .mc-logo, .mc-logo-placeholder { width: 26px; height: 26px; }
  .mc-name { font-size: 0.74rem; }
  .mc-time { font-size: 0.74rem; }
  .mc-live { font-size: 0.55rem; padding: 0.25rem 0.5rem; }
  .league-header { font-size: 0.66rem; padding: 0.5rem 0.75rem; }
  .video-wrapper { border-radius: var(--r-sm); }
}

/* ─── Scrollbar ─────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.05); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.1); }

::selection {
  background: rgba(140,82,255,0.25);
  color: white;
}
