/* WC26 Predictor — Copa-inspired light theme */
:root {
  --bg: #f5f0e8;
  --surface: #ffffff;
  --surface-2: #f0ebe0;
  --border: #e0d8c8;
  --text-1: #1a1a1a;
  --text-2: #555;
  --text-muted: #999;
  --gold: #b8963e;
  --gold-light: #f0e4c0;
  --gold-row-bg: #fdf5e0;
  --gold-border: #d4a843;
  --green: #2d7a3e;
  --green-light: #e6f4ea;
  --red: #c0392b;
  --red-light: #fde8e6;
  --grey-badge: #f0ede8;
  --grey-text: #888;
  --black: #111;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 4px rgba(0,0,0,0.08);
}

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

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text-1);
  font-size: 15px;
  line-height: 1.5;
  min-height: 100vh;
}

/* ---- NAV ---- */
.nav {
  background: #111;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  height: 48px;
  position: sticky;
  top: 0;
  z-index: 100;
}
.nav-brand { font-weight: 800; font-size: 16px; letter-spacing: 0.5px; color: #fff; text-decoration: none; }
.nav-links { display: flex; gap: 16px; align-items: center; }
.nav-links a { color: #ccc; text-decoration: none; font-size: 13px; }
.nav-links a:hover { color: #fff; }
.btn-nav { background: var(--gold); color: #fff !important; padding: 5px 12px; border-radius: var(--radius-sm); font-weight: 600; font-size: 13px; }

/* Hide secondary nav links on small screens, keep only Sign in / Log out */
@media (max-width: 600px) {
  .nav-links a:not(.btn-nav) { display: none; }
  .nav-brand { font-size: 14px; }
}

/* ---- HINT STRIP ---- */
.hint-strip {
  background: var(--gold-light);
  border-bottom: 1px solid var(--gold-border);
  padding: 8px 16px;
  font-size: 13px;
  color: #6b4e1a;
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  position: sticky;
  top: 48px;
  z-index: 90;
}
/* Hide hint strip on mobile — takes too much space */
@media (max-width: 768px) { .hint-strip { display: none; } }

/* ---- CONTAINERS ---- */
.container { max-width: 1300px; margin: 0 auto; padding: 0 12px; }
@media (min-width: 600px) { .container { padding: 0 20px; } }
.section { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); margin: 12px 0; padding: 16px; box-shadow: var(--shadow); }
@media (min-width: 600px) { .section { margin: 20px 0; padding: 24px; } }
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; flex-wrap: wrap; gap: 8px; }
.section-title { font-weight: 900; font-size: 18px; letter-spacing: 1.5px; text-transform: uppercase; }

/* ---- GROUP CARDS ---- */
.groups-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
@media (max-width: 1000px) { .groups-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px)  { .groups-grid { grid-template-columns: 1fr; } }

.group-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}
.group-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.group-name { font-weight: 800; font-size: 15px; letter-spacing: 1px; text-transform: uppercase; }
.qualify-badge {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  background: var(--gold-light);
  color: var(--gold);
  border: 1px solid var(--gold-border);
  border-radius: 4px;
  padding: 2px 7px;
}
.group-table-header {
  display: grid;
  grid-template-columns: 32px 1fr 24px;
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  padding: 0 4px 6px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}

.team-row {
  display: grid;
  grid-template-columns: 32px 1fr 24px;
  align-items: center;
  padding: 6px 4px;
  border-radius: var(--radius-sm);
  cursor: grab;
  transition: background 0.1s;
  user-select: none;
  border: 1px solid transparent;
}
.team-row:hover { background: var(--surface-2); }
.team-row.qualifying {
  background: var(--gold-row-bg);
  border-color: var(--gold-border);
}
.team-row.locked { opacity: 0.55; cursor: default; }
.team-row.dragging { opacity: 0.4; }
.team-row.drag-over { background: var(--gold-light); }

.pos-badge {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 12px;
  background: var(--grey-badge);
  color: var(--grey-text);
}
.pos-badge.gold { background: var(--gold); color: #fff; }

.team-info { display: flex; align-items: center; gap: 8px; padding: 0 8px; flex: 1; }
.team-flag { font-size: 18px; line-height: 1; flex-shrink: 0; }
.team-name { font-size: 14px; font-weight: 500; }
.fifa-rank { font-size: 11px; color: var(--text-muted); font-weight: 500; margin-left: 4px; white-space: nowrap; }

.drag-handle { color: var(--text-muted); font-size: 14px; cursor: grab; text-align: center; }

/* ---- 3RD PLACE RANKER ---- */
.third-place-list { display: flex; flex-direction: column; gap: 6px; max-width: 800px; }
.third-place-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: grab;
}
.third-place-row.advancing { background: var(--green-light); border-color: #a8d5b0; }
.third-place-row.eliminated { background: var(--grey-badge); opacity: 0.65; }
.third-place-row .rank { font-weight: 800; font-size: 13px; color: var(--text-muted); width: 28px; }
.advancing-label, .eliminated-label {
  font-size: 12px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase;
  padding: 6px 0 4px;
  color: var(--text-muted);
}
.advancing-label { color: var(--green); }
.cutoff-line { border: none; border-top: 2px dashed #ccc; margin: 4px 0; }

/* ---- BRACKET ---- */
.bracket-container {
  overflow-x: auto;
  padding-bottom: 12px;
}
.bracket-inner {
  display: flex;
  gap: 0;
  min-width: 1100px;
}
.bracket-round {
  flex: 1;
  min-width: 180px;
  padding: 0 8px;
}
.round-header {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 0 4px 10px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
}

.bracket-match {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.match-label {
  font-size: 10px;
  color: var(--text-muted);
  padding: 4px 10px 2px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
.match-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  min-height: 44px;
  cursor: pointer;
  transition: background 0.1s;
}
.match-row:hover { background: var(--surface-2); }
.match-row.selected { background: var(--black); color: #fff; }
.match-row.selected .team-flag { filter: none; }
.match-row.selected .fifa-rank { color: rgba(255,255,255,0.45); }
.match-row.locked { cursor: default; opacity: 0.55; }
.match-row.locked:hover { background: inherit; }
.vs-divider {
  text-align: center;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--text-muted);
  padding: 4px 0;
  background: var(--surface-2);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.tbd-row {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px; min-height: 44px;
  color: var(--text-muted);
  font-size: 13px; font-style: italic;
}
.vs-divider-tbd {
  text-align: center;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--text-muted);
  padding: 4px 0;
  background: var(--surface-2);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.champion-box {
  background: #1a1a1a;
  color: #fff;
  border-radius: var(--radius);
  padding: 24px 16px;
  text-align: center;
  min-width: 160px;
}
.champion-label { font-size: 11px; letter-spacing: 2px; color: var(--gold); font-weight: 700; text-transform: uppercase; }
.champion-name { font-size: 22px; font-weight: 800; margin-top: 8px; }
.champion-flag { font-size: 36px; margin: 8px 0; }

/* ---- SAVE BUTTON ---- */
.save-bar {
  position: fixed;
  bottom: 16px;
  right: 16px;
  z-index: 200;
}
@media (max-width: 600px) {
  .save-bar { left: 16px; right: 16px; bottom: 12px; }
}
.btn-save {
  background: var(--gold);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  padding: 14px 32px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(184,150,62,0.4);
  transition: transform 0.1s;
  width: 100%;
}
@media (min-width: 600px) { .btn-save { width: auto; } }
.btn-save:hover { transform: translateY(-2px); }
.btn-save:disabled { opacity: 0.6; cursor: default; transform: none; }

/* ---- TOAST ---- */
.toast {
  position: fixed; bottom: 80px; right: 24px;
  background: #1a1a1a; color: #fff;
  padding: 12px 20px; border-radius: var(--radius-sm);
  font-size: 14px; z-index: 300;
  opacity: 0; pointer-events: none;
  transition: opacity 0.3s;
}
.toast.show { opacity: 1; }

/* ---- FORMS ---- */
.form-card {
  max-width: 400px; margin: 60px auto;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 32px; box-shadow: var(--shadow);
}
.form-card h1 { font-size: 22px; font-weight: 800; margin-bottom: 24px; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--text-2); }
.form-group input {
  width: 100%; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 15px; background: var(--surface);
}
.form-group input:focus { outline: 2px solid var(--gold); border-color: var(--gold); }
.btn-primary {
  width: 100%; padding: 12px; background: var(--black);
  color: #fff; border: none; border-radius: var(--radius-sm);
  font-size: 15px; font-weight: 700; cursor: pointer;
}
.btn-primary:hover { background: #333; }
.error-msg { color: var(--red); font-size: 13px; margin-bottom: 12px; }
.form-link { font-size: 13px; color: var(--text-2); text-align: center; margin-top: 16px; }
.form-link a { color: var(--gold); }

/* ---- LEADERBOARD ---- */
.lb-table { width: 100%; border-collapse: collapse; }
.lb-table th { text-align: left; font-size: 12px; letter-spacing: 0.5px; text-transform: uppercase; color: var(--text-muted); padding: 8px 12px; border-bottom: 2px solid var(--border); }
.lb-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); font-size: 14px; }
.lb-table tr:hover td { background: var(--surface-2); }
.lb-table tr.me td { background: var(--gold-row-bg); font-weight: 600; }
.rank-num { font-weight: 800; color: var(--gold); }

/* ---- DASHBOARD ---- */
.dashboard-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; }
@media (max-width: 768px) { .dashboard-grid { grid-template-columns: 1fr; } }
.score-big { font-size: 56px; font-weight: 900; color: var(--gold); }
.score-label { font-size: 12px; letter-spacing: 1px; text-transform: uppercase; color: var(--text-muted); }

/* ---- MISC ---- */
.badge { display: inline-block; padding: 3px 10px; border-radius: 4px; font-size: 12px; font-weight: 700; }
.badge-green { background: var(--green-light); color: var(--green); }
.badge-gold { background: var(--gold-light); color: var(--gold); }
.badge-grey { background: var(--grey-badge); color: var(--grey-text); }
.btn { display: inline-block; padding: 8px 18px; border-radius: var(--radius-sm); font-weight: 600; font-size: 14px; cursor: pointer; border: none; text-decoration: none; }
.btn-outline { border: 1px solid var(--border); background: var(--surface); color: var(--text-1); }
.locked-overlay { color: var(--text-muted); font-size: 12px; font-style: italic; }
