/* -------------------------------------------------------
   GLOBAL THEME VARIABLES
------------------------------------------------------- */
:root {
  --bg: #ffffff;
  --fg: #111111;
  --card-bg: #fafafa;
  --border: #cccccc;
  --muted: #666666;
  --accent: #f3f3f3;
  --link: #0057ff;
}

[data-theme="dark"] {
  --bg: #05060a;
  --fg: #f5f5f5;
  --card-bg: #11131a;
  --border: #33384a;
  --muted: #9ca3af;
  --accent: #1f2933;
  --link: #4da3ff;
}

/* -------------------------------------------------------
   BASE
------------------------------------------------------- */
body {
  background: var(--bg);
  color: var(--fg);
  font-family: system-ui, sans-serif;
  margin: 0;
  padding: 0;
}

h1, h2, h3, h4 {
  color: var(--fg);
}

a {
  color: var(--link);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* -------------------------------------------------------
   HEADER + NAV
------------------------------------------------------- */
header {
  padding: 20px;
  text-align: center;
}

nav {
  margin-top: 10px;
}

nav a {
  margin: 0 10px;
  font-weight: 500;
}

#theme-toggle {
  margin-top: 10px;
  padding: 8px 14px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--accent);
  color: var(--fg);
  cursor: pointer;
}

/* -------------------------------------------------------
   SECTION TOGGLER BUTTONS
------------------------------------------------------- */
.section-toggle-buttons {
  text-align: center;
  margin-bottom: 20px;
}

.section-toggle-buttons button {
  padding: 8px 14px;
  margin: 4px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--accent);
  color: var(--fg);
  cursor: pointer;
}

/* -------------------------------------------------------
   GROUP TABLES
------------------------------------------------------- */
.group-wrapper {
  display: flex;
  flex-wrap: wrap;
  gap: 28px; /* increased spacing */
  justify-content: center;
  padding: 10px 0; /* extra breathing room */
}

.group-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  width: 320px; /* wider box */
  background: var(--card-bg);
  page-break-inside: avoid;
  box-sizing: border-box;
}

.group-title {
  font-weight: 600;
  margin-bottom: 6px;
  text-align: center;
}

.standings-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.standings-table th,
.standings-table td {
  border: 1px solid var(--border);
  padding: 4px 6px;
  text-align: center;
}

.standings-table th {
  background: var(--accent);
}

.team-name {
  font-weight: 500;
  text-align: left;
}

.highlight-adv {
  background: rgba(0, 200, 0, 0.15);
}

/* -------------------------------------------------------
   KNOCKOUT BRACKET
------------------------------------------------------- */
.bracket-container {
  display: flex;
  flex-direction: row;
  gap: 16px;
  overflow-x: auto;
}

.bracket-round {
  min-width: 180px;
  page-break-inside: avoid;
}

.bracket-round h4 {
  text-align: center;
  margin-bottom: 8px;
}

.match {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 8px;
  margin-bottom: 10px;
  background: var(--card-bg);
  font-size: 0.8rem;
}

.team {
  display: flex;
  justify-content: space-between;
  margin-bottom: 2px;
}

.team.winner {
  font-weight: 700;
  color: #0a0;
}

.connector.large {
  height: 20px;
}

/* -------------------------------------------------------
   PDF BUTTON
------------------------------------------------------- */
.pdf-button {
  display: inline-block;
  margin: 10px auto 20px;
  padding: 10px 16px;
  border: 1px solid var(--border);
  background: var(--accent);
  color: var(--fg);
  cursor: pointer;
  border-radius: 6px;
}

/* -------------------------------------------------------
   PRINT MODE (Option C)
------------------------------------------------------- */
@media print {
  header,
  nav,
  .section-toggle-buttons,
  .pdf-button,
  footer {
    display: none !important;
  }

  body.print-bracket-only #section-live,
  body.print-bracket-only #section-blank,
  body.print-bracket-only #section-print {
    display: block !important;
  }

  body {
    margin: 10mm;
  }
}

/* -------------------------------------------------------
   UTILITIES
------------------------------------------------------- */
.hidden {
  display: none;
}
