/* Sport4Africa hub — Airbnb-inspired spacing/cards + sports palette + dark mode */

:root,
html[data-theme="light"] {
  --bg: #f7f7f7;
  --bg-elev: #ffffff;
  --ink: #222222;
  --muted: #6a6a6a;
  --line: #dddddd;
  --shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.06);
  --brand: #e61e4d;
  --brand-hover: #d70466;
  --brand-soft: #fff0f3;
  --navy: #1b2a4a;
  --gold: #c9a227;
  --ok: #008a05;
  --ok-bg: #e7f6ea;
  --danger: #c13515;
  --info: #1b2a4a;
  --info-bg: #eef1f6;
  --radius: 16px;
  --radius-sm: 12px;
  --header-h: 72px;
  --font: "Plus Jakarta Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
  --max: 1180px;
}

html[data-theme="dark"] {
  --bg: #0b0b0d;
  --bg-elev: #17181c;
  --ink: #f2f2f2;
  --muted: #b0b0b0;
  --line: #2c2d33;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --brand: #ff5a6a;
  --brand-hover: #ff7a86;
  --brand-soft: #3a1520;
  --navy: #8ea4d4;
  --gold: #e2c15a;
  --ok: #4ade80;
  --ok-bg: #14301f;
  --danger: #ff8a70;
  --info: #9db4e0;
  --info-bg: #1c2436;
}

*,
*::before,
*::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: clamp(15px, 0.35vw + 14px, 17px);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; }

a { color: var(--navy); text-decoration: none; }
a:hover { text-decoration: underline; }

/* —— Header (Airbnb-style top bar) —— */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--header-h);
  background: var(--bg-elev);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 clamp(16px, 3vw, 40px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  text-decoration: none;
  min-width: 0;
}

.brand:hover { text-decoration: none; }

.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
  background: #1b2a4a;
}

.brand-text { min-width: 0; }
.brand-text strong {
  display: block;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
  color: var(--brand);
}
.brand-text span {
  display: block;
  font-size: 0.72rem;
  color: var(--muted);
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.site-nav a,
.site-nav button.nav-link {
  color: var(--ink);
  background: none;
  border: 0;
  font: inherit;
  cursor: pointer;
  padding: 8px 12px;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 560;
  font-size: 0.9rem;
}

.site-nav a:hover,
.site-nav button.nav-link:hover,
.site-nav a.active {
  background: var(--bg);
  text-decoration: none;
}

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--bg-elev);
  color: var(--ink);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
}

.icon-btn:hover { box-shadow: var(--shadow-sm); }

.account-menu { position: relative; }
.account-menu summary {
  list-style: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 0.88rem;
  font-weight: 600;
}
.account-menu summary::-webkit-details-marker { display: none; }
.account-menu .menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  min-width: 200px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  padding: 6px;
  z-index: 50;
}
.account-menu .menu a,
.account-menu .menu button {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: 0;
  font: inherit;
  color: inherit;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
}
.account-menu .menu a:hover,
.account-menu .menu button:hover { background: var(--bg); }

.nav-toggle { display: none; }

/* —— Page —— */
.page {
  width: min(var(--max), calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 64px;
}

.page-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 22px;
}

.page-head h1 {
  margin: 0 0 4px;
  font-size: clamp(1.5rem, 1.2rem + 1.2vw, 2rem);
  letter-spacing: -0.03em;
  font-weight: 700;
}

.page-head p { margin: 0; color: var(--muted); }

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

/* —— Subnav pills —— */
.subnav {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 14px;
  margin: -4px 0 18px;
  -webkit-overflow-scrolling: touch;
}

.subnav a {
  flex: 0 0 auto;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--ink);
  font-weight: 600;
  font-size: 0.88rem;
  text-decoration: none;
  background: var(--bg-elev);
}

.subnav a:hover {
  border-color: var(--ink);
  text-decoration: none;
}
.subnav a.active {
  border-color: var(--brand);
  color: var(--brand);
  background: var(--brand-soft);
  text-decoration: none;
}

/* —— Buttons —— */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--brand);
  color: #fff;
  border: 0;
  border-radius: 999px;
  padding: 10px 18px;
  font-weight: 650;
  font-size: 0.92rem;
  cursor: pointer;
  text-decoration: none;
  box-shadow: var(--shadow-sm);
}

