/* Tennis Esports Tour — Bracket Hub custom styles
   Brand: #0779bf primary, dark navy surfaces, premium esports feel. */

:root {
  --brand: #0779bf;
  --brand-700: #055f99;
  --brand-300: #4ea7e3;
  --brand-100: #d8ecfb;
  --ink: #07142a;
  --ink-2: #0d1f3d;
  --paper: #f5f9fd;
  --paper-2: #e8f1fa;
  --line: #cfe1f1;
  --muted: #5d7390;
  --gold: #f4c542;
  --silver: #b8c2d0;
  --live: #ef5b5b;
  --live-soft: #ffe2e2;
  --upcoming: #6b7d96;
  --win: #21b07a;
  --loss: #d9455c;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.font-display {
  font-family: 'Bebas Neue', 'Inter', system-ui, sans-serif;
  letter-spacing: 0.02em;
}

/* Header / hero */
.tet-header {
  background: linear-gradient(135deg, #021024 0%, #062a52 45%, #0779bf 100%);
  color: #fff;
  position: relative;
  overflow: hidden;
}
.tet-header::before {
  content: "";
  position: absolute; inset: 0;
  background-image:
    radial-gradient(circle at 15% 30%, rgba(78,167,227,0.35) 0, transparent 35%),
    radial-gradient(circle at 85% 70%, rgba(7,121,191,0.55) 0, transparent 40%);
  pointer-events: none;
}
.tet-header::after {
  content: "";
  position: absolute; inset: 0;
  background-image:
    linear-gradient(transparent 95%, rgba(255,255,255,0.06) 95%),
    linear-gradient(90deg, transparent 95%, rgba(255,255,255,0.06) 95%);
  background-size: 32px 32px;
  opacity: 0.4;
  pointer-events: none;
}
.tet-header .row-relative { position: relative; z-index: 1; }

.tet-brand-pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 12px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 999px;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #cfe6fb;
}
.tet-brand-pill .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--brand-300);
  box-shadow: 0 0 0 4px rgba(78,167,227,0.25);
  animation: pulse 1.6s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(1.25); }
}

.tet-logo {
  height: 36px;
  filter: brightness(0) invert(1);
  opacity: 0.95;
}
.tet-logo-wide {
  height: 40px;
  filter: brightness(0) invert(1);
  opacity: 0.85;
}

