/* ── Font: FSAldrinWeb-Medium ─────────────────────────────────────────── */
/* ── Reset & base ─────────────────────────────────────────────────────── */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --white: #ffffff;
  --teal-dark: #2a635d;
  --navy: #192837;
  --teal: #65c8c4;
  --mint: #e0f8f8;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-400: #9ca3af;
  --gray-600: #4b5563;
  --gray-800: #1f2937;
  --positive: #059669;
  --negative: #dc2626;
}

html {
  font-size: 15px;
}

body {
  font-family: "Poppins", sans-serif;
  background: var(--gray-50);
  color: var(--gray-800);
  min-height: 100vh;
}

/* ── Navbar ───────────────────────────────────────────────────────────── */
.navbar {
  background: var(--teal-dark);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
}

.nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  height: 68px;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.nav-logo {
  height: 34px;
  width: auto;
}

.nav-title {
  font-family: "Montserrat", "Poppins", sans-serif;
  font-weight: 300;
  font-size: 1.35rem;
  color: var(--white);
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.nav-links {
  display: flex;
  gap: 0.25rem;
}

.nav-link {
  font-family: "Poppins", sans-serif;
  font-weight: 500;
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.7);
  text-decoration: none;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  transition: color 0.15s, background 0.15s;
}

.nav-link:hover {
  color: var(--white);
  background: rgba(255, 255, 255, 0.08);
}

.nav-link.active {
  color: var(--teal);
  background: rgba(101, 200, 196, 0.1);
}

/* ── Content ──────────────────────────────────────────────────────────── */
.content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.5rem;
}

.view.hidden {
  display: none;
}

.view-header {
  margin-bottom: 1rem;
}

.view-header h2 {
  font-family: "Poppins", sans-serif;
  font-weight: 600;
  font-size: 1.5rem;
  color: var(--navy);
}

.subtitle {
  color: var(--gray-600);
  font-size: 0.9rem;
  margin-top: 0.15rem;
}

/* ── Breadcrumb ───────────────────────────────────────────────────────── */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  color: var(--gray-400);
  margin-bottom: 0.75rem;
  min-height: 1.5rem;
}

.breadcrumb a {
  color: var(--teal-dark);
  text-decoration: none;
  font-weight: 500;
}

.breadcrumb a:hover {
  text-decoration: underline;
}

.breadcrumb .sep {
  color: var(--gray-400);
  user-select: none;
}

.breadcrumb .current {
  color: var(--gray-600);
  font-weight: 500;
}

/* ── Table ────────────────────────────────────────────────────────────── */
.table-wrap {
  background: var(--white);
  border-radius: 10px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  border-collapse: collapse;
}

thead th {
  background: var(--navy);
  color: var(--white);
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.75rem 1rem;
  text-align: left;
}

thead th.col-num,
thead th.col-sg,
thead th.col-rank {
  text-align: right;
}

tbody tr {
  border-bottom: 1px solid var(--gray-100);
  transition: background 0.1s;
}

tbody tr.clickable {
  cursor: pointer;
}

tbody tr.clickable:hover {
  background: var(--mint);
}

tbody td {
  padding: 0.65rem 1rem;
  font-size: 0.9rem;
}

.col-rank {
  width: 50px;
  text-align: right;
  color: var(--gray-400);
  font-weight: 600;
}

