/* =========================================================
   ATG-FF — Design System v2
   Base: deep navy-charcoal
   Accent: violet-indigo (UI/brand)
   Gold: amber (scores & FP data)
   ========================================================= */

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

/* ----- Custom Properties --------------------------------- */
:root {
  /* Backgrounds */
  --bg:        #0b0e18;
  --surface-0: #0f1221;
  --surface-1: #141829;
  --surface-2: #1a1f35;
  --surface-3: #212640;

  /* Borders */
  --border:    #1e2338;
  --border-hi: #272d47;

  /* Text */
  --text:       #e4e7f0;
  --text-muted: #64748b;
  --text-dim:   #334155;

  /* Primary accent: violet-indigo */
  --accent:      #8b7cf8;
  --accent-2:    #7c6ef5;
  --accent-dim:  #6c5ee8;
  --accent-glow: rgba(139, 124, 248, 0.14);
  --accent-glow-sm: rgba(139, 124, 248, 0.07);

  /* Gold: amber — used for scores, FP, data highlights */
  --gold:      #f59e0b;
  --gold-dim:  rgba(245, 158, 11, 0.13);

  /* Semantic */
  --danger:      #f87171;
  --danger-dim:  rgba(248, 113, 113, 0.12);
  --warning:     #fbbf24;
  --warning-dim: rgba(251, 191, 36, 0.12);
  --info:        #60a5fa;
  --info-dim:    rgba(96, 165, 250, 0.12);
  --success:     #34d399;
  --success-dim: rgba(52, 211, 153, 0.12);

  /* Position colors */
  --pos-qb: #60a5fa;
  --pos-rb: #34d399;
  --pos-wr: #c084fc;
  --pos-te: #fb923c;
  --pos-k:  #94a3b8;

  /* Geometry */
  --radius:    8px;
  --radius-lg: 12px;
  --radius-xl: 18px;

  /* Shadows */
  --shadow:    0 1px 2px rgba(0,0,0,0.5), 0 4px 16px rgba(0,0,0,0.3);
  --shadow-lg: 0 2px 4px rgba(0,0,0,0.6), 0 8px 32px rgba(0,0,0,0.4);
  --shadow-accent: 0 4px 20px rgba(139, 124, 248, 0.25);

  /* Motion */
  --transition: 0.15s cubic-bezier(0.4, 0, 0.2, 1);

  /* Font */
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
}

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

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

a { color: var(--accent); text-decoration: none; transition: color var(--transition); }
a:hover { color: #a89efa; }

h1, h2, h3, h4 {
  color: var(--text);
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 0.5rem;
  letter-spacing: -0.02em;
}
h1 { font-size: 1.75rem; font-weight: 800; }
h2 { font-size: 1.2rem; font-weight: 700; }
h3 { font-size: 1rem; font-weight: 600; }
h4 { font-size: 0.875rem; font-weight: 600; color: var(--text-muted); }

p { margin-bottom: 0.75rem; }
ul { padding-left: 1.25rem; }

/* ----- Layout ------------------------------------------- */
.container {
  max-width: 1300px;
  margin: 0 auto;
  padding: 0 24px;
}

.page-body { padding: 32px 0 72px; }

.page-header {
  display: flex;
  align-items: baseline;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 28px;
}
.page-header h1 { margin-bottom: 0; }

.page-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 24px;
}

.section { margin-bottom: 36px; }
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.section-header h2, .section-header h3 { margin-bottom: 0; }