/* Tournament selector */
.tournament-tabs {
  display: flex; gap: 8px; flex-wrap: wrap;
}
.tournament-tab {
  flex: 1 1 220px;
  text-align: left;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 16px;
  cursor: pointer;
  transition: all 0.15s ease;
  position: relative;
  overflow: hidden;
}
.tournament-tab:hover { border-color: var(--brand); transform: translateY(-1px); }
.tournament-tab.active {
  border-color: var(--brand);
  background: linear-gradient(135deg, #fff 0%, #e8f4fd 100%);
  box-shadow: 0 8px 24px -12px rgba(7,121,191,0.5);
}
.tournament-tab .tab-name {
  font-weight: 700;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.2;
}
.tournament-tab .tab-meta {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}
.tournament-tab .tab-status {
  position: absolute; top: 12px; right: 12px;
  font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase;
  padding: 3px 8px; border-radius: 999px; font-weight: 600;
}
.status-live  { background: var(--live-soft); color: var(--live); }
.status-live::before {
  content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%;
  background: var(--live); margin-right: 6px; vertical-align: middle;
  animation: pulse 1.6s ease-in-out infinite;
}
.status-upcoming { background: #e3edf7; color: #3d5980; }
.status-completed { background: #e6f6ee; color: #1d8b5b; }

/* Tournament meta strip */
.tournament-meta {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px;
}
@media (max-width: 768px) {
  .tournament-meta { grid-template-columns: repeat(2, 1fr); }
}
.meta-card {
  background: #fff; border: 1px solid var(--line);
  border-radius: 12px; padding: 12px 14px;
}
.meta-card .meta-label {
  font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--muted); font-weight: 600;
}
.meta-card .meta-value {
  font-size: 16px; font-weight: 700; color: var(--ink); margin-top: 2px;
}

/* Bracket */
.bracket-wrap {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 20px;
  overflow-x: auto;
}
.bracket {
  display: grid;
  grid-template-columns: 1fr 24px 1fr 24px 1fr;
  gap: 0;
  min-width: 720px;
}
.bracket-col {
  display: flex; flex-direction: column; justify-content: space-around; gap: 8px;
}
.bracket-round-label {
  text-align: center;
  font-size: 10px; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--muted); font-weight: 700;
  padding-bottom: 6px;
}
.match {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  transition: all 0.15s ease;
  cursor: pointer;
  position: relative;
}
.match:hover { border-color: var(--brand); box-shadow: 0 4px 16px -6px rgba(7,121,191,0.35); }
.match.is-live { border-color: var(--live); box-shadow: 0 0 0 2px rgba(239,91,91,0.12); }
.match.is-final-winner { border-color: var(--win); }
.match-line {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}
.match-line:last-child { border-bottom: 0; }
.match-line.winner { background: linear-gradient(90deg, #f0fbf5 0%, #fff 100%); }
.match-line.loser { opacity: 0.55; }
.match-line.player-card-trigger { cursor: pointer; }
.match-line.player-card-trigger:hover { background: #f4faff; }

.player-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700; color: #fff;
  background: linear-gradient(135deg, var(--brand) 0%, #062a52 100%);
  flex-shrink: 0; letter-spacing: 0.02em;
}
.player-avatar.large { width: 56px; height: 56px; font-size: 16px; }
.player-avatar.xl    { width: 72px; height: 72px; font-size: 20px; }
.player-name { font-weight: 600; font-size: 13px; color: var(--ink); line-height: 1.2; }
.player-seed { font-size: 10px; color: var(--muted); font-weight: 600; }
.player-sets {
  margin-left: auto;
  font-weight: 700; font-size: 13px;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.win-prob {
  font-size: 10px; color: var(--muted);
  font-variant-numeric: tabular-nums;
  width: 36px; text-align: right;
}
.win-prob .pct-bar {
  display: block; width: 100%; height: 3px;
  background: var(--line); border-radius: 2px; margin-top: 3px; overflow: hidden;
}
.win-prob .pct-bar > span { display: block; height: 100%; background: var(--brand); }

.match-status-row {
  padding: 4px 10px; font-size: 10px;
  background: #f4f8fc; color: var(--muted);
  letter-spacing: 0.08em; text-transform: uppercase;
  border-top: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between;
}
.match-status-row.is-live { background: var(--live-soft); color: var(--live); font-weight: 600; }
.match-status-row.is-final { background: #eaf6f0; color: #1d8b5b; font-weight: 600; }

.bracket-connector {
  display: flex; align-items: center; justify-content: center;
}
.bracket-connector::before {
  content: ""; width: 100%; height: 1px; background: var(--line);
}

/* Player panel */
.player-panel {
  position: fixed; top: 0; right: 0;
  width: 420px; max-width: 100vw; height: 100vh;
  background: #fff;
  box-shadow: -16px 0 40px -10px rgba(7,21,42,0.25);
  transform: translateX(100%);
  transition: transform 0.25s ease;
  z-index: 60;
  display: flex; flex-direction: column;
  overflow: hidden;
}
.player-panel.open { transform: translateX(0); }
.player-panel .panel-header {
  background: linear-gradient(135deg, #062a52 0%, var(--brand) 100%);
  color: #fff; padding: 20px;
}
.player-panel .panel-body { flex: 1; overflow-y: auto; padding: 20px; }
.player-panel .close-btn {
  position: absolute; top: 14px; right: 14px;
  background: rgba(255,255,255,0.12); color: #fff;
  border: 0; width: 32px; height: 32px; border-radius: 50%;
  cursor: pointer; font-size: 18px; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
}
.player-panel .close-btn:hover { background: rgba(255,255,255,0.2); }

.stat-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px;
  margin-top: 16px;
}
.stat-cell {
  background: #f4f8fc; border: 1px solid var(--line);
  border-radius: 10px; padding: 10px 12px;
}
.stat-cell .stat-label {
  font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--muted); font-weight: 600;
}
.stat-cell .stat-value {
  font-size: 20px; font-weight: 800; color: var(--ink);
  margin-top: 2px; font-variant-numeric: tabular-nums;
}
.stat-cell .stat-sub { font-size: 11px; color: var(--brand-700); margin-top: 2px; }

.sparkline {
  width: 100%; height: 64px; display: block;
}
.sparkline .grid { stroke: var(--line); stroke-width: 1; }
.sparkline .line { fill: none; stroke: var(--brand); stroke-width: 2.2; stroke-linejoin: round; stroke-linecap: round; }
.sparkline .area { fill: rgba(7,121,191,0.12); }
.sparkline .pt { fill: var(--brand); }

.form-dots { display: flex; gap: 4px; margin-top: 6px; }
.form-dot { width: 18px; height: 8px; border-radius: 3px; }
.form-dot.W { background: var(--win); }
.form-dot.L { background: var(--loss); opacity: 0.55; }

.section-title {
  font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--muted); font-weight: 700; margin: 20px 0 8px 0;
}

.accuracy-bar {
  display: flex; align-items: center; gap: 8px; margin: 6px 0;
}
.accuracy-bar .label { font-size: 12px; color: var(--ink); width: 90px; }
.accuracy-bar .track {
  flex: 1; height: 8px; background: var(--line); border-radius: 4px; overflow: hidden;
}
.accuracy-bar .fill { height: 100%; background: linear-gradient(90deg, var(--brand-300) 0%, var(--brand) 100%); }
.accuracy-bar .pct { font-size: 12px; color: var(--ink); font-weight: 600; width: 40px; text-align: right; font-variant-numeric: tabular-nums; }

.player-list-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 8px;
  cursor: pointer; transition: background 0.12s ease;
}
.player-list-row:hover { background: #f4f8fc; }
.player-list-row .meta { font-size: 11px; color: var(--muted); }

/* Backdrop for panel */
.backdrop {
  position: fixed; inset: 0; background: rgba(7,21,42,0.45);
  opacity: 0; pointer-events: none; transition: opacity 0.2s ease;
  z-index: 55;
}
.backdrop.open { opacity: 1; pointer-events: auto; }

/* Footer */
.tet-footer {
  background: #021024; color: #cfe6fb; padding: 28px 0 22px;
  font-size: 13px;
}
.tet-footer a { color: #cfe6fb; text-decoration: none; opacity: 0.85; }
.tet-footer a:hover { opacity: 1; color: #fff; }
.tet-footer .small { font-size: 11px; color: #8aa6c4; margin-top: 8px; }

/* Buttons */
.btn-brand {
  background: var(--brand); color: #fff; border: 0;
  padding: 10px 18px; border-radius: 10px; font-weight: 600;
  cursor: pointer; transition: background 0.15s ease;
  display: inline-flex; align-items: center; gap: 8px;
}
.btn-brand:hover { background: var(--brand-700); }
.btn-ghost {
  background: rgba(255,255,255,0.08); color: #fff;
  border: 1px solid rgba(255,255,255,0.2);
  padding: 10px 18px; border-radius: 10px; font-weight: 600; cursor: pointer;
}
.btn-ghost:hover { background: rgba(255,255,255,0.15); }

/* Live ticker */
.live-ticker {
  background: #fff; border: 1px solid var(--line); border-radius: 12px;
  padding: 10px 16px; display: flex; align-items: center; gap: 12px;
  font-size: 13px; color: var(--ink);
  overflow: hidden;
}
.live-ticker .ticker-label {
  font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--live); font-weight: 700; flex-shrink: 0;
  display: inline-flex; align-items: center; gap: 6px;
}
.live-ticker .ticker-label::before {
  content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  background: var(--live); animation: pulse 1.6s ease-in-out infinite;
}
.live-ticker .ticker-track {
  flex: 1; overflow: hidden; white-space: nowrap; position: relative;
}
.live-ticker .ticker-track .ticker-row {
  display: inline-block; padding-left: 100%;
  animation: tickerSlide 36s linear infinite;
}
.live-ticker .ticker-track .ticker-row span { margin-right: 36px; color: var(--ink); }
.live-ticker .ticker-track .ticker-row span b { color: var(--brand-700); }
@keyframes tickerSlide {
  0% { transform: translateX(0); }
  100% { transform: translateX(-100%); }
}

/* Subscribe strip */
.subscribe {
  background: linear-gradient(135deg, #062a52 0%, var(--brand) 100%);
  border-radius: 16px; padding: 22px; color: #fff;
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
}
.subscribe .grow { flex: 1 1 220px; }
.subscribe input {
  background: rgba(255,255,255,0.12); color: #fff;
  border: 1px solid rgba(255,255,255,0.3);
  padding: 10px 14px; border-radius: 10px; min-width: 220px; font-size: 14px;
}
.subscribe input::placeholder { color: rgba(255,255,255,0.6); }
.subscribe input:focus { outline: 2px solid #fff; outline-offset: 2px; }
.subscribe .btn-on-dark { background: #fff; color: var(--brand-700); }

/* Mobile tweaks */
@media (max-width: 768px) {
  .bracket-wrap { padding: 12px; }
  .player-panel { width: 100vw; }
  .tournament-tab { flex: 1 1 100%; }
}

/* Utility */
.text-muted-2 { color: var(--muted); }
.divider { height: 1px; background: var(--line); margin: 16px 0; }
.no-scrollbar::-webkit-scrollbar { display: none; }
.no-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }
