/* Season Ending Roster - Shared Styles
   ============================================ */

/* CSS Custom Properties */
:root {
  /* Colors - Light theme with Dark Royal Blue accent
     Color Theory: Split-complementary scheme
     Primary: Dark Royal Blue (#1a3a6e)
     Accents: Grey scale for structure, white for surfaces
     Complementary: Teal green for success states */
  --bg: #f4f6f9;
  --bg-elevated: #ffffff;
  --card: #ffffff;
  --card-hover: #f0f3f7;
  --text: #1e2a3a;
  --text-secondary: #5c6b7a;
  --muted: #8d99a8;
  --line: #dce1e8;
  --line-subtle: #e8ecf1;
  --accent: #1a3a6e;
  --accent-hover: #2a5298;
  --accent-light: rgba(26, 58, 110, 0.08);
  --success: #0d8a6a;
  --warning: #d4820a;
  --error: #d64545;

  /* Spacing */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;

  /* Layout */
  --max-width: 1200px;
  --sticky-top: 60px;

  /* Shadows - lighter for light theme */
  --shadow-sm: 0 1px 3px rgba(30, 42, 58, 0.06), 0 1px 2px rgba(30, 42, 58, 0.08);
  --shadow-md: 0 4px 12px rgba(30, 42, 58, 0.08), 0 2px 4px rgba(30, 42, 58, 0.06);
  --shadow-lg: 0 8px 24px rgba(30, 42, 58, 0.1), 0 4px 8px rgba(30, 42, 58, 0.06);
  --shadow-glow: 0 0 20px rgba(26, 58, 110, 0.12);
}

/* Reset & Base */
*, *::before, *::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  margin: 0;
  font-weight: 600;
  line-height: 1.3;
}

h1 { font-size: 26px; }
h2 { font-size: 20px; }
h3 { font-size: 16px; }

p {
  margin: 0 0 16px;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.15s ease;
}

a:hover {
  color: var(--accent-hover);
}

/* ===== Top Navigation Bar ===== */
.sitebar {
  position: sticky;
  top: 0;
  z-index: 1000;
  width: 100%;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}

.bar-inner {
  margin: 0 auto;
  max-width: var(--max-width);
  padding: 12px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.brand {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: var(--text);
}

.brand-sub {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

/* Navigation Tabs */
.tabs {
  display: inline-flex;
  gap: 4px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--bg-elevated);
}

.tabs a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  padding: 8px 14px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  transition: all 0.15s ease;
}

.tabs a:hover {
  color: var(--text);
  background: var(--card);
  border-color: var(--line);
}

.tabs a[aria-current="page"] {
  color: var(--text);
  background: var(--card);
  border-color: var(--line);
}

/* Responsive nav */
@media (max-width: 768px) {
  .bar-inner {
    flex-direction: column;
    gap: 12px;
  }

  .tabs {
    flex-wrap: wrap;
    justify-content: center;
  }

  .tabs a {
    padding: 6px 10px;
    font-size: 12px;
  }
}

/* ===== Main Content Wrapper ===== */
.wrap {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 24px 20px;
}

/* Page Header */
.page-header {
  margin-bottom: 24px;
}

.page-header h1 {
  margin-bottom: 8px;
}

.page-header .hint,
.hint {
  color: var(--muted);
  font-size: 14px;
}

/* ===== Cards ===== */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  overflow: visible;
  box-shadow: var(--shadow-md);
}

/* Allow cards to clip content when needed (e.g., images) */
.card-clip {
  overflow: hidden;
}

.card-header {
  padding: 16px 20px;
  background: linear-gradient(135deg, rgba(26, 58, 110, 0.06) 0%, rgba(42, 82, 152, 0.06) 100%);
  border-bottom: 1px solid var(--line);
}

.card-body {
  padding: 16px 20px;
}

/* ===== Tables ===== */
table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
}