/* ----- Navigation --------------------------------------- */
.nav {
  background: rgba(11, 14, 24, 0.82);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-hi);
  position: sticky;
  top: 0;
  z-index: 100;
}
.nav-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 58px;
}
.nav-brand {
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  background: linear-gradient(135deg, var(--accent) 0%, #c084fc 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  padding: 4px 0;
}
.nav-brand:hover { opacity: 0.85; }
.nav-links { display: flex; align-items: center; gap: 2px; }
.nav-links a {
  color: var(--text-muted);
  padding: 6px 13px;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  transition: color var(--transition), background var(--transition);
}
.nav-links a:hover { color: var(--text); background: var(--surface-2); }
.nav-links a.active {
  color: var(--accent);
  background: var(--accent-glow);
}
.nav-right { display: flex; align-items: center; gap: 10px; }
.nav-user {
  font-size: 0.8rem;
  color: var(--text-muted);
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* ----- Flash Messages ----------------------------------- */
.flash-messages { margin-bottom: 24px; }
.flash {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 13px 16px;
  border-radius: var(--radius);
  margin-bottom: 8px;
  font-size: 0.875rem;
  border: 1px solid transparent;
}
.flash.success { background: var(--success-dim); border-color: rgba(52,211,153,0.25); color: var(--success); }
.flash.error   { background: var(--danger-dim);  border-color: rgba(248,113,113,0.25); color: var(--danger); }
.flash.info    { background: var(--info-dim);    border-color: rgba(96,165,250,0.25);  color: var(--info); }
.flash.warning { background: var(--warning-dim); border-color: rgba(251,191,36,0.25);  color: var(--warning); }
.flash-close {
  margin-left: auto;
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  opacity: 0.5;
  font-size: 1rem;
  line-height: 1;
  flex-shrink: 0;
  transition: opacity var(--transition);
}
.flash-close:hover { opacity: 1; }

/* ----- Cards -------------------------------------------- */
.card {
  background: linear-gradient(160deg, var(--surface-1) 0%, var(--surface-0) 100%);
  border: 1px solid var(--border-hi);
  border-radius: var(--radius-lg);
  padding: 22px 26px;
  margin-bottom: 20px;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.025) inset, var(--shadow);
}
.card-sm { padding: 14px 18px; }
.card + .card { margin-top: 0; }
.card-title {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 16px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* ----- Buttons ------------------------------------------ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  font-family: var(--font);
  font-weight: 600;
  font-size: 0.875rem;
  text-decoration: none;
  transition: all var(--transition);
  white-space: nowrap;
  position: relative;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

/* Default (primary) */
.btn:not(.btn-secondary):not(.btn-danger):not(.btn-warning):not(.btn-ghost) {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dim) 100%);
  color: #fff;
  box-shadow: 0 2px 8px rgba(139, 124, 248, 0.3), 0 1px 2px rgba(0,0,0,0.3);
}
.btn:not(.btn-secondary):not(.btn-danger):not(.btn-warning):not(.btn-ghost):hover {
  background: linear-gradient(135deg, #9d8ffa 0%, var(--accent) 100%);
  box-shadow: 0 4px 18px rgba(139, 124, 248, 0.45), 0 1px 2px rgba(0,0,0,0.3);
  color: #fff;
}

.btn-secondary {
  background: var(--surface-2);
  color: var(--text-muted);
  border: 1px solid var(--border-hi);
}
.btn-secondary:hover { background: var(--surface-3); color: var(--text); border-color: var(--accent); }

.btn-danger { background: var(--danger-dim); color: var(--danger); border: 1px solid rgba(248,113,113,0.3); }
.btn-danger:hover { background: var(--danger); color: #fff; box-shadow: 0 4px 14px rgba(248,113,113,0.3); }

.btn-warning { background: var(--warning-dim); color: var(--warning); border: 1px solid rgba(251,191,36,0.3); }
.btn-warning:hover { background: var(--warning); color: #0b0e18; }

.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { color: var(--text); background: var(--surface-2); }

.btn-sm { padding: 5px 12px; font-size: 0.8rem; }
.btn-lg { padding: 12px 26px; font-size: 0.95rem; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none !important; box-shadow: none !important; }

/* ----- Forms -------------------------------------------- */
.form-group { margin-bottom: 18px; }
.form-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 7px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.form-control {
  width: 100%;
  padding: 10px 13px;
  background: var(--surface-2);
  border: 1px solid var(--border-hi);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.9rem;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.form-control:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.form-control::placeholder { color: var(--text-dim); }
select.form-control { cursor: pointer; }

.form-section {
  margin-top: 28px;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-hi);
}
.form-section h3 {
  color: var(--text-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
}
.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
}

/* ----- Tables ------------------------------------------- */
.data-table {
  width: 100%;
  border-collapse: collapse;
}
.data-table th {
  padding: 10px 14px;
  text-align: left;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border-hi);
  white-space: nowrap;
}
.data-table td {
  padding: 11px 14px;
  font-size: 0.875rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.data-table tbody tr { transition: background var(--transition); }
.data-table tbody tr:hover { background: var(--surface-2); }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table .col-num { text-align: right; font-variant-numeric: tabular-nums; }
.data-table .col-center { text-align: center; }

/* ----- Badges ------------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 100px;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
}
.badge-qb { background: rgba(96,165,250,0.13); color: var(--pos-qb); border: 1px solid rgba(96,165,250,0.2); }
.badge-rb { background: rgba(52,211,153,0.13); color: var(--pos-rb); border: 1px solid rgba(52,211,153,0.2); }
.badge-wr { background: rgba(192,132,252,0.13); color: var(--pos-wr); border: 1px solid rgba(192,132,252,0.2); }
.badge-te { background: rgba(251,146,60, 0.13); color: var(--pos-te); border: 1px solid rgba(251,146,60,0.2); }
.badge-k  { background: rgba(148,163,184,0.13); color: var(--pos-k);  border: 1px solid rgba(148,163,184,0.2); }
.badge-bot    { background: var(--surface-3); color: var(--text-muted); border: 1px solid var(--border-hi); }
.badge-success{ background: var(--success-dim); color: var(--success); border: 1px solid rgba(52,211,153,0.2); }
.badge-info   { background: var(--info-dim);    color: var(--info);    border: 1px solid rgba(96,165,250,0.2); }
.badge-warning{ background: var(--warning-dim); color: var(--warning); border: 1px solid rgba(251,191,36,0.2); }
.badge-danger { background: var(--danger-dim);  color: var(--danger);  border: 1px solid rgba(248,113,113,0.2); }
.badge-muted  { background: var(--surface-2);   color: var(--text-muted); border: 1px solid var(--border-hi); }

/* ----- Status Pill -------------------------------------- */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 11px;
  border-radius: 100px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.status-pill::before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}
.status-draft     { background: var(--info-dim);    color: var(--info); }
.status-season    { background: var(--success-dim); color: var(--success); }
.status-playoffs  { background: var(--accent-glow); color: var(--accent); }
.status-pre       { background: var(--surface-2);   color: var(--text-muted); }
.status-complete  { background: var(--gold-dim);    color: var(--gold); }

/* ----- Score / Stat displays ---------------------------- */
.score-big {
  font-size: 2.25rem;
  font-weight: 900;
  color: var(--gold);
  letter-spacing: -2px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.score-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 7px 0;
  border-bottom: 1px solid var(--border);
}
.stat-row:last-child { border-bottom: none; }
.stat-row .stat-label { color: var(--text-muted); font-size: 0.85rem; }
.stat-row .stat-val   { font-weight: 600; font-size: 0.9rem; }

/* ----- Matchup layout ----------------------------------- */
.matchup-card {
  background: linear-gradient(160deg, var(--surface-1) 0%, var(--surface-0) 100%);
  border: 1px solid var(--border-hi);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 28px;
  box-shadow: var(--shadow);
}
.matchup-header {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 20px;
  padding: 28px 28px 24px;
  background: linear-gradient(180deg, var(--surface-2) 0%, var(--surface-1) 100%);
  border-bottom: 1px solid var(--border-hi);
  position: relative;
}
.matchup-header::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border-hi), transparent);
}
.matchup-team { text-align: center; padding: 10px 12px; border-radius: var(--radius); }
.matchup-team.winner {
  background: rgba(245, 158, 11, 0.07);
  box-shadow: inset 0 0 0 1.5px rgba(245, 158, 11, 0.45), 0 0 20px rgba(245, 158, 11, 0.08);
}
.matchup-team.winner .team-name { color: var(--gold); }
.matchup-team .team-name { font-size: 1rem; font-weight: 700; margin-bottom: 8px; letter-spacing: -0.02em; }
.matchup-vs {
  color: var(--text-dim);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.matchup-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
}
.matchup-col { padding: 18px 22px; }
.matchup-col + .matchup-col { border-left: 1px solid var(--border); }

