/*
 * Dark Court — WBD Design System
 * A premium dark-theme sports app aesthetic.
 * No framework dependencies. Pure CSS with custom properties.
 */

/* ================================================================
   DESIGN TOKENS
   ================================================================ */

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

:root {
  /* Surfaces */
  --bg:          #0c0f14;
  --surface:     #151a24;
  --elevated:    #1e2433;
  --border:      #2a3040;
  --border-light:#353d50;

  /* Accent */
  --accent:      #5b8def;
  --accent-dim:  rgba(91, 141, 239, 0.15);
  --accent-glow: rgba(91, 141, 239, 0.3);
  --hot:         #ff6b35;
  --hot-dim:     rgba(255, 107, 53, 0.15);
  --danger:      #ef4444;

  /* Text */
  --text:        #e8eaf0;
  --text-secondary: #8892a4;
  --text-muted:  #5a6478;

  /* Rank */
  --gold:        #fbbf24;
  --silver:      #94a3b8;
  --bronze:      #d97706;
  --money:       #4ade80;

  /* WBD Special */
  --ice:         #60a5fa;
  --ice-dim:     rgba(96, 165, 250, 0.15);

  /* Typography */
  --font:        'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --mono:        'Inter', monospace;

  /* Sizing */
  --radius-sm:   6px;
  --radius:      10px;
  --radius-lg:   16px;
  --radius-xl:   20px;
  --nav-height:  56px;
  --bottom-bar:  64px;
  --max-width:   1200px;

  /* Transitions */
  --ease:        cubic-bezier(0.4, 0, 0.2, 1);
  --duration:    200ms;
}


/* ================================================================
   RESET & BASE
   ================================================================ */

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

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

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100dvh;
  padding-bottom: calc(var(--bottom-bar) + 16px);
}

@media (min-width: 768px) {
  body { padding-bottom: 0; }
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--duration) var(--ease);
}
a:hover { color: #7da8f7; }

img { max-width: 100%; height: auto; }

::selection {
  background: var(--accent-dim);
  color: var(--accent);
}


/* ================================================================
   TYPOGRAPHY
   ================================================================ */

h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--text);
}

h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.2rem; }
h4 { font-size: 1.05rem; }

.text-muted   { color: var(--text-muted) !important; }
.text-secondary { color: var(--text-secondary) !important; }
.text-accent  { color: var(--accent) !important; }
.text-hot     { color: var(--hot) !important; }
.text-ice     { color: var(--ice) !important; }
.text-gold    { color: var(--gold) !important; }
.text-silver  { color: var(--silver) !important; }
.text-bronze  { color: var(--bronze) !important; }
.text-money   { color: var(--money) !important; }
.text-danger  { color: var(--danger) !important; }

.stat-number {
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
}

.label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}


/* ================================================================
   LAYOUT
   ================================================================ */

.page {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 20px 16px;
}

.page-header {
  margin-bottom: 24px;
}

.page-header h1 {
  display: flex;
  align-items: center;
  gap: 10px;
}

.page-header .page-subtitle {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-top: 4px;
}

.grid {
  display: grid;
  gap: 16px;
}

.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 767px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .grid-2-mobile { grid-template-columns: repeat(2, 1fr); }
}

.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-xs  { gap: 4px; }
.gap-sm  { gap: 8px; }
.gap-md  { gap: 12px; }
.gap-lg  { gap: 16px; }
.gap-xl  { gap: 24px; }


/* ================================================================
   TOP NAVIGATION
   ================================================================ */

.topnav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(12, 15, 20, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  height: var(--nav-height);
  display: flex;
  align-items: center;
  padding: 0 16px;
}

.topnav-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.topnav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-weight: 800;
  font-size: 1.1rem;
  letter-spacing: -0.02em;
}
.topnav-brand:hover { color: var(--text); }
.topnav-brand img { height: 28px; }

.topnav-links {
  display: none;
  list-style: none;
  gap: 4px;
}

@media (min-width: 768px) {
  .topnav-links { display: flex; }
}

.topnav-links a {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 500;
  transition: all var(--duration) var(--ease);
}

.topnav-links a:hover,
.topnav-links a.active {
  color: var(--text);
  background: var(--elevated);
}

.topnav-links a.active {
  color: var(--accent);
}

.topnav-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.season-select {
  background: var(--elevated);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-size: 0.8rem;
  font-family: var(--font);
  font-weight: 600;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238892a4' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  padding-right: 26px;
}

.season-select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-dim);
}

