/* ============================================================================
   Jollibee Rewards prototype — Component layer
   Reused verbatim from the Blacksmith prototype (forge/.../components.css):
   hand-built CSS reproductions of @talino-labs/nmblr.foundry-ui components, keyed
   to each component's foundry MCP spec. Class names mirror the library's `fds-*`
   anatomy so this maps 1:1 to the real components on rebuild. Tokens only — no raw
   hex — so the Jollibee brand overlay in tokens.css reskins everything.
   ========================================================================== */

/* ---- Reset / base ---------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-text);
  font-size: 1rem;
  line-height: 1.5;
  color: var(--c-text);
  background: var(--c-canvas);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, h4, h5, h6 { font-family: var(--font-display); margin: 0; color: var(--c-text); }
button { font-family: inherit; }
a { color: inherit; }
.ficon { display: block; flex: 0 0 auto; }

/* Type helpers (display face = chrome/headings; text face = content) */
.t-display { font-family: var(--font-display); }
.t-text { font-family: var(--font-text); }
.t-mono { font-family: var(--font-mono); }
.t-h4 { font-family: var(--font-display); font-size: 2rem; line-height: 1.15; font-weight: 600; }
.t-h5 { font-family: var(--font-display); font-size: 1.75rem; line-height: 1.2; font-weight: 500; }
.t-h6 { font-family: var(--font-display); font-size: 1.5rem; line-height: 1.25; font-weight: 500; }
.t-h7 { font-family: var(--font-display); font-size: 1.25rem; line-height: 1.3; font-weight: 600; }
.t-eyebrow { font-family: var(--font-display); font-size: 0.6875rem; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--c-muted); }
.t-b1 { font-size: 1.125rem; line-height: 1.55; }
.t-b2 { font-size: 1rem; line-height: 1.5; font-weight: 500; }
.t-b3 { font-size: 0.875rem; line-height: 1.43; }
.t-b4 { font-size: 0.75rem; line-height: 1.5; }
.t-muted { color: var(--c-muted); }
.t-text-2 { color: var(--c-text-2); }

