/* ============================================================
   Culture — Reusable components
   ============================================================ */

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: var(--s-2);
  min-height: 44px;
  padding: 0 var(--s-5);
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: var(--t-base);
  letter-spacing: 0.01em;
  transition: transform var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease), opacity var(--dur-fast);
  white-space: nowrap;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
  background: var(--accent);
  color: #0A0A0A;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  box-shadow: 0 1px 0 rgba(255,255,255,0.18) inset, 0 8px 24px var(--accent-glow);
}
.btn-primary:hover { background: var(--accent-hover); color: #000; }

.btn-ghost {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--surface-3); }

.btn-block { width: 100%; }
.btn-lg { min-height: 52px; font-size: var(--t-md); border-radius: var(--radius-md); }

.btn-link { color: var(--accent); font-weight: 600; padding: var(--s-2) var(--s-3); letter-spacing: 0.04em; }

/* ---------- Inputs ---------- */
.input {
  width: 100%;
  min-height: 52px;
  padding: 0 var(--s-4);
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: var(--t-md);
  outline: none;
  transition: border-color var(--dur-fast), background var(--dur-fast);
}
.input:focus { border-color: var(--accent); background: var(--surface-2); }
.input::placeholder { color: var(--text-dim); }

.field { display: block; margin-bottom: var(--s-4); }
.field-label { display: block; font-size: var(--t-sm); color: var(--text-muted); margin-bottom: var(--s-2); font-weight: 500; }

/* ---------- Cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--s-4);
  box-shadow: var(--shadow-card);
}
.card-tight { padding: var(--s-3) var(--s-4); }
.card-flat  { box-shadow: none; }

.card-accent {
  /* Default (Bronze fallback) — charcoal industrial card with bone text */
  background:
    linear-gradient(135deg, rgba(255,255,255,0.04), transparent 60%),
    var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-md);
  padding: var(--s-4);
  box-shadow: var(--shadow-card);
  position: relative;
  overflow: hidden;
}
.card-accent::after {
  /* Big watermark monogram in the corner of the membership card */
  content: "C";
  position: absolute;
  right: -10px; top: -28px;
  font-family: var(--font-display);
  font-size: 200px;
  font-weight: 800;
  color: rgba(232,225,212,0.05);
  letter-spacing: -0.05em;
  pointer-events: none;
}

/* Tier-based hero card variants (Home > Points balance card).
   Mirrors the wallet card palette so the member's tier is consistent. */
