/* The Basketball Lab – styles (RTL, phone first) */

:root {
  --bg: #EEEEEC;
  --card: #FFFFFF;
  --ink: #131416;
  --muted: #5C5F66;
  --line: #DEDEDB;
  --line-strong: #C4C4C0;
  --accent: #131416;
  --accent-ink: #000000;
  --hl: #D2501A;      /* ball orange, for small highlights only */
  --accent-soft: #F3E3DA;
  --dark: #131416;
  --dark-2: #26282C;
  --dark-soft: #B9BBC0;
  --good: #1F7A4D;   --good-bg: #E3F2EA;   --good-ink: #1F5C3C;
  --warn: #B7791F;   --warn-bg: #FFF1D6;   --warn-ink: #7A4A00;
  --danger: #9B1C1C; --danger-bg: #FDE4E0; --danger-line: #F0B9B0;
  --chip: #E4E4E1;
  --radius: 16px;
  --font: Heebo, system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  --display: Rubik, Heebo, system-ui, sans-serif;
  --tabbar-h: 68px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100dvh;
  background: var(--bg); color: var(--ink);
  font-family: var(--font); font-size: 16px; line-height: 1.45;
}
h1, h2, h3 { margin: 0; line-height: 1.2; }
p { margin: 0; }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
code { background: var(--chip); padding: 1px 6px; border-radius: 6px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Text helpers ---------- */
.muted { color: var(--muted); }
.soft { color: var(--dark-soft); }
.small { font-size: 13px; }
.big { font-family: var(--display); font-size: 22px; font-weight: 700; }
.text-danger { color: var(--danger); }
.pre { white-space: pre-wrap; }

/* ---------- Layout ---------- */
.shell { min-height: 100dvh; display: flex; flex-direction: column; min-width: 0; }
.page > * { min-width: 0; }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px 4px; max-width: 760px; width: 100%; margin: 0 auto;
}
.brand { display: flex; align-items: center; gap: 8px; font-family: var(--display); font-weight: 700; font-size: 15px; }
.brand svg { color: var(--accent); width: 28px; height: 28px; }
.brand-mark { height: 30px; width: auto; display: block; }
.brand-lg { font-size: 18px; justify-content: center; margin-bottom: 8px; }
.brand-lg svg { width: 36px; height: 36px; }