.user-menu {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.user-menu a {
  color: var(--text-secondary);
  padding: 6px;
  border-radius: var(--radius-sm);
}
.user-menu a:hover {
  color: var(--text);
  background: var(--elevated);
}


/* ================================================================
   MOBILE BOTTOM TABS
   ================================================================ */

.bottom-tabs {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: rgba(12, 15, 20, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  height: var(--bottom-bar);
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding-bottom: env(safe-area-inset-bottom, 0);
}

@media (min-width: 768px) {
  .bottom-tabs { display: none; }
}

.bottom-tabs a {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  color: var(--text-muted);
  font-size: 0.65rem;
  font-weight: 500;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  transition: color var(--duration) var(--ease);
}

.bottom-tabs a i {
  font-size: 1.2rem;
}

.bottom-tabs a:hover,
.bottom-tabs a.active {
  color: var(--accent);
}


/* ================================================================
   CARDS
   ================================================================ */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color var(--duration) var(--ease);
}

.card:hover {
  border-color: var(--border-light);
}

.card-body {
  padding: 16px;
}

.card-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
}

.card-glow {
  border-color: var(--accent);
  box-shadow: 0 0 20px var(--accent-dim), inset 0 1px 0 var(--accent-dim);
}

.card-gold { border-color: var(--gold); box-shadow: 0 4px 20px rgba(251, 191, 36, 0.1); }
.card-silver { border-color: var(--silver); }
.card-bronze { border-color: var(--bronze); }


/* ================================================================
   STAT CARDS (for hero numbers)
   ================================================================ */

.stat-card {
  text-align: center;
  padding: 16px 12px;
}

.stat-card .stat-value {
  font-size: 1.8rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
  line-height: 1;
  margin-bottom: 4px;
}

.stat-card .stat-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}


/* ================================================================
   TABLES
   ================================================================ */

.table-dark {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.table-dark th {
  padding: 10px 12px;
  font-weight: 600;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  text-align: left;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}

.table-dark th:hover {
  color: var(--text-secondary);
}

.table-dark td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  font-variant-numeric: tabular-nums;
}

.table-dark tr:last-child td {
  border-bottom: none;
}

.table-dark tr:hover td {
  background: var(--elevated);
}

.table-dark .text-right { text-align: right; }
.table-dark .text-center { text-align: center; }

/* Sticky first column on mobile */
@media (max-width: 767px) {
  .table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}


/* ================================================================
   BADGES
   ================================================================ */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.badge-accent { background: var(--accent-dim); color: var(--accent); }
.badge-hot    { background: var(--hot-dim); color: var(--hot); }
.badge-ice    { background: var(--ice-dim); color: var(--ice); }
.badge-gold   { background: rgba(251, 191, 36, 0.15); color: var(--gold); }
.badge-silver { background: rgba(148, 163, 184, 0.15); color: var(--silver); }
.badge-bronze { background: rgba(217, 119, 6, 0.15); color: var(--bronze); }
.badge-money  { background: rgba(74, 222, 128, 0.15); color: var(--money); }
.badge-muted  { background: rgba(90, 100, 120, 0.2); color: var(--text-muted); }

.badge-rank {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.75rem;
}

.badge-rank-1 { background: rgba(251, 191, 36, 0.2); color: var(--gold); border: 2px solid var(--gold); }
.badge-rank-2 { background: rgba(148, 163, 184, 0.15); color: var(--silver); border: 2px solid var(--silver); }
.badge-rank-3 { background: rgba(217, 119, 6, 0.15); color: var(--bronze); border: 2px solid var(--bronze); }
.badge-rank-n { background: var(--elevated); color: var(--text-muted); border: 2px solid var(--border); }


/* ================================================================
   AVATARS (initials circles)
   ================================================================ */

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.8rem;
  color: var(--text);
  background: var(--elevated);
  border: 2px solid var(--border);
  flex-shrink: 0;
}

.avatar-sm { width: 28px; height: 28px; font-size: 0.65rem; }
.avatar-lg { width: 48px; height: 48px; font-size: 1rem; }

.avatar-accent { background: var(--accent-dim); border-color: var(--accent); color: var(--accent); }

/* Player headshot thumbnails */
.headshot {
  width: 36px;
  height: 28px;
  object-fit: cover;
  object-position: top;
  border-radius: var(--radius-sm);
  background: var(--elevated);
  flex-shrink: 0;
}

.headshot-lg {
  width: 80px;
  height: 60px;
  border-radius: var(--radius);
}

.headshot-xl {
  width: 120px;
  height: 90px;
  border-radius: var(--radius);
}


