/* ======================================================
   GB Golf Optimizer — GameBlazers × SilverReyes Edition
   ====================================================== */

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

:root {
  --bg:           #0d0d0e;
  --surface:      #141414;
  --surface-2:    #1c1c1e;
  --surface-3:    #252525;
  --accent:       #f47b3d;
  --accent-dim:   rgba(244, 123, 61, 0.09);
  --accent-glow:  rgba(244, 123, 61, 0.28);
  --accent-hover: #f58f58;
  --gold:         #c9a845;
  --gold-dim:     rgba(201, 168, 69, 0.10);
  --text:         #e4e4e6;
  --text-muted:   #5a5a6a;
  --border:       #282828;
  --border-2:     #363636;
  --shadow:       0 2px 16px rgba(0,0,0,0.55);
  --shadow-md:    0 4px 28px rgba(0,0,0,0.65);
  --shadow-lg:    0 8px 56px rgba(0,0,0,0.80);
  --radius:       8px;
  --font-display: 'Prompt', sans-serif;
  --font-mono:    'JetBrains Mono', monospace;
  --font-body:    'Prompt', sans-serif;
}

body {
  font-family: var(--font-body);
  margin: 0;
  padding: 0;
  background-color: var(--bg);
  background-image:
    radial-gradient(ellipse 80% 50% at 5% 0%, rgba(244, 123, 61, 0.05) 0%, transparent 70%);
  color: var(--text);
  line-height: 1.5;
}

/* ── Hero Header ───────────────────────────────────────── */

header {
  position: relative;
  height: 320px;
  overflow: hidden;
  display: flex;
  align-items: flex-end;
  padding-bottom: 2.25rem;
}

.hero-bg {
  position: absolute;
  inset: 0;
  background-image: url('golf-hero.jpg');
  background-color: #1a1010;
  background-size: cover;
  background-position: center 45%;
  filter: brightness(0.78) saturate(0.85);
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    135deg,
    rgba(13, 13, 14, 0.65) 0%,
    rgba(13, 13, 14, 0.42) 42%,
    rgba(13, 13, 14, 0.12) 100%
  );
}

/* Dual accent line at header bottom */
header::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent) 0%, rgba(244, 123, 61, 0.15) 65%, transparent 100%);
}

.hero-content {
  position: relative;
  z-index: 2;
  padding: 0 2.5rem;
}

.gb-logo {
  display: block;
  height: 30px;
  width: auto;
  opacity: 0.90;
  margin-bottom: 0.9rem;
  filter: drop-shadow(0 0 14px rgba(244, 123, 61, 0.45));
}

.hero-content h1 {
  margin: 0 0 0.25rem;
  font-family: var(--font-display);
  font-size: 4rem;
  font-weight: 900;
  color: var(--text);
  letter-spacing: 0.01em;
  line-height: 1;
  text-transform: uppercase;
  text-shadow: 0 2px 20px rgba(0,0,0,0.9), 0 1px 6px rgba(0,0,0,0.95);
}

.hero-subtitle {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--text-muted);
  font-weight: 400;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

/* ── Main layout ─────────────────────────────────────────── */

main {
  max-width: 1200px;
  margin: 2rem auto;
  padding: 0 1.25rem;
}

/* ── Two-column layout ───────────────────────────────────── */

.content-layout {
  display: block;
}

.content-layout.has-sidebar {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 1.5rem;
  align-items: start;
}

.sidebar {
  position: sticky;
  top: 1.5rem;
}

/* ── Exclusion report (sidebar) ──────────────────────────── */

#exclusion-report {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--gold);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

#exclusion-report h2 {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 0.85rem 1.25rem;
  background: var(--surface-2);
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}

#exclusion-report ul {
  margin: 0;
  padding: 0.85rem 1.25rem 1rem 1.75rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: #dcdcdc;
  line-height: 1.6;
}

#exclusion-report ul li {
  margin-bottom: 0.45rem;
}

#exclusion-report ul li:last-child {
  margin-bottom: 0;
}

.excl-reason {
  color: #888;
}

/* ── Upload section ──────────────────────────────────────── */

#upload-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  margin-bottom: 1.5rem;
  overflow: hidden;
}

#upload-section summary {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.66rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  user-select: none;
  padding: 0.9rem 1.5rem;
  background: var(--surface-2);
  color: var(--text-muted);
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  border-bottom: 1px solid var(--border);
  border-left: 3px solid var(--gold);
  transition: color 0.2s;
}

#upload-section summary:hover {
  color: var(--text);
}

#upload-section summary::-webkit-details-marker { display: none; }

#upload-section summary::before {
  content: '▸';
  font-size: 0.8rem;
  transition: transform 0.2s ease;
  color: var(--gold);
}

