/* Session planner - the website's one stylesheet.
 *
 * Colours are tokens on :root, redefined for dark mode. Every foreground has a
 * dark partner by construction, because nothing below uses a raw colour.
 * Theme: [data-theme] on <html> wins; otherwise the system preference.
 */
:root {
  --bg: #f1f5f9;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: #cbd5e1;
  --border-soft: #e2e8f0;
  --text: #0f172a;
  --muted: #475569;
  --brand: #1d4ed8;
  --brand-hover: #1e40af;
  --brand-text: #ffffff;
  --brand-soft: #dbeafe;
  --brand-soft-text: #1e3a8a;
  --link: #1d4ed8;
  --danger: #b91c1c;
  --danger-hover: #991b1b;
  --danger-soft: #fee2e2;
  --danger-soft-text: #7f1d1d;
  --success-soft: #dcfce7;
  --success-soft-text: #14532d;
  --warn-soft: #fef3c7;
  --warn-soft-text: #78350f;
  --info-soft: #e0f2fe;
  --info-soft-text: #0c4a6e;
  --focus: #2563eb;
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.08), 0 4px 16px rgba(15, 23, 42, 0.06);
  --overlay: rgba(15, 23, 42, 0.55);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b1120;
    --surface: #111827;
    --surface-2: #1e293b;
    --border: #475569;
    --border-soft: #334155;
    --text: #e2e8f0;
    --muted: #a5b4c8;
    --brand: #3b82f6;
    --brand-hover: #60a5fa;
    --brand-text: #0b1120;
    --brand-soft: #1e3a8a;
    --brand-soft-text: #dbeafe;
    --link: #93c5fd;
    --danger: #f87171;
    --danger-hover: #fca5a5;
    --danger-soft: #450a0a;
    --danger-soft-text: #fecaca;
    --success-soft: #052e16;
    --success-soft-text: #bbf7d0;
    --warn-soft: #422006;
    --warn-soft-text: #fde68a;
    --info-soft: #082f49;
    --info-soft-text: #bae6fd;
    --focus: #93c5fd;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
    --overlay: rgba(0, 0, 0, 0.7);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0b1120;
  --surface: #111827;
  --surface-2: #1e293b;
  --border: #475569;
  --border-soft: #334155;
  --text: #e2e8f0;
  --muted: #a5b4c8;
  --brand: #3b82f6;
  --brand-hover: #60a5fa;
  --brand-text: #0b1120;
  --brand-soft: #1e3a8a;
  --brand-soft-text: #dbeafe;
  --link: #93c5fd;
  --danger: #f87171;
  --danger-hover: #fca5a5;
  --danger-soft: #450a0a;
  --danger-soft-text: #fecaca;
  --success-soft: #052e16;
  --success-soft-text: #bbf7d0;
  --warn-soft: #422006;
  --warn-soft-text: #fde68a;
  --info-soft: #082f49;
  --info-soft-text: #bae6fd;
  --focus: #93c5fd;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
  --overlay: rgba(0, 0, 0, 0.7);
  color-scheme: dark;
}

* { box-sizing: border-box; }

/* SVG elements ignore the hidden attribute without this. */
[hidden] { display: none !important; }

html, body { margin: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: Calibri, "Segoe UI", Arial, "Helvetica Neue", Helvetica, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  overflow-x: hidden;
}

button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }

a { color: var(--link); }

h1, h2, h3 { line-height: 1.25; margin: 0 0 12px; }
h1 { font-size: 26px; }
h2 { font-size: 20px; }
h3 { font-size: 17px; }
p { margin: 0 0 12px; }

.muted { color: var(--muted); }
.small { font-size: 14px; }
.nowrap { white-space: nowrap; }
.tabular { font-variant-numeric: tabular-nums; }

:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* --- buttons: one height rule, so side-by-side buttons always match ------ */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  vertical-align: middle; font-family: inherit; font-size: 15px; line-height: 1.25;
  min-height: 40px; padding: 9px 16px; border-radius: 8px;
  border: 1px solid var(--brand); background: var(--brand); color: var(--brand-text);
  font-weight: 600; text-decoration: none; cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--brand-hover); border-color: var(--brand-hover); }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: var(--surface-2); border-color: var(--border); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #ffffff; }