/* ================================================================
   BUTTONS
   ================================================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--duration) var(--ease);
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent);
  color: #0c0f14;
}
.btn-primary:hover {
  background: #7da8f7;
  box-shadow: 0 4px 12px var(--accent-dim);
}

.btn-secondary {
  background: var(--elevated);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover {
  background: var(--border);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}
.btn-ghost:hover {
  background: var(--elevated);
  color: var(--text);
}

.btn-sm { padding: 5px 10px; font-size: 0.75rem; }
.btn-lg { padding: 12px 24px; font-size: 1rem; }
.btn-icon { padding: 8px; }

.btn-danger {
  background: rgba(239, 68, 68, 0.15);
  color: var(--danger);
}
.btn-danger:hover {
  background: rgba(239, 68, 68, 0.25);
}


/* ================================================================
   FORMS
   ================================================================ */

input[type="text"],
input[type="password"],
input[type="email"],
input[type="search"],
input[type="number"],
select,
textarea {
  background: var(--elevated);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-family: var(--font);
  font-size: 0.85rem;
  width: 100%;
  transition: border-color var(--duration) var(--ease), box-shadow var(--duration) var(--ease);
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

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

.input-group {
  display: flex;
  gap: 8px;
}

.input-icon {
  position: relative;
}
.input-icon i {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.85rem;
}
.input-icon input {
  padding-left: 36px;
}


/* ================================================================
   TABS
   ================================================================ */

.tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.tabs::-webkit-scrollbar { display: none; }

.tab {
  padding: 10px 16px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--duration) var(--ease);
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
  font-family: var(--font);
}

.tab:hover { color: var(--text-secondary); }
.tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}


/* ================================================================
   SNOWFLAKE (white boy indicator)
   ================================================================ */

.snowflake {
  color: var(--ice);
  font-size: 0.75rem;
}

.snowflake-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px;
  border-radius: 999px;
  background: var(--ice-dim);
  color: var(--ice);
  font-size: 0.7rem;
  font-weight: 600;
}


/* ================================================================
   ELIMINATED STATE
   ================================================================ */

.eliminated {
  opacity: 0.45;
}

.eliminated-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px;
  border-radius: 999px;
  background: var(--hot-dim);
  color: var(--hot);
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}


/* ================================================================
   ON THE CLOCK (draft)
   ================================================================ */

.on-the-clock {
  background: var(--accent-dim);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.on-the-clock .team-name {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--accent);
}

.timer {
  font-size: 1.4rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.timer-green  { color: var(--accent); }
.timer-yellow { color: var(--gold); }
.timer-red    { color: var(--hot); animation: pulse 1s ease-in-out infinite; }

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


/* ================================================================
   TROPHY / PODIUM
   ================================================================ */

.podium {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 12px;
  padding: 24px 0;
}

.podium-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.podium-bar {
  width: 80px;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 8px;
  font-weight: 800;
  font-size: 1.2rem;
}

.podium-bar-1 { height: 120px; background: rgba(251, 191, 36, 0.2); color: var(--gold); border: 1px solid var(--gold); border-bottom: none; }
.podium-bar-2 { height: 90px; background: rgba(148, 163, 184, 0.1); color: var(--silver); border: 1px solid var(--silver); border-bottom: none; }
.podium-bar-3 { height: 60px; background: rgba(217, 119, 6, 0.1); color: var(--bronze); border: 1px solid var(--bronze); border-bottom: none; }


/* ================================================================
   EMPTY STATES
   ================================================================ */

.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}

.empty-state i {
  font-size: 2.5rem;
  margin-bottom: 12px;
  display: block;
}

.empty-state p {
  font-size: 0.9rem;
}


/* ================================================================
   ANIMATIONS
   ================================================================ */

@keyframes fade-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slide-up {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.animate-in {
  animation: fade-in 0.3s var(--ease) both;
}

.stagger-1 { animation-delay: 0.05s; }
.stagger-2 { animation-delay: 0.1s; }
.stagger-3 { animation-delay: 0.15s; }
.stagger-4 { animation-delay: 0.2s; }


/* ================================================================
   UTILITY
   ================================================================ */

.mt-xs { margin-top: 4px; }
.mt-sm { margin-top: 8px; }
.mt-md { margin-top: 16px; }
.mt-lg { margin-top: 24px; }
.mt-xl { margin-top: 32px; }

.mb-xs { margin-bottom: 4px; }
.mb-sm { margin-bottom: 8px; }
.mb-md { margin-bottom: 16px; }
.mb-lg { margin-bottom: 24px; }

.p-sm { padding: 8px; }
.p-md { padding: 16px; }
.p-lg { padding: 24px; }

.w-full { width: 100%; }
.text-center { text-align: center; }
.text-right  { text-align: right; }
.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.hidden-mobile {
  display: none;
}
@media (min-width: 768px) {
  .hidden-mobile { display: revert; }
  .hidden-desktop { display: none; }
}


/* ================================================================
   SCROLLBAR
   ================================================================ */

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--border-light);
}