thead th {
  position: sticky;
  top: var(--sticky-top);
  z-index: 3;
  background: var(--card);
  box-shadow: 0 1px 0 var(--line);
  text-align: left;
  padding: 12px 14px;
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  white-space: nowrap;
  cursor: pointer;
  transition: color 0.15s ease;
}

/* First and last header cells need rounded corners when at top */
thead th:first-child {
  border-top-left-radius: var(--radius-xl);
}

thead th:last-child {
  border-top-right-radius: var(--radius-xl);
}

/* Last row cells need rounded corners at bottom */
tbody tr:last-child td:first-child {
  border-bottom-left-radius: var(--radius-xl);
}

tbody tr:last-child td:last-child {
  border-bottom-right-radius: var(--radius-xl);
}

thead th:hover {
  color: var(--text);
}

tbody td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--line-subtle);
  vertical-align: middle;
}

tbody tr:last-child td {
  border-bottom: none;
}

tbody tr {
  transition: background 0.1s ease;
}

tbody tr:hover {
  background: var(--card-hover);
}

.right {
  text-align: right;
}

.center {
  text-align: center;
}

.small {
  font-size: 12px;
}

/* ===== Buttons & Links ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--accent);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
}

.btn:hover {
  color: var(--accent-hover);
  background: var(--card);
  border-color: var(--accent);
}

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

.btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

/* ===== Form Elements ===== */
input[type="search"],
input[type="text"],
select {
  background: var(--bg-elevated);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  font-size: 14px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input[type="search"]:focus,
input[type="text"]:focus,
select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(26, 58, 110, 0.12);
}

input[type="search"]::placeholder {
  color: var(--muted);
}

label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--text-secondary);
  cursor: pointer;
}

input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

/* ===== Badges & Tags ===== */
.badge {
  display: inline-block;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--bg-elevated);
}

.badge-success {
  color: var(--success);
  border-color: var(--success);
  background: rgba(34, 197, 94, 0.1);
}

.badge-warning {
  color: var(--warning);
  border-color: var(--warning);
  background: rgba(245, 158, 11, 0.1);
}

.badge-error {
  color: var(--error);
  border-color: var(--error);
  background: rgba(239, 68, 68, 0.1);
}

/* Position Badges (Fantasy specific) */
.pos {
  display: inline-block;
  min-width: 36px;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 600;
  text-align: center;
  text-transform: uppercase;
}