.col-name {
  text-align: left;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.col-num {
  text-align: right;
  width: 90px;
}

.col-sg {
  text-align: right;
  width: 110px;
  font-weight: 600;
}

.col-course {
  text-align: left;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.85rem;
  color: var(--gray-600);
}

.col-year {
  text-align: center;
  width: 65px;
}

.col-tee {
  text-align: left;
  width: 130px;
  font-size: 0.82rem;
  color: var(--gray-600);
}

.col-date {
  text-align: left;
  width: 120px;
}

td.col-rank {
  color: var(--gray-400);
  font-weight: 600;
  font-size: 0.85rem;
}

td.col-name {
  font-weight: 500;
  color: var(--navy);
}

.clickable td.col-name {
  color: var(--teal-dark);
}

td.col-sg {
  font-variant-numeric: tabular-nums;
}

.sg-positive {
  color: var(--positive);
}

.sg-negative {
  color: var(--negative);
}

/* ── FAQ ──────────────────────────────────────────────────────────────── */
.faq-card {
  background: var(--white);
  border-radius: 10px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
  padding: 2rem;
  max-width: 720px;
}

.faq-card h2 {
  font-family: "Poppins", sans-serif;
  font-weight: 600;
  font-size: 1.5rem;
  color: var(--navy);
  margin-bottom: 1.5rem;
}

.faq-item {
  margin-bottom: 1.5rem;
}

.faq-item h3 {
  font-weight: 600;
  font-size: 1rem;
  color: var(--teal-dark);
  margin-bottom: 0.35rem;
}

.faq-item p {
  color: var(--gray-600);
  font-size: 0.9rem;
  line-height: 1.6;
}

.faq-weights {
  list-style: none;
  margin-top: 0.6rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.3rem 1.5rem;
  color: var(--gray-600);
  font-size: 0.9rem;
}

/* ── Inline-expand (event rounds inside player table) ─────────────────── */
tr.event-row td.col-name {
  cursor: pointer;
}

tr.event-row td.col-name::before {
  content: "▸ ";
  font-size: 0.7rem;
  color: var(--gray-400);
  transition: transform 0.15s;
  display: inline-block;
  margin-right: 0.25rem;
}

tr.event-row.expanded td.col-name::before {
  content: "▾ ";
  color: var(--teal-dark);
}

tr.event-row.expanded {
  background: var(--mint);
}

tr.round-row {
  background: var(--gray-50);
}

tr.round-row td {
  padding: 0.4rem 1rem;
  font-size: 0.82rem;
  color: var(--gray-600);
}

tr.round-row td.col-name {
  padding-left: 2.2rem;
  font-weight: 400;
}

tr.round-row td:first-child {
  padding-left: 2.2rem;
}

/* ── Admin tabs ───────────────────────────────────────────────────────── */
.admin-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.admin-tab {
  font-family: "Poppins", sans-serif;
  font-weight: 500;
  font-size: 0.85rem;
  padding: 0.45rem 1.2rem;
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  background: var(--white);
  color: var(--gray-600);
  cursor: pointer;
  transition: all 0.15s;
}

.admin-tab:hover {
  border-color: var(--teal);
  color: var(--teal-dark);
}

.admin-tab.active {
  background: var(--teal-dark);
  border-color: var(--teal-dark);
  color: var(--white);
}

/* ── Year filter buttons ──────────────────────────────────────────────── */
.admin-year-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 1rem;
}

.year-btn {
  font-family: "Poppins", sans-serif;
  font-weight: 500;
  font-size: 0.8rem;
  padding: 0.3rem 0.85rem;
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  background: var(--white);
  color: var(--gray-600);
  cursor: pointer;
  transition: all 0.15s;
}

.year-btn:hover {
  border-color: var(--teal);
  color: var(--teal-dark);
}

.year-btn.active {
  background: var(--teal-dark);
  border-color: var(--teal-dark);
  color: var(--white);
}

/* ── Sortable headers ────────────────────────────────────────────────── */
th.sortable {
  cursor: pointer;
  user-select: none;
}

th.sortable:hover {
  background: #1a3347;
}

.sort-indicator {
  font-size: 0.65rem;
  margin-left: 0.15rem;
}

/* ── Admin table rows ─────────────────────────────────────────────────── */
tr.admin-event-row td.col-name::before {
  content: "▸ ";
  font-size: 0.7rem;
  color: var(--gray-400);
  display: inline-block;
  margin-right: 0.25rem;
}

tr.admin-event-row.expanded td.col-name::before {
  content: "▾ ";
  color: var(--teal-dark);
}

tr.admin-event-row.expanded {
  background: var(--mint);
}

tr.admin-round-row {
  background: var(--gray-50);
}

tr.admin-round-row td {
  padding: 0.45rem 1rem;
  font-size: 0.85rem;
  color: var(--gray-600);
}

tr.admin-round-row td:first-child {
  padding-left: 2.2rem;
}

tr.admin-round-row td.col-name::before {
  content: "▸ ";
  font-size: 0.6rem;
  color: var(--gray-400);
  display: inline-block;
  margin-right: 0.2rem;
}

tr.admin-round-row.expanded td.col-name::before {
  content: "▾ ";
  color: var(--teal-dark);
}

tr.admin-round-row.expanded {
  background: var(--mint);
}

tr.admin-round-row.clickable:hover {
  background: var(--mint);
}

tr.admin-player-row {
  background: var(--white);
}

tr.admin-player-row td {
  padding: 0.35rem 1rem;
  font-size: 0.8rem;
  color: var(--gray-600);
}

tr.admin-player-row td:first-child {
  padding-left: 3.5rem;
}

/* ── Hamburger toggle (hidden on desktop) ────────────────────────────── */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  flex-direction: column;
  gap: 5px;
}