.btn:hover { background: var(--brand-hover); text-decoration: none; color: #fff; }
.btn-secondary {
  background: var(--bg-elev);
  color: var(--ink);
  border: 1px solid var(--line);
  box-shadow: none;
}
.btn-secondary:hover { background: var(--bg); color: var(--ink); }
.btn-ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
  box-shadow: none;
}

/* —— Cards / tables —— */
.messages { list-style: none; padding: 0; margin: 0 0 16px; }
.messages li {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--bg-elev);
  margin-bottom: 8px;
}
.messages li.success { color: var(--ok); background: var(--ok-bg); border-color: transparent; }
.messages li.error { color: var(--danger); }

.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 16px; }
.toolbar .grow { flex: 1; min-width: 180px; }

.card {
  background: var(--bg-elev);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: clamp(14px, 2vw, 22px);
  margin-bottom: 18px;
}

.card h2 { margin: 0 0 14px; font-size: 1.05rem; letter-spacing: -0.02em; }

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

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
  min-width: 560px;
}

table.data th,
table.data td {
  text-align: left;
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
}

table.data th {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

table.data tr:last-child td { border-bottom: 0; }
table.data tr:hover td { background: var(--bg); }
table.data form { margin: 0; }
table.data .btn { width: auto; }

.badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--info-bg);
  color: var(--navy);
}

.badge.public, .badge.ok { color: var(--ok); background: var(--ok-bg); }
.badge.game { color: var(--brand); background: var(--brand-soft); }
.badge.training { color: var(--ok); background: var(--ok-bg); }

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 18px;
}

.form-grid .full { grid-column: 1 / -1; }

.form-group label { display: block; font-size: 0.82rem; color: var(--muted); margin-bottom: 6px; font-weight: 600; }

.form-control, select, textarea,
input[type="text"], input[type="email"], input[type="password"],
input[type="number"], input[type="datetime-local"], input[type="date"] {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  font: inherit;
  background: var(--bg-elev);
  color: var(--ink);
}

.form-control:focus, select:focus, textarea:focus, input:focus {
  outline: 2px solid var(--brand);
  border-color: transparent;
}

.choose-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr));
  gap: 16px;
}

.choose-card {
  display: block;
  background: var(--bg-elev);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  color: inherit;
  text-decoration: none;
}

.choose-card:hover { transform: translateY(-2px); text-decoration: none; }
.choose-card h3 { margin: 0 0 6px; }
.choose-card p { margin: 0; color: var(--muted); font-size: 0.9rem; }
.choose-card .ctx { margin-top: 10px; font-size: 0.8rem; color: var(--muted); }

.kv {
  display: grid;
  grid-template-columns: minmax(100px, 140px) 1fr;
  gap: 8px 12px;
  font-size: 0.92rem;
}
.kv dt { color: var(--muted); margin: 0; }
.kv dd { margin: 0; }

.muted { color: var(--muted); }
.note { font-size: 0.78rem; color: var(--muted); margin-top: 16px; }
.help { font-size: 0.8rem; color: var(--muted); margin: 6px 0 0; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}
.plain-list { margin: 0; padding-left: 1.15rem; }
.plain-list li { margin: 6px 0; }
.callout h2 { margin-top: 0; }
.steps { margin: 0; padding-left: 1.2rem; }
.steps li { margin: 8px 0; }
.sponsor-blurb {
  font-size: 0.82rem;
  color: var(--muted);
  margin: 14px 0 0;
}
.org-logo {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 12px;
}
.news-item { padding: 14px 0; border-bottom: 1px solid var(--line); }
.news-item:last-child { border-bottom: 0; }
.errorlist {
  color: var(--danger);
  list-style: none;
  padding: 0;
  margin: 6px 0 0;
  font-size: 0.85rem;
}

.site-footer {
  border-top: 1px solid var(--line);
  padding: 22px clamp(16px, 3vw, 40px);
  display: flex;
  flex-wrap: wrap;
  gap: 12px 20px;
  color: var(--muted);
  font-size: 0.85rem;
}
.site-footer .credit {
  opacity: 0.7;
  font-size: 0.78rem;
}

/* Login */
.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
  background:
    radial-gradient(1200px 400px at 10% -10%, rgba(230, 30, 77, 0.12), transparent 50%),
    radial-gradient(800px 300px at 110% 10%, rgba(27, 42, 74, 0.18), transparent 45%),
    var(--bg);
}

