/* Whakatāne SLSC — green & gold theme (surf.org.nz style) */
:root {
  --green-dark: #0d3d1a;
  --green-mid: #1a5c2e;
  --green-brand: #2d7d3e;
  --green-light: #3d9b52;
  --gold-dark: #b8860b;
  --gold-mid: #d4a817;
  --gold-light: #f0c14b;
  --gold-pale: #faf3e0;
  --white: #ffffff;
  --off-white: #f8f9fa;
  --text: #1a1a1a;
  --text-muted: #5a5a5a;
  --border: rgba(13, 61, 26, 0.15);
  --shadow: 0 4px 20px rgba(13, 61, 26, 0.12);
  --radius: 12px;
  --font: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: linear-gradient(180deg, var(--off-white) 0%, var(--white) 12rem);
  min-height: 100vh;
  line-height: 1.5;
}

/* Header */
.site-header {
  background: linear-gradient(135deg, var(--green-dark) 0%, var(--green-mid) 100%);
  color: var(--white);
  padding: 1rem 1.5rem;
  box-shadow: var(--shadow);
}

.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.club-logo {
  color: var(--gold-light);
  font-weight: 700;
  font-size: 1.1rem;
  text-decoration: none;
  letter-spacing: 0.02em;
}

.club-logo:hover {
  color: var(--white);
  text-decoration: underline;
}

.event-badge {
  background: var(--gold-mid);
  color: var(--green-dark);
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.9rem;
}

/* Main */
.main-content {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

/* Hero */
.hero {
  text-align: center;
  padding: 2.5rem 1rem;
  margin-bottom: 2.5rem;
}

.hero h1 {
  margin: 0 0 0.5rem;
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 700;
  color: var(--green-dark);
  letter-spacing: -0.02em;
}

.hero .event-date {
  color: var(--text-muted);
  font-size: 1.1rem;
  margin: 0 0 0.25rem;
}

.hero .club-tagline {
  margin: 0;
  font-size: 1rem;
  color: var(--green-mid);
  font-weight: 600;
}

.error-hero {
  background: var(--gold-pale);
  border: 2px solid var(--gold-light);
  border-radius: var(--radius);
  padding: 2rem;
  text-align: left;
}

.error-hero h1 {
  color: var(--green-dark);
  margin-top: 0;
}

.error-hero code {
  background: var(--white);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-size: 0.9em;
}

/* Division cards */
.division-card {
  margin-bottom: 2.5rem;
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  border: 1px solid var(--border);
}

.division-title {
  margin: 0;
  padding: 1rem 1.25rem;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--white);
  background: linear-gradient(90deg, var(--green-mid) 0%, var(--green-brand) 100%);
}

.heats-list {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  padding: 1.25rem;
}

/* ── Filter bar ─────────────────────────────────────────────────────────── */
.filter-bar {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 2rem;
  padding: 1rem 1.25rem;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.55rem 1.1rem;
  border: 2px solid var(--border);
  border-radius: 999px;
  background: var(--off-white);
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s ease;
  user-select: none;
}

.toggle-btn:hover {
  border-color: var(--green-brand);
  color: var(--green-dark);
  background: var(--white);
}

.toggle-btn.active {
  background: var(--green-dark);
  border-color: var(--green-dark);
  color: var(--white);
  box-shadow: 0 2px 8px rgba(13, 61, 26, 0.25);
}

.toggle-btn.active .toggle-icon {
  filter: brightness(1.4);
}

.toggle-icon {
  font-size: 1rem;
  line-height: 1;
}

.filter-divider {
  display: block;
  width: 1px;
  height: 1.6rem;
  background: var(--border);
  margin: 0 0.25rem;
}

