/* ==========================================================================
   BrowneGuesser — Shared Stylesheet
   Site:    browneguesser.com
   Purpose: All shared styles for every page on the site.
   ========================================================================== */

/* ── RESET & BASE ────────────────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  /* Brand colours */
  --navy:        #0a1628;
  --navy-mid:    #111e35;
  --navy-light:  #1a3a6b;
  --blue:        #2a5298;
  --gold:        #e8b84b;
  --gold-dark:   #d4a030;
  --red:         #c8102e;
  --text:        #e8eaf0;
  --text-muted:  #8aa0cc;
  --text-dim:    #5a7ab5;
  --green:       #5ee87a;
  --border:      #1e3060;

  /* Spacing */
  --page-max:    700px;
  --gap:         16px;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: var(--navy);
  color: var(--text);
  min-height: 100vh;
  /* Bottom padding so sticky save-bar never covers content */
  padding-bottom: 80px;
}

a {
  color: var(--gold);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* ── NAV ─────────────────────────────────────────────────────────────────── */
.site-nav {
  background: #070f1e;
  border-bottom: 1px solid var(--border);
  padding: 0 var(--gap);
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 52px;
  position: sticky;
  top: 0;
  z-index: 200;
}

.nav-brand {
  font-size: 1rem;
  font-weight: 800;
  color: var(--gold);
  letter-spacing: 1px;
  text-transform: uppercase;
  text-decoration: none;
}

.nav-brand:hover {
  text-decoration: none;
  opacity: 0.85;
}

.nav-links {
  display: flex;
  gap: 24px;
  list-style: none;
}

.nav-links a {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  text-transform: uppercase;
  text-decoration: none;
  padding: 4px 0;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--gold);
  border-bottom-color: var(--gold);
  text-decoration: none;
}

/* ── HEADER (page hero) ──────────────────────────────────────────────────── */
.page-header {
  background: linear-gradient(135deg, var(--red) 0%, #002868 50%, var(--red) 100%);
  padding: 22px var(--gap) 18px;
  text-align: center;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}

.page-header h1 {
  font-size: clamp(1.25rem, 5vw, 1.9rem);
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: #fff;
  text-shadow: 0 2px 8px rgba(0,0,0,0.4);
}

.page-header p {
  color: #ccd6f6;
  margin-top: 5px;
  font-size: clamp(0.75rem, 3vw, 0.9rem);
  letter-spacing: 0.5px;
}

/* ── PAGE CONTAINER ──────────────────────────────────────────────────────── */
.container {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 18px var(--gap) 24px;
}

/* ── DATE GROUP HEADER ───────────────────────────────────────────────────── */
.date-header {
  background: linear-gradient(90deg, var(--navy-light), var(--blue));
  border-left: 5px solid var(--gold);
  padding: 9px 14px;
  border-radius: 6px 6px 0 0;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--gold);
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 20px;
}

.matchday-tag {
  background: var(--gold);
  color: var(--navy);
  font-size: 0.65rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 10px;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

/* ── MATCH ROW ───────────────────────────────────────────────────────────── */
.match {
  background: var(--navy-mid);
  border: 1px solid var(--border);
  border-top: none;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: background 0.15s;
}

.match:hover {
  background: #172540;
}

.match:last-child {
  border-radius: 0 0 6px 6px;
}

/* Group badge (e.g. "Group A") */
.match-group {
  font-size: 0.62rem;
  font-weight: 700;
  color: var(--gold);
  background: rgba(232, 184, 75, 0.12);
  border: 1px solid rgba(232, 184, 75, 0.3);
  border-radius: 4px;
  padding: 2px 5px;
  width: 52px;
  min-width: 52px;
  text-align: center;
  letter-spacing: 0.3px;
  flex-shrink: 0;
}

/* Fixture block — stacks on mobile, goes horizontal on wider screens */
.fixture {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.team-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 3px 0;
}

.team-name {
  font-size: clamp(0.82rem, 3.2vw, 0.93rem);
  font-weight: 600;
  color: var(--text);
  flex: 1;
  /* Prevent very long names from blowing out the layout */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Thin "v" separator between team rows */
.vs-divider {
  text-align: center;
  color: var(--text-dim);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 1px;
  padding: 1px 0;
  line-height: 1;
}

/* ── SCORE INPUTS ────────────────────────────────────────────────────────── */
.score-input {
  /* 48×44 px meets the 44 px minimum touch-target recommendation */
  width: 48px;
  height: 44px;
  min-width: 48px;
  background: #0d1f3c;
  border: 2px solid #2a4a80;
  border-radius: 8px;
  color: #fff;
  font-size: 1.15rem;
  font-weight: 700;
  text-align: center;
  outline: none;
  /* Remove browser number spinners */
  -moz-appearance: textfield;
  transition: border-color 0.2s, background 0.2s;
  cursor: text;
}

.score-input::-webkit-outer-spin-button,
.score-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
}

.score-input:focus {
  border-color: var(--gold);
  background: #162a50;
}

/* Read-only state used in exported snapshot files */
.score-input[readonly] {
  border-color: var(--border);
  color: #aab8d8;
  cursor: default;
}

/* ── DESKTOP FIXTURE LAYOUT (≥ 520px) ───────────────────────────────────── */
/*
 * On wider screens the fixture switches from a two-row stacked layout
 * to the classic: [Home] [score] v [score] [Away]
 */
@media (min-width: 520px) {
  .fixture {
    flex-direction: row;
    align-items: center;
    gap: 6px;
  }

  .team-row {
    flex: 1;
    padding: 0;
  }

  /* Home: team name right-aligned, score on the right of the name */
  .team-row.home {
    flex-direction: row-reverse;
  }

  .team-row.home .team-name {
    text-align: right;
  }

  /* Away: score on the left, team name on the right */
  .team-row.away {
    flex-direction: row;
  }

  .team-row.away .team-name {
    text-align: left;
  }

  .vs-divider {
    font-size: 0.75rem;
    padding: 0 4px;
    flex-shrink: 0;
  }
}

/* ── STICKY SAVE BAR ─────────────────────────────────────────────────────── */
.save-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #0d1827;
  border-top: 2px solid var(--gold);
  padding: 10px var(--gap);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  z-index: 100;
}

