/* ============================================================================
   ASF COACH INTERFACE — COMPONENT LIBRARY
   Reusable, theme-aware component classes. Pair with tokens.css.
   Every component works under .theme-floor and .theme-office unchanged —
   they read semantic vars, so the same markup adapts to either environment.
   ========================================================================== */

/* ---- BUTTONS -------------------------------------------------------------- */
.btn {
  font-family: var(--font-ui);
  font-weight: var(--w-semi);
  font-size: var(--t-base);
  display: inline-flex; align-items: center; justify-content: center;
  gap: var(--s-2);
  min-height: var(--tap-floor);
  padding: 0 var(--s-5);
  border-radius: var(--r-md);
  border: 1px solid transparent;
  background: var(--surface-2);
  color: var(--text-hi);
  cursor: pointer;
  transition: transform var(--dur-fast) var(--ease-out),
              background var(--dur-fast), box-shadow var(--dur-fast), border-color var(--dur-fast);
  user-select: none; -webkit-tap-highlight-color: transparent;
  white-space: nowrap;
}
.btn:active { transform: scale(0.97); }
.btn:hover  { background: var(--surface-3); }

.btn--ghost { background: transparent; border-color: var(--border); color: var(--text-mid); }
.btn--ghost:hover { background: var(--surface); color: var(--text-hi); }

.btn--primary {
  background: var(--accent); color: var(--on-accent); border-color: transparent;
  font-weight: var(--w-bold);
}
.btn--primary:hover { background: var(--accent-strong); }

.btn--danger { background: var(--stop); color: var(--on-accent); }
.btn--danger:hover { filter: brightness(1.06); }

.btn--lg { min-height: var(--tap-primary); font-size: var(--t-md); padding: 0 var(--s-7); border-radius: var(--r-lg); }
.btn--block { width: 100%; white-space: normal; } /* full-width buttons wrap long labels instead of widening their grid track (BUG-011) */

/* the floor SAVE button — the most important control in the app */
.btn-save {
  width: 100%;
  min-height: var(--tap-primary);
  border: none; border-radius: var(--r-lg);
  background: var(--accent); color: var(--on-accent);
  font-family: var(--font-ui); font-weight: var(--w-black);
  font-size: var(--t-lg); letter-spacing: 0.01em;
  display: flex; align-items: center; justify-content: center; gap: var(--s-3);
  cursor: pointer; box-shadow: var(--glow-accent);
  transition: transform var(--dur-fast) var(--ease-out), filter var(--dur-fast);
}
.btn-save:active { transform: scale(0.98); filter: brightness(1.05); }

/* ---- SEARCH FIELD (identical everywhere — pattern P1) --------------------- */
.search {
  display: flex; align-items: center; gap: var(--s-3);
  height: var(--tap-floor);
  padding: 0 var(--s-4);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-md);
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
}
.search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search__icon { width: 20px; height: 20px; color: var(--text-lo); flex: none; }
.search input {
  flex: 1; min-width: 0; border: none; outline: none; background: transparent;
  font-family: var(--font-ui); font-size: var(--t-base); color: var(--text-hi);
}
.search input::placeholder { color: var(--text-lo); }