/* ---- Button (button.json) -------------------------------------------------- */
.fds-btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: var(--space-4);
  font-family: var(--font-display); font-weight: 400; font-size: 14px; line-height: 20px;
  padding: var(--space-6) var(--space-12);
  border-radius: var(--radius-full);
  border: 1px solid transparent;
  cursor: pointer; white-space: nowrap; user-select: none;
  transition: filter .15s ease, background .15s ease, color .15s ease, border-color .15s ease;
}
.fds-btn:focus-visible { outline: 2px solid var(--c-accent); outline-offset: 2px; }
.fds-btn .ficon { width: 20px; height: 20px; }
.fds-btn--sm { padding: var(--space-4) var(--space-8); font-size: 13px; }
.fds-btn--lg { padding: var(--space-8) var(--space-16); font-size: 16px; }
.fds-btn--gradient { background: var(--c-gradient-brand); color: #fff; }
.fds-btn--gradient:hover { filter: brightness(0.96); }
.fds-btn--primary { background: var(--c-accent-solid); color: var(--c-text-on-accent-solid); }
.fds-btn--primary:hover { background: color-mix(in srgb, var(--c-accent-solid) 90%, #000); }
.fds-btn--primary:active { background: color-mix(in srgb, var(--c-accent-solid) 82%, #000); }
.fds-btn--secondary { background: color-mix(in srgb, var(--c-accent) 18%, var(--c-canvas)); color: var(--c-text); }
.fds-btn--secondary:hover { background: color-mix(in srgb, var(--c-accent) 28%, var(--c-canvas)); }
.fds-btn--outline { background: transparent; color: var(--c-accent-strong); border-color: var(--c-accent); }
.fds-btn--outline:hover { background: var(--c-accent-faint); }
.fds-btn--ghost { background: transparent; color: var(--c-accent-strong); }
.fds-btn--ghost:hover { background: var(--c-subtle); }
.fds-btn[disabled], .fds-btn[aria-disabled="true"] { pointer-events: none; }
.fds-btn--gradient[disabled], .fds-btn--primary[disabled], .fds-btn--secondary[disabled] { filter: saturate(0.5) opacity(0.55); }
.fds-btn--outline[disabled], .fds-btn--ghost[disabled] { color: var(--c-muted); border-color: var(--c-border-strong); background: transparent; }
.fds-btn--icon { padding: var(--space-6); border-radius: var(--radius-md); background: transparent; color: var(--c-muted); border: none; }
.fds-btn--icon:hover { background: var(--c-surface-hover); color: var(--c-text); }
.fds-btn--full { width: 100%; }

/* ---- Card (card.json) ------------------------------------------------------ */
.fds-card { border-radius: var(--radius-2xl); background: var(--c-surface); border: 1px solid var(--c-border); }
.fds-card--flat { background: var(--c-surface-raised); border: none; box-shadow: none; }
.fds-card--raised { background: var(--c-surface-raised); border: none; box-shadow: 0 1px 3px rgba(0,0,0,0.06), 0 4px 12px rgba(0,0,0,0.04); }
.fds-card--outlined { background: var(--c-surface); border: 1px solid var(--c-border); }
.fds-card__pad { padding: var(--space-16) var(--space-24); }
.fds-card__pad--sm { padding: var(--space-12) var(--space-16); }
.fds-card__pad--lg { padding: var(--space-24); }
.fds-card__header { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-12); }
.fds-card__title { font-family: var(--font-display); font-size: 0.875rem; font-weight: 600; }
.fds-card__desc { font-family: var(--font-text); font-size: 0.75rem; color: var(--c-muted); margin-top: var(--space-4); }
/* selectable card (Radio substitute per foundations gaps) */
.fds-card--selectable { cursor: pointer; transition: border-color .15s ease, box-shadow .15s ease, background .15s ease; }
.fds-card--selectable:hover { border-color: var(--c-border-strong); }
.fds-card--selectable[aria-pressed="true"], .fds-card--selectable.is-selected {
  border-color: var(--c-accent); box-shadow: inset 0 0 0 1px var(--c-accent); background: var(--c-accent-faint);
}

/* ---- Pill (pill.json) ------------------------------------------------------ */
.fds-pill {
  display: inline-flex; align-items: center; gap: var(--space-4);
  height: 1.625rem; padding: 0 var(--space-8);
  font-family: var(--font-display); font-weight: 500; font-size: 12px; line-height: 1;
  border-radius: var(--radius-full); white-space: nowrap;
  background: var(--c-subtle); color: var(--c-text-2);
}
.fds-pill--sm { height: 1.25rem; padding: 0 var(--space-6); font-size: 10px; }
.fds-pill .ficon { width: 14px; height: 14px; }
.fds-pill__dot { width: 6px; height: 6px; border-radius: var(--radius-full); background: currentColor; }
.fds-pill--accent { background: var(--c-accent-faint); color: var(--c-accent-strong); }
.fds-pill--success { background: var(--c-success-bg); color: var(--c-success-text); }
.fds-pill--error { background: var(--c-error-bg); color: var(--c-error-text); }
.fds-pill--warning { background: var(--c-warning-bg); color: var(--c-warning-text); }
.fds-pill--info { background: var(--c-info-bg); color: var(--c-info-text); }
.fds-pill--neutral { background: var(--c-subtle); color: var(--c-text-2); }

/* ---- Chip (chip.json) ------------------------------------------------------ */
.fds-chip {
  display: inline-flex; align-items: center; gap: var(--space-4);
  height: 1.625rem; padding: 0 var(--space-8);
  font-family: var(--font-display); font-weight: 500; font-size: 12px; line-height: 1;
  border-radius: var(--radius-full); border: none; cursor: default;
  background: var(--c-subtle); color: var(--c-text-2);
}
.fds-chip--accent { background: var(--c-accent-faint); color: var(--c-accent-strong); }
.fds-chip--info { background: var(--c-info-bg); color: var(--c-info-text); }
.fds-chip--warning { background: var(--c-warning-bg); color: var(--c-warning-text); }
.fds-chip[role="button"], .fds-chip.is-clickable { cursor: pointer; }
.fds-chip .ficon { width: 14px; height: 14px; }
.fds-chip__remove { display: inline-flex; align-items: center; justify-content: center; width: 16px; height: 16px; margin-right: -2px; border: none; background: transparent; color: inherit; cursor: pointer; opacity: .7; border-radius: var(--radius-full); }
.fds-chip__remove:hover { opacity: 1; background: color-mix(in srgb, currentColor 12%, transparent); }
.fds-chip--selectable { cursor: pointer; background: var(--c-surface); border: 1px solid var(--c-border); color: var(--c-text); }
.fds-chip--selectable:hover { border-color: var(--c-border-strong); }
.fds-chip--selectable.is-selected { background: var(--c-accent-faint); border-color: var(--c-accent); color: var(--c-accent-strong); }

/* ---- Tabs (tabs.json) ------------------------------------------------------ */
.fds-tabs { display: inline-flex; }
.fds-tablist { display: inline-flex; }
.fds-tab {
  font-family: var(--font-display); font-size: 0.875rem; font-weight: 400;
  border: none; background: transparent; color: var(--c-muted); cursor: pointer;
  display: inline-flex; align-items: center; gap: var(--space-6);
}
.fds-tab .ficon { width: 16px; height: 16px; }
/* line variant */
.fds-tablist--line { gap: var(--space-4); }
.fds-tablist--line .fds-tab { padding: var(--space-8) var(--space-12); border-radius: var(--radius-10); }
.fds-tablist--line .fds-tab:hover { background: var(--c-subtle); color: var(--c-text); }
.fds-tablist--line .fds-tab.is-active { background: var(--c-border); color: var(--c-text); font-weight: 500; box-shadow: inset 0 0 0 0.5px var(--c-border-strong); }
:root.dark .fds-tablist--line .fds-tab.is-active { background: var(--c-surface-overlay); color: #fff; }
/* segment variant */
.fds-tablist--segment { background: var(--c-subtle); border-radius: var(--radius-lg); padding: var(--space-4); gap: var(--space-2); }
.fds-tablist--segment .fds-tab { padding: var(--space-4) var(--space-12); border-radius: var(--radius-md); }
.fds-tablist--segment .fds-tab:hover { color: var(--c-text); }
.fds-tablist--segment .fds-tab.is-active { background: var(--c-surface); color: var(--c-text); font-weight: 500; box-shadow: 0 1px 3px rgba(0,0,0,0.08); }
:root.dark .fds-tablist--segment .fds-tab.is-active { background: var(--c-surface-overlay); color: #fff; }

/* ---- Input (form-field.json) ----------------------------------------------- */
.fds-field { display: flex; flex-direction: column; gap: var(--space-6); }
.fds-field__label { font-family: var(--font-display); font-size: 0.875rem; font-weight: 400; color: var(--c-muted); }
.fds-input {
  display: flex; align-items: center; gap: var(--space-8);
  padding: var(--space-8) var(--space-12);
  border-radius: var(--radius-20);
  border: 1px solid var(--c-muted); background: var(--c-subtle);
}
:root.dark .fds-input { border-color: var(--c-disabled); background: var(--c-canvas); }
.fds-input input { flex: 1; border: none; background: transparent; outline: none; font-family: var(--font-text); font-size: 0.875rem; color: var(--c-text); min-width: 0; }
.fds-input input::placeholder { color: var(--c-text-subtle); }
.fds-input .ficon { width: 18px; height: 18px; color: var(--c-icon); }
.fds-input:focus-within { border-color: var(--c-accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--c-accent) 15%, transparent); }
.fds-field__helper { font-family: var(--font-text); font-size: 0.75rem; color: var(--c-muted); }

/* ---- Dropdown (dropdown.json) ---------------------------------------------- */
.fds-dropdown { position: relative; }
.fds-dropdown__trigger {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: var(--space-8);
  padding: var(--space-8) var(--space-12);
  border-radius: var(--radius-20); border: 1px solid var(--c-border-strong);
  background: var(--c-surface); color: var(--c-text);
  font-family: var(--font-display); font-size: 0.875rem; cursor: pointer; text-align: left;
}
:root.dark .fds-dropdown__trigger { background: var(--c-surface-inset); }
.fds-dropdown__trigger:hover { border-color: var(--c-accent); }
.fds-dropdown__trigger .ficon { width: 18px; height: 18px; color: var(--c-icon); transition: transform .15s ease; }
.fds-dropdown.is-open .fds-dropdown__chevron { transform: rotate(180deg); }
.fds-dropdown__value { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fds-dropdown__value.is-placeholder { color: var(--c-text-subtle); }
.fds-dropdown__listbox {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 30;
  background: var(--c-surface-raised); border: 1px solid var(--c-border);
  border-radius: var(--radius-xl); padding: var(--space-4);
  box-shadow: 0 8px 28px rgba(8,9,28,0.14); display: none; max-height: 260px; overflow: auto;
}
.fds-dropdown.is-open .fds-dropdown__listbox { display: block; }
.fds-dropdown__option {
  display: flex; align-items: center; gap: var(--space-8); width: 100%;
  padding: var(--space-8) var(--space-12); border-radius: var(--radius-10);
  border: none; background: transparent; color: var(--c-text);
  font-family: var(--font-display); font-size: 0.875rem; cursor: pointer; text-align: left;
}
.fds-dropdown__option:hover, .fds-dropdown__option.is-focused { background: var(--c-subtle); }
.fds-dropdown__option.is-selected { color: var(--c-accent-strong); }
.fds-dropdown__option .ficon { width: 16px; height: 16px; margin-left: auto; color: var(--c-accent); }
.fds-dropdown__opt-support { display: block; font-family: var(--font-text); font-size: 0.75rem; color: var(--c-muted); font-weight: 400; }

/* ---- Switch (switch.json) -------------------------------------------------- */
.fds-switch { position: relative; display: inline-block; width: 2.25rem; height: 1.25rem; flex: 0 0 auto; cursor: pointer; }
.fds-switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.fds-switch__track { position: absolute; inset: 0; border-radius: var(--radius-full); background: var(--c-border-strong); transition: background .15s ease; }
.fds-switch__thumb { position: absolute; top: 0.125rem; left: 0.125rem; width: 1rem; height: 1rem; border-radius: var(--radius-full); background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,0.25); transition: transform .15s ease; }
.fds-switch input:checked + .fds-switch__track { background: var(--c-accent); }
.fds-switch input:checked + .fds-switch__track + .fds-switch__thumb { transform: translateX(1rem); }
.fds-switch input:focus-visible + .fds-switch__track { box-shadow: 0 0 0 3px color-mix(in srgb, var(--c-accent) 20%, transparent); }
.fds-switch.is-disabled { opacity: 0.5; cursor: not-allowed; }
.fds-switch-row { display: flex; align-items: center; justify-content: space-between; gap: var(--space-12); }

/* ---- Stepper (horizontal — stepper.json) ----------------------------------- */
.fds-stepper { display: flex; align-items: center; gap: var(--space-8); }
.fds-stepper__step { display: inline-flex; align-items: center; gap: var(--space-8); }
.fds-stepper__dot {
  width: 26px; height: 26px; border-radius: var(--radius-full); flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-size: 0.8125rem; font-weight: 600;
  background: var(--c-subtle); color: var(--c-muted); border: 1px solid var(--c-border);
}
.fds-stepper__dot .ficon { width: 15px; height: 15px; }
.fds-stepper__label { font-family: var(--font-display); font-size: 0.8125rem; color: var(--c-muted); }
.fds-stepper__step.is-active .fds-stepper__dot { background: var(--c-accent-solid); color: var(--c-text-on-accent-solid); border-color: transparent; }
.fds-stepper__step.is-active .fds-stepper__label { color: var(--c-text); font-weight: 600; }
.fds-stepper__step.is-complete .fds-stepper__dot { background: var(--c-accent-faint); color: var(--c-accent-strong); border-color: transparent; }
.fds-stepper__step.is-complete .fds-stepper__label { color: var(--c-text-2); }
.fds-stepper__line { width: 22px; height: 1.5px; background: var(--c-border); border-radius: var(--radius-full); }
.fds-stepper__step.is-complete + .fds-stepper__line { background: var(--c-accent); }

/* ---- Shared: advisory note ------------------------------------------------- */
.fds-advisory {
  display: flex; gap: var(--space-8); align-items: flex-start;
  background: var(--c-info-bg); color: var(--c-info-text);
  border-radius: var(--radius-lg); padding: var(--space-8) var(--space-12);
  font-family: var(--font-text); font-size: 0.8125rem; line-height: 1.45;
}
.fds-advisory .ficon { width: 16px; height: 16px; margin-top: 2px; flex: 0 0 auto; }