#upload-section[open] summary::before {
  transform: rotate(90deg);
}

#upload-section > form {
  padding: 1.5rem;
}

.form-row {
  display: flex;
  flex-direction: column;
  margin-top: 1rem;
}

.form-row-heading {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
  display: block;
}

.file-upload-zone {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  background: var(--surface-2);
  border: 1.5px dashed var(--accent);
  border-radius: var(--radius);
  padding: 1.2rem 1rem;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  text-align: center;
}

.file-upload-zone:hover {
  border-color: var(--accent-hover);
  background: rgba(244, 123, 61, 0.06);
}

.file-upload-zone input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
  clip: rect(0,0,0,0);
}

.upload-icon {
  color: var(--accent);
  opacity: 0.75;
  width: 22px;
  height: 22px;
}

.upload-hint {
  font-family: var(--font-mono);
  font-size: 0.70rem;
  color: var(--text-muted);
  letter-spacing: 0.06em;
}

.upload-filename {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--accent);
  display: none;
  font-weight: 500;
}

/* -- Source selector -- */

.source-selector {
  display: flex;
  gap: 16px;
  margin-top: 8px;
  align-items: flex-start;
  flex-wrap: wrap;
}

.csv-only-hint {
  border-left: 1px solid var(--border-2);
  padding-left: 12px;
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.6;
  font-style: italic;
}

.hybrid-hint {
  border-left: 1px solid var(--border-2);
  padding-left: 12px;
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.6;
  font-style: italic;
}

.csv-format-hint {
  border-left: 1px solid var(--border-2);
  padding-left: 12px;
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.7;
}

.csv-format-hint strong {
  color: var(--text);
}

.csv-format-hint code {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 0 4px;
  color: var(--accent);
}

.source-radio {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
}

.source-radio:has(input[disabled]) {
  opacity: 0.35;
  cursor: not-allowed;
}

.staleness-label {
  font-family: var(--font-mono);
  font-size: 0.88rem;
  margin-top: 6px;
}

.staleness-tournament {
  color: var(--accent);
  font-weight: 700;
  letter-spacing: 0.02em;
}

.staleness-meta {
  color: var(--text);
}

.staleness-label.stale .staleness-tournament {
  color: var(--text-muted);
}

.staleness-label.stale .staleness-meta {
  color: var(--text-muted);
}

.csv-hint {
  margin: 0.5rem 0 0.75rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.7;
}

.csv-hint strong {
  color: var(--text);
}

.csv-hint code {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 0 4px;
  color: var(--accent);
}

.csv-hint-note {
  font-size: 0.68rem;
  color: var(--text-muted);
  opacity: 0.75;
}

/* ── Buttons ─────────────────────────────────────────────── */

button[type="submit"] {
  margin-top: 1.5rem;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  padding: 0.65rem 2rem;
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.18s, box-shadow 0.18s, transform 0.1s;
  box-shadow: 0 2px 16px var(--accent-glow);
}

button[type="submit"]:hover {
  background: var(--accent-hover);
  box-shadow: 0 4px 28px var(--accent-glow);
  transform: translateY(-1px);
}

button[type="submit"]:active {
  transform: translateY(0);
  box-shadow: 0 1px 8px var(--accent-glow);
}

#clear-all-btn {
  background: transparent;
  border: 1px solid var(--border-2);
  border-radius: 5px;
  padding: 0.25rem 0.85rem;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
  margin-left: auto;
  flex-shrink: 0;
}

#clear-all-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-dim);
}

/* ── Alerts & banners ────────────────────────────────────── */

.error {
  background: rgba(220, 38, 38, 0.08);
  border: 1px solid rgba(220, 38, 38, 0.22);
  border-left: 3px solid #dc2626;
  border-radius: var(--radius);
  color: #f87171;
  font-weight: 600;
  padding: 0.85rem 1.1rem;
  margin: 0.75rem 0 1.25rem;
  font-size: 0.84rem;
  font-family: var(--font-mono);
}

.reset-banner {
  background: var(--gold-dim);
  border: 1px solid rgba(201, 168, 69, 0.22);
  border-left: 3px solid var(--gold);
  color: var(--gold);
  padding: 0.7rem 1.1rem;
  margin-bottom: 1.25rem;
  border-radius: var(--radius);
  font-size: 0.76rem;
  font-family: var(--font-mono);
  font-weight: 500;
}

/* ── Player pool ─────────────────────────────────────────── */

#player-pool-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  margin-bottom: 1.5rem;
  overflow: hidden;
}

#player-pool-section > summary {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.66rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  user-select: none;
  padding: 0.9rem 1.5rem;
  background: var(--surface-2);
  color: var(--text-muted);
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  transition: color 0.2s;
}