/* ---- INPUT / FORM FIELD --------------------------------------------------- */
.field { display: flex; flex-direction: column; gap: var(--s-2); }
.field__label {
  font-family: var(--font-mono); font-size: var(--t-micro);
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-lo);
  display: flex; align-items: center; gap: var(--s-2);
}
.field__req { color: var(--stop); }
.field__opt { color: var(--text-lo); font-weight: var(--w-reg); text-transform: none; letter-spacing: 0; }
.input {
  height: var(--tap-floor); padding: 0 var(--s-4);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md);
  font-family: var(--font-ui); font-size: var(--t-base); color: var(--text-hi); outline: none;
}
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* big numeric capture field — for the floor */
.capture-value {
  display: flex; align-items: baseline; justify-content: center; gap: var(--s-3);
  background: var(--surface); border: 1.5px solid var(--border); border-radius: var(--r-lg);
  padding: var(--s-4) var(--s-5); min-height: 96px;
}
.capture-value.is-active { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.capture-value__num {
  font-family: var(--font-display); font-weight: var(--w-bold);
  font-size: var(--t-3xl); line-height: 1; color: var(--text-hi);
  font-variant-numeric: tabular-nums;
}
.capture-value__num.is-empty { color: var(--text-lo); }
.capture-value__unit { font-family: var(--font-mono); font-size: var(--t-md); color: var(--text-mid); }

/* ---- CHIP / TAG / FLAG ---------------------------------------------------- */
.chip {
  display: inline-flex; align-items: center; gap: var(--s-2);
  height: 34px; padding: 0 var(--s-3);
  border-radius: var(--r-pill);
  background: var(--surface-2); border: 1px solid var(--border);
  font-size: var(--t-sm); font-weight: var(--w-med); color: var(--text-mid);
  white-space: nowrap;
}
.chip--active { background: var(--accent-soft); border-color: transparent; color: var(--accent); font-weight: var(--w-semi); }
.chip__dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex: none; }

/* status flag pills (semantic) */
.flag { display:inline-flex; align-items:center; gap:6px; height: 24px; padding: 0 10px;
  border-radius: var(--r-pill); font-family: var(--font-mono); font-size: var(--t-micro);
  letter-spacing: 0.04em; text-transform: uppercase; font-weight: var(--w-med); }
.flag--new   { background: var(--info-soft); color: var(--info); }
.flag--pending { background: var(--pending-soft); color: var(--pending); }
.flag--saved { background: var(--go-soft); color: var(--go); }
.flag--stop  { background: var(--stop-soft); color: var(--stop); }
.flag svg { width: 13px; height: 13px; }

/* ---- LIST ROW (pattern P2/P5 — headline value, no row actions) ------------ */
.row {
  display: flex; align-items: center; gap: var(--s-4);
  min-height: var(--tap-floor); padding: var(--s-3) var(--s-4);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md);
  cursor: pointer; text-align: left; width: 100%;
  transition: background var(--dur-fast), border-color var(--dur-fast), transform var(--dur-fast);
}
.row:hover { background: var(--surface-2); border-color: var(--border-strong); }
.row:active { transform: scale(0.995); }
.row__main { flex: 1; min-width: 0; }
.row__title { font-size: var(--t-md); font-weight: var(--w-semi); color: var(--text-hi);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row__sub { font-size: var(--t-cap); color: var(--text-lo); margin-top: 1px; }
.row__value { font-family: var(--font-display); font-variant-numeric: tabular-nums;
  font-weight: var(--w-bold); font-size: var(--t-md); color: var(--text-hi); flex: none; }
.row__value small { font-family: var(--font-mono); font-size: var(--t-cap); color: var(--text-mid); font-weight: var(--w-reg); }
.row__chev { width: 18px; height: 18px; color: var(--text-lo); flex: none; }

/* ---- SAVE-STATUS INDICATOR (always visible — F5a) ------------------------- */
.savestat {
  display: inline-flex; align-items: center; gap: var(--s-2);
  height: 30px; padding: 0 12px; border-radius: var(--r-pill);
  font-family: var(--font-mono); font-size: var(--t-micro); letter-spacing: 0.04em;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text-mid);
}
.savestat__dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.savestat--saved   { color: var(--go); } .savestat--saved .savestat__dot { background: var(--go); }
.savestat--pending { color: var(--pending); } .savestat--pending .savestat__dot { background: var(--pending);
  animation: pulse 1s var(--ease-in-out) infinite; }
.savestat--stuck   { color: var(--stop); border-color: color-mix(in oklch, var(--stop) 40%, transparent); }
.savestat--stuck .savestat__dot { background: var(--stop); }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.3; } }

