/* ============================================================================
   STAND TO - Component library
   Shared, composable UI primitives used across the veteran app and the portal.
   ============================================================================ */

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  min-height: var(--tap-min); padding: 0 var(--space-5);
  font-family: var(--font-body); font-size: var(--fs-body); font-weight: 600;
  border: 1px solid transparent; border-radius: var(--radius-pill);
  background: var(--color-surface); color: var(--color-text);
  cursor: pointer; transition: transform var(--dur-fast) var(--ease-calm), background var(--dur-fast) var(--ease-calm), box-shadow var(--dur-fast) var(--ease-calm), filter var(--dur-fast) var(--ease-calm);
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(.96); }
.btn:disabled { opacity: .5; cursor: default; }
.btn svg { width: 20px; height: 20px; }
/* primary + accent actions carry the Aura gradients + a soft warm glow */
.btn-primary { background: var(--grad-flame); color: var(--color-on-primary); box-shadow: var(--shadow-glow); border-color: transparent; }
.btn-primary:hover { filter: brightness(1.03); }
.btn-accent, .btn-lavender { background: var(--grad-lavender); color: var(--color-on-accent); box-shadow: var(--shadow-lavender); border-color: transparent; }
.btn-accent:hover, .btn-lavender:hover { filter: brightness(1.03); }
/* secondary / ghost / quiet: white or transparent pills with a soft warm border */
.btn-secondary { background: var(--color-surface); border-color: var(--color-border-strong); color: var(--color-text); box-shadow: var(--shadow-sm); }
.btn-secondary:hover { background: var(--color-surface-sunken); }
.btn-ghost   { background: transparent; border-color: var(--color-border-strong); color: var(--color-text); }
.btn-ghost:hover { background: var(--color-surface-sunken); }
.btn-quiet   { background: transparent; color: var(--color-primary-strong); min-height: 40px; padding: 0 var(--space-3); }
.btn-quiet:hover { background: var(--color-primary-50); }
.btn-danger  { background: var(--color-danger); color: #fff; box-shadow: var(--shadow-sm); }
.btn-danger:hover { filter: brightness(.95); }
.btn-block   { display: flex; width: 100%; }
.btn-sm      { min-height: 38px; font-size: var(--fs-caption); padding: 0 var(--space-4); }
.btn-icon    { width: var(--tap-min); height: var(--tap-min); min-height: 0; padding: 0; border-radius: var(--radius-pill); }

/* ---------- Cards ---------- */
.card {
  background: var(--color-surface); border: 1px solid var(--color-border);
  border-radius: var(--radius-lg); padding: var(--space-5);
  box-shadow: var(--shadow-card);
}
.card-flat { box-shadow: none; }
.card-tight { padding: var(--space-4); border-radius: var(--radius-md); }
/* hero card: warm flame gradient with white text + a soft warm glow (never dark) */
.card-hero {
  border: none; color: #fff;
  background: var(--grad-score);
  box-shadow: var(--shadow-glow); position: relative; overflow: hidden;
}
.card-hero h2, .card-hero h3 { color: #fff; }
.card-hero .u-muted, .card-hero .stat-label, .card-hero .u-label { color: rgba(255,255,255,.82); }
/* Action buttons sitting ON a flame hero card become a crisp white pill with
   coral text - a second gradient (esp. lavender) clashes on the coral field. */
.card-hero .btn-primary, .card-hero .btn-accent, .card-hero .btn-lavender {
  background: #fff; color: var(--coral-700); box-shadow: var(--shadow-sm); border-color: transparent;
}
.card-hero .btn-primary:hover, .card-hero .btn-accent:hover, .card-hero .btn-lavender:hover { filter: none; background: var(--cream-50); }
.card-hero .btn-primary svg, .card-hero .btn-accent svg, .card-hero .btn-lavender svg { color: var(--coral-600); }
/* accent card: calm lavender tint */
.card-accent {
  border: 1px solid var(--color-accent-200); color: var(--color-text);
  background: linear-gradient(150deg, var(--lavender-50) 0%, var(--lavender-100) 100%);
}
/* frosted glass card */
.card-glass {
  background: var(--glass-light); border: 1px solid var(--glass-border);
  -webkit-backdrop-filter: blur(var(--blur-glass)); backdrop-filter: blur(var(--blur-glass));
  box-shadow: var(--shadow-glass);
}
.card-link { cursor: pointer; transition: transform var(--dur-fast) var(--ease-calm), box-shadow var(--dur-fast) var(--ease-calm); }
.card-link:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.card-link:active { transform: translateY(0); }

/* ---------- Chips & tags ---------- */
.chip {
  display: inline-flex; align-items: center; gap: var(--space-2);
  min-height: 40px; padding: 0 var(--space-4);
  border-radius: var(--radius-pill); border: 1px solid var(--color-border);
  background: var(--color-surface); color: var(--color-text);
  font-size: var(--fs-caption); font-weight: 500; cursor: pointer;
  box-shadow: var(--shadow-xs);
  transition: all var(--dur-fast) var(--ease-calm);
}
.chip:hover { border-color: var(--color-primary-300); }
.chip[aria-pressed="true"], .chip.is-on {
  background: var(--grad-flame); border-color: transparent; color: #fff; font-weight: 600;
  box-shadow: var(--shadow-glow-soft);
}
.chip svg { width: 16px; height: 16px; }
.tag {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: var(--radius-pill);
  font-size: var(--fs-label); font-weight: 600; letter-spacing: .02em;
  background: var(--color-surface-sunken); color: var(--color-text-secondary);
}
.tag-primary { background: var(--color-primary-50); color: var(--color-primary-strong); }
.tag-accent  { background: var(--color-accent-50); color: var(--color-accent-strong); }
.tag-crisis  { background: var(--color-danger-soft); color: var(--color-danger-text); }
.tag-24-7    { background: var(--color-primary-50); color: var(--color-primary-strong); }

/* ---------- Section headers ---------- */
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin: var(--space-6) 0 var(--space-3); }
.section-head h3 { font-size: var(--fs-title); font-family: var(--font-body); font-weight: 700; }
.section-head .link { font-size: var(--fs-caption); color: var(--color-primary-strong); font-weight: 600; cursor: pointer; }

/* ---------- List rows ---------- */
.list { display: flex; flex-direction: column; gap: var(--space-2); }
.list-row {
  display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-3) var(--space-4); min-height: var(--tap-min);
  background: var(--color-surface); border: 1px solid var(--color-border);
  border-radius: var(--radius-md); cursor: pointer; text-align: left; width: 100%;
  transition: all var(--dur-fast) var(--ease-calm); color: var(--color-text);
}
.list-row:hover { border-color: var(--color-primary-300); box-shadow: var(--shadow-sm); }
/* ---------- Signature: circular icon badges ----------
   Every icon chip (.lr-icon) renders as a round badge. The default is a soft
   coral tint, but call-sites that pass an inline background/colour still read as
   a round badge (not a square). Helper .icon-badge* classes give the JS richer
   gradient + glow variants. */
