/* ==========================================================================
   BingStream — Dark Sports Streaming Theme
   Pure CSS, no frameworks. Mobile-first.
   ========================================================================== */

:root {
  --bg:          #0c0c10;
  --surface:     #16161e;
  --surface2:    #1f1f2a;
  --border:      #2c2c3a;
  --accent:      #e53935;   /* Live red */
  --accent-dark: #b71c1c;
  --upcoming:    #fb8c00;   /* Upcoming orange */
  --text:        #f0f0f4;
  --muted:       #8e8e9e;
  --live-green:  #00e676;
  --radius:      10px;
  --header-h:    56px;
}

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

html {
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica,
    Arial, sans-serif;
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  display: block;
  max-width: 100%;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

/* ==========================================================================
   Header
   ========================================================================== */
#site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.logo {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #fff;
}

.live-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: #fff;
  background: var(--accent);
  padding: 5px 11px;
  border-radius: 999px;
}

.live-badge::before {
  content: '●';
  color: #fff;
  animation: pulse 1.4s ease-in-out infinite;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.25;
  }
}

/* ==========================================================================
   Layout
   ========================================================================== */
main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px;
}

/* ==========================================================================
   Tab bar (Live / Upcoming)
   ========================================================================== */
.tab-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

.tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 16px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  transition: background 0.15s, color 0.15s;
}

.tab.active {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}

.tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  font-size: 0.72rem;
  font-weight: 700;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.3);
}

.tab.active .tab-count {
  background: rgba(0, 0, 0, 0.25);
}

/* ==========================================================================
   Category strip
   ========================================================================== */
.category-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 10px;
  margin-bottom: 14px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

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

.cat-pill {
  flex: 0 0 auto;
  padding: 7px 14px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}

.cat-pill.active {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}

/* ==========================================================================
   Match grid + cards
   ========================================================================== */
.match-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}

.match-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s;
}

.match-card:hover {
  transform: translateY(-3px) scale(1.01);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.55);
  border-color: #3a3a4d;
}

.card-poster {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

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

.card-poster .logo-pair {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at center, #20202c 0%, #0c0c10 100%);
}

.card-poster .logo-pair img {
  width: 64px;
  height: 64px;
  object-fit: contain;
}

.card-poster .logo-pair em {
  font-style: normal;
  font-weight: 800;
  color: var(--muted);
  font-size: 0.9rem;
}

.status-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  border-radius: 6px;
  color: #fff;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
}

.status-badge.live {
  background: var(--accent);
}

.status-badge.live::before {
  content: '●';
  animation: pulse 1.4s ease-in-out infinite;
}

.status-badge.upcoming {
  background: var(--upcoming);
}

.card-body {
  padding: 12px;
}

.card-body .teams {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 6px;
  min-height: 28px;
}

.card-body .teams img {
  width: 24px;
  height: 24px;
  object-fit: contain;
  flex: 0 0 auto;
}

.card-body .teams span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-body .teams em {
  font-style: normal;
  font-size: 0.72rem;
  color: var(--muted);
  flex: 0 0 auto;
}

.card-body .title-only {
  font-size: 0.92rem;
  font-weight: 600;
  margin-bottom: 6px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-body .league {
  font-size: 0.76rem;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ==========================================================================
   Skeleton loading
   ========================================================================== */
.skeleton-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.skeleton-card .sk-poster {
  aspect-ratio: 16 / 9;
}

.skeleton-card .sk-line {
  height: 12px;
  margin: 12px;
  border-radius: 4px;
}

.skeleton-card .sk-line.short {
  width: 50%;
}

.shimmer {
  background: linear-gradient(
    90deg,
    var(--surface2) 25%,
    #2a2a38 50%,
    var(--surface2) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
}

@keyframes shimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

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

.empty-state .big {
  font-size: 2.4rem;
  margin-bottom: 10px;
}

/* ==========================================================================
   Watch page
   ========================================================================== */
.watch-main {
  max-width: 960px;
}

.back-btn {
  display: inline-block;
  margin-bottom: 14px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--muted);
  transition: color 0.15s;
}

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

#match-title {
  font-size: 1.35rem;
  font-weight: 700;
  margin-bottom: 14px;
  line-height: 1.25;
}

.player-wrap {
  position: relative;
  width: 100%;
  max-width: 900px;
  margin: 0 auto 16px;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
}

#player {
  width: 100%;
  height: 100%;
  background: #000;
  display: block;
}

.player-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 24px;
  text-align: center;
  background: rgba(8, 8, 12, 0.82);
  backdrop-filter: blur(3px);
}

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

.player-overlay img {
  max-width: 60%;
  max-height: 45%;
  object-fit: contain;
  border-radius: 8px;
  opacity: 0.85;
}

.player-overlay p {
  font-size: 0.95rem;
  color: var(--text);
  max-width: 420px;
}

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

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

#btn-next-server {
  padding: 10px 20px;
  font-size: 0.9rem;
  font-weight: 700;
  color: #fff;
  background: var(--accent);
  border-radius: 999px;
  transition: background 0.15s;
}

#btn-next-server:hover {
  background: var(--accent-dark);
}

#btn-next-server.hidden {
  display: none;
}

/* ---- Server switcher ---- */
.server-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}

.server-btn {
  padding: 9px 16px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  transition: background 0.15s, color 0.15s;
}

.server-btn:hover {
  color: var(--text);
  border-color: #3a3a4d;
}

.server-btn.active {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}

/* ---- Match meta ---- */
.match-meta {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}

.meta-teams {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.meta-teams .team-logo {
  width: 34px;
  height: 34px;
  object-fit: contain;
}

.meta-teams em {
  font-style: normal;
  font-size: 0.82rem;
  color: var(--muted);
}

.meta-info {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.meta-info .status-badge {
  position: static;
}

.league-label {
  font-size: 0.85rem;
  color: var(--muted);
  font-weight: 600;
}

/* ==========================================================================
   Toast
   ========================================================================== */
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%) translateY(140%);
  z-index: 100;
  max-width: calc(100% - 32px);
  padding: 13px 20px;
  font-size: 0.88rem;
  font-weight: 600;
  color: #fff;
  background: var(--accent);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  transition: transform 0.35s cubic-bezier(0.2, 0.8, 0.3, 1);
}

.toast.show {
  transform: translateX(-50%) translateY(0);
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 768px) {
  .match-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
}

@media (max-width: 480px) {
  .match-grid {
    grid-template-columns: 1fr;
  }
  #match-title {
    font-size: 1.15rem;
  }
  main {
    padding: 12px;
  }
}

/* ==========================================================================
   Clappr player container (fills the 16:9 .player-wrap)
   ========================================================================== */
#player {
  width: 100%;
  height: 100%;
}

#player [data-player],
#player .container,
#player video {
  width: 100% !important;
  height: 100% !important;
  background: #000;
}
