/* ==========================================================================
   Whitehill & Bordon FC — Club Admin
   Club palette: Navy #1B2838 · Gold #BD9B6B · Red #9F1F33 · White
   ========================================================================== */

:root {
  --navy: #1B2838;
  --navy-soft: #24344a;
  --gold: #BD9B6B;
  --gold-soft: #d8c4a3;
  --red: #9F1F33;
  --ink: #1B2838;
  --muted: #5a6675;
  --line: #dce1e8;
  --bg: #f4f6f9;
  --white: #fff;
  --ok: #2e7d32;
  --shadow: 0 10px 30px rgba(27, 40, 56, .12);
  --radius: 12px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

.boot { padding: 60px; text-align: center; color: var(--muted); }

button { font-family: inherit; cursor: pointer; }
a { color: var(--red); }

/* ---- Buttons -------------------------------------------------------------- */
.btn {
  border: 0; border-radius: 9px; padding: 10px 16px; font-size: 14px; font-weight: 600;
  background: var(--gold); color: var(--navy); transition: filter .15s, background .15s;
}
.btn:hover { filter: brightness(1.05); }
.btn.secondary { background: var(--white); color: var(--navy); border: 1px solid var(--line); }
.btn.secondary:hover { background: #eef1f5; }
.btn.danger { background: var(--white); color: var(--red); border: 1px solid #eecbd1; }
.btn.danger:hover { background: #fbeaec; }
.btn.small { padding: 6px 11px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: default; }

/* ==========================================================================
   LOGIN
   ========================================================================== */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(120% 120% at 50% 0%, #24344a 0%, #1B2838 60%); padding: 20px;
}
.login-card {
  background: var(--white); border-radius: 16px; box-shadow: 0 20px 60px rgba(0,0,0,.35);
  width: 100%; max-width: 380px; padding: 32px 30px;
}
.login-crest { text-align: center; margin-bottom: 18px; }
.login-card h1 { font-size: 19px; margin: 0 0 2px; text-align: center; }
.login-card .sub { text-align: center; color: var(--muted); font-size: 13px; margin-bottom: 22px; }
.login-error { background: #fbeaec; color: var(--red); border: 1px solid #f0c4cb; padding: 9px 12px; border-radius: 8px; font-size: 13px; margin-bottom: 14px; }

/* ==========================================================================
   APP SHELL
   ========================================================================== */
.shell { min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
  background: var(--navy); color: var(--white);
  display: flex; align-items: center; gap: 16px; padding: 0 18px; height: 60px;
}
.brand { display: flex; align-items: center; gap: 11px; font-weight: 700; letter-spacing: .2px; }
.crest-mark {
  width: 34px; height: 34px; border-radius: 50%; flex: none;
  border: 2px solid var(--gold); display: flex; align-items: center; justify-content: center;
  font-size: 17px; background: var(--navy-soft);
}
.crest-img {
  border-radius: 50%; object-fit: cover; flex: none; display: block;
  background: #fff;
}
.brand .full { font-size: 15px; }
.brand .tag { color: var(--gold); font-size: 11px; font-weight: 600; letter-spacing: .6px; text-transform: uppercase; }

.topnav { display: flex; gap: 4px; margin-left: 10px; flex: 1; flex-wrap: wrap; align-items: center; }
.topnav a {
  color: #c4cdd9; text-decoration: none; font-size: 14px; font-weight: 600;
  padding: 8px 13px; border-radius: 8px; white-space: nowrap;
}
.topnav a:hover { background: var(--navy-soft); color: #fff; }
.topnav a.active { background: var(--gold); color: var(--navy); }

/* category dropdowns */
.nav-group { position: relative; }
.nav-top {
  background: none; border: 0; color: #c4cdd9; font-size: 14px; font-weight: 600;
  padding: 8px 13px; border-radius: 8px; cursor: pointer; white-space: nowrap;
}
.nav-top:hover { background: var(--navy-soft); color: #fff; }
.nav-top.active { background: var(--gold); color: var(--navy); }
.nav-top .caret { font-size: 10px; opacity: .75; margin-left: 3px; }
.nav-menu {
  position: absolute; top: calc(100% + 4px); left: 0; min-width: 215px;
  background: #fff; border-radius: 10px; box-shadow: 0 14px 34px rgba(27,40,56,.28);
  padding: 6px; display: none; z-index: 40;
}
.nav-group.open .nav-menu { display: block; }
.nav-menu a {
  display: block; color: var(--ink); font-size: 14px; font-weight: 600;
  padding: 9px 12px; border-radius: 7px; white-space: nowrap;
}
.nav-menu a:hover { background: #eef1f5; color: var(--ink); }
.nav-menu a.active { background: var(--gold); color: var(--navy); }

.user-menu { display: flex; align-items: center; gap: 12px; font-size: 13px; color: #c4cdd9; }
.user-menu strong { color: #fff; }

/* Hamburger — hidden on desktop, shown in the mobile media query below. */
.nav-toggle {
  display: none; background: none; border: 0; color: #fff; cursor: pointer;
  font-size: 22px; line-height: 1; padding: 6px 10px; border-radius: 8px;
}
.nav-toggle:hover { background: var(--navy-soft); }

.content { flex: 1; padding: 24px; max-width: 1180px; width: 100%; margin: 0 auto; }

.page-head { margin-bottom: 18px; }
.page-head h2 { margin: 0 0 3px; font-size: 22px; }
.page-head p { margin: 0; color: var(--muted); font-size: 14px; }

/* ---- Mobile nav (hamburger drawer) ---------------------------------------- */
@media (max-width: 720px) {
  .topbar { height: auto; flex-wrap: wrap; padding: 10px 14px; }
  .brand { order: 1; }
  .brand .full { font-size: 14px; }
  .nav-toggle { display: block; order: 2; margin-left: auto; }

  /* Nav + user-menu collapse into a drawer that the hamburger toggles. */
  .topnav { order: 5; width: 100%; margin: 8px 0 0; display: none; flex-direction: column; align-items: stretch; gap: 2px; }
  .topbar.nav-open .topnav { display: flex; }
  .topnav a, .nav-top { width: 100%; padding: 12px 13px; text-align: left; }
  .nav-group { width: 100%; }

  /* Dropdowns render in-flow inside the drawer (not as floating popovers). */
  .nav-menu {
    position: static; display: none; min-width: 0; padding: 2px 0 4px 14px;
    background: transparent; box-shadow: none;
  }
  .nav-group.open .nav-menu { display: block; }
  .nav-menu a { color: #c4cdd9; padding: 10px 12px; }
  .nav-menu a:hover { background: var(--navy-soft); color: #fff; }

  .user-menu { order: 6; width: 100%; display: none; justify-content: space-between; margin-top: 8px; padding-top: 10px; border-top: 1px solid var(--navy-soft); }
  .topbar.nav-open .user-menu { display: flex; }

  .content { padding: 16px; }
}

/* ==========================================================================
   FORMS / INPUTS
   ========================================================================== */
label.field { display: block; font-weight: 600; font-size: 13px; margin: 12px 0 5px; }
input[type=text], input[type=password], input[type=email], input[type=tel],
input[type=number], input[type=date], select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px;
  font-size: 14px; font-family: inherit; background: #fff; color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--gold-soft); border-color: var(--gold); }
textarea { min-height: 70px; resize: vertical; }
.hint { color: var(--muted); font-size: 12px; margin-top: 4px; }

/* ==========================================================================
   CARDS & STATS
   ========================================================================== */
.card { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.cards { display: grid; gap: 16px; }

.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 22px; }
.stat {
  background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 16px 18px; border-top: 3px solid var(--gold);
}
.stat .value { font-size: 26px; font-weight: 800; color: var(--navy); line-height: 1.1; }
.stat .label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; margin-top: 4px; }
.stat.revenue { border-top-color: var(--red); }
.stat.revenue .value { color: var(--red); }

/* ==========================================================================
   MODULE TABS
   ========================================================================== */
.tabs { display: flex; gap: 6px; border-bottom: 2px solid var(--line); margin-bottom: 20px; flex-wrap: wrap; }
.tabs button {
  background: none; border: 0; padding: 10px 14px; font-size: 14px; font-weight: 600; color: var(--muted);
  border-bottom: 3px solid transparent; margin-bottom: -2px;
}
.tabs button.active { color: var(--navy); border-bottom-color: var(--gold); }

/* ==========================================================================
   PITCH MAP
   ========================================================================== */
.map-toolbar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 16px; }
.legend { display: flex; gap: 16px; font-size: 13px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.swatch { width: 14px; height: 14px; border-radius: 4px; display: inline-block; }
.swatch.sold { background: var(--navy); border: 2px solid var(--gold); }
.swatch.free { background: #fff; border: 2px solid var(--line); }

.pitch-grid {
  display: grid;
  grid-template-columns: auto 1fr auto;
  grid-template-rows: auto 1fr auto;
  grid-template-areas:
    ".    far   ."
    "left pitch right"
    ".    near  .";
  gap: 12px; align-items: stretch;
}
.side { background: #eef1f5; border-radius: 10px; padding: 10px; }
.side .side-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); margin-bottom: 8px; text-align: center; }
.area-far { grid-area: far; }
.area-left { grid-area: left; }
.area-right { grid-area: right; }
.area-near { grid-area: near; }

.pitch {
  grid-area: pitch; min-height: 220px; border-radius: 10px;
  background: repeating-linear-gradient(90deg, #2f7d3a 0 36px, #2c7637 36px 72px);
  border: 3px solid #fff; box-shadow: inset 0 0 0 2px rgba(255,255,255,.5);
  display: flex; align-items: center; justify-content: center; position: relative; color: rgba(255,255,255,.85);
}
.pitch::before { content: ""; position: absolute; left: 50%; top: 8%; bottom: 8%; width: 2px; background: rgba(255,255,255,.6); }
.pitch::after { content: ""; position: absolute; left: 50%; top: 50%; width: 70px; height: 70px; border: 2px solid rgba(255,255,255,.6); border-radius: 50%; transform: translate(-50%, -50%); }
.pitch .pitch-label { font-size: 12px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; z-index: 1; text-shadow: 0 1px 3px rgba(0,0,0,.4); }

/* board chips */
.boards { display: flex; flex-wrap: wrap; gap: 5px; justify-content: center; }
.area-left .boards, .area-right .boards { flex-direction: column; }
.board {
  width: 30px; height: 30px; border-radius: 5px; border: 2px solid var(--line);
  background: #fff; font-size: 10px; font-weight: 700; color: var(--muted);
  display: flex; align-items: center; justify-content: center; cursor: pointer; position: relative;
  transition: transform .08s;
}
.board:hover { transform: scale(1.12); z-index: 2; border-color: var(--gold); }
.board.sold { background: var(--navy); border-color: var(--gold); color: var(--gold); }
.board .dot { display: none; }
.dugout {
  width: 100%; text-align: center; font-size: 10px; font-weight: 700; color: var(--navy);
  background: var(--gold-soft); border-radius: 5px; padding: 3px 0; margin: 4px 0; text-transform: uppercase; letter-spacing: .5px;
}

@media (max-width: 720px) {
  .pitch-grid { grid-template-columns: 1fr; grid-template-areas: "far" "pitch" "right" "left" "near"; }
  .area-left .boards, .area-right .boards { flex-direction: row; }
  .pitch { min-height: 120px; }
}

/* ==========================================================================
   TABLES (list / sponsors / users)
   ========================================================================== */
.table-wrap { overflow-x: auto; background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); }
table.grid { width: 100%; border-collapse: collapse; font-size: 14px; }
table.grid th, table.grid td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); }
table.grid th { background: #f0f2f5; font-size: 12px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); position: sticky; top: 0; }
table.grid tr:hover td { background: #fafbfc; }
table.grid .num { text-align: right; font-variant-numeric: tabular-nums; }
.area-subhead td { background: var(--navy); color: #fff; font-weight: 700; font-size: 13px; }
.area-subhead td .sub-rev { float: right; color: var(--gold); }
.pill { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 11px; font-weight: 700; }
.pill.sold { background: #e7edf5; color: var(--navy); }
.pill.free { background: #fdeef0; color: var(--red); }
.grand td { font-weight: 800; font-size: 15px; background: #f0f2f5; border-top: 2px solid var(--navy); }

/* ==========================================================================
   MODAL
   ========================================================================== */
.modal-back {
  position: fixed; inset: 0; background: rgba(27,40,56,.55); display: flex; align-items: center; justify-content: center;
  padding: 20px; z-index: 50;
}
.modal {
  background: #fff; border-radius: 14px; box-shadow: 0 30px 80px rgba(0,0,0,.4);
  width: 100%; max-width: 460px; max-height: 90vh; overflow-y: auto;
}
.modal-head { padding: 18px 22px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; }
.modal-head h3 { margin: 0; font-size: 17px; }
.modal-head .close { background: none; border: 0; font-size: 22px; line-height: 1; color: var(--muted); cursor: pointer; }
.modal-body { padding: 18px 22px; }
.modal-foot { padding: 14px 22px; border-top: 1px solid var(--line); display: flex; gap: 10px; justify-content: flex-end; }
.modal-foot .spacer { flex: 1; }

.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 480px) { .row2 { grid-template-columns: 1fr; } }

/* ---- toast ---- */
.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
  background: var(--navy); color: #fff; padding: 11px 20px; border-radius: 30px; font-size: 14px;
  box-shadow: var(--shadow); z-index: 100; opacity: 0; transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { background: var(--red); }

.empty { text-align: center; color: var(--muted); padding: 40px 20px; }

/* ==========================================================================
   INVOICE SHEET + PRINT
   ========================================================================== */
.invoice-sheet {
  background: #fff; color: var(--ink); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 36px 40px; max-width: 820px; margin: 0 auto;
}
@media (max-width: 600px) { .invoice-sheet { padding: 22px 18px; } }

@media print {
  .topbar, .topnav, #app-footer, .no-print { display: none !important; }
  body, html { background: #fff !important; }
  .content { padding: 0 !important; max-width: none !important; }
  .invoice-sheet { box-shadow: none !important; border: 0 !important; max-width: none !important; padding: 0 !important; }
  /* hide the demo banner if present */
  .demo-banner { display: none !important; }
}
.coming-soon { display: inline-block; font-size: 10px; background: var(--navy-soft); color: var(--gold); padding: 1px 6px; border-radius: 10px; margin-left: 6px; }
.toolbar-right { margin-left: auto; display: flex; gap: 8px; }
