/* main.css — WPFSA platform AppShell (compact port of the events shell
   look: slate palette, left sidebar, topbar). Shared shape between the
   admin and members apps; each app carries its own copy. */

:root {
  --bg: #f1f5f9;
  --surface: #ffffff;
  --border: #e2e8f0;
  --ink: #1e293b;
  --muted: #64748b;
  --brand: #1e5fae;
  --brand-ink: #ffffff;
  --danger: #b91c1c;
  --success: #15803d;
  --radius: 8px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.5;
}
a { color: var(--brand); }

/* ── AppShell ─────────────────────────────────────────────────────── */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 230px;
  flex-shrink: 0;
  background: #0f172a;
  color: #cbd5e1;
  display: flex;
  flex-direction: column;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 16px; border-bottom: 1px solid #1e293b;
}
.brand-mark {
  width: 36px; height: 36px; border-radius: 8px;
  background: var(--brand); color: var(--brand-ink);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
}
.brand-name { font-size: 12px; font-weight: 600; line-height: 1.3; color: #e2e8f0; }
.sidebar-nav { flex: 1; padding: 12px 8px; }
.nav-item {
  display: block; padding: 9px 12px; border-radius: 6px;
  color: #cbd5e1; text-decoration: none; font-size: 14px;
}
.nav-item:hover { background: #1e293b; color: #fff; }
.nav-item.active { background: var(--brand); color: #fff; }
.sidebar-footer { padding: 12px 16px; border-top: 1px solid #1e293b; font-size: 13px; }
.user-name { font-weight: 600; color: #e2e8f0; }
.user-meta { color: #64748b; font-size: 12px; margin-bottom: 8px; }

.main-area { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  background: var(--surface); border-bottom: 1px solid var(--border);
  padding: 14px 24px; display: flex; align-items: center;
}
.topbar-title { font-size: 17px; font-weight: 650; }
.content { flex: 1; padding: 24px; max-width: 1100px; }
.app-footer { padding: 12px 24px; color: var(--muted); font-size: 12px; }

/* ── Cards / tiles ────────────────────────────────────────────────── */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px; margin-bottom: 16px;
}
.tile-grid {
  display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}
.tile {
  display: block; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px; text-decoration: none;
  color: var(--ink);
}
.tile:hover { border-color: var(--brand); }
.tile.disabled { opacity: 0.55; pointer-events: none; }
.tile h3 { margin: 0 0 6px; font-size: 16px; }
.tile p { margin: 0; color: var(--muted); font-size: 13px; }
.badge-soon {
  display: inline-block; margin-top: 10px; padding: 2px 8px;
  background: #e2e8f0; color: var(--muted); border-radius: 999px;
  font-size: 11px; font-weight: 600; text-transform: uppercase;
}

/* ── Flash / alerts ───────────────────────────────────────────────── */
.flash { margin: 16px 24px 0; padding: 10px 14px; border-radius: 6px; font-size: 14px; }
.flash-success { background: #dcfce7; color: var(--success); }
.flash-error   { background: #fee2e2; color: var(--danger); }
.flash-info    { background: #e0f2fe; color: #075985; }

/* ── Auth page ────────────────────────────────────────────────────── */
.auth-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.auth-card {
  width: 100%; max-width: 380px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 32px 28px;
}
.auth-brand { text-align: center; margin-bottom: 20px; }
.auth-brand .brand-mark { margin: 0 auto 10px; }
.auth-brand h1 { margin: 0; font-size: 20px; }
.auth-alert {
  background: #fee2e2; color: var(--danger); padding: 10px 12px;
  border-radius: 6px; font-size: 14px; margin-bottom: 14px;
}
.auth-alert.info { background: #e0f2fe; color: #075985; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.field input {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border);
  border-radius: 6px; font-size: 15px;
}
.field input:focus { outline: 2px solid var(--brand); outline-offset: -1px; border-color: var(--brand); }
.btn {
  display: inline-block; width: 100%; padding: 11px 16px;
  background: var(--brand); color: #fff; border: 0; border-radius: 6px;
  font-size: 15px; font-weight: 600; cursor: pointer;
}
.btn:hover { filter: brightness(1.08); }

.text-muted { color: var(--muted); }
.text-small { font-size: 13px; }

/* ── Phones (2026-09-11) — same shape as the events admin: the sidebar
   becomes an off-canvas drawer behind a ☰ in the topbar, a bottom nav
   carries the four most-used destinations + Menu, tables stack into
   labelled cards, form rows stack. ────────────────────────────────── */
.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(15,23,42,.5); z-index: 40; }
.sidebar-overlay.open { display: block; }
.topbar .menu-btn { display: none; background: none; border: 0; padding: 6px; margin: -6px 8px -6px -6px; color: var(--ink); cursor: pointer; line-height: 0; border-radius: 6px; }
.topbar .menu-btn svg { width: 24px; height: 24px; }
.bottom-nav { display: none; }
@media (max-width: 760px) {
  .sidebar {
    position: fixed; top: 0; bottom: 0; left: 0; width: 260px; max-width: 85vw; z-index: 50;
    transform: translateX(-100%); transition: transform .2s ease; overflow-y: auto;
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-footer { display: block; }
  .nav-item { min-height: 44px; display: flex; align-items: center; }
  .topbar { position: sticky; top: 0; z-index: 30; padding: 10px 14px; gap: 6px; }
  .topbar .menu-btn { display: inline-flex; }
  .topbar-title { font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
  .content { padding: 14px 12px calc(72px + env(safe-area-inset-bottom, 0)); max-width: none; }
  .app-footer { padding-bottom: calc(72px + env(safe-area-inset-bottom, 0)); }
  .flash { margin: 12px 12px 0; }
  .tile-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
  .tile { padding: 14px; }
  .card { padding: 14px; }
  .bottom-nav {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0; height: 60px; z-index: 45;
    background: var(--surface); border-top: 1px solid var(--border); box-shadow: 0 -2px 8px rgba(0,0,0,.06);
    padding-bottom: env(safe-area-inset-bottom, 0);
  }
  .bottom-nav a, .bottom-nav button {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    font: inherit; font-size: 10px; font-weight: 600; color: var(--muted); background: none; border: 0;
    text-decoration: none; cursor: pointer; min-width: 0;
  }
  .bottom-nav a.active { color: var(--brand); }
  .bottom-nav svg { width: 22px; height: 22px; }
  select, input[type=text], input[type=email], input[type=search], input[type=number], input[type=date], textarea { font-size: 16px; }
  .form-row { gap: 8px; }
  .form-row .field { flex: 1 1 100%; min-width: 0; }
  .btn-inline { width: 100%; }
}
@media (max-width: 640px) {
  /* table.data → stacked cards; footer.php's script stamps data-label from the <th>s. */
  .table-wrap { overflow: visible; }
  table.data.is-cards { display: block; border: 0; background: transparent; }
  table.data.is-cards thead, table.data.is-cards tr.is-headrow { display: none; }
  table.data.is-cards tbody { display: flex; flex-direction: column; gap: 10px; }
  table.data.is-cards tr { display: block; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 6px 12px; }
  table.data.is-cards tr.total { background: #f8fafc; }
  table.data.is-cards td { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; padding: 7px 0; border-bottom: 1px solid #f1f5f9; text-align: right; min-width: 0; overflow-wrap: anywhere; }
  table.data.is-cards td:last-child { border-bottom: 0; }
  table.data.is-cards td:first-child { font-weight: 600; }
  table.data.is-cards td::before { content: attr(data-label); flex: 0 0 38%; text-align: left; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding-top: 2px; }
  table.data.is-cards td[data-label=""]::before { display: none; }
  table.data.is-cards td:empty { display: none; }
  table.data.is-cards td.num { text-align: right; }
}

  .sidebar { width: 100%; flex-direction: row; align-items: center; overflow-x: auto; }
  .sidebar-brand { border-bottom: 0; padding: 12px; flex-shrink: 0; }
  .brand-name { display: none; }
  .sidebar-nav { display: flex; padding: 8px; gap: 4px; }
  .nav-item { padding: 10px 12px; white-space: nowrap; min-height: 44px; display: flex; align-items: center; }
  .sidebar-footer { display: none; }
  .content { padding: 16px; }
}