/* ---- TOAST (non-blocking undo/edit — F5) ---------------------------------- */
.toast {
  display: flex; align-items: center; gap: var(--s-3);
  padding: var(--s-3) var(--s-3) var(--s-3) var(--s-4);
  background: var(--surface-3); border: 1px solid var(--border-strong);
  border-radius: var(--r-lg); box-shadow: var(--shadow-2);
  backdrop-filter: blur(8px);
}
.toast__check { width: 28px; height: 28px; border-radius: 50%; background: var(--go-soft);
  color: var(--go); display: grid; place-items: center; flex: none; }
.toast__body { flex: 1; min-width: 0; }
.toast__title { font-size: var(--t-sm); font-weight: var(--w-semi); color: var(--text-hi);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.toast__sub { font-family: var(--font-mono); font-size: var(--t-micro); color: var(--text-mid); }
.toast__act { height: 40px; padding: 0 var(--s-3); border-radius: var(--r-sm); border: none;
  background: transparent; color: var(--accent); font-family: var(--font-ui);
  font-weight: var(--w-bold); font-size: var(--t-sm); cursor: pointer; }
.toast__act:hover { background: var(--accent-soft); }
.toast__act--mute { color: var(--text-mid); }
.toast__act--mute:hover { background: var(--surface-2); color: var(--text-hi); }

/* ---- NUMERIC KEYPAD (floor) ----------------------------------------------- */
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s-2); }
.key {
  min-height: var(--tap-primary); border-radius: var(--r-md);
  background: var(--surface-2); border: 1px solid var(--border);
  font-family: var(--font-display); font-weight: var(--w-semi); font-size: var(--t-xl);
  color: var(--text-hi); cursor: pointer; display: grid; place-items: center;
  transition: transform var(--dur-fast) var(--ease-out), background var(--dur-fast);
  -webkit-tap-highlight-color: transparent;
}
.key:active { transform: scale(0.95); background: var(--surface-3); }
.key--util { font-family: var(--font-ui); font-size: var(--t-base); color: var(--text-mid); }

/* ---- CARD / PANEL --------------------------------------------------------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  box-shadow: var(--shadow-1); }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); }

/* ---- TOGGLE (include-archived etc.) --------------------------------------- */
.toggle { display: inline-flex; align-items: center; gap: var(--s-3); cursor: pointer; user-select: none; }
.toggle__track { width: 46px; height: 28px; border-radius: var(--r-pill); background: var(--surface-3);
  border: 1px solid var(--border); position: relative; transition: background var(--dur-fast); flex: none; }
.toggle__knob { position: absolute; top: 2px; left: 2px; width: 22px; height: 22px; border-radius: 50%;
  background: var(--text-mid); transition: transform var(--dur-fast) var(--ease-out), background var(--dur-fast); }
.toggle.is-on .toggle__track { background: var(--accent-soft); border-color: transparent; }
.toggle.is-on .toggle__knob { transform: translateX(18px); background: var(--accent); }

/* ---- SEGMENTED CONTROL (mode switch etc.) --------------------------------- */
.seg { display: inline-flex; padding: 4px; gap: 4px; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: var(--r-md); }
.seg__item { min-height: 44px; padding: 0 var(--s-4); border: none; background: transparent; cursor: pointer;
  border-radius: var(--r-sm); font-family: var(--font-ui); font-weight: var(--w-semi); font-size: var(--t-sm);
  color: var(--text-mid); display: inline-flex; align-items: center; gap: var(--s-2); }
.seg__item.is-active { background: var(--surface); color: var(--text-hi); box-shadow: var(--shadow-1); }

/* ---- DIVIDER / LABEL ------------------------------------------------------ */
.eyebrow { font-family: var(--font-mono); font-size: var(--t-micro); letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--text-lo); }
.hr { height: 1px; background: var(--border); border: none; margin: 0; }
