/* Club Contacts additions on top of the shared Team Sheets stylesheet (style.css). */

header.topbar nav a.active { opacity: 1; text-decoration: underline; }
header.topbar .muted-light { color: #fff; opacity: 0.7; }

.subnav { background: var(--card); border-bottom: 1px solid var(--border); padding: 0 24px; display: flex; gap: 2px; flex-wrap: wrap; }
.subnav a { padding: 11px 12px 9px; color: var(--muted); text-decoration: none; font-size: 0.9rem; border-bottom: 3px solid transparent; }
.subnav a:hover { color: var(--text); }
.subnav a.active { color: var(--primary); border-bottom-color: var(--gold); font-weight: 600; }

.report-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.report-head .subtitle { max-width: 760px; }
.report-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.stat-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat-card { background: var(--card); border: 1px solid var(--border); border-top: 3px solid var(--primary); border-radius: 8px; padding: 12px 14px; }
.stat-label { color: var(--muted); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.03em; font-weight: 600; }
.stat-value { font-size: 1.6rem; font-weight: 700; margin-top: 4px; }

.report-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; margin-bottom: 24px; }
a.report-card { text-decoration: none; color: inherit; margin-bottom: 0; transition: border-color 0.15s; }
a.report-card:hover { border-color: var(--primary); }
a.report-card h2 { color: var(--primary); }
.mini-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; margin: 0; }
.mini-stats dt { color: var(--muted); font-size: 0.75rem; }
.mini-stats dd { margin: 2px 0 0; font-size: 1.15rem; font-weight: 700; }