.login-card {
  width: min(440px, 100%);
  background: var(--bg-elev);
  border-radius: 24px;
  box-shadow: var(--shadow);
  padding: clamp(22px, 4vw, 36px);
}

.login-card .brand-mark { width: 72px; height: 72px; }
.login-card h1 { margin: 12px 0 6px; letter-spacing: -0.03em; }
.login-card .lede { color: var(--muted); margin: 0 0 20px; }

.login-toolbar {
  display: flex;
  justify-content: flex-end;
  width: min(440px, 100%);
  margin-bottom: 12px;
}

/* Legacy hub class aliases so older templates still work */
.hub { display: contents; }
.hub-nav { display: none; }
.hub-main { display: contents; }
.hub-header { display: contents; }

/* —— Breakpoints —— */
@media (max-width: 900px) {
  .nav-toggle { display: inline-flex; }
  .site-nav {
    display: none;
    position: absolute;
    top: var(--header-h);
    left: 0;
    right: 0;
    background: var(--bg-elev);
    border-bottom: 1px solid var(--line);
    flex-direction: column;
    align-items: stretch;
    padding: 10px 16px 16px;
    box-shadow: var(--shadow);
  }
  .site-nav.is-open { display: flex; }
  .site-header { position: sticky; }
  .account-menu .menu {
    position: static;
    box-shadow: none;
    border: 0;
    padding: 4px 0 0;
  }
}

@media (max-width: 720px) {
  .form-grid { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 1fr; gap: 2px 0; }
  .page { width: calc(100% - 24px); padding-top: 18px; }
  table.data { min-width: 480px; }
  .brand-text span { display: none; }
}

@media (max-width: 420px) {
  :root { --header-h: 64px; }
  .brand-mark { width: 38px; height: 38px; }
  .btn { width: 100%; }
  .page-head .actions { width: 100%; }
}

@media (min-width: 1400px) {
  :root { --max: 1280px; }
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.squad-edit {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}
.shirt-input { width: 72px; min-width: 72px; flex: 0 0 72px; }
.pos-input { flex: 1 1 160px; min-width: 120px; }
.squad-name { flex: 1 1 140px; font-weight: 600; }

.people-picker { position: relative; margin-top: 8px; }
.people-results {
  position: absolute;
  z-index: 5;
  left: 0;
  right: 0;
  top: 100%;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  max-height: 260px;
  overflow: auto;
}
.people-hit {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
  padding: 10px 12px;
  font: inherit;
  color: inherit;
  cursor: pointer;
}
.people-hit span { display: block; color: var(--muted); font-size: 0.8rem; }
.people-hit:hover { background: var(--bg); }

.coach-board { margin-top: 8px; }
.board-help { color: var(--muted); font-size: 0.85rem; }
.board-zones { display: flex; flex-direction: column; gap: 16px; }
.board-zone h3 { margin: 0 0 8px; font-size: 1rem; }
.board-zone h3 span { color: var(--muted); font-weight: 600; }
.slot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 8px;
}
.pitch-grid, .bench-grid {
  background: var(--ok-bg);
  border: 1px dashed var(--navy);
  border-radius: var(--radius);
  padding: 12px;
}
.slot {
  min-height: 72px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  background: var(--bg-elev);
  padding: 8px;
}
.slot.pool {
  min-height: 80px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px;
}
.chip {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px;
  border-radius: 10px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  cursor: grab;
  user-select: none;
  min-width: 96px;
}
.chip.is-selected { outline: 2px solid var(--brand); }
.chip.is-dragging { opacity: 0.6; }
.chip-num { font-size: 0.72rem; font-weight: 700; color: var(--navy); }
.chip-name { font-weight: 700; font-size: 0.88rem; }
.chip-pos { font-size: 0.75rem; color: var(--muted); }
.board-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-top: 16px;
}
#lineup-status.error { color: var(--danger); }

.chat-log { display: flex; flex-direction: column; gap: 10px; }
.chat-msg {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}
.chat-msg.mine { border-color: var(--navy); }
.chat-msg p { margin: 4px 0 0; }
.chat-meta { font-size: 0.75rem; color: var(--muted); }
.chat-compose { margin-top: 16px; }

@media (prefers-reduced-motion: reduce) {
  .choose-card { transition: none; }
}