.nav-toggle span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--white);
  border-radius: 2px;
  transition: transform 0.2s, opacity 0.2s;
}

/* ── Responsive: tablet (≤ 768px) ────────────────────────────────────── */
@media (max-width: 768px) {
  .nav-inner {
    flex-wrap: wrap;
    height: auto;
    padding: 0.75rem 1rem;
    gap: 0.5rem;
  }

  .nav-brand {
    flex: 1;
    min-width: 0;
  }

  .nav-title {
    font-size: 1.05rem;
  }

  .nav-toggle {
    display: flex;
  }

  .nav-links {
    display: none;
    width: 100%;
    flex-direction: column;
    gap: 0.25rem;
    padding-top: 0.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
  }

  .nav-links.open {
    display: flex;
  }

  .nav-link {
    padding: 0.65rem 1rem;
    font-size: 0.95rem;
    border-radius: 6px;
  }

  .content {
    padding: 1rem 0.75rem;
  }

  .view-header h2 {
    font-size: 1.25rem;
  }

  thead th,
  tbody td {
    padding: 0.5rem 0.6rem;
    font-size: 0.8rem;
  }

  tbody tr.clickable td {
    padding-top: 0.7rem;
    padding-bottom: 0.7rem;
  }

  .col-name {
    max-width: 160px;
  }

  .col-course {
    max-width: 140px;
  }
}

/* ── Responsive: phone (≤ 600px) ─────────────────────────────────────── */
@media (max-width: 600px) {
  html {
    font-size: 14px;
  }

  .nav-logo {
    height: 26px;
  }

  .nav-title {
    font-size: 0.95rem;
  }

  .content {
    padding: 0.75rem 0.5rem;
  }

  .table-wrap {
    border-radius: 8px;
  }

  thead th {
    padding: 0.6rem 0.5rem;
    font-size: 0.72rem;
    letter-spacing: 0.02em;
  }

  tbody td {
    padding: 0.5rem;
    font-size: 0.8rem;
  }

  tbody tr.clickable td {
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
  }

  /* Rankings table: hide Avg Score (4th col) */
  #rankings-table th:nth-child(4),
  #rankings-table td:nth-child(4) {
    display: none;
  }

  #rankings-table .col-rank {
    width: 36px;
  }

  #rankings-table .col-sg {
    width: 80px;
  }

  /* Player table: hide Course (2nd), Year (3rd), Avg Score (5th) */
  #player-table th:nth-child(2),
  #player-table td:nth-child(2),
  #player-table th:nth-child(3),
  #player-table td:nth-child(3),
  #player-table th:nth-child(5),
  #player-table td:nth-child(5) {
    display: none;
  }

  .col-name {
    max-width: 130px;
  }

  /* Player header: compact layout */
  .view-header {
    margin-bottom: 0.75rem;
  }

  #player-subtitle {
    font-size: 0.82rem;
    line-height: 1.5;
  }

  /* Round sub-rows: tighter on mobile */
  tr.round-row td {
    padding: 0.35rem 0.5rem;
    font-size: 0.78rem;
  }

  tr.round-row td.col-name {
    padding-left: 1.5rem;
  }

  tr.round-row td:first-child {
    padding-left: 1.5rem;
  }

  /* Breadcrumb */
  .breadcrumb {
    font-size: 0.8rem;
  }

  /* FAQ */
  .faq-card {
    padding: 1.25rem;
  }

  .faq-card h2 {
    font-size: 1.25rem;
  }
}

/* ── Responsive: small phone (≤ 400px) ───────────────────────────────── */
@media (max-width: 400px) {
  .nav-brand {
    gap: 0.5rem;
  }

  .nav-logo {
    height: 28px;
  }

  .nav-title {
    font-size: 0.9rem;
  }

  .content {
    padding: 0.5rem 0.35rem;
  }

  thead th {
    padding: 0.5rem 0.35rem;
    font-size: 0.68rem;
  }

  tbody td {
    padding: 0.45rem 0.35rem;
    font-size: 0.75rem;
  }

  /* Rankings: also hide Rounds (3rd col) on very small screens */
  #rankings-table th:nth-child(3),
  #rankings-table td:nth-child(3) {
    display: none;
  }

  /* Player table: also hide Date (7th col, now last visible) */
  #player-table th:nth-child(7),
  #player-table td:nth-child(7) {
    display: none;
  }

  .col-name {
    max-width: 110px;
  }

  #rankings-table .col-sg {
    width: 70px;
  }
}
