/* ═══════════════════════════════════════════════════════════════════════════
   CONTROLS — buttons, badges, tabs, toggles, scales.
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Buttons: the primary is GREEN (blue is for links), and it presses by
      DARKENING — a drop-lip shadow "read as a cheap 3D bevel". ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 18px;
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 16px;
  font-weight: 600;
  line-height: 1.25;
  border: 2px solid transparent;
  cursor: pointer;
  transition: background 0.1s, border-color 0.1s, color 0.1s;
  text-decoration: none;
}
.btn-primary, .btn-success {
  background: var(--btn-primary-bg);
  border-color: var(--btn-primary-bg);
  color: var(--on-accent);
}
.btn-primary:hover, .btn-success:hover { background: var(--btn-primary-hover); }
.btn-primary:active, .btn-success:active { background: var(--btn-primary-active); }
.btn-primary:disabled, .btn-success:disabled {
  background: var(--btn-primary-disabled-bg);
  border-color: var(--btn-primary-disabled-bg);
  color: var(--btn-primary-disabled-ink);
  cursor: not-allowed;
}
.btn-secondary {
  background: var(--bg-card);
  color: var(--brand-primary);
  border-color: var(--brand-primary);
}
.btn-secondary:hover { background: var(--surface-hover); }
.btn-danger {
  background: var(--bg-card);
  color: var(--red);
  border-color: var(--red);
}
.btn-danger:hover { background: var(--btn-danger-hover-bg); color: #fff; }
.btn-lg { padding: 14px 24px; font-size: 17px; }
.btn-sm { padding: 7px 12px; font-size: 13px; }
.btn-block { width: 100%; }

/* ── Badges: square, bordered, legible. the health identity does not do pills.
      GREY IS FOR ABSENCE OF DATA — an unmeasured number is not a warning. ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 2px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.5;
  border: 1px solid transparent;
}
.badge-green { background: var(--badge-green-bg); color: var(--badge-green-ink); border-color: var(--badge-green-border); }
.badge-amber { background: var(--badge-amber-bg); color: var(--badge-amber-ink); border-color: var(--badge-amber-border); }
.badge-red   { background: var(--badge-red-bg);   color: var(--badge-red-ink);   border-color: var(--badge-red-border); }
.badge-blue  { background: var(--badge-blue-bg);  color: var(--badge-blue-ink);  border-color: var(--badge-blue-border); }
.badge-grey  { background: var(--badge-grey-bg);  color: var(--badge-grey-ink);  border-color: var(--badge-grey-border); }

/* ── Tabs: inactive tabs are underlined LINKS (the GOV.UK affordance);
      the active one is ink with a heavy underline. ── */
.tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.tab {
  padding: 11px 18px;
  font-size: 15px;
  color: var(--brand-primary);
  text-decoration: underline;
  border: none;
  background: none;
  border-bottom: 4px solid transparent;
  margin-bottom: -1px;
  cursor: pointer;
  font-family: var(--font);
}
.tab:hover { color: var(--brand-deep); }
/* Sport's --brand-deep IS its dark background, so hovered text vanished against it -
   hover brightens instead on the dark theme. */
:root[data-domain="sport"] .tab:hover { color: var(--accent-light); }
.tab.active {
  color: var(--text);
  border-bottom-color: var(--brand-primary);
  font-weight: 700;
  text-decoration: none;
}

/* ── Segmented toggle (English/Cymraeg and other binary choices) ── */
.view-toggle {
  display: inline-flex;
  border: 1px solid var(--brand-primary);
  border-radius: var(--radius);
  overflow: hidden;
}
.view-btn {
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 600;
  background: var(--bg-card);
  color: var(--brand-primary);
  border: none;
  border-right: 1px solid var(--brand-primary);
  cursor: pointer;
  font-family: var(--font);
}
.view-btn:last-child { border-right: none; }
.view-btn:hover { background: var(--surface-hover); }
.view-btn.active { background: var(--brand-primary); color: var(--on-accent); }

/* ── Check-in scale: 44×44 targets (gloved thumbs, WCAG), mono digits ── */
.checkin-scale { display: flex; gap: 6px; flex-wrap: wrap; }
.scale-btn {
  width: 44px;
  height: 44px;
  border: 2px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--bg-card);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
}
.scale-btn:hover { border-color: var(--brand-primary); background: var(--surface-hover); }
.scale-btn.selected {
  border-color: var(--brand-deep);
  background: var(--brand-primary);
  color: var(--on-accent);
}

/* ── Onboarding option list ── */
.onboard-options { border: 1px solid var(--border); background: var(--bg-card); }
.onboard-option {
  display: block;
  width: 100%;
  text-align: left;
  padding: 16px 18px;
  font-size: 16px;
  border: none;
  border-bottom: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  cursor: pointer;
  font-family: var(--font);
}
.onboard-option:last-child { border-bottom: none; }
.onboard-option:hover { background: var(--surface-hover); }
.onboard-option.selected { background: var(--brand-primary); color: var(--on-accent); font-weight: 600; }

/* ── File field ──
   The native control is kept (semantics, validation, keyboard) but hidden from view, because its
   button and empty-state text are the browser's own words in the browser's own language. Hidden
   the accessible way — still focusable, still in the tab order — so the label below can wear the
   focus treatment on its behalf. */
.file-field { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.file-field-input {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0; border: 0;
  clip-path: inset(50%);
  overflow: hidden; white-space: nowrap;
}
.file-field-button { cursor: pointer; }
.file-field-name { font-size: 14px; color: var(--ink); overflow-wrap: anywhere; }
.file-field-name.is-empty { color: var(--ink-muted); }
/* Treatment A, as for any other thing you activate: the input carries focus, the label shows it. */
.file-field-input:focus-visible + .file-field-button {
  outline: 3px solid var(--focus);
  outline-offset: 0;
  box-shadow: 0 4px 0 0 var(--focus-ink);
  background-color: var(--focus) !important;
  color: var(--focus-ink) !important;
  border-color: var(--focus-ink) !important;
  border-radius: 0;
}