.page {
  flex: 1; width: 100%; max-width: 760px; margin: 0 auto;
  padding: 8px 16px calc(var(--tabbar-h) + 24px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 12px; outline: none;
}
.page-head { margin-top: 4px; }
.page-title { font-family: var(--display); font-size: 24px; font-weight: 700; }
.page-sub { margin-top: -6px; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.row-between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.loading { padding: 48px 16px; text-align: center; color: var(--muted); }

/* ---------- Bottom tab bar ---------- */
.tabbar {
  position: fixed; inset-inline: 0; bottom: 0; z-index: 10;
  background: var(--card); border-top: 1px solid var(--line);
  display: grid; grid-template-columns: repeat(var(--tabs, 4), minmax(0, 1fr));
  padding: 6px 4px calc(10px + env(safe-area-inset-bottom));
}
.tab {
  text-align: center; line-height: 1.15;
  min-height: 52px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--muted); font-size: 12px; font-weight: 500; text-decoration: none; border-radius: 12px;
}
.tab-on { color: var(--ink); font-weight: 700; }
.tab-on svg { color: var(--hl); }
.tab:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
@media (min-width: 760px) {
  .tabbar { max-width: 760px; margin: 0 auto; border: 1px solid var(--line); border-bottom: 0; border-radius: 16px 16px 0 0; }
}

/* ---------- Child switcher ---------- */
.switcher { display: flex; gap: 8px; overflow-x: auto; padding: 4px 16px 0; max-width: 760px; width: 100%; margin: 0 auto; }
.chip {
  min-height: 40px; padding: 0 18px; border-radius: 20px; border: 1px solid #D6D3CB;
  background: var(--card); font-weight: 500; white-space: nowrap; cursor: pointer;
}
.chip-on { background: var(--dark); color: #fff; border-color: var(--dark); }

/* ---------- Cards ---------- */
.card { background: var(--card); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.card-label { font-size: 13px; font-weight: 700; color: var(--muted); }
.card-title { font-size: 16px; font-weight: 700; }
.card-dark { background: var(--dark); color: #fff; }
.card-dark .card-label { color: var(--dark-soft); }
.card-accent { border: 1px solid #E9C2AE; }
.card-danger { border: 1px solid var(--danger-line); }
.card-warn { border: 1px solid #EBC98A; background: #FFFBF2; }

.list { list-style: none; margin: 0; padding: 0; }
.list-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 0; border-bottom: 1px solid var(--chip); }
.list-row:last-child { border-bottom: 0; }
.list-row-tap { padding: 0; }
.row-btn {
  width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 8px;
  min-height: 56px; padding: 8px 0; background: none; border: 0; text-align: start; cursor: pointer;
}
.row-btn .end { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; font-size: 14px; }

.list-cards { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.list-card {
  display: flex; flex-direction: column; gap: 4px; width: 100%;
  background: var(--card); border: 1px solid transparent; border-radius: 14px; padding: 12px 16px;
  color: inherit; text-decoration: none; text-align: start; cursor: pointer;
}
.list-card:hover { border-color: var(--line); }
.list-card:focus-visible { outline: 2px solid var(--accent); }

.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; }
.facts dt { color: var(--muted); font-size: 14px; }
.facts dd { margin: 0; }

.meter { height: 8px; border-radius: 4px; background: var(--chip); overflow: hidden; }
.meter > div { height: 100%; background: var(--hl); border-radius: 4px; }

.empty { background: var(--card); border-radius: var(--radius); padding: 28px 16px; text-align: center; display: flex; flex-direction: column; gap: 6px; }

/* ---------- Badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 10px;
  font-size: 12px; font-weight: 700; background: var(--chip); color: #3F4757; white-space: nowrap;
}
.badge-good   { background: var(--good-bg);   color: var(--good-ink); }
.badge-warn   { background: var(--warn-bg);   color: var(--warn-ink); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-accent { background: var(--accent);    color: #fff; }
.card-dark .badge-good { background: var(--good); color: #fff; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 0 16px; border-radius: 12px;
  border: 1px solid #D6D3CB; background: var(--card); color: var(--ink);
  font-size: 15px; font-weight: 500; text-decoration: none; cursor: pointer;
}
.btn:disabled { opacity: .6; cursor: default; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 700; }
.btn-primary:hover { background: var(--accent-ink); }
.btn-on-dark { background: transparent; border-color: #5A6A8C; color: #fff; }
.btn-ghost-danger { background: transparent; border-color: var(--danger-line); color: var(--danger); }
.btn-small { min-height: 36px; padding: 0 12px; font-size: 14px; }
.btn-wide { width: 100%; }
.btn:focus-visible, .chip:focus-visible, .icon-btn:focus-visible, .link-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.icon-btn {
  width: 44px; height: 44px; border-radius: 22px; border: 0; background: var(--card);
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
}
.link-btn { background: none; border: 0; color: var(--ink); text-decoration: underline; font-weight: 500; min-height: 44px; padding: 0 4px; cursor: pointer; }
.link-btn:disabled { color: var(--muted); cursor: default; }
.back { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); text-decoration: none; min-height: 40px; font-size: 14px; }
.back svg { width: 18px; height: 18px; }

/* ---------- Segmented tabs ---------- */
.segmented { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--chip); border-radius: 12px; padding: 4px; }
.segmented a, .segmented label {
  min-height: 40px; display: flex; align-items: center; justify-content: center; gap: 6px;
  border-radius: 9px; color: #3F4757; text-decoration: none; font-weight: 500; cursor: pointer;
}
.segmented .seg-on, .seg-input label:has(input:checked) { background: var(--card); color: var(--ink); font-weight: 700; }
.seg-input input { accent-color: var(--accent); }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; border: 0; margin: 0; padding: 0; min-width: 0; }
.field > span, .field > legend { font-size: 14px; font-weight: 700; padding: 0; margin-bottom: 0; }
.field input:not([type=checkbox]):not([type=radio]), .field select, .field textarea, .search input {
  width: 100%; min-height: 48px; border-radius: 12px; border: 1px solid var(--line-strong);
  background: var(--card); padding: 10px 12px; font-size: 16px;
}
.field textarea { min-height: 72px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus, .search input:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
.field input[dir=ltr] { text-align: left; }
.code-input { font-size: 24px !important; letter-spacing: 6px; text-align: center !important; font-family: var(--display); }
.check { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--accent); margin: 0; }
.checks { display: flex; flex-wrap: wrap; gap: 0 16px; }
.checks-scroll { max-height: 40vh; overflow-y: auto; flex-direction: column; flex-wrap: nowrap; }
.toolbar { display: flex; gap: 12px; align-items: center; }
.search { position: relative; flex: 1; display: block; }
.search svg { position: absolute; inset-inline-start: 12px; top: 15px; color: var(--muted); }
.search input { padding-inline-start: 38px; }

/* ---------- Login ---------- */
.auth-wrap {
  min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 20px;
  padding: 32px 16px calc(24px + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, rgba(19,20,22,.55) 0%, rgba(19,20,22,.35) 40%, rgba(19,20,22,.92) 100%), url('/img/hero.jpg') 40% center / cover no-repeat, var(--dark);
}
.auth-logo { width: 120px; height: auto; margin-bottom: auto; margin-top: 4vh; align-self: flex-start; margin-inline-start: 8px; filter: drop-shadow(0 2px 12px rgba(0,0,0,.35)); }
@media (min-height: 760px) { .auth-logo { width: 140px; } }
@media (min-width: 700px) { .auth-wrap { justify-content: center; } .auth-logo { align-self: center; margin: 0; width: 160px; } }
.auth-card { width: 100%; max-width: 400px; background: var(--card); border-radius: 20px; padding: 28px 20px; display: flex; flex-direction: column; gap: 12px; }
.auth-card h1 { font-family: var(--display); font-size: 24px; text-align: center; }
.auth-card > .muted { text-align: center; }

/* ---------- Sheet (dialog) ---------- */
dialog.sheet {
  width: 100%; max-width: 560px; max-height: 92dvh; margin: auto auto 0; padding: 0;
  border: 0; border-radius: 20px 20px 0 0; background: var(--bg); color: var(--ink);
}
@media (min-width: 600px) { dialog.sheet { margin: auto; border-radius: 20px; } }
dialog.sheet::backdrop { background: rgba(11, 20, 40, .45); }
.sheet-form { display: flex; flex-direction: column; max-height: 92dvh; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px 8px; }
.sheet-head h2 { font-family: var(--display); font-size: 19px; }
.sheet-body { padding: 4px 16px 16px; overflow-y: auto; display: flex; flex-direction: column; gap: 16px; }
.sheet-foot { display: flex; gap: 8px; padding: 12px 16px calc(16px + env(safe-area-inset-bottom)); background: var(--card); border-top: 1px solid var(--line); }
.sheet-foot .btn-ghost-danger { flex: 0 0 auto; }

/* ---------- Toasts ---------- */
#toasts { position: fixed; inset-inline: 16px; bottom: calc(var(--tabbar-h) + 20px + env(safe-area-inset-bottom)); z-index: 100; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { max-width: 480px; padding: 12px 16px; border-radius: 12px; background: var(--dark); color: #fff; font-weight: 500; box-shadow: 0 6px 24px rgba(11,20,40,.18); }
.toast-error { background: var(--danger); }

/* ---------- Sessions (admin week view) ---------- */
.grid-3 { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 10px; }
.weeknav { display: flex; align-items: center; justify-content: space-between; background: var(--card); border-radius: 14px; padding: 4px; }
.weeknav-label { display: flex; flex-direction: column; align-items: center; }
.flip svg { transform: scaleX(-1); }
.day { display: flex; flex-direction: column; gap: 6px; }
.day-title { font-size: 15px; font-weight: 700; margin-top: 6px; }
.day-empty { padding: 0 4px; }
.list-card.is-cancelled strong { text-decoration: line-through; color: var(--muted); }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 4px; }
.stats > div { background: var(--dark-2); border-radius: 12px; padding: 8px 10px; display: flex; flex-direction: column; }
.stats strong { font-family: var(--display); font-size: 20px; }
.stats span { font-size: 12px; color: var(--dark-soft); }

/* attendance */
.att-row { display: grid; grid-template-columns: 1fr auto; gap: 6px 8px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--chip); }
.att-row:last-child { border-bottom: 0; }
.att-row > div:first-child { display: flex; flex-direction: column; }
.att-row .link-btn { grid-column: 1 / -1; justify-self: start; min-height: 28px; color: var(--muted); }
.att { display: flex; gap: 4px; }
.att-btn { min-height: 40px; padding: 0 10px; border-radius: 10px; border: 1px solid #D6D3CB; background: var(--card); color: #3F4757; font-size: 13px; cursor: pointer; }
.att-btn.on { color: #fff; font-weight: 700; border-color: transparent; }
.att-present.on { background: var(--good); }
.att-late.on { background: var(--warn); }
.att-absent.on { background: var(--danger); }

/* ---------- Schedule (member) ---------- */
.pill { font-size: 13px; color: var(--muted); background: var(--card); padding: 6px 12px; border-radius: 14px; }
.pill strong { color: var(--ink); }
.days { width: 100%; max-width: 100%; min-width: 0; display: grid; grid-auto-flow: column; grid-auto-columns: 52px; gap: 6px; overflow-x: auto; padding-bottom: 4px; scroll-snap-type: x proximity; }
.day-btn { position: relative;
  height: 66px; border-radius: 12px; border: 0; background: var(--card); color: var(--ink);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; cursor: pointer; scroll-snap-align: start;
}
.day-btn .small { color: var(--muted); font-size: 12px; }
.day-btn strong { font-size: 16px; }
.day-btn.on { background: var(--dark); color: #fff; }
.day-btn.on .small { color: var(--dark-soft); }
.dot { width: 6px; height: 6px; border-radius: 3px; background: var(--hl); }
.dot.none { background: transparent; }
.session { border-inline-start: 4px solid transparent; }
.session-good { border-inline-start-color: var(--good); }
.session-warn { border-inline-start-color: var(--warn); }
.session-cancelled { opacity: .7; }
.session-cancelled .card-title { text-decoration: line-through; }
.btn-outline { border-color: var(--ink); font-weight: 700; }

/* ---------- Payments ---------- */
.segmented button { min-height: 40px; border: 0; background: transparent; border-radius: 9px; color: #3F4757; font-weight: 500; cursor: pointer; }
.tile { gap: 2px; padding: 12px; }
.tile strong { font-family: var(--display); font-size: 18px; }
.btn-good { background: var(--good); border-color: var(--good); color: #fff; font-weight: 700; }
.section-title { font-size: 14px; font-weight: 700; color: var(--muted); margin-top: 6px; }
.strike { text-decoration: line-through; }
.pay-card { gap: 6px; }

/* ---------- Messages & videos ---------- */
.msg { gap: 6px; }
.msg-unread { border: 1px solid var(--ink); }
.unread-dot { display: inline-block; width: 8px; height: 8px; border-radius: 4px; background: var(--hl); margin-inline-end: 6px; vertical-align: middle; }
.tab { position: relative; }
.tab-count { position: absolute; top: 4px; inset-inline-start: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--hl); color: #fff; font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.video { padding: 0 0 14px; overflow: hidden; gap: 8px; }
.video > :not(.video-frame) { padding-inline: 16px; }
.video-frame { aspect-ratio: 16 / 9; background: var(--dark); display: flex; align-items: center; justify-content: center; }
.video-frame video { width: 100%; height: 100%; background: #000; }
.play { width: 60px; height: 60px; border-radius: 30px; border: 0; background: var(--hl); color: #fff; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.play:disabled { opacity: .6; }
.lock-note { display: flex; gap: 6px; align-items: flex-start; }
.lock-note svg { flex-shrink: 0; margin-top: 2px; }
.brand span { white-space: nowrap; }

/* ---------- Registration ---------- */
.reg-wrap { max-width: 640px; margin: 0 auto; padding: 12px 16px 40px; display: flex; flex-direction: column; gap: 14px; }
.reg-head { display: flex; align-items: center; gap: 8px; font-family: var(--display); font-weight: 700; }
.reg-head .icon-btn { margin-inline-start: auto; }
.kid-block { border: 0; margin: 0; }
.kid-block legend { padding: 0; float: right; }
.consent { align-items: flex-start; font-size: 14px; }
.consent input { margin-top: 2px; flex-shrink: 0; }
.count { display: inline-flex; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--hl); color: #fff; font-size: 11px; font-weight: 700; align-items: center; justify-content: center; }
.notice-link { flex-direction: row; justify-content: space-between; align-items: center; text-decoration: none; color: inherit; }
.reg-card .facts { grid-template-columns: max-content 1fr; }
.add-kid-link { align-self: center; }

/* ---------- Price list ---------- */
.plan-list { display: flex; flex-direction: column; gap: 8px; }
.plan { display: flex; align-items: center; gap: 10px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; cursor: pointer; }
.plan:has(input:checked) { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink) inset; }
.plan input { width: 20px; height: 20px; accent-color: var(--ink); margin: 0; flex-shrink: 0; }
.plan-text { display: flex; flex-direction: column; flex: 1; }
.plan-price { font-family: var(--display); font-weight: 700; font-size: 17px; white-space: nowrap; }
.plan-off { opacity: .55; cursor: default; }
.btn-wa { background: #1F7A4D; border-color: #1F7A4D; color: #fff; font-weight: 700; }

/* Upcoming sessions (home) and book-ahead sheet */
.up-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--chip); }
.up-row:last-child { border-bottom: 0; }
.up-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.up-side { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.up-cancelled .up-main strong { text-decoration: line-through; opacity: .7; }
#upcoming .btn-wide { margin-top: 12px; }
.ahead-tools { gap: 12px; align-items: center; }
.ahead-list .list-row { padding: 2px 0; }
.ahead-item { align-items: flex-start; padding: 6px 0; width: 100%; }
.ahead-item input { margin-top: 3px; flex-shrink: 0; }
.nowrap { white-space: nowrap; }
.video-frame { background-size: cover; background-position: center; }
.video-frame iframe { width: 100%; height: 100%; border: 0; }
.video > strong { display: block; }
.video-frame-ig { aspect-ratio: 4 / 5; max-height: 70vh; position: relative; background: linear-gradient(135deg, #feda75, #d62976 50%, #4f5bd5); }
/* Once playing: a phone-width column, as tall as the post needs. */
.video-frame-ig.ig-open { aspect-ratio: auto; max-height: none; background: var(--card); justify-content: center; }
.video-frame-ig iframe { width: 100%; max-width: 420px; height: 760px; background: #fff; display: block; }
.ig-tag { position: absolute; bottom: 12px; inset-inline-start: 16px; color: #fff; font-weight: 700; font-size: 14px; }