.badge-good { background: #eaf7ee; color: #1e7a3c; }
.badge-bad { background: #fdecea; color: var(--danger); }
.badge-warn { background: #fff8e6; color: #92620a; }

.filter-bar { padding: 16px 20px; }
/* The buttons that act on a whole page, above its filters. */
.season-picker { display: flex; gap: 8px; align-items: center; margin: -6px 0 16px; }
.season-picker label { margin: 0; }
.season-picker select { margin: 0; width: auto; }
.page-actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
/* A button and the field it acts on, side by side. */
.inline-form { display: flex; gap: 8px; align-items: center; }
.inline-form select { margin-bottom: 0; width: auto; }
.filter-bar .filter-grid { margin-top: 0; }

.report-meta { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; margin-bottom: 10px; }
/* A count with a button beside it: the two sit on the same line, and the
   button is sized to the text rather than to a page action. */
.report-meta.meta-with-action { align-items: center; gap: 14px; }
.report-meta.meta-with-action .btn { padding: 5px 12px; font-size: 0.85rem; }
.email-box { font-size: 0.88rem; }
.email-box summary { cursor: pointer; color: var(--primary); }
.email-box textarea { display: block; width: min(640px, 100%); font: inherit; font-size: 0.85rem; padding: 8px; border: 1px solid var(--border); border-radius: 6px; margin: 8px 0; }

.table-card { padding: 0; overflow: hidden; }
.table-card .table-scroll { max-height: 72vh; overflow: auto; }
.table-card table { margin-top: 0; }
.table-card thead th { position: sticky; top: 0; background: var(--card); z-index: 1; box-shadow: inset 0 -1px 0 var(--border); }
.report-table td { white-space: nowrap; }
/* A column of tags wraps within a readable width instead of stretching to its longest row.
   The width goes on an inner block because browsers ignore max-width on table cells. */
.report-table td.wrap { white-space: normal; }
.report-table td.wrap .cell-wrap { min-width: 12rem; max-width: 22rem; }

/* A row's actions behind a single "⋮" menu, as in the Team Sheets app. The list is
   position:fixed and hidden from its first frame, so it never widens the row or gets
   clipped by the scrolling table; the script in report.ejs places and shows it. */
.row-menu-cell { width: 1%; text-align: right; }
.action-menu { position: relative; display: inline-block; }
.action-menu > summary { list-style: none; cursor: pointer; padding: 3px 9px; border: 1px solid var(--border); border-radius: 6px; font-size: 1.1rem; line-height: 1.4; color: var(--muted); user-select: none; }
.action-menu > summary::-webkit-details-marker { display: none; }
.action-menu > summary:hover, .action-menu[open] > summary { border-color: var(--primary); color: var(--primary); }
.action-menu-list { position: fixed; visibility: hidden; background: var(--card); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15); min-width: 180px; z-index: 30; padding: 4px; }
.action-menu-item { display: block; padding: 8px 10px; border-radius: 6px; font-size: 0.88rem; color: var(--text); text-decoration: none; white-space: nowrap; }
.action-menu-item:hover { background: var(--bg); }
/* A form's button in a menu looks like the menu's links. */
.action-menu-list { text-align: left; }
.action-menu-list form { margin: 0; }
button.action-menu-item { width: 100%; margin: 0; background: none; border: none; text-align: left; font: inherit; font-size: 0.88rem; color: var(--text); cursor: pointer; }
button.action-menu-item:hover { background: var(--bg); }
/* A menu item that opens a file picker is a <label>, which forms style bold. */
label.action-menu-item { font-weight: normal; margin: 0; cursor: pointer; }
.action-menu-item.danger { color: var(--danger); }
tr.editing td { background: #fff8e6; }

.group-card summary { cursor: pointer; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.group-card summary code { font-size: 0.8rem; }
.group-counts { margin-left: auto; display: flex; gap: 6px; }
.invite-link { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; word-break: break-all; margin: 14px 0; }

.import-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; }
.import-grid .card { margin-bottom: 0; }
.import-grid form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.import-grid input[type="file"] { margin-bottom: 4px; flex: 1 1 100%; }
.columns-help { margin-top: 14px; font-size: 0.85rem; }
.columns-help summary { cursor: pointer; color: var(--muted); }
.columns-help ul { padding-left: 18px; margin: 8px 0 0; }
.columns-help code, .small code { font-size: 0.8rem; word-break: break-all; }
.small { font-size: 0.85rem; }

.row-form { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 0 16px; }
/* A checkbox in the row of fields, lined up with the boxes rather than their labels. */
.row-form-check { align-self: end; display: flex; align-items: center; min-height: 40px; margin-bottom: 16px; }
.row-form-check label.checkbox { flex-wrap: wrap; white-space: nowrap; column-gap: 8px; row-gap: 2px; }
.row-form-actions { grid-column: 1 / -1; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
label.checkbox { display: flex; gap: 8px; align-items: center; font-weight: 400; margin: 0; }
.row-actions { display: flex; gap: 12px; align-items: center; white-space: nowrap; }
.row-actions form { margin: 0; }
button.link-button { background: none; border: none; color: var(--danger); padding: 0; font: inherit; cursor: pointer; }
.inline-form { display: inline; margin: 0 0 0 6px; }
.action-link { margin-left: 6px; font-size: 0.8rem; white-space: nowrap; }
.cell-note { display: block; font-size: 0.72rem; color: var(--muted); }
.tag-input { display: flex; margin-bottom: 16px; }
.tag-input input { margin-bottom: 0; border-radius: 0 6px 6px 0; }
.tag-prefix { padding: 10px 10px; background: #eef1f6; border: 1px solid var(--border); border-right: none; border-radius: 6px 0 0 6px; color: var(--muted); font-size: 1rem; white-space: nowrap; }
.tag-prefix:empty { display: none; }
.detail-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px 16px; margin: 0; }
.detail-list dt { color: var(--muted); font-size: 0.78rem; }
.detail-list dd { margin: 2px 0 0; font-weight: 600; word-break: break-word; }
label.plain-label { font-weight: 400; font-size: inherit; margin: 0; cursor: pointer; }

@media (max-width: 640px) {
  /* One swipeable row of report tabs instead of several wrapped rows. */
  .subnav { padding: 0 12px; flex-wrap: nowrap; overflow-x: auto; }
  .subnav a { white-space: nowrap; }
  .group-counts { margin-left: 0; }
}


/* My details: the WhatsApp groups someone belongs in, joined or not. */
/* What someone does, one role to a line with the teams it is for. */
.plain-list { list-style: none; margin: 10px 0 0; padding: 0; }
.plain-list li { padding: 4px 0; }

.group-list { list-style: none; margin: 10px 0 0; padding: 0; }
.group-list li { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 8px 0; border-top: 1px solid var(--border); }
.group-list li:first-child { border-top: none; }
.group-list .btn { padding: 4px 10px; font-size: 0.85rem; }

/* Availability: a tick per person per game time, and the tick boxes on the
   form someone fills in for a round. */
.grid-table th.slot, .grid-table td.slot { text-align: center; white-space: nowrap; }
.grid-table td.slot .tick { color: var(--good, #157347); font-weight: 700; }
.check-row { display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 8px 0 4px; }
.check-row .checkbox { white-space: nowrap; }

/* The availability form's two notes fields: one each side, meeting in the
   middle, with their boxes lined up however the labels wrap. */
.notes-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; align-items: end; margin-top: 12px; }
@media (max-width: 640px) { .notes-row { grid-template-columns: 1fr; } }

/* The rounds someone has already sent in, so they can go back and change one. */
.sent-rounds { list-style: none; margin: 0 0 14px; padding: 0; }
.sent-rounds li { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; padding: 6px 0; border-top: 1px solid var(--border); }
.sent-rounds li:first-child { border-top: none; }

/* My details: the sections someone rarely changes open on a click, so the
   page opens on what they're here for. */
.page-section > summary { cursor: pointer; font-size: 1.15rem; font-weight: 700; display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; list-style: none; }
.page-section > summary::-webkit-details-marker { display: none; }
/* A chevron that turns as the section opens, so it reads as something to open. */
.page-section > summary::before { content: '\25B8'; color: var(--primary); font-size: 0.9em; transition: transform 0.15s ease; }
.page-section[open] > summary::before { transform: rotate(90deg); }
.page-section > summary:hover { color: var(--primary); }
.page-section > summary span { font-weight: 400; }
.page-section[open] > summary { margin-bottom: 12px; }

/* The rounds already played, out of the way until someone wants them. */
.sent-past { margin: -6px 0 12px; }
.sent-past > summary { cursor: pointer; color: var(--muted); font-size: 0.88rem; }

/* The tag and invite link at the top of a group, so they're there to copy
   without opening it. */
.group-head { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 10px 0 4px; }
.group-head a { word-break: break-all; }

/* A report's own role tag, beside its heading. */
h1 .heading-tag { font-size: 0.55em; vertical-align: middle; }

/* Joining a report's WhatsApp group: the invite link as two buttons rather
   than a long URL across the intro. */
.whatsapp-line { margin: 14px 0 8px; }
.whatsapp-actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 12px; }
.whatsapp-actions .btn, .whatsapp-actions button { padding: 5px 12px; font-size: 0.85rem; }

/* The setting-up pages behind one top bar item, so the bar stays short. A
   <details> so it works with no JavaScript; /nav-menu.js only closes it when
   you click away. */
header.topbar .nav-menu { position: relative; }
header.topbar .nav-menu > summary {
  cursor: pointer; opacity: 0.85; list-style: none; display: inline-flex; align-items: center; gap: 4px;
}
header.topbar .nav-menu > summary::-webkit-details-marker { display: none; }
header.topbar .nav-menu > summary::after { content: '\25be'; font-size: 0.8em; }
header.topbar .nav-menu[open] > summary, header.topbar .nav-menu > summary:hover { opacity: 1; }
header.topbar .nav-menu > summary.active { opacity: 1; text-decoration: underline; }
header.topbar .nav-menu-items {
  position: absolute; top: calc(100% + 12px); left: 0; z-index: 30; min-width: 170px;
  display: flex; flex-direction: column; gap: 12px;
  padding: 14px 18px; background: var(--primary);
  border: 1px solid rgba(255, 255, 255, 0.3); border-radius: 6px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

@media (max-width: 640px) {
  /* The bar is already a column behind the hamburger, so the menu opens in
     place rather than floating over what's under it. */
  header.topbar .nav-menu-items {
    position: static; border: none; box-shadow: none; background: none;
    padding: 12px 0 0 14px; gap: 14px;
  }
}

/* The coach survey's player cards: a form per player, opened one at a time,
   with the ratings as a compact grid rather than five rows of radios. */
.player-card { margin: 10px 0; }
.player-card > summary { display: flex; align-items: center; gap: 10px; }
.player-card textarea { min-height: 60px; }
.player-card input[type="text"], .player-card select, .player-card textarea { margin-bottom: 10px; }
table.ratings { width: auto; margin: 4px 0 14px; }
table.ratings td, table.ratings th { padding: 4px 10px; }
table.ratings input[type="radio"] { margin: 0; }

/* A sortable column heading: the whole label is the link, and an arrow
   shows which column the rows are in the order of. */
table thead th > a { color: inherit; text-decoration: none; white-space: nowrap; }
table thead th > a:hover { text-decoration: underline; }
table thead th.sorted { color: var(--primary); }

/* What a coach said about one player, in the survey's drill-down: enough
   room to read a sentence, not so much that the page scrolls sideways. */
td.player-said { max-width: 420px; white-space: normal; }
td.player-said .badge { font-size: 0.72rem; margin: 0 2px 3px 0; display: inline-block; }
td.player-said div + div { margin-top: 3px; }

/* The coach survey list. A response is two rows: what the coach said, and
   the players underneath it, so opening the players doesn't widen a column
   and shove the rest of the table about. The pair reads as one row. */
tr.survey-row > td { border-bottom: none; padding-bottom: 4px; }
tr.survey-players > td { padding-top: 0; }
tr.survey-players summary { cursor: pointer; color: var(--muted); font-size: 0.85rem; }
td.nowrap { white-space: nowrap; }
/* Room for a sentence, not for the whole width of the table. */
td.team-notes { max-width: 460px; white-space: normal; }

/* Text a button copies, kept in the page but out of sight. Not display:none
   - a hidden field's value can't always be read for the clipboard. */
.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* The age groups an Age Group Coordinator looks after: the season's own
   brackets, ticked rather than typed. */
fieldset.age-picker { border: 1px solid var(--border); border-radius: 8px; padding: 10px 14px; margin: 0 0 12px; }
fieldset.age-picker legend { font-size: 0.85rem; color: var(--muted); padding: 0 6px; }
fieldset.age-picker label.checkbox { display: inline-flex; align-items: center; gap: 5px; margin: 0 14px 4px 0; }
/* A status badge explains its own rule on hover. */
.report-table span[title] { cursor: help; }

/* A filter that takes several values at once - role on Staff, user type on
   Users. Boxed in as a fieldset it stood taller than the plain dropdowns
   beside it and threw the whole filter row out of line, so it's a <details>
   sized exactly like a select that drops its tick boxes over the page. It
   opens and closes on its own; /nav-menu.js only closes it on a click away. */
.tick-menu { position: relative; }
.tick-menu > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  list-style: none;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--card);
  color: var(--text);
  font-size: 1rem;
  cursor: pointer;
}
.tick-menu > summary::-webkit-details-marker { display: none; }
.tick-menu > summary::after { content: '\25be'; color: var(--muted); font-size: 0.8em; }
.tick-menu[open] > summary { border-color: var(--primary); }
.tick-menu-items {
  position: absolute;
  z-index: 30;
  top: calc(100% + 4px);
  left: 0;
  min-width: 100%;
  max-height: 300px;
  overflow-y: auto;
  padding: 8px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(28, 36, 48, 0.14);
}
.tick-menu-items .tick {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 6px 8px;
  border-radius: 4px;
  white-space: nowrap;
  font-weight: 400;
  cursor: pointer;
}
.tick-menu-items .tick:hover { background: var(--bg); }
.tick-menu-items .tick input { margin: 0; }
.tick-menu-items .muted { display: block; padding: 6px 8px 2px; }
/* Roles ticked straight off the Staff table, behind a dropdown so seven of
   them don't stretch the column. */
.role-menu { position: relative; }
.role-menu > summary { cursor: pointer; list-style: none; }
/* The column is as wide as the widest single role and no wider: each role
   can't break inside itself, so min-content settles on "Team Manager" and
   anyone holding several wraps to a line each. */
.role-list { display: inline-block; max-width: min-content; }
.role-name { white-space: nowrap; }
.role-position { display: block; font-size: 0.85rem; }
.role-menu > summary::-webkit-details-marker { display: none; }
/* The caret rides along with the last role rather than being an item of its
   own, so it can't be the thing that wraps: the column is then wide enough
   for the widest role and its caret side by side. */
.role-menu .role-list .role-name:last-child::after { content: ' \25BE'; color: var(--muted); }
.role-menu[open] > summary { font-weight: 500; }
.role-menu-items {
  position: absolute; z-index: 5; left: 0; top: 100%; min-width: 200px;
  background: var(--card); border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 12px; box-shadow: 0 6px 20px rgba(0,0,0,0.12);
}
.role-menu-items label { display: flex; align-items: center; gap: 6px; padding: 3px 0; white-space: nowrap; }
.role-menu-position { display: block; margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--border); font-size: 0.85rem; }
.role-menu-position select { display: block; margin-top: 4px; width: 100%; }
