/* ============================================================
   assets/css/components.css — SmartSwap shared component layer
   ------------------------------------------------------------
   Extracts the recurring inline-style patterns (≈2,600 of them)
   into named, themeable, mobile-aware classes. Loaded AFTER
   main.css + theme.css so it can rely on the token variables and
   compose with existing component classes.

   Conventions
   -----------
   • Spacing utilities use PX values in their name: .mb-16 = 16px.
     The three legacy Tailwind-style names already in main.css
     (.mb-4, .mt-4, .mt-8 → 16/16/32px) are intentionally NOT
     redefined here. New code should use the px-named utilities.
   • Layout grids (.grid-2 / .grid-3 / .grid-auto) collapse to a
     single column at ≤768px automatically — no per-view media
     queries and no fragile [style*=] hooks required.
   ============================================================ */

/* ── TEXT COLOUR ─────────────────────────────────────────── */
.muted        { color: var(--c-text2); }
.muted-2      { color: var(--c-text3); }
.text-accent  { color: var(--c-accent); }
.text-danger  { color: var(--c-danger); }
.text-gold    { color: var(--c-gold); }
.text-gut     { color: var(--c-gut); }
.text-sleep   { color: var(--c-sleep); }
.text-breath  { color: var(--c-breath); }
.text-base    { color: var(--c-text); }
.text-white   { color: #fff; }

/* ── FONT SIZE (px) ──────────────────────────────────────── */
.fs-10 { font-size: 10px; }
.fs-11 { font-size: 11px; }
.fs-12 { font-size: 12px; }
.fs-13 { font-size: 13px; }
.fs-14 { font-size: 14px; }
.fs-15 { font-size: 15px; }
.fs-16 { font-size: 16px; }
.fs-18 { font-size: 18px; }
.fs-20 { font-size: 20px; }
.fs-24 { font-size: 24px; }
.fs-28 { font-size: 28px; }
.fs-32 { font-size: 32px; }
.fs-36 { font-size: 36px; }
.text-xs { font-size: 12px; }
.text-sm { font-size: 14px; }
.text-lg { font-size: 1.1rem; }

/* ── FONT WEIGHT / STYLE ─────────────────────────────────── */
.fw-300 { font-weight: 300; }
.fw-400 { font-weight: 400; }
.fw-500 { font-weight: 500; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.italic { font-style: italic; }
.serif  { font-family: var(--font-serif); }
.uppercase { text-transform: uppercase; letter-spacing: 0.08em; }
.lh-tight { line-height: 1.3; }
.lh-snug  { line-height: 1.5; }
.lh-relaxed { line-height: 1.7; }

/* ── EYEBROW / SECTION LABEL ─────────────────────────────── */
/* Replaces the ~70 hand-rolled uppercase letter-spaced labels   */
.eyebrow {
  font-size: 12px; font-weight: 600; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--c-accent); margin-bottom: 12px;
}
.eyebrow-sm   { font-size: 11px; letter-spacing: 0.1em; margin-bottom: 8px; }
.eyebrow-muted { color: var(--c-text3); }

/* ── SPACING (margin, px-named) ──────────────────────────── */
.m-0  { margin: 0; }
.mb-2  { margin-bottom: 2px; }  .mt-2  { margin-top: 2px; }
.mb-6  { margin-bottom: 6px; }  .mt-6  { margin-top: 6px; }
.mb-8  { margin-bottom: 8px; }  .mt-8b { margin-top: 8px; }
.mb-10 { margin-bottom: 10px; } .mt-10 { margin-top: 10px; }
.mb-12 { margin-bottom: 12px; } .mt-12 { margin-top: 12px; }
.mb-14 { margin-bottom: 14px; } .mt-14 { margin-top: 14px; }
.mb-16 { margin-bottom: 16px; } .mt-16 { margin-top: 16px; }
.mb-18 { margin-bottom: 18px; } .mt-18 { margin-top: 18px; }
.mb-20 { margin-bottom: 20px; } .mt-20 { margin-top: 20px; }
.mb-24 { margin-bottom: 24px; } .mt-24 { margin-top: 24px; }
.mb-28 { margin-bottom: 28px; } .mt-28 { margin-top: 28px; }
.mb-32 { margin-bottom: 32px; } .mt-32 { margin-top: 32px; }
.mb-36 { margin-bottom: 36px; } .mt-36 { margin-top: 36px; }
.mb-40 { margin-bottom: 40px; } .mt-40 { margin-top: 40px; }
.mb-48 { margin-bottom: 48px; } .mt-48 { margin-top: 48px; }
.mx-auto { margin-left: auto; margin-right: auto; }
.ml-auto { margin-left: auto; }

/* ── PADDING (px-named) ──────────────────────────────────── */
.p-0  { padding: 0; }
.p-8  { padding: 8px; }
.p-12 { padding: 12px; }
.p-16 { padding: 16px; }
.p-20 { padding: 20px; }
.p-24 { padding: 24px; }

/* ── FLEX LAYOUT ─────────────────────────────────────────── */
/* .row   — horizontal flex, vertically centred, 8px gap         */
/* .stack — vertical flex, 8px gap                               */
.row        { display: flex; align-items: center; gap: 8px; }
.row-top    { display: flex; align-items: flex-start; gap: 8px; }
.row-between{ display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.row-center { display: flex; align-items: center; justify-content: center; gap: 8px; }
.stack      { display: flex; flex-direction: column; gap: 8px; }
.wrap       { flex-wrap: wrap; }
.flex-1     { flex: 1; min-width: 0; }

/* ── GRID LAYOUT (auto-collapsing on mobile) ─────────────── */
.grid        { display: grid; gap: 16px; }
.grid-2      { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3      { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.grid-4      { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.grid-auto   { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; }
.grid-auto-sm{ display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }

/* gap utilities — after grids so they compose with/override grid gap */
.gap-4  { gap: 4px; }
.gap-6  { gap: 6px; }
.gap-10 { gap: 10px; }
.gap-12 { gap: 12px; }
.gap-14 { gap: 14px; }
.gap-16 { gap: 16px; }
.gap-20 { gap: 20px; }
.gap-24 { gap: 24px; }

@media (max-width: 768px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .grid-4 { gap: 12px; }
}
@media (min-width: 769px) and (max-width: 980px) {
  .grid-4 { grid-template-columns: 1fr 1fr; }
}

/* ── TABLES ──────────────────────────────────────────────── */
/* .table wraps in a horizontal-scroll container on small screens */
.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; }
.th {
  text-align: left; font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--c-text3); padding: 10px 12px;
  border-bottom: 1px solid var(--c-border);
}
.th-right { text-align: right; }
.th-center { text-align: center; }
.td  { padding: 10px 12px; border-bottom: 1px solid var(--c-border2); font-size: 14px; }
.td-right { text-align: right; }
.td-center { text-align: center; }

/* ── PILLS / BADGES ──────────────────────────────────────── */
.pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 99px;
  font-size: 12px; font-weight: 600; line-height: 1.4;
}
.pill-accent  { background: rgba(45,106,79,0.10); color: var(--c-accent); }
.pill-gold    { background: rgba(212,168,83,0.14); color: var(--c-gold); }
.pill-danger  { background: rgba(192,57,43,0.10); color: var(--c-danger); }
.pill-muted   { background: var(--c-bg2); color: var(--c-text3); }
.pill-sleep   { background: rgba(61,64,91,0.10); color: var(--c-sleep); }

/* ── BANNER (gradient callout box) ───────────────────────── */
/* Replaces the welcome / upgrade gradient boxes scattered inline */
.banner {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  background: linear-gradient(135deg, rgba(45,106,79,0.07), rgba(183,228,199,0.10));
  border: 1px solid rgba(45,106,79,0.18);
  border-radius: 16px; padding: 20px 24px; margin-bottom: 24px;
}
.banner-icon { font-size: 36px; line-height: 1; flex-shrink: 0; }
.banner-body { flex: 1; min-width: 200px; }
.banner-title { font-weight: 700; font-size: 15px; color: var(--c-text); margin-bottom: 4px; }
.banner-text  { font-size: 13px; color: var(--c-text2); line-height: 1.6; }
.banner-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ── HAIRLINE DIVIDER ────────────────────────────────────── */
.divider  { height: 1px; background: var(--c-border2); border: 0; margin: 16px 0; }
.divider-v{ width: 1px; align-self: stretch; background: var(--c-border2); }

/* ── DISPLAY / POSITION UTILITIES ────────────────────────── */
.hidden  { display: none !important; }
.inline  { display: inline; }
.inline-block { display: inline-block; }
.block   { display: block; }
.w-100   { width: 100%; }
.h-100   { height: 100%; }
.text-center { text-align: center; }
.text-left   { text-align: left; }
.text-right  { text-align: right; }
.relative { position: relative; }
.nowrap  { white-space: nowrap; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pointer { cursor: pointer; }

/* Hide an element only on small screens (replaces nth-child hacks) */
@media (max-width: 768px) { .hide-mobile { display: none !important; } }
@media (max-width: 600px) { .hide-sm     { display: none !important; } }
@media (min-width: 769px) { .show-mobile { display: none !important; } }

/* ── Grid span + danger-outline button + disabled inputs ───── */
.span-full { grid-column: 1 / -1; }
.btn-danger-outline { background: transparent; color: var(--c-danger); border-color: var(--c-danger); }
.btn-danger-outline:hover { background: rgba(192,57,43,0.06); }
.form-input:disabled { opacity: 0.55; cursor: not-allowed; }

/* ── Check list (✓ feature lists) ──────────────────────────── */
.check-list { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.check-list li { font-size: 13px; color: var(--c-text2); display: flex; gap: 6px; }
.check-list .ck { color: var(--c-accent); font-weight: 700; }
.flex-shrink-0 { flex-shrink: 0; }
.gap-8 { gap: 8px; }
.minw-0 { min-width: 0; }
.ml-8 { margin-left: 8px; }
.ml-4 { margin-left: 4px; }
.py-16 { padding: 16px 0; }
.items-start { align-items: flex-start; }
.d-inline { display: inline; }
.flush { padding: 0; overflow: hidden; }
.center-screen { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 24px; background: var(--c-bg); }
