/* ============================================================
   NFL Playoff Fantasy — Design System
   Dark premium sports aesthetic
   ============================================================ */

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

:root {
  --bg:          #09090f;
  --bg-surface:  #111118;
  --bg-raised:   #18181f;
  --bg-hover:    #1f1f28;
  --border:      rgba(255,255,255,0.08);
  --border-mid:  rgba(255,255,255,0.14);

  /* "gold" is the theme accent; js/theme.js overrides these for team / NFL themes */
  --gold:        #f5a623;
  --gold-rgb:    245,166,35;
  --gold-dim:    rgba(245,166,35,0.15);
  --gold-border: rgba(245,166,35,0.35);
  --gold-hover:  #e09a1f;
  --gold-deep:   #e08a0a;
  --on-gold:     #000;

  --blue:        #3b82f6;
  --blue-dim:    rgba(59,130,246,0.15);
  --blue-border: rgba(59,130,246,0.35);

  --green:       #22c55e;
  --green-dim:   rgba(34,197,94,0.12);
  --red:         #ef4444;
  --red-dim:     rgba(239,68,68,0.12);

  --text:        #f0eff8;
  --text-2:      #9391a8;
  --text-3:      #5a5870;

  --radius:      10px;
  --radius-sm:   6px;
  --radius-lg:   16px;
  --font:        -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-mono:   'SF Mono', 'Fira Code', monospace;

  --shadow:      0 4px 24px rgba(0,0,0,0.5);
  --shadow-sm:   0 2px 8px rgba(0,0,0,0.4);
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  min-height: 100vh;
}

/* ── Typography ── */
h1 { font-size: 28px; font-weight: 700; letter-spacing: -0.5px; }
h2 { font-size: 20px; font-weight: 600; }
h3 { font-size: 16px; font-weight: 600; }

.label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-3);
}

/* ── Layout ── */
.page { max-width: 1200px; margin: 0 auto; padding: 0 1.5rem; }
.page-narrow { max-width: 680px; margin: 0 auto; padding: 0 1.5rem; }

/* ── Navbar ── */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(9,9,15,0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  padding: 0 1.5rem;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.navbar-logo {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--gold), var(--gold-deep));
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.navbar-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.2px;
}

.navbar-title span { color: var(--gold); }

.navbar-right { display: flex; align-items: center; gap: 10px; }

.nav-link {
  font-size: 13px;
  color: var(--text-2);
  text-decoration: none;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  transition: color 0.12s, background 0.12s;
}
.nav-link:hover { color: var(--text); background: var(--bg-raised); }
.nav-link.active { color: var(--gold); }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px;
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font);
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: none;
  transition: all 0.12s;
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--gold);
  color: var(--on-gold);
}
.btn-primary:hover { background: var(--gold-hover); }

.btn-ghost {
  background: transparent;
  color: var(--text-2);
  border: 1px solid var(--border-mid);
}
.btn-ghost:hover { color: var(--text); background: var(--bg-raised); }

.btn-danger {
  background: var(--red-dim);
  color: var(--red);
  border: 1px solid rgba(239,68,68,0.3);
}
.btn-danger:hover { background: rgba(239,68,68,0.2); }

.btn-sm { height: 28px; padding: 0 10px; font-size: 11px; }
.btn-lg { height: 44px; padding: 0 20px; font-size: 15px; }
.btn-full { width: 100%; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ── Cards ── */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
}

.card-hover {
  transition: border-color 0.12s, background 0.12s;
  cursor: pointer;
}
.card-hover:hover {
  border-color: var(--border-mid);
  background: var(--bg-raised);
}

/* ── Form elements ── */
input[type="text"],
input[type="email"],
input[type="number"],
select,
textarea {
  width: 100%;
  height: 38px;
  padding: 0 12px;
  background: var(--bg-raised);
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 13px;
  font-family: var(--font);
  outline: none;
  transition: border-color 0.12s;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--gold);
}

textarea { height: auto; padding: 10px 12px; resize: vertical; }

label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-2);
  margin-bottom: 5px;
}