:root[data-theme="dark"] .btn-danger { color: #1a0505; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn-danger { color: #1a0505; } }
.btn-danger:hover { background: var(--danger-hover); border-color: var(--danger-hover); }
.btn-sm { padding: 5px 11px; min-height: 32px; font-size: 14px; }
.btn svg { width: 16px; height: 16px; flex-shrink: 0; }
.btn[disabled] { opacity: 0.6; cursor: not-allowed; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
}
.icon-btn:hover { background: var(--surface-2); }
.icon-btn svg { width: 20px; height: 20px; }

.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* --- cards and forms --------------------------------------------------- */

.card {
  background: var(--surface); border: 1px solid var(--border-soft); border-radius: 12px;
  padding: 20px; box-shadow: var(--shadow); margin-bottom: 20px; min-width: 0;
}
.card > :last-child { margin-bottom: 0; }

.field { margin-bottom: 16px; }
.field label, .label { display: flex; align-items: center; gap: 6px; font-weight: 600; margin-bottom: 4px; }
.field .hint { font-size: 14px; color: var(--muted); margin-top: 4px; }

input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=url], select, textarea {
  width: 100%; min-height: 40px; padding: 8px 10px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); line-height: 1.25;
}
textarea { min-height: 120px; resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--focus); outline-offset: 0; border-color: var(--focus); }

.checkbox { display: flex; gap: 8px; align-items: flex-start; font-weight: 400; }
.checkbox input { margin-top: 4px; width: 18px; height: 18px; }

.password-wrap { position: relative; }
.password-wrap input { padding-right: 48px; }
.password-wrap .eye {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  width: 36px; height: 34px; border: 0; background: transparent; color: var(--muted);
  cursor: pointer; border-radius: 6px; display: inline-flex; align-items: center; justify-content: center;
}
.password-wrap .eye:hover { color: var(--text); background: var(--surface-2); }
.password-wrap .eye svg { width: 20px; height: 20px; }

.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0 16px; }

/* --- notices ------------------------------------------------------------ */

.notice { border-radius: 10px; padding: 12px 14px; margin-bottom: 16px; border: 1px solid transparent; }
.notice-info { background: var(--info-soft); color: var(--info-soft-text); }
.notice-warn { background: var(--warn-soft); color: var(--warn-soft-text); }
.notice-error { background: var(--danger-soft); color: var(--danger-soft-text); }
.notice-success { background: var(--success-soft); color: var(--success-soft-text); }
.notice ul { margin: 6px 0 0; padding-left: 20px; }
.notice a { color: inherit; }

.badge {
  display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 13px; font-weight: 600;
  background: var(--surface-2); color: var(--muted); border: 1px solid var(--border-soft);
}
.badge-brand { background: var(--brand-soft); color: var(--brand-soft-text); border-color: transparent; }
.badge-warn { background: var(--warn-soft); color: var(--warn-soft-text); border-color: transparent; }
.badge-success { background: var(--success-soft); color: var(--success-soft-text); border-color: transparent; }

/* --- tables -------------------------------------------------------------- */

.table-wrap { overflow-x: auto; max-width: 100%; }
table.data { width: 100%; border-collapse: collapse; font-size: 15px; }
table.data th, table.data td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border-soft); vertical-align: middle; }
table.data th { font-size: 14px; color: var(--muted); font-weight: 600; white-space: nowrap; }
table.data th[data-sort] { cursor: pointer; user-select: none; }
table.data th[data-sort]:hover { color: var(--text); }
table.data th .sort-mark { display: inline-block; width: 1em; font-size: 11px; }
table.data tr.archived td { color: var(--muted); }
table.data td.actions-cell { text-align: right; white-space: nowrap; }

/* --- layout: signed in --------------------------------------------------- */