#player-pool-section > summary:hover {
  color: var(--text);
}

#player-pool-section > summary::-webkit-details-marker { display: none; }

#player-pool-section > summary::before {
  content: '▸';
  font-size: 0.8rem;
  transition: transform 0.2s ease;
  color: var(--accent);
}

#player-pool-section[open] > summary::before {
  transform: rotate(90deg);
}

.pool-hint {
  font-weight: 400;
  font-size: 0.62rem;
  color: var(--text-muted);
  margin-left: 4px;
}

.pool-inner {
  padding: 1rem 1.25rem 1.25rem;
  overflow-x: auto;
}

/* ── Tables ──────────────────────────────────────────────── */

table {
  width: 100%;
  border-collapse: collapse;
  background: transparent;
  font-size: 0.86rem;
  font-family: var(--font-body);
}

th, td {
  padding: 0.55rem 0.9rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}

td:first-child,
th:first-child {
  text-align: center;
}

thead th {
  background: var(--surface-3);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.63rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border-2);
  white-space: nowrap;
}

thead th[onclick] {
  cursor: pointer;
  user-select: none;
  transition: color 0.15s, background 0.15s;
}

thead th[onclick]:hover {
  color: var(--accent);
  background: var(--surface-2);
}

tfoot td, tfoot th {
  background: var(--surface-3);
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.8rem;
  border-top: 1px solid var(--border-2);
  border-bottom: none;
  color: var(--gold);
}

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

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

input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 15px;
  height: 15px;
  border: 1.5px solid #484848;
  border-radius: 3px;
  background: var(--surface-3);
  cursor: pointer;
  position: relative;
  vertical-align: middle;
  flex-shrink: 0;
  transition: border-color 0.15s, background 0.15s;
}

input[type="checkbox"]:hover:not(:disabled) {
  border-color: var(--accent);
}

input[type="checkbox"]:checked {
  background: var(--accent);
  border-color: var(--accent);
}

input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  left: 3.5px;
  top: 0.5px;
  width: 5px;
  height: 9px;
  border: 2px solid #fff;
  border-top: none;
  border-left: none;
  transform: rotate(45deg);
}

input[type="checkbox"]:disabled {
  opacity: 0.28;
  cursor: not-allowed;
}

/* ── Constraint count ────────────────────────────────────── */

#constraint-count {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.06em;
  margin-bottom: 0.85rem;
  padding: 0.4rem 0.85rem;
  background: var(--accent-dim);
  border: 1px solid rgba(244, 123, 61, 0.18);
  border-radius: 4px;
  display: inline-block;
}

/* ── Contest sections ────────────────────────────────────── */

.contest-section {
  margin-bottom: 2.5rem;
}

.contest-section h2 {
  font-family: var(--font-display);
  font-size: 1.55rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text);
  margin: 0 0 1rem;
  padding-bottom: 0.65rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.contest-section h2::before {
  content: '';
  display: inline-block;
  width: 4px;
  height: 1.2rem;
  background: var(--accent);
  border-radius: 2px;
  flex-shrink: 0;
}

.lineup-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 1rem;
}

.lineup-header {
  padding: 0.65rem 1rem;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-muted);
  display: flex;
  gap: 1.5rem;
}

.lineup-header span {
  color: var(--gold);
}

/* ── Infeasibility notice ────────────────────────────────── */

.infeasible {
  font-style: italic;
  color: var(--text-muted);
  background: var(--surface);
  padding: 0.85rem 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  border-left: 3px solid var(--border-2);
  font-size: 0.88rem;
}

/* ── Loading overlay ─────────────────────────────────────── */

#loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(13, 13, 14, 0.88);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  backdrop-filter: blur(10px);
}

.overlay-content {
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  border-radius: 12px;
  padding: 2rem 3rem;
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text);
  box-shadow: var(--shadow-lg), 0 0 60px var(--accent-glow);
  display: flex;
  align-items: center;
  gap: 1rem;
}

.overlay-content::before {
  content: '';
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
  animation: pulse 1.2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
    box-shadow: 0 0 0 0 var(--accent-glow);
  }
  50% {
    opacity: 0.4;
    transform: scale(0.75);
  }
}

/* ── Lock golfer empty cell ──────────────────────────────── */

.lock-golfer-empty {
  display: block;
  min-width: 1rem;
  color: transparent;
}

/* ── Responsive ──────────────────────────────────────────── */

@media (max-width: 640px) {
  header { height: 210px; padding-bottom: 1.5rem; }
  .hero-content h1 { font-size: 2.4rem; }
  .gb-logo { height: 22px; margin-bottom: 0.6rem; }
  main { padding: 0 0.75rem; }
  th, td { padding: 0.4rem 0.55rem; font-size: 0.78rem; }
}