/* Inline filter control (e.g. competitor dropdown) to match toggle buttons */
.filter-control {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.competitor-select {
  min-width: 160px;
  padding: 0.55rem 2rem 0.55rem 1rem;
  border: 2px solid var(--border);
  border-radius: 999px;
  background: var(--off-white);
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%235a5a5a' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.85rem center;
}

.competitor-select:hover,
.competitor-select:focus {
  border-color: var(--green-brand);
  color: var(--text);
  outline: none;
}

.competitor-select.active {
  background-color: var(--green-dark);
  border-color: var(--green-dark);
  color: var(--white);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23ffffff' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
}

/* ── Event picker dropdown ──────────────────────────────────────────────── */
.dropdown-wrap {
  position: relative;
}

.dropdown-trigger {
  gap: 0.5rem;
}

.caret {
  font-size: 0.75rem;
  margin-left: 0.1rem;
  opacity: 0.7;
}

.dropdown-panel {
  position: absolute;
  top: calc(100% + 0.5rem);
  left: 0;
  z-index: 200;
  width: 300px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 32px rgba(13, 61, 26, 0.18);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.dropdown-panel[hidden] {
  display: none;
}

.dropdown-search-wrap {
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--border);
  background: var(--off-white);
}

.dropdown-search {
  width: 100%;
  padding: 0.45rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: var(--font);
  font-size: 0.875rem;
  outline: none;
  background: var(--white);
  color: var(--text);
}

.dropdown-search:focus {
  border-color: var(--green-brand);
  box-shadow: 0 0 0 2px rgba(45, 125, 62, 0.2);
}

.dropdown-actions {
  display: flex;
  gap: 0.75rem;
  padding: 0.4rem 0.75rem;
  border-bottom: 1px solid var(--border);
  background: var(--off-white);
}

.link-btn {
  background: none;
  border: none;
  padding: 0;
  font-family: var(--font);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--green-brand);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.link-btn:hover {
  color: var(--green-dark);
}

.dropdown-list {
  list-style: none;
  margin: 0;
  padding: 0.35rem 0;
  max-height: 320px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.dropdown-list::-webkit-scrollbar {
  width: 6px;
}

.dropdown-list::-webkit-scrollbar-track {
  background: transparent;
}

.dropdown-list::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

.dropdown-item {
  padding: 0;
}

.dropdown-item label {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.45rem 0.9rem;
  font-size: 0.875rem;
  color: var(--text);
  cursor: pointer;
  transition: background 0.1s;
  user-select: none;
}

.dropdown-item label:hover {
  background: rgba(45, 125, 62, 0.07);
}

.dropdown-item input[type=checkbox] {
  accent-color: var(--green-brand);
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
  cursor: pointer;
}

/* Heat card */
.heat-card {
  background: var(--off-white);
  border-radius: 8px;
  border: 1px solid var(--border);
  overflow: hidden;
}

.heat-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 1rem;
  background: var(--white);
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  color: var(--green-dark);
}

.heat-round {
  color: var(--green-mid);
}

.heat-num {
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
}

/* Team member list under a relay/team competitor row */
.team-members {
  list-style: none;
  margin: 0.3rem 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.team-members li {
  font-size: 0.8rem;
  color: var(--text-muted);
  padding-left: 0.9rem;
  position: relative;
}

.team-members li::before {
  content: '·';
  position: absolute;
  left: 0.25rem;
  color: var(--green-light);
  font-weight: 700;
}

.our-club .team-members li {
  color: var(--green-mid);
}

.final-badge {
  margin-left: auto;
  background: var(--gold-mid);
  color: var(--green-dark);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
}

/* Results table */
.results-table-wrap {
  overflow-x: auto;
}

.results-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.results-table th,
.results-table td {
  padding: 0.65rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.results-table thead th {
  font-weight: 600;
  color: var(--text-muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.results-table tbody tr:last-child td {
  border-bottom: none;
}

.results-table tbody tr.our-club {
  background: linear-gradient(90deg, rgba(45, 125, 62, 0.12) 0%, transparent 100%);
}

.results-table .place {
  font-weight: 600;
  width: 4rem;
}

.medal {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--green-dark);
}

.medal-1 {
  background: var(--gold-light);
  color: var(--green-dark);
}

.medal-2 {
  background: #c0c0c0;
  color: var(--text);
}

.medal-3 {
  background: #cd7f32;
  color: var(--white);
}


/* Empty state */
.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  background: var(--gold-pale);
  border-radius: var(--radius);
  border: 1px dashed var(--gold-mid);
  color: var(--text-muted);
}

.empty-state p {
  margin: 0.5rem 0;
}

/* Footer */
.site-footer {
  margin-top: 3rem;
  padding: 1.5rem 1.5rem 2rem;
  text-align: center;
  font-size: 0.9rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
}

.site-footer a {
  color: var(--green-mid);
  text-decoration: none;
}

.site-footer a:hover {
  text-decoration: underline;
}

@media (max-width: 480px) {
  .filter-bar {
    flex-direction: column;
    align-items: flex-start;
  }
  .filter-divider {
    display: none;
  }
}