.pos-QB { background: #dc2626; color: #fff; }
.pos-RB { background: #059669; color: #fff; }
.pos-WR { background: #2563eb; color: #fff; }
.pos-TE { background: #d97706; color: #fff; }
.pos-K { background: #7c3aed; color: #fff; }
.pos-DEF { background: #78716c; color: #fff; }
.pos-BN { background: #3f3f46; color: #a1a1aa; }
.pos-IR { background: #27272a; color: #71717a; }

/* ===== Grid Layouts ===== */
.grid {
  display: grid;
  gap: 16px;
}

.grid-2 {
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}

.grid-3 {
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

.grid-4 {
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}

/* ===== Roster Grid (Homepage) ===== */
.roster-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}

.roster-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  overflow: hidden;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.roster-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.roster-header {
  background: linear-gradient(135deg, #1a3a6e 0%, #2a5298 100%);
  padding: 14px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.roster-header h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: #ffffff;
}

.roster-header .team-name {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.75);
  margin-top: 3px;
}

.crown-badges {
  display: flex;
  gap: 2px;
  font-size: 16px;
}

.crown-badge {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  background: rgba(251, 191, 36, 0.15);
  border: 1px solid rgba(251, 191, 36, 0.3);
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 600;
  color: #fbbf24;
  white-space: nowrap;
}

.roster-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.roster-table th {
  text-align: left;
  padding: 10px 14px;
  background: rgba(26, 58, 110, 0.06);
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  position: static;
  box-shadow: none;
}

.roster-table td {
  padding: 8px 14px;
  border-bottom: 1px solid var(--line-subtle);
}

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

.roster-table tr:hover {
  background: var(--card-hover);
}

.player-team {
  color: var(--muted);
  font-size: 11px;
  margin-left: 4px;
}

/* ===== Bracket View (Playoffs) ===== */
.bracket-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(260px, 1fr));
  gap: 18px;
}

@media (max-width: 900px) {
  .bracket-grid {
    grid-template-columns: 1fr;
  }
}

.round {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  padding: 14px;
  box-shadow: var(--shadow-md);
}

.round h3 {
  margin: 0 0 12px 4px;
  font-size: 14px;
  color: var(--text-secondary);
  font-weight: 600;
}

.game {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.game:last-child {
  margin-bottom: 0;
}

.game-row {
  display: grid;
  grid-template-columns: 32px 1fr 60px;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  border: 1px solid var(--line-subtle);
  transition: background 0.1s ease;
}

.game-row.winner {
  background: rgba(34, 197, 94, 0.1);
  border-color: rgba(34, 197, 94, 0.3);
}

.game-row .seed {
  font-size: 11px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 6px;
  text-align: center;
  background: var(--bg);
}

.game-row .name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
}

.game-row .score {
  text-align: right;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* ===== Controls Row ===== */
.controls {
  display: flex;
  gap: 14px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.controls input[type="search"] {
  min-width: 280px;
}

.controls .count {
  font-size: 12px;
  color: var(--muted);
}

/* ===== Utility Classes ===== */
.muted {
  color: var(--muted);
}

.text-secondary {
  color: var(--text-secondary);
}

.text-success {
  color: var(--success);
}

.text-warning {
  color: var(--warning);
}

.text-error {
  color: var(--error);
}

.win { color: var(--success); }
.loss { color: var(--error); }
.tie { color: var(--text-secondary); }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }

/* ===== Footer ===== */
.site-footer {
  max-width: var(--max-width);
  margin: 32px auto 0;
  padding: 20px;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  border-top: 1px solid var(--line);
}

.site-footer .foot-meta {
  margin-top: 6px;
  font-size: 11px;
}

/* Alternative row footer */
.footer-row {
  max-width: var(--max-width);
  margin: 24px auto 36px;
  padding: 0 20px;
  color: var(--muted);
  font-size: 12px;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

/* ===== Section Headers ===== */
.section-title {
  margin: 24px 0 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
  font-size: 18px;
  font-weight: 600;
}

/* ===== Details/Collapsible ===== */
details {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

summary {
  cursor: pointer;
  list-style: none;
  user-select: none;
  padding: 14px 16px;
  background: var(--bg-elevated);
  font-weight: 500;
  transition: background 0.15s ease;
}

summary::-webkit-details-marker {
  display: none;
}

summary:hover {
  background: var(--card);
}

details .body {
  padding: 16px;
}

pre.trans {
  white-space: pre-wrap;
  word-wrap: break-word;
  font-family: ui-monospace, Consolas, 'Courier New', monospace;
  font-size: 12px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 14px;
  max-height: 500px;
  overflow-y: auto;
}

/* ===== Key-Value Display ===== */
.kv {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 8px 16px;
}

@media (max-width: 640px) {
  .kv {
    grid-template-columns: 1fr;
  }
}

.kv > div:nth-child(odd) {
  font-weight: 500;
  color: var(--text-secondary);
}

/* ===== Table of Contents (History page) ===== */
.toc {
  padding: 14px 16px;
}

.toc h3 {
  margin: 0 0 10px;
  font-size: 14px;
}

.toc a {
  display: block;
  color: var(--text-secondary);
  text-decoration: none;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  transition: all 0.15s ease;
}

.toc a:hover {
  color: var(--text);
  background: var(--card-hover);
}

.toc .sub {
  margin-left: 12px;
  font-size: 12px;
  color: var(--muted);
}

/* ===== Loading State ===== */
.loading {
  text-align: center;
  padding: 40px;
  color: var(--muted);
}

/* ===== Empty State ===== */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--muted);
}

.empty-state p {
  margin: 0;
}

/* ===== Animations ===== */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.fade-in {
  animation: fadeIn 0.3s ease;
}