/* ----- Draft Board -------------------------------------- */
.player-table-wrap { overflow-x: auto; }

/* ----- Standings ---------------------------------------- */
.standings-rank {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1px solid var(--border-hi);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.82rem;
  color: var(--text-muted);
}
.rank-1 { background: rgba(251,191,36,0.12); color: #fbbf24; border-color: rgba(251,191,36,0.35); }
.rank-2 { background: rgba(148,163,184,0.12); color: #94a3b8; border-color: rgba(148,163,184,0.35); }
.rank-3 { background: rgba(251,146,60, 0.12); color: #fb923c; border-color: rgba(251,146,60, 0.35); }

/* ----- Empty State -------------------------------------- */
.empty-state {
  text-align: center;
  padding: 56px 24px;
  color: var(--text-dim);
}
.empty-state p { font-size: 0.9rem; margin-bottom: 16px; }

/* ----- Loading ------------------------------------------ */
.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border-hi);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.65s linear infinite;
  display: inline-block;
}
.loading-block {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 36px;
  color: var(--text-muted);
  font-size: 0.875rem;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ----- Utility ------------------------------------------ */
.text-accent  { color: var(--gold); }
.text-muted   { color: var(--text-muted); }
.text-danger  { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-info    { color: var(--info); }

.fw-bold { font-weight: 700; }
.fw-600  { font-weight: 600; }
.font-mono { font-family: var(--font-mono); font-size: 0.85em; }

.mt-4  { margin-top: 4px; }
.mt-8  { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mt-32 { margin-top: 32px; }
.mb-8  { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }

.d-flex      { display: flex; }
.align-center { align-items: center; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.flex-wrap { flex-wrap: wrap; }
.w-full { width: 100%; }
.hidden { display: none !important; }

/* ----- Divider ------------------------------------------ */
hr, .divider {
  border: none;
  border-top: 1px solid var(--border-hi);
  margin: 24px 0;
}

/* ----- Responsive --------------------------------------- */
@media (max-width: 768px) {
  .nav-inner { flex-wrap: wrap; height: auto; padding: 10px 0; gap: 8px; }
  .nav-links { gap: 2px; }
  .nav-links a { padding: 5px 9px; font-size: 0.82rem; }
  .matchup-body { grid-template-columns: 1fr; }
  .matchup-col + .matchup-col { border-left: none; border-top: 1px solid var(--border); }
  .matchup-header { grid-template-columns: 1fr; text-align: center; }
  .form-row { grid-template-columns: 1fr 1fr; }
  h1 { font-size: 1.4rem; }

  /* Tighten vertical rhythm */
  .page-body { padding: 20px 0 60px; }
  .card { padding: 16px 18px; }
  .page-header { margin-bottom: 18px; }

  /* Hide non-essential table columns on tablet/phone */
  .hide-mobile { display: none !important; }
}

@media (max-width: 480px) {
  .container { padding: 0 12px; }
  .form-row { grid-template-columns: 1fr; }
  .data-table th, .data-table td { padding: 9px 10px; font-size: 0.82rem; }
  .score-big { font-size: 1.75rem; }

  /* Further tighten on small phones */
  .page-body { padding: 14px 0 52px; }
  .card { padding: 14px 14px; }
  .page-header { margin-bottom: 14px; }

  /* btn-sm: minimum 44px tap target */
  .btn-sm { padding: 10px 14px; font-size: 0.82rem; min-height: 44px; }

  /* Hide email in nav — users know who they are; saves a full nav row */
  .nav-user { display: none; }

  /* Compact empty states */
  .empty-state { padding: 36px 16px; }
}
