/* ============================================================
   CWPPL — Chitungwiza Women's Premier Pool League
   Design system: pool-hall scoreboard meets championship crest.
   Palette pulled from the League's own badge — wine, hot pink,
   brass gold, felt green, and a near-black rail.
   ============================================================ */

@font-face {
  font-family: 'Bebas Neue';
  src: url('../assets/fonts/bebas-neue-latin-400-normal.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Inter';
  src: url('../assets/fonts/inter-latin-400-normal.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Inter';
  src: url('../assets/fonts/inter-latin-500-normal.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Inter';
  src: url('../assets/fonts/inter-latin-600-normal.woff2') format('woff2');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Inter';
  src: url('../assets/fonts/inter-latin-700-normal.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Inter';
  src: url('../assets/fonts/inter-latin-800-normal.woff2') format('woff2');
  font-weight: 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'JetBrains Mono';
  src: url('../assets/fonts/jetbrains-mono-latin-500-normal.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'JetBrains Mono';
  src: url('../assets/fonts/jetbrains-mono-latin-600-normal.woff2') format('woff2');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'JetBrains Mono';
  src: url('../assets/fonts/jetbrains-mono-latin-700-normal.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --wine: #6b0d3a;
  --wine-deep: #4a0827;
  --pink: #e91e86;
  --pink-bright: #ff3d9a;
  --gold: #c9a227;
  --gold-bright: #e8c34a;
  --felt: #0f5c3d;
  --felt-deep: #0a3f2a;
  --rail: #1a1420;
  --rail-soft: #251c2c;
  --cream: #fdf7fa;
  --cream-dim: #f6ebf1;
  --ink: #24141d;
  --ink-soft: #6b5866;
  --line: #ecdce6;
  --win: #1a7a1a;
  --draw: #b8860b;
  --loss: #a02020;
  --shadow-card: 0 2px 0 rgba(107,13,58,0.08), 0 8px 24px rgba(107,13,58,0.06);
  --radius: 10px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--cream);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

.display {
  font-family: 'Bebas Neue', 'Inter', sans-serif;
  letter-spacing: 0.02em;
}

.mono {
  font-family: 'JetBrains Mono', monospace;
}

a { color: inherit; }

button {
  font-family: inherit;
  cursor: pointer;
}

::selection { background: var(--pink); color: white; }

/* ---------- Header / Nav ---------- */

.site-header {
  background: linear-gradient(180deg, var(--rail) 0%, var(--wine-deep) 140%);
  border-bottom: 3px solid var(--gold);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  flex-shrink: 0;
}

.brand img {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 2px solid var(--gold);
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.05;
}

.brand-text .name {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 22px;
  color: #fff;
  letter-spacing: 0.03em;
}

.brand-text .tag {
  font-size: 11px;
  color: var(--gold-bright);
  font-style: italic;
  font-family: 'Inter', sans-serif;
}

.main-nav {
  display: flex;
  gap: 4px;
  margin-left: auto;
}

.main-nav button {
  background: transparent;
  border: none;
  color: rgba(255,255,255,0.75);
  padding: 10px 16px;
  font-size: 15px;
  font-weight: 600;
  border-radius: 8px 8px 0 0;
  border-bottom: 3px solid transparent;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.main-nav button:hover {
  color: #fff;
  background: rgba(255,255,255,0.06);
}

.main-nav button.active {
  color: #fff;
  border-bottom-color: var(--pink-bright);
}

@media (max-width: 720px) {
  .header-inner { flex-wrap: wrap; }
  .main-nav { width: 100%; margin-left: 0; justify-content: space-between; }
  .main-nav button { padding: 8px 6px; font-size: 12.5px; flex: 1; text-align: center; }
  .brand-text .name { font-size: 18px; }
}

/* ---------- Layout ---------- */

.page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 24px 80px;
}

.view { display: none; }
.view.active { display: block; }

/* ---------- Hero (Dashboard) ---------- */

.hero-banner {
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--shadow-card);
  margin-bottom: 28px;
  border: 1px solid var(--line);
}

.hero-banner img {
  width: 100%;
  display: block;
}

/* Scoreboard stat strip — the signature moment */

.scoreboard {
  background: var(--rail);
  border-radius: 14px;
  padding: 22px 8px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  margin-bottom: 32px;
  box-shadow: var(--shadow-card);
  position: relative;
}

.scoreboard::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 14px;
  border: 1px solid rgba(201,162,39,0.35);
  pointer-events: none;
}

.stat {
  text-align: center;
  padding: 6px 10px;
  border-right: 1px solid rgba(255,255,255,0.08);
}

.stat:last-child { border-right: none; }

.stat .num {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 44px;
  color: var(--gold-bright);
  line-height: 1;
  text-shadow: 0 0 18px rgba(232,195,74,0.35);
}

.stat .label {
  font-size: 11.5px;
  color: rgba(255,255,255,0.65);
  margin-top: 6px;
  font-weight: 600;
}

@media (max-width: 640px) {
  .scoreboard { grid-template-columns: repeat(2, 1fr); row-gap: 18px; }
  .stat:nth-child(2) { border-right: none; }
  .stat:nth-child(odd) { border-right: 1px solid rgba(255,255,255,0.08); }
  .stat .num { font-size: 34px; }
}

/* Dashboard grid */

.dash-grid {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 24px;
}

@media (max-width: 860px) {
  .dash-grid { grid-template-columns: 1fr; }
}

.panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 2px solid var(--felt);
  background: linear-gradient(180deg, #ffffff, #fdf9fb);
}

.panel-head h2 {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 22px;
  margin: 0;
  letter-spacing: 0.02em;
  color: var(--wine);
}

.panel-body { padding: 18px 20px; }

.mini-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--cream-dim);
  font-size: 14.5px;
}

.mini-row:last-child { border-bottom: none; }

.mini-row .rank {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--cream-dim);
  color: var(--wine);
  font-weight: 700;
  font-size: 12px;
  margin-right: 10px;
}

.mini-row:nth-child(1) .rank { background: var(--gold); color: #fff; }
.mini-row:nth-child(2) .rank { background: #c7c7c7; color: #fff; }
.mini-row:nth-child(3) .rank { background: #b8894a; color: #fff; }

.mini-row .name { font-weight: 600; flex: 1; }
.mini-row .pts {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  color: var(--wine);
}

.link-btn {
  background: none;
  border: none;
  color: var(--pink);
  font-weight: 700;
  font-size: 13.5px;
}

.link-btn:hover { text-decoration: underline; }

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 8px;
  border: none;
  font-weight: 700;
  font-size: 14px;
  transition: transform 0.08s, box-shadow 0.15s, background 0.15s;
}

.btn:active { transform: translateY(1px); }

.btn-primary {
  background: var(--wine);
  color: #fff;
  box-shadow: 0 2px 0 var(--wine-deep);
}
.btn-primary:hover { background: #7d1044; }

.btn-gold {
  background: var(--gold);
  color: #3a2c00;
  box-shadow: 0 2px 0 #97791d;
}
.btn-gold:hover { background: var(--gold-bright); }

.btn-ghost {
  background: transparent;
  color: var(--wine);
  border: 1.5px solid var(--wine);
}
.btn-ghost:hover { background: var(--cream-dim); }

.btn-sm { padding: 7px 12px; font-size: 12.5px; }

.btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* ---------- Fixtures & Scores view ---------- */

.week-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 2px 14px;
  margin-bottom: 18px;
  scrollbar-width: thin;
}

.week-pill {
  flex-shrink: 0;
  padding: 9px 16px;
  border-radius: 20px;
  border: 1.5px solid var(--line);
  background: #fff;
  font-weight: 700;
  font-size: 13.5px;
  color: var(--ink-soft);
  white-space: nowrap;
  position: relative;
}

.week-pill.active {
  background: var(--wine);
  border-color: var(--wine);
  color: #fff;
}

.week-pill .dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-right: 6px;
  background: #ccc;
  vertical-align: middle;
}

.week-pill .dot.complete { background: var(--felt); }
.week-pill .dot.partial { background: var(--gold); }

.week-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}

.week-panel-head h2 {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 30px;
  color: var(--wine);
  margin: 0;
}

.week-panel-head .sub {
  font-size: 13px;
  color: var(--ink-soft);
  margin-top: 2px;
}

.week-actions { display: flex; gap: 10px; flex-wrap: wrap; }

#capture-week {
  background: #fff;
  border-radius: 14px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.capture-header {
  background: linear-gradient(135deg, var(--wine) 0%, var(--wine-deep) 100%);
  padding: 20px 24px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.capture-header img { width: 46px; height: 46px; border-radius: 50%; border: 2px solid var(--gold); }

.capture-header .ct {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 24px;
  color: #fff;
  letter-spacing: 0.02em;
  line-height: 1.1;
}

.capture-header .cs {
  font-size: 11.5px;
  color: var(--gold-bright);
}

.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.scroll-hint {
  display: none;
  text-align: center;
  font-size: 11.5px;
  color: var(--ink-soft);
  padding: 8px 0 4px;
  background: #fff;
}

@media (max-width: 640px) {
  .scroll-hint { display: block; }
  table.match-table, table.log-table { min-width: 640px; }
}

table.match-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14.5px;
}

table.match-table thead th {
  background: var(--felt);
  color: #fff;
  text-align: left;
  padding: 10px 14px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

table.match-table thead th.center,
table.match-table td.center { text-align: center; }

table.match-table tbody tr:nth-child(even) { background: var(--cream-dim); }

table.match-table tbody tr.postponed { background: #fff3d6; }

table.match-table td {
  padding: 9px 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.pname { font-weight: 700; color: var(--ink); }
.pid { font-family: 'JetBrains Mono', monospace; font-size: 11.5px; color: var(--ink-soft); display: block; }

.score-input-group {
  display: flex;
  align-items: center;
  gap: 5px;
  justify-content: center;
}

.score-input-group input {
  width: 40px;
  text-align: center;
  padding: 5px 2px;
  border: 1.5px solid var(--line);
  border-radius: 6px;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  font-size: 14px;
  color: var(--wine);
}

.score-input-group input:focus {
  outline: none;
  border-color: var(--pink);
}

.score-input-group span { color: var(--ink-soft); font-weight: 700; }

.score-display {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  font-size: 15px;
  color: var(--wine);
}

.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.badge-played { background: #e4f3ea; color: var(--win); }
.badge-scheduled { background: #eef0ef; color: #667066; }
.badge-postponed { background: #fdeecb; color: var(--draw); }

.row-btn {
  background: none;
  border: 1.3px solid var(--line);
  border-radius: 6px;
  padding: 4px 9px;
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-soft);
}
.row-btn:hover { background: var(--cream-dim); }
.row-btn.postpone-active { background: var(--draw); color: #fff; border-color: var(--draw); }

.week-footer-note {
  padding: 14px 20px 18px;
  font-size: 12px;
  color: var(--ink-soft);
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.save-bar {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
}

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--rail);
  color: #fff;
  padding: 12px 22px;
  border-radius: 30px;
  font-weight: 600;
  font-size: 14px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.3);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
  z-index: 999;
  border: 1px solid var(--gold);
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ---------- League Log view ---------- */

.log-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 18px;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: 8px;
  padding: 8px 12px;
  min-width: 220px;
}

.search-box input {
  border: none;
  outline: none;
  font-size: 14px;
  flex: 1;
  font-family: inherit;
}

#capture-log {
  background: #fff;
  border-radius: 14px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

table.log-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

table.log-table thead th {
  background: var(--felt);
  color: #fff;
  padding: 11px 12px;
  font-size: 11.5px;
  font-weight: 700;
  text-align: center;
  letter-spacing: 0.03em;
}

table.log-table thead th.left { text-align: left; }

table.log-table tbody td {
  padding: 9px 12px;
  text-align: center;
  border-bottom: 1px solid var(--line);
  font-family: 'JetBrains Mono', monospace;
}

table.log-table tbody td.left {
  text-align: left;
  font-family: 'Inter', sans-serif;
}

table.log-table tbody tr:nth-child(even) { background: var(--cream-dim); }
table.log-table tbody tr:nth-child(-n+3) td.pos { color: var(--gold); font-weight: 800; }

td.pos { font-weight: 700; color: var(--wine); }

td.pts { font-weight: 800; color: var(--wine); font-size: 15px; }

.log-name-cell { display: flex; align-items: center; gap: 8px; }
.log-name-cell .pname { font-family: 'Inter', sans-serif; }

/* ---------- Empty state ---------- */

.empty-note {
  text-align: center;
  padding: 40px 20px;
  color: var(--ink-soft);
  font-size: 14px;
}

/* ---------- Footer ---------- */

.site-footer {
  text-align: center;
  padding: 24px;
  font-size: 12.5px;
  color: var(--ink-soft);
  border-top: 1px solid var(--line);
}

.site-footer .exec {
  max-width: 720px;
  margin: 6px auto 0;
  line-height: 1.5;
}

/* ---------- Export/capture mode ----------
   Applied briefly while html2canvas captures a panel, so the
   downloaded image reads as a finished result sheet rather than
   a live data-entry form. */

.exporting .row-btn { display: none; }

.exporting .score-input-group input {
  border: none;
  background: transparent;
  padding: 0;
  width: auto;
  min-width: 16px;
  color: var(--wine);
}

.exporting .score-input-group input::-webkit-outer-spin-button,
.exporting .score-input-group input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.exporting .score-input-group input[type="number"] { -moz-appearance: textfield; }

/* Empty (unplayed) score cells read as an en dash rather than
   two empty boxes with a hyphen floating between them. */
.exporting .score-input-group.is-empty input,
.exporting .score-input-group.is-empty span { visibility: hidden; }
.exporting .score-input-group.is-empty::after {
  content: "\2014";
  color: var(--ink-soft);
  position: absolute;
}
.exporting .score-input-group.is-empty { position: relative; }

.admin-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.2);
  color: rgba(255,255,255,0.85);
  padding: 8px 14px;
  border-radius: 20px;
  font-size: 12.5px;
  font-weight: 600;
  flex-shrink: 0;
}
.admin-btn:hover { background: rgba(255,255,255,0.16); }
.admin-btn.is-admin {
  background: var(--gold);
  border-color: var(--gold);
  color: #3a2c00;
}

@media (max-width: 720px) {
  .admin-btn span:last-child { display: none; }
  .admin-btn { padding: 8px 10px; }
}

/* ---------- Admin login modal ---------- */

.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(26,20,32,0.55);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-overlay.show { display: flex; }

.modal-box {
  background: #fff;
  border-radius: 14px;
  padding: 26px;
  max-width: 360px;
  width: 100%;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  border-top: 4px solid var(--gold);
}
.modal-box h3 {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 24px;
  color: var(--wine);
  margin: 0 0 10px;
  letter-spacing: 0.02em;
}
.modal-box p {
  font-size: 13.5px;
  color: var(--ink-soft);
  margin: 0 0 16px;
  line-height: 1.5;
}
.modal-box input {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--line);
  border-radius: 8px;
  font-size: 16px;
  font-family: 'JetBrains Mono', monospace;
  margin-bottom: 16px;
  letter-spacing: 0.1em;
}
.modal-box input:focus { outline: none; border-color: var(--pink); }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; }

/* ---------- Viewer-mode notice ---------- */

.viewer-note {
  text-align: center;
  font-size: 12.5px;
  color: var(--ink-soft);
  font-style: italic;
  margin-top: 14px;
}

/* ---------- Print / PDF export ---------- */

@media screen {
  .print-only { display: none; }
}

@media print {
  body.print-mode-week * ,
  body.print-mode-log * {
    visibility: hidden;
  }
  body.print-mode-week #capture-week,
  body.print-mode-week #capture-week *,
  body.print-mode-log #capture-log,
  body.print-mode-log #capture-log * {
    visibility: visible;
  }
  body.print-mode-week #capture-week,
  body.print-mode-log #capture-log {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    box-shadow: none;
    border: none;
  }
  /* Print the finished result, not the editable form */
  body.print-mode-week .row-btn { display: none !important; }
  body.print-mode-week .score-input-group input {
    border: none !important;
    background: transparent !important;
    padding: 0 !important;
    width: auto !important;
    min-width: 14px !important;
  }
  body.print-mode-week .score-input-group.is-empty input,
  body.print-mode-week .score-input-group.is-empty span { visibility: hidden !important; }
  body.print-mode-week .score-input-group.is-empty::after {
    content: "\2014";
    color: var(--ink-soft);
  }
  @page { margin: 12mm; }
}

/* ---------- Scrollbars ---------- */

.week-strip::-webkit-scrollbar { height: 6px; }
.week-strip::-webkit-scrollbar-thumb { background: var(--line); border-radius: 4px; }

/* ---------- Focus visibility ---------- */

button:focus-visible, input:focus-visible {
  outline: 2px solid var(--pink);
  outline-offset: 2px;
}

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}

/* ---- links to the main CWPPL website ---- */
.site-link{color:rgba(255,255,255,.85);text-decoration:none;font-weight:600;font-size:14px;padding:8px 12px;border:1px solid rgba(255,255,255,.25);border-radius:999px;white-space:nowrap;margin-left:auto}
.site-link:hover{color:#fff;border-color:#fff}
.site-link + .main-nav{margin-left:12px}
.preview-note{margin:0;background:#3a2430;color:#F3E3EB;font-size:13px;text-align:center;padding:6px 12px}
@media (max-width:720px){.site-link{order:2;margin-left:auto;font-size:12.5px;padding:6px 10px}.site-link + .main-nav{margin-left:0;order:3}}
@media print{.site-link,.preview-note{display:none!important}}