.save-bar-note {
  font-size: 0.75rem;
  color: var(--text-dim);
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.saved-msg {
  display: none;
  color: var(--green);
  font-weight: 700;
  font-size: 0.8rem;
  white-space: nowrap;
}

/* ── BUTTONS ─────────────────────────────────────────────────────────────── */
.btn {
  /* 44px height = minimum accessible touch target */
  min-height: 44px;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  cursor: pointer;
  border: none;
  white-space: nowrap;
  touch-action: manipulation;
  transition: opacity 0.15s, border-color 0.15s, color 0.15s;
}

.btn-primary {
  background: linear-gradient(90deg, var(--gold), var(--gold-dark));
  color: var(--navy);
}

.btn-primary:hover {
  opacity: 0.88;
}

.btn-secondary {
  background: transparent;
  color: var(--text-muted);
  border: 2px solid #2a4a80;
}

.btn-secondary:hover {
  border-color: var(--gold);
  color: var(--gold);
}

/* ── SNAPSHOT BANNER (shown in exported read-only files) ─────────────────── */
.snapshot-banner {
  max-width: var(--page-max);
  margin: 14px auto 0;
  padding: 12px 16px;
  background: #1a3a1a;
  border: 2px solid var(--green);
  border-radius: 8px;
  color: var(--green);
  font-size: 0.85rem;
  text-align: center;
  display: none; /* shown only in exported snapshots */
}

/* ── TWO-COLUMN PAGE LAYOUT ──────────────────────────────────────────────── */
/*
 * Mobile-first: single column.
 * At ≥ 1024px: matches left (fluid), standings right (fixed 280px), sticky.
 */
.page-layout {
  display: grid;
  grid-template-columns: 1fr;          /* single column on mobile */
  gap: 0;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--gap);
  align-items: start;
}

.matches-col {
  padding: 18px 0 24px;
  min-width: 0;                        /* prevent grid blowout on long team names */
}

.standings-col {
  padding: 18px 0 24px;
}

@media (min-width: 1024px) {
  .page-layout {
    grid-template-columns: 1fr 280px;  /* matches fluid, sidebar fixed */
    gap: 24px;
  }

  .standings-col {
    position: sticky;
    top: 60px;                         /* clears the 52px nav + a little breathing room */
    max-height: calc(100vh - 80px);
    overflow-y: auto;
    padding-right: 4px;
    /* Subtle scrollbar styling for WebKit */
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
  }

  .standings-col::-webkit-scrollbar       { width: 4px; }
  .standings-col::-webkit-scrollbar-track { background: transparent; }
  .standings-col::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
}

/* ── STANDINGS SIDEBAR ───────────────────────────────────────────────────── */

.standings-title {
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--gold);
  padding: 10px 0 8px;
  border-bottom: 2px solid var(--gold);
  margin-bottom: 12px;
}

/* One card per group */
.group-card {
  background: var(--navy-mid);
  border: 1px solid var(--border);
  border-radius: 6px;
  margin-bottom: 10px;
  overflow: hidden;
}

.group-card-header {
  background: linear-gradient(90deg, var(--navy-light), var(--blue));
  padding: 6px 10px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--gold);
}

/* Standings table inside each card */
.standings-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.75rem;
}

.standings-table th {
  padding: 4px 6px;
  text-align: center;
  color: var(--text-dim);
  font-weight: 700;
  font-size: 0.68rem;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
}

/* Team name column left-aligned */
.standings-table th:first-child,
.standings-table td:first-child {
  text-align: left;
  padding-left: 10px;
}

.standings-table td {
  padding: 5px 6px;
  text-align: center;
  color: var(--text-muted);
  border-bottom: 1px solid rgba(30, 48, 96, 0.5);
}

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

/* Highlight teams currently in qualification positions (top 2) */
.standings-table tr.qualify td {
  color: var(--text);
}

.standings-table tr.qualify td:first-child {
  border-left: 3px solid var(--green);
  padding-left: 7px;
}

/* Points column bold */
.standings-table td.pts {
  font-weight: 800;
  color: var(--text);
}

/* ── ABOUT PAGE CONTENT ──────────────────────────────────────────────────── */
.about-content {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 28px var(--gap) 40px;
}

.about-content h2 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--gold);
  margin-bottom: 10px;
  margin-top: 28px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-left: 4px solid var(--gold);
  padding-left: 10px;
}

.about-content h2:first-child {
  margin-top: 0;
}

.about-content p {
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.7;
  margin-bottom: 12px;
}

.about-content ul {
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.8;
  padding-left: 20px;
  margin-bottom: 12px;
}

.about-content a {
  color: var(--gold);
}

/* ── FOOTER ──────────────────────────────────────────────────────────────── */
.site-footer {
  text-align: center;
  padding: 24px var(--gap);
  color: var(--text-dim);
  font-size: 0.78rem;
  border-top: 1px solid var(--border);
  margin-top: 32px;
}