.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 240px; flex-shrink: 0; background: var(--surface); border-right: 1px solid var(--border-soft);
  padding: 20px 14px; display: flex; flex-direction: column; gap: 4px;
}
.sidebar .brand { font-weight: 700; font-size: 18px; padding: 0 10px 12px; }
.sidebar .club-logo { display: block; max-width: 100%; max-height: 64px; object-fit: contain; margin: 0 10px 12px; }
.sidebar .section { font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; padding: 14px 10px 4px; }
.nav-link {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px;
  color: var(--text); text-decoration: none; font-weight: 500;
}
.nav-link:hover { background: var(--surface-2); }
.nav-link.active { background: var(--brand-soft); color: var(--brand-soft-text); }
.nav-link svg { width: 18px; height: 18px; flex-shrink: 0; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 24px; border-bottom: 1px solid var(--border-soft); background: var(--surface);
}
.topbar .who { color: var(--muted); font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.content { padding: 24px; max-width: 1100px; width: 100%; }
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.page-head h1 { margin: 0; }

.menu-toggle { display: none; }

@media (max-width: 820px) {
  .app { flex-direction: column; }
  .sidebar { width: 100%; border-right: 0; border-bottom: 1px solid var(--border-soft); padding: 12px 16px; }
  .sidebar[data-collapsed="true"] .nav-group { display: none; }
  .menu-toggle { display: inline-flex; }
  .topbar { padding: 10px 16px; }
  .content { padding: 16px; }
}

/* --- layout: signed out ------------------------------------------------- */

.auth-wrap { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px 16px; }
.auth-top { position: fixed; top: 12px; right: 12px; }
.auth-card { width: 100%; max-width: 440px; }
.auth-card h1 { font-size: 24px; }
.auth-brand { text-align: center; font-weight: 700; font-size: 20px; margin-bottom: 16px; }
.auth-links { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.forgot-link { display: inline-block; margin-top: 6px; font-size: 15px; }

/* --- landing: lives in site.css, loaded only by layout-public.php --- */

/* --- stats --------------------------------------------------------------- */

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat .num { font-size: 30px; font-weight: 700; font-variant-numeric: tabular-nums; }

/* --- tabs ---------------------------------------------------------------- */

.tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }

/* --- image drop zones -------------------------------------------------- */

.image-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.drop {
  border: 2px dashed var(--border); border-radius: 10px; padding: 14px; text-align: center;
  background: var(--surface-2); transition: border-color 0.15s, background 0.15s;
}
.drop.dragover { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-soft-text); }
.drop input[type=file] { display: block; margin: 8px auto 0; max-width: 100%; }
.drop .chosen { font-weight: 600; margin-top: 6px; word-break: break-all; }
.thumb {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  width: 180px; height: 110px; border-radius: 8px; border: 1px solid var(--border-soft); margin-bottom: 8px;
}
.thumb.on-light { background: #ffffff; }
.thumb.on-dark { background: #0f172a; }
.thumb img { max-width: 92%; max-height: 92%; object-fit: contain; }
.thumb .remove {
  position: absolute; top: -10px; right: -10px; width: 26px; height: 26px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; font-size: 16px; line-height: 1; padding: 0;
}
.thumb .remove:hover { background: var(--danger-soft); color: var(--danger-soft-text); }
.thumb form { margin: 0; }
.pending-badge { margin-left: 6px; }

/* --- the "i" bubble ------------------------------------------------------ */

.info-btn {
  display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px;
  padding: 0; border: 0; border-radius: 999px; background: transparent; color: var(--muted); cursor: pointer;
}
.info-btn:hover, .info-btn:focus-visible { color: var(--link); }
.info-btn svg { width: 18px; height: 18px; }
.info-bubble {
  position: fixed; z-index: 60; max-width: 340px; padding: 10px 12px; border-radius: 8px;
  background: var(--text); color: var(--bg); font-size: 14px; font-weight: 400; line-height: 1.45;
  box-shadow: var(--shadow);
}

.guide { font-size: 14px; color: var(--muted); margin-top: 4px; min-height: 1.2em; }

/* --- confirm modal and toasts ------------------------------------------ */

.modal-overlay {
  position: fixed; inset: 0; z-index: 50; background: var(--overlay);
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.modal { width: 100%; max-width: 460px; }
.modal h2 { margin-bottom: 8px; }

.toasts { position: fixed; z-index: 70; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; max-width: min(420px, calc(100vw - 32px)); }
.toast {
  display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 10px;
  box-shadow: var(--shadow); border: 1px solid var(--border-soft);
}
.toast-success { background: var(--success-soft); color: var(--success-soft-text); }
.toast-error { background: var(--danger-soft); color: var(--danger-soft-text); }
.toast-info { background: var(--info-soft); color: var(--info-soft-text); }
.toast .close { margin-left: auto; border: 0; background: transparent; color: inherit; cursor: pointer; font-size: 18px; line-height: 1; padding: 0 2px; }

/* --- spinner ------------------------------------------------------------ */

.spinner { width: 16px; height: 16px; animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.notice-body { white-space: pre-wrap; }

/* --- the club logo swaps with the theme -------------------------------- */

.logo-dark { display: none; }
:root[data-theme="dark"] .logo-light.has-dark { display: none; }
:root[data-theme="dark"] .logo-dark { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .logo-light.has-dark { display: none; }
  :root:not([data-theme="light"]) .logo-dark { display: block; }
}
.sidebar-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.plain-link { color: inherit; text-decoration: none; }
.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; }
.brand-logo { display: block; max-height: 40px; max-width: 220px; object-fit: contain; }
.auth-brand .brand-logo { margin: 0 auto; }
/* A thumbnail's ground is fixed (white or near-black), so its text is too. */
.thumb.on-light { color: #475569; }
.thumb.on-dark { color: #a5b4c8; }
.thumb [data-empty] { color: inherit; }
/* Positioned, so an absolutely placed child (the .sr-only "Actions" header)
   is clipped by the table's own scroll box instead of widening the page. */
.table-wrap { position: relative; }
.topbar .actions { flex-wrap: nowrap; flex-shrink: 0; }
html { overflow-x: hidden; }

/* --- radio choices and copy rows ------------------------------------------- */

.choice { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--border-soft); border-radius: 10px; margin-bottom: 8px; cursor: pointer; }
.choice:hover { background: var(--surface-2); }
.choice input { margin-top: 4px; }
.copy-row { display: flex; gap: 8px; align-items: stretch; flex-wrap: wrap; }
.copy-row input { flex: 1 1 320px; min-width: 0; font-family: Consolas, "Courier New", monospace; font-size: 14px; }