.lr-icon {
  width: 40px; height: 40px; border-radius: 50%; flex: none;
  display: grid; place-items: center;
  background: var(--coral-100); color: var(--coral-600);
}
.lr-icon svg { width: 20px; height: 20px; }

.list-row .lr-icon {
  width: 44px; height: 44px; border-radius: 50%; flex: none;
  display: grid; place-items: center; background: var(--coral-100); color: var(--coral-600);
}
.list-row .lr-icon svg { width: 22px; height: 22px; }

/* gradient icon badges - white glyph on a flame/lavender gradient, or soft tints */
.icon-badge {
  border-radius: 50%; flex: none; display: grid; place-items: center;
  background: var(--grad-flame); color: #fff; box-shadow: var(--shadow-glow-soft);
}
.icon-badge svg { stroke: #fff; }
.icon-badge--lavender { background: var(--grad-lavender); color: #fff; box-shadow: var(--shadow-lavender); }
.icon-badge--lavender svg { stroke: #fff; }
.icon-badge--soft { background: var(--coral-100); color: var(--coral-600); box-shadow: none; }
.icon-badge--soft svg { stroke: currentColor; }
.icon-badge--ghost { background: var(--lavender-100); color: var(--lavender-600); box-shadow: none; }
.icon-badge--ghost svg { stroke: currentColor; }
.list-row .lr-body { flex: 1; min-width: 0; }
.list-row .lr-title { display: block; font-weight: 600; font-size: var(--fs-body); line-height: 1.3; }
.list-row .lr-sub { display: block; margin-top: 2px; font-size: var(--fs-caption); color: var(--color-text-secondary); line-height: 1.35; }
.list-row .lr-chev { color: var(--color-text-tertiary); flex: none; }

/* ---------- Avatars ---------- */
.avatar {
  width: 40px; height: 40px; border-radius: var(--radius-pill); flex: none;
  display: grid; place-items: center; font-weight: 700; font-size: var(--fs-caption);
  background: var(--color-primary-100); color: var(--color-primary-700);
}
.avatar-lg { width: 56px; height: 56px; font-size: var(--fs-title); }
.avatar-sm { width: 32px; height: 32px; font-size: var(--fs-label); }

/* ---------- Progress ---------- */
.progress { height: 10px; border-radius: var(--radius-pill); background: var(--color-surface-sunken); overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: var(--radius-pill); background: var(--color-accent); transition: width var(--dur) var(--ease-calm); }
.progress-primary > span { background: var(--color-primary); }

/* ---------- Stat pills ---------- */
.stat { display: flex; flex-direction: column; gap: 2px; }
/* numeric readouts use Geist Mono, big + tabular; labels stay sentence-case body */
.stat .stat-num, .ps-num, .ms-num {
  font-family: var(--font-mono); font-size: 1.6rem; font-weight: 500; line-height: 1;
  font-feature-settings: "tnum" 1; font-variant-numeric: tabular-nums; letter-spacing: -.01em;
}
.stat .stat-label { font-size: var(--fs-caption); color: var(--color-text-secondary); }
.stat-row { display: flex; gap: var(--space-4); }

/* ---------- Mood tiles & segmented selector ---------- */
.mood-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: var(--space-2); }
.mood-tile {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: var(--space-3) 4px; border-radius: var(--radius-lg);
  border: 2px solid transparent; background: var(--color-surface); cursor: pointer;
  transition: transform var(--dur-fast) var(--ease-calm), border-color var(--dur-fast) var(--ease-calm);
}
.mood-tile:hover { transform: translateY(-2px); }
.mood-tile .mood-face { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; box-shadow: var(--shadow-xs); }
.mood-tile .mood-face svg { width: 28px; height: 28px; color: #fff; }
.mood-tile .mood-word { font-size: var(--fs-label); font-weight: 600; color: var(--color-text-secondary); }
.mood-tile.is-on { border-color: var(--color-primary); background: var(--coral-50); box-shadow: var(--shadow-glow-soft); }
.mood-tile.is-on .mood-word { color: var(--color-primary-strong); }

/* ---------- Bottom navigation: floating frosted-glass pill ---------- */
.bottom-nav {
  display: flex; align-items: stretch; justify-content: space-around;
  margin: 0 var(--space-4) max(var(--space-3), env(safe-area-inset-bottom));
  padding: var(--space-2);
  background: var(--glass-light);
  -webkit-backdrop-filter: blur(var(--blur-glass)); backdrop-filter: blur(var(--blur-glass));
  border: 1px solid var(--glass-border); border-radius: var(--radius-pill);
  box-shadow: var(--shadow-lg);
}
.nav-item {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  padding: var(--space-2) 4px; min-height: 52px; border: none; background: none; cursor: pointer;
  border-radius: var(--radius-pill);
  color: var(--color-text-tertiary); font-size: 11px; font-weight: 600;
  transition: color var(--dur-fast) var(--ease-calm), background var(--dur-fast) var(--ease-calm), box-shadow var(--dur-fast) var(--ease-calm);
}
.nav-item svg { width: 24px; height: 24px; }
.nav-item.is-active {
  color: #fff; background: var(--grad-flame); box-shadow: var(--shadow-glow-soft);
}
.nav-item.is-fab { position: relative; flex: 0 0 auto; }
.nav-item .fab {
  width: 56px; height: 56px; margin-top: -26px; border-radius: 50%;
  background: var(--grad-flame); color: #fff;
  display: grid; place-items: center; box-shadow: var(--shadow-glow);
  border: 3px solid var(--color-surface);
}
.nav-item .fab svg { width: 26px; height: 26px; }

/* ---------- Toast / notification banner ---------- */
.toast-wrap { position: absolute; left: 0; right: 0; top: 0; z-index: 60; display: flex; flex-direction: column; gap: var(--space-2); padding: var(--space-3); pointer-events: none; }
.toast {
  pointer-events: auto; background: var(--color-surface); border: 1px solid var(--color-border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); padding: var(--space-3) var(--space-4);
  display: flex; align-items: center; gap: var(--space-3);
  animation: toast-in var(--dur) var(--ease-calm);
}
.toast .toast-ico { width: 38px; height: 38px; border-radius: var(--radius-sm); display: grid; place-items: center; flex: none; background: var(--color-primary-50); color: var(--color-primary-strong); }
.toast .toast-ico svg { width: 22px; height: 22px; }
.toast-title { font-weight: 700; font-size: var(--fs-caption); }
.toast-sub { font-size: var(--fs-caption); color: var(--color-text-secondary); }
.toast-crisis .toast-ico { background: var(--color-danger-soft); color: var(--color-danger-text); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-12px); } to { opacity: 1; transform: translateY(0); } }

/* ---------- Sheets / modals ---------- */
.sheet-scrim { position: absolute; inset: 0; background: rgba(30,22,14,.38); z-index: 70; display: flex; align-items: flex-end; animation: fade-in var(--dur) var(--ease-calm); }
.sheet {
  width: 100%; background: var(--color-surface); border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  padding: var(--space-5); box-shadow: var(--shadow-lg); animation: sheet-up var(--dur) var(--ease-calm); max-height: 88%; overflow-y: auto;
}
.sheet-handle { width: 40px; height: 4px; border-radius: var(--radius-pill); background: var(--color-border-strong); margin: 0 auto var(--space-4); }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes sheet-up { from { transform: translateY(100%); } to { transform: translateY(0); } }

/* ---------- RAG status chip ---------- */
.rag {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: var(--radius-pill);
  font-size: var(--fs-label); font-weight: 700; letter-spacing: .02em;
}
.rag .dot { width: 8px; height: 8px; border-radius: 50%; }
.rag-green { background: var(--rag-green-bg); color: var(--color-success-text); }
.rag-green .dot { background: var(--rag-green); }
.rag-amber { background: var(--rag-amber-bg); color: var(--color-warning-text); }
.rag-amber .dot { background: var(--rag-amber); }
.rag-red { background: var(--rag-red-bg); color: var(--color-danger-text); }
.rag-red .dot { background: var(--rag-red); }

/* ---------- Banner (inline notice) ---------- */
.banner { display: flex; gap: var(--space-3); padding: var(--space-3) var(--space-4); border-radius: var(--radius-md); align-items: flex-start; font-size: var(--fs-caption); }
.banner svg { width: 20px; height: 20px; flex: none; margin-top: 1px; }
.banner-crisis { background: var(--color-danger-soft); color: var(--color-danger-text); border: 1px solid #EBC9C2; }
.banner-info { background: var(--color-primary-50); color: var(--color-primary-700); }
.banner-warn { background: var(--rag-amber-bg); color: var(--color-warning-text); }

/* ---------- Sparkline / mini bars ---------- */
.spark { display: inline-flex; align-items: flex-end; gap: 2px; height: 26px; }
.spark i { width: 4px; border-radius: 2px; background: var(--color-primary-200); display: block; }

/* ---------- Pills row ---------- */
.pill-scroll { display: flex; gap: var(--space-2); overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.pill-scroll::-webkit-scrollbar { display: none; }

/* ---------- Empty / confirmation states ---------- */
.confirm-state { text-align: center; padding: var(--space-6) var(--space-4); }
.confirm-state .blob { width: 96px; height: 96px; margin: 0 auto var(--space-4); border-radius: 42% 58% 56% 44% / 50% 44% 56% 50%; display: grid; place-items: center; background: var(--color-primary-50); color: var(--color-primary); }
.confirm-state .blob svg { width: 48px; height: 48px; }

/* ---------- Calendar heatmap ---------- */
.heat { display: grid; grid-template-columns: repeat(15, 1fr); gap: 5px; }
.heat i { aspect-ratio: 1; border-radius: 5px; background: var(--color-surface-sunken); }
.heat i.h1 { background: var(--color-primary-100); }
.heat i.h2 { background: var(--color-primary-200); }
.heat i.h3 { background: var(--color-primary-400); }
.heat i.h4 { background: var(--color-primary); }
.heat i.freeze { background: var(--color-sky); }

/* ---------- Badge medallion ---------- */
.medal { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; }
.medal .disc { width: 60px; height: 60px; border-radius: var(--radius-pill); display: grid; place-items: center; background: var(--color-accent-50); color: var(--color-accent-strong); border: 2px solid var(--color-accent-200); }
.medal .disc svg { width: 30px; height: 30px; }
.medal.is-locked .disc { background: var(--color-surface-sunken); color: var(--color-text-tertiary); border-color: var(--color-border); }
.medal .medal-name { font-size: var(--fs-label); font-weight: 600; color: var(--color-text-secondary); }