.card-accent.gold {
  background:
    linear-gradient(135deg, rgba(255,255,255,0.18), transparent 45%),
    linear-gradient(160deg, #C99A2E 0%, #A47217 55%, #6E4A0B 100%);
  color: #1a0f00;
  border-color: rgba(0,0,0,0.10);
  box-shadow: 0 8px 24px rgba(164,114,23,0.45);
}
.card-accent.gold::after { color: rgba(58,36,0,0.18); }

.card-accent.silver {
  background:
    linear-gradient(135deg, rgba(255,255,255,0.35), transparent 45%),
    linear-gradient(160deg, #E6E8EC 0%, #B6BAC2 50%, #7F858E 100%);
  color: #1a1d22;
  border-color: rgba(0,0,0,0.10);
  box-shadow: 0 8px 24px rgba(127,133,142,0.45);
}
.card-accent.silver::after { color: rgba(42,45,51,0.18); }

.card-accent.bronze {
  background:
    linear-gradient(135deg, rgba(255,255,255,0.18), transparent 45%),
    linear-gradient(160deg, #C97A3A 0%, #8E4B1F 55%, #5A2E10 100%);
  color: #1a0a00;
  border-color: rgba(0,0,0,0.10);
  box-shadow: 0 8px 24px rgba(142,75,31,0.45);
}
.card-accent.bronze::after { color: rgba(58,26,0,0.18); }

/* Tonal tweaks so the mini QR tile reads well on light tier backgrounds. */
.card-accent.gold .qr-mini,
.card-accent.silver .qr-mini,
.card-accent.bronze .qr-mini {
  background: #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,0.18);
}

/* ---------- Top app bar ---------- */
.appbar {
  display: flex; align-items: center;
  height: 52px;
  padding: 0 var(--s-5);
  position: relative;
}
.appbar .title { font-size: var(--t-md); font-weight: 600; text-align: center; flex: 1; }
.appbar .back  { width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center; border-radius: var(--radius-pill); color: var(--text); }
.appbar .back:active { background: var(--surface-2); }
.appbar .back-spacer { width: 36px; height: 36px; flex: 0 0 36px; }
.appbar .right { width: 36px; display: inline-flex; justify-content: flex-end; }

/* The brand wordmark used at the top of the home screen */
.brand {
  font-weight: 800;
  letter-spacing: 0.12em;
  font-size: var(--t-md);
}

/* ---------- Bottom navigation ---------- */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: var(--max-w);
  height: calc(var(--bottom-nav-h) + var(--safe-bottom));
  padding: 0 var(--s-2) var(--safe-bottom);
  background: rgba(10,10,10,0.92);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: center;
  align-items: stretch;
  z-index: 50;
}
.bottom-nav a {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px;
  flex: 1 1 0; min-width: 0;
  height: 100%;
  text-align: center;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 500;
  transition: color var(--dur-fast);
  position: relative;
}
.bottom-nav a svg {
  width: 24px; height: 24px;
  stroke: currentColor;
  display: block;
  margin: 0 auto;
}
.bottom-nav a span { display: block; line-height: 1; }
.bottom-nav a.active { color: var(--text); }
.bottom-nav a.active::before {
  content: ""; position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: 28px; height: 2px; background: var(--accent); border-radius: 0 0 2px 2px;
}

/* ---------- Tabs (Classes / PT / Open Gym) ---------- */
.tabs {
  display: inline-flex;
  background: var(--surface-2);
  border-radius: var(--radius-pill);
  padding: 4px;
  gap: 2px;
}
.tabs button {
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  font-size: var(--t-sm);
  font-weight: 600;
  color: var(--text-muted);
  transition: color var(--dur-fast), background var(--dur-fast);
}
.tabs button.active {
  background: var(--accent);
  color: #0A0A0A;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* Smaller chip tabs (e.g. category filter on Booking) */
.chips { display: flex; gap: var(--s-2); overflow-x: auto; padding-bottom: 2px; }
.chips::-webkit-scrollbar { display: none; }
.chips button {
  flex: 0 0 auto;
  padding: 6px 14px;
  background: var(--surface-2);
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  font-size: var(--t-sm);
  font-weight: 500;
}
.chips button.active {
  background: var(--accent);
  color: #0A0A0A;
  border-color: var(--accent);
}

/* ---------- Date strip ---------- */
.date-strip { display: flex; gap: var(--s-2); overflow-x: auto; }
.date-strip::-webkit-scrollbar { display: none; }
.date-strip .day {
  flex: 0 0 auto;
  width: 44px;
  padding: var(--s-2) 0;
  border-radius: var(--radius-md);
  background: var(--surface);
  border: 1px solid var(--border);
  text-align: center;
  cursor: pointer;
  transition: background var(--dur-fast), border-color var(--dur-fast), color var(--dur-fast);
}
.date-strip .day .dow { font-size: 10px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.06em; }
.date-strip .day .dom { font-size: var(--t-md); font-weight: 700; margin-top: 2px; }
.date-strip .day.active { background: var(--accent); border-color: var(--accent); color: #0A0A0A; }
.date-strip .day.active .dow { color: rgba(10,10,10,0.75); }
.date-strip .day.active .dom { color: #0A0A0A; }

/* ---------- Session card ---------- */
.session {
  display: grid;
  grid-template-columns: 64px 1fr auto;
  gap: var(--s-3);
  padding: var(--s-3);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: var(--s-3);
  align-items: center;
}
.session .thumb {
  width: 64px; height: 64px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, #2a2a2a, #161616);
  position: relative;
  overflow: hidden;
}
.session .thumb::after {
  /* subtle maroon glint */
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(135deg, transparent 60%, rgba(122,31,43,0.35));
}
.session .title { font-weight: 600; font-size: var(--t-base); }
.session .meta  { color: var(--text-muted); font-size: var(--t-sm); margin-top: 2px; }
.session .right { text-align: right; }
.session .pill  {
  display: inline-block;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: var(--accent-soft);
  color: var(--accent);
}
.session .pill.full { background: rgba(217,83,79,0.18); color: #ECA0A0; }
.session .pill.success { background: rgba(79,190,121,0.12); color: var(--success); }
.session .pts { color: var(--accent); font-weight: 600; font-size: var(--t-xs); margin-top: 6px; }

.session-book {
  margin-top: 8px;
  padding: 8px 16px;
  border-radius: 999px;
  border: none;
  background: var(--accent);
  color: #0A0A0A;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: var(--t-sm);
  cursor: pointer;
  min-width: 72px;
  transition: transform 0.08s ease, opacity 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}
.session-book:active { transform: scale(0.96); }
.session-book:hover { opacity: 0.9; }
.session-book.full,
.session-book.booked,
.session-book[disabled] {
  background: rgba(255,255,255,0.08);
  color: var(--text-muted);
  cursor: not-allowed;
  opacity: 1;
}
.session-book.booked {
  background: rgba(79,190,121,0.12);
  color: var(--success);
}

/* ---------- Boot splash (shown during Auth.bootCheck) ---------- */
.boot-splash {
  position: fixed; inset: 0;
  background: var(--bg, #0A0A0A);
  display: flex; align-items: center; justify-content: center;
  z-index: 999;
}
.boot-splash::after {
  content: "";
  width: 32px; height: 32px;
  border: 3px solid rgba(255,255,255,0.12);
  border-top-color: var(--accent, #8b1e2b);
  border-radius: 50%;
  animation: bootSpin 0.8s linear infinite;
}
@keyframes bootSpin { to { transform: rotate(360deg); } }

/* ---------- In-app confirm sheet (replaces native confirm in sandboxed iframe) ---------- */
.confirm-sheet {
  position: fixed; inset: 0; z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  animation: confirmFade 0.15s ease-out;
}
.confirm-backdrop {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.65);
}
.confirm-card {
  position: relative;
  background: var(--surface, #1a1a1a);
  border: 1px solid var(--border, rgba(255,255,255,0.08));
  border-radius: 16px;
  padding: 24px 20px 16px;
  width: 100%; max-width: 320px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.confirm-msg {
  font-size: var(--t-base);
  font-weight: 600;
  color: var(--text, #fff);
  text-align: center;
  margin-bottom: 20px;
  line-height: 1.4;
}
.confirm-actions {
  display: flex; gap: 10px;
}
.confirm-cancel, .confirm-ok {
  flex: 1;
  padding: 12px 16px;
  border-radius: 999px;
  border: none;
  font-weight: 600;
  font-size: var(--t-sm);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.08s ease, opacity 0.15s ease;
}
.confirm-cancel {
  background: rgba(255,255,255,0.08);
  color: var(--text, #fff);
}
.confirm-ok {
  background: var(--accent);
  color: #0A0A0A;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 700;
}
.confirm-cancel:active, .confirm-ok:active { transform: scale(0.97); }
@keyframes confirmFade {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ---------- Coach row (Book PT) ---------- */
.coach {
  display: grid;
  grid-template-columns: 48px 1fr auto;
  gap: var(--s-3);
  padding: var(--s-3) 0;
  border-bottom: 1px solid var(--border);
  align-items: center;
  cursor: pointer;
}
.coach:last-child { border-bottom: none; }
.coach .avatar {
  width: 48px; height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, #353535, #1d1d1d);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); font-weight: 700;
  overflow: hidden;
}
.coach .name { font-weight: 600; }
.coach .role { color: var(--text-muted); font-size: var(--t-sm); }
.coach .rating { color: var(--warning); font-size: var(--t-sm); margin-top: 2px; }
.coach .check { width: 26px; height: 26px; border-radius: 50%; background: var(--accent); display: flex; align-items: center; justify-content: center; color: #0A0A0A; font-weight: 700; }
.coach.selected { background: linear-gradient(90deg, rgba(122,31,43,0.06), transparent); }

/* ---------- Time slot picker ---------- */
.slots { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s-2); }
.slots button {
  height: 44px;
  border-radius: var(--radius-md);
  background: var(--surface-2);
  color: var(--text);
  font-weight: 600;
  border: 1px solid var(--border);
  font-size: var(--t-sm);
}
.slots button.active { background: var(--accent); border-color: var(--accent); color: #0A0A0A; }
.slots button:disabled { color: var(--text-dim); background: var(--surface); opacity: 0.5; }

/* ---------- QR card ---------- */
.qr-card {
  background: #fff;
  border-radius: var(--radius-md);
  padding: var(--s-4);
  display: flex; align-items: center; justify-content: center;
}
.qr-card canvas, .qr-card svg { display: block; }

/* ---------- Leaderboard rows ---------- */
.lb-row {
  display: grid;
  grid-template-columns: 28px 36px 1fr auto;
  gap: var(--s-3);
  padding: var(--s-3);
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
  background: transparent;
  align-items: center;
}
.lb-row .rank { font-weight: 700; color: var(--text-muted); text-align: center; }
.lb-row .avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(135deg, #353535, #1d1d1d);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; color: var(--text-muted); font-size: var(--t-sm);
}
.lb-row .name { font-weight: 500; }
.lb-row .score { font-weight: 700; color: var(--text); }
.lb-row.you {
  background: var(--accent);
  color: #0A0A0A;
}
.lb-row.you .rank, .lb-row.you .score { color: #0A0A0A; font-weight: 800; }
.lb-row.you .avatar { background: rgba(0,0,0,0.15); color: #0A0A0A; }
.lb-row.top-three .rank { color: var(--accent); }

/* ---------- Chat ---------- */
.chat-msg {
  display: grid;
  grid-template-columns: 40px 1fr auto;
  gap: var(--s-3);
  padding: var(--s-3) 0;
  border-bottom: 1px solid var(--border);
}
.chat-msg .avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: linear-gradient(135deg, #404040, #1d1d1d);
  display: flex; align-items: center; justify-content: center;
  color: var(--text); font-weight: 700;
}
.chat-msg .name { font-weight: 600; }
.chat-msg .body { color: var(--text-muted); margin-top: 2px; font-size: var(--t-sm); }
.chat-msg .time { color: var(--text-dim); font-size: var(--t-xs); }
.chat-msg .badge {
  margin-top: 6px;
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--accent); color: #0A0A0A; font-size: 11px; font-weight: 700;
}
.chat-msg.pinned {
  background: linear-gradient(90deg, var(--accent-soft), transparent);
  border-radius: var(--radius-sm);
  padding: var(--s-3);
  margin-bottom: var(--s-3);
  border-bottom: none;
}
.chat-msg.pinned .avatar { background: var(--accent); color: #0A0A0A; }

.chat-thumb {
  width: 80px; height: 56px;
  border-radius: var(--radius-sm);
  margin-top: 6px;
  background: linear-gradient(135deg, #353535, #1d1d1d);
}

/* ---------- Progress bar ---------- */
.progress {
  width: 100%;
  height: 6px;
  background: var(--surface-3);
  border-radius: var(--radius-pill);
  overflow: hidden;
}
.progress > span {
  display: block;
  height: 100%;
  background: var(--accent);
  border-radius: var(--radius-pill);
  transition: width var(--dur-slow) var(--ease);
}

/* Circular progress (Challenge featured card) */
.ring {
  position: relative;
  width: 120px; height: 120px;
}
.ring svg { transform: rotate(-90deg); }
.ring .pct {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: var(--t-xl);
}
.ring .pct small { display: block; font-size: 10px; color: var(--text-muted); font-weight: 500; margin-top: 2px; }

/* ---------- Badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.badge-accent  { background: var(--accent-soft); color: var(--accent); }
.badge-success { background: rgba(79,190,121,0.14); color: var(--success); }
.badge-muted   { background: var(--surface-2); color: var(--text-muted); }

/* ---------- Toast ---------- */
.toast-host {
  position: fixed; left: 50%; bottom: calc(var(--bottom-nav-h) + 12px + var(--safe-bottom));
  transform: translateX(-50%);
  z-index: 100;
  display: flex; flex-direction: column; gap: 8px;
  pointer-events: none;
  width: calc(100% - 32px);
  max-width: 360px;
}
.toast {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  font-size: var(--t-sm);
  font-weight: 500;
  box-shadow: var(--shadow-lift);
  animation: toast-in var(--dur-base) var(--ease);
}
.toast.error { border-color: rgba(217,83,79,0.4); }
.toast.success { border-color: rgba(79,190,121,0.4); }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}

/* ---------- Skeleton (loading) ---------- */
.skel {
  background: linear-gradient(90deg, var(--surface) 0%, var(--surface-2) 50%, var(--surface) 100%);
  background-size: 200% 100%;
  animation: skel-pan 1.4s ease-in-out infinite;
  border-radius: var(--radius-sm);
}
@keyframes skel-pan {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.skel-block { height: 72px; margin-bottom: var(--s-3); border-radius: var(--radius-md); }
.skel-line  { height: 12px; margin-bottom: var(--s-2); border-radius: 6px; }

/* ---------- Venue switcher (logo toggle) ---------- */
.venue-switch-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}
.venue-switch-row { display: flex; align-items: center; }
.venue-hint {
  font-size: 11px;
  color: var(--text-muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 3px 8px;
  border-radius: var(--radius-pill);
  letter-spacing: 0.02em;
  white-space: nowrap;
  animation: venueHintFade 0.4s ease both;
}
@keyframes venueHintFade {
  from { opacity: 0; transform: translateY(-2px); }
  to   { opacity: 1; transform: translateY(0); }
}
.venue-caption {
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.venue-caption span {
  color: var(--text);
  font-weight: 600;
}
.venue-switch {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  background: transparent;
  border: 0;
  padding: 0;
}
.venue-switch button {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 50%;
  background: #fff;
  border: 2px solid transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  opacity: 0.45;
  transition: opacity 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}
.venue-switch button img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  pointer-events: none;
}
.venue-switch button:active { transform: scale(0.94); }
.venue-switch button.active {
  opacity: 1;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(122, 31, 43, 0.25);
}

/* ---------- Icon button (bell / settings) ---------- */
.icon-btn {
  width: 36px; height: 36px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--radius-pill);
  color: var(--text);
}
.icon-btn:active { background: var(--surface-2); }
.icon-btn svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 2; }