.form-group { margin-bottom: 1rem; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ── Position badges ── */
.pos {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  letter-spacing: 0.04em;
  min-width: 28px;
  text-align: center;
}
.pos-QB { background: rgba(59,130,246,0.2); color: #93c5fd; border: 1px solid rgba(59,130,246,0.3); }
.pos-RB { background: rgba(34,197,94,0.15); color: #86efac; border: 1px solid rgba(34,197,94,0.3); }
.pos-WR { background: rgba(245,166,35,0.15); color: #fcd34d; border: 1px solid rgba(245,166,35,0.3); }
.pos-TE { background: rgba(168,85,247,0.15); color: #d8b4fe; border: 1px solid rgba(168,85,247,0.3); }
.pos-FB { background: rgba(239,68,68,0.12); color: #fca5a5; border: 1px solid rgba(239,68,68,0.25); }

/* ── Status pills ── */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 500;
  padding: 3px 10px;
  border-radius: 100px;
}
.pill-live { background: var(--red-dim); color: var(--red); border: 1px solid rgba(239,68,68,0.3); }
.pill-active { background: var(--green-dim); color: var(--green); border: 1px solid rgba(34,197,94,0.3); }
.pill-setup { background: var(--gold-dim); color: var(--gold); border: 1px solid var(--gold-border); }
.pill-complete { background: var(--bg-raised); color: var(--text-2); border: 1px solid var(--border-mid); }
.pill-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill-dot.pulse { animation: pulse 1.4s ease-in-out infinite; }

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

/* ── Team logo ── */
.team-logo {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: contain;
  background: var(--bg-raised);
}

.team-logo-sm { width: 22px; height: 22px; }
.team-logo-lg { width: 48px; height: 48px; }

/* ── Player avatar ── */
.player-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-2);
  overflow: hidden;
  flex-shrink: 0;
}
.player-avatar img { width: 100%; height: 100%; object-fit: cover; }
.player-avatar-sm { width: 28px; height: 28px; font-size: 10px; }

/* ── Scoreboard / Stats grid ── */
.round-cols {
  display: grid;
  grid-template-columns: 1fr repeat(5, auto);
  gap: 0;
}

.stat-cell {
  padding: 10px 12px;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
}

.stat-num {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  font-family: var(--font-mono);
  text-align: right;
  min-width: 48px;
}

.stat-num.highlight { color: var(--gold); }

/* ── Rank medal ── */
.rank { font-size: 13px; font-weight: 700; color: var(--text-3); min-width: 20px; }
.rank-1 { color: #fbbf24; }
.rank-2 { color: #94a3b8; }
.rank-3 { color: #b45309; }

/* ── Draft board ── */
.draft-pick {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-surface);
  transition: all 0.12s;
}

.draft-pick.drafted { opacity: 0.35; pointer-events: none; }
.draft-pick.on-clock { border-color: var(--gold-border); background: var(--gold-dim); }

.pick-num-badge {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-3);
  min-width: 24px;
  font-family: var(--font-mono);
}

/* ── Tab bar ── */
.tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  gap: 0;
  overflow-x: auto;
  overflow-y: hidden;
}

.tab {
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  background: none;
  border-left: none;
  border-right: none;
  border-top: none;
  font-family: var(--font);
  transition: all 0.12s;
  white-space: nowrap;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--gold); border-bottom-color: var(--gold); }

/* ── Toast notifications ── */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 999;
}

.toast {
  padding: 10px 16px;
  background: var(--bg-raised);
  border: 1px solid var(--border-mid);
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--text);
  box-shadow: var(--shadow);
  animation: slideIn 0.2s ease;
  max-width: 320px;
}

.toast.success { border-color: rgba(34,197,94,0.4); color: var(--green); }
.toast.error   { border-color: rgba(239,68,68,0.4);  color: var(--red); }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}

/* ── Dividers + spacing ── */
.divider { height: 1px; background: var(--border); margin: 1.5rem 0; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-1 { flex: 1; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }

/* ── Loading skeleton ── */
.skeleton {
  background: linear-gradient(90deg, var(--bg-raised) 25%, var(--bg-hover) 50%, var(--bg-raised) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── Empty state ── */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--text-3);
}
.empty-state .icon { font-size: 48px; margin-bottom: 1rem; }
.empty-state p { font-size: 14px; }

/* ── Responsive ── */
@media (max-width: 768px) {
  h1 { font-size: 22px; }
  .form-row { grid-template-columns: 1fr; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .page, .page-narrow { padding: 0 1rem; }
  .navbar { padding: 0 1rem; }
}
