/*
 * Pharmasift Benchmark prototype: shared components.
 * Used by both the member site (on top of site_core.css) and the admin panel (on top of admin/css/site.css).
 * Colours come from the existing SCSS variables in scss/site_core.scss.
 */
:root {
  --ps-navy: #333366; /* $colorMain */
  --ps-orange: #ff6600; /* $colorSecondary */
  --ps-grey-btn: #a6a6a6; /* darken(white, 35%) - secondary buttons */
  --ps-tile: #f2f2f2; /* darken(white, 5%) - tiles and boxes */
  --ps-bm: #e3a21a; /* Benchmark accent */
  --ps-bm-ink: #8a5d00; /* Benchmark accent for text on white */
  --ps-bm-soft: #fbf1db;
  --ps-text: #222;
  --ps-muted: #5f5f6e;
  --ps-line: #d5d5e0;
  --ps-track: #e4e4ee;
  --ps-green: #318048;
  --ps-green-soft: #e3f1e7;
  --ps-red: #b3261e;
  --ps-red-soft: #fbe7e6;
  --ps-blue-soft: #e6e6f2;
  --ps-admin: #aa004c; /* admin accent from admin/css/site.css */
  --ps-admin-dark: #6a1b3e;
}

.bm,
.bm * {
  box-sizing: border-box;
}
.bm {
  color: var(--ps-text);
  font-size: 14px;
  line-height: 1.45;
}
.bm p {
  margin: 0 0 12px;
}
.bm h1,
.bm h2,
.bm h3 {
  margin: 0;
}
.bm-sr {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
.bm-muted {
  color: var(--ps-muted);
}
.bm-small {
  font-size: 12px;
}
.bm-hidden {
  display: none !important;
}

/* ---------- Buttons (mirror #user_button) ---------- */
.bm-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
  padding: 8px 18px;
  border: 0;
  border-radius: 0;
  background: var(--ps-navy);
  color: #fff;
  cursor: pointer;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  text-decoration: none;
  transition:
    background-color 0.3s,
    color 0.3s;
}
.bm-btn:hover {
  background: var(--ps-orange);
  color: #fff;
}
.bm-btn:focus-visible,
.bm a:focus-visible,
.bm button:focus-visible,
.bm input:focus-visible,
.bm select:focus-visible,
.bm textarea:focus-visible {
  outline: 3px solid var(--ps-orange);
  outline-offset: 2px;
}
.bm-btn--secondary {
  background: var(--ps-grey-btn);
  color: #000;
}
.bm-btn--secondary:hover {
  background: var(--ps-orange);
  color: #fff;
}
.bm-btn--ghost {
  background: #fff;
  color: var(--ps-navy);
  box-shadow: inset 0 0 0 2px var(--ps-navy);
}
.bm-btn--ghost:hover {
  background: var(--ps-navy);
  color: #fff;
}
.bm-btn--success {
  background: var(--ps-green);
}
.bm-btn--success:hover {
  background: #24603a;
}
.bm-btn--danger {
  background: #fff;
  color: var(--ps-red);
  box-shadow: inset 0 0 0 2px var(--ps-red);
}
.bm-btn--danger:hover {
  background: var(--ps-red);
  color: #fff;
}
.bm-btn--link {
  background: none;
  color: var(--ps-navy);
  padding: 4px 6px;
  min-height: 0;
  text-transform: none;
  font-weight: 700;
  text-decoration: underline;
}
.bm-btn--link:hover {
  background: none;
  color: var(--ps-orange);
}
.bm-btn--sm {
  min-height: 32px;
  padding: 5px 12px;
  font-size: 12px;
}
.bm-btn[disabled],
.bm-btn[aria-disabled="true"] {
  opacity: 0.45;
  cursor: not-allowed;
}
.bm-btn[disabled]:hover {
  background: var(--ps-navy);
  color: #fff;
}
.bm-btn--success[disabled]:hover {
  background: var(--ps-green);
}
.bm-btn--danger[disabled]:hover {
  background: #fff;
  color: var(--ps-red);
}

/* ---------- Status chips ---------- */
.bm-chip {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  line-height: 18px;
  white-space: nowrap;
  background: var(--ps-blue-soft);
  color: var(--ps-navy);
}
.bm-chip--pending {
  background: var(--ps-bm-soft);
  color: var(--ps-bm-ink);
}
.bm-chip--completed,
.bm-chip--approved,
.bm-chip--live,
.bm-chip--clear {
  background: var(--ps-green-soft);
  color: #22603a;
}
.bm-chip--closed,
.bm-chip--draft,
.bm-chip--archived,
.bm-chip--skipped {
  background: #ececf1;
  color: #4a4a58;
}
.bm-chip--published,
.bm-chip--scheduled,
.bm-chip--in_survey {
  background: var(--ps-blue-soft);
  color: var(--ps-navy);
}
.bm-chip--rejected,
.bm-chip--flagged,
.bm-chip--error {
  background: var(--ps-red-soft);
  color: var(--ps-red);
}

/* ---------- Form controls ---------- */
.bm-field {
  margin-bottom: 16px;
}
.bm-field > label,
.bm-label {
  display: block;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--ps-navy);
}
.bm-label .bm-optional,
.bm-field > label .bm-optional {
  font-weight: 400;
  color: var(--ps-muted);
}
.bm-input,
.bm-select,
.bm-textarea {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid #b9b9c9;
  border-radius: 0;
  background: #fff;
  font: inherit;
  font-size: 14px;
  color: var(--ps-text);
}
.bm-textarea {
  min-height: 96px;
  resize: vertical;
}
.bm-select {
  appearance: auto;
}
.bm-help {
  font-size: 12px;
  color: var(--ps-muted);
  margin-top: 5px;
}
.bm-counter {
  float: right;
  font-weight: 400;
  font-size: 12px;
  color: var(--ps-muted);
}
.bm-counter.is-over {
  color: var(--ps-red);
  font-weight: 700;
}
.bm-error-text {
  color: var(--ps-red);
  font-size: 13px;
  font-weight: 700;
  margin-top: 6px;
}
.is-invalid .bm-input,
.is-invalid .bm-textarea,
.bm-input.is-invalid {
  border-color: var(--ps-red);
  box-shadow: 0 0 0 1px var(--ps-red);
}
.bm-row-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}

/* Segmented control (answer format) */
.bm-seg {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  border: 0;
  padding: 0;
  margin: 0;
}
.bm-seg legend {
  font-weight: 700;
  color: var(--ps-navy);
  margin-bottom: 6px;
  padding: 0;
}
.bm-seg label {
  position: relative;
  cursor: pointer;
}
.bm-seg input {
  position: absolute;
  opacity: 0;
  inset: 0;
  cursor: pointer;
}
.bm-seg span {
  display: inline-block;
  padding: 8px 12px;
  background: #fff;
  border: 1px solid #b9b9c9;
  font-size: 13px;
  font-weight: 700;
  color: var(--ps-navy);
}
.bm-seg input:checked + span {
  background: var(--ps-navy);
  color: #fff;
  border-color: var(--ps-navy);
}
.bm-seg input:focus-visible + span {
  outline: 3px solid var(--ps-orange);
  outline-offset: 2px;
}

/* Options editor (list of answer options) */
.bm-opt-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.bm-opt-list li {
  display: flex;
  gap: 6px;
  margin-bottom: 6px;
  align-items: center;
}
.bm-opt-list .bm-input {
  flex: 1;
}
.bm-icon-btn {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  border: 1px solid #b9b9c9;
  background: #fff;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  color: var(--ps-navy);
}
.bm-icon-btn:hover {
  background: var(--ps-orange);
  color: #fff;
  border-color: var(--ps-orange);
}
.bm-icon-btn[disabled] {
  opacity: 0.35;
  cursor: not-allowed;
  background: #fff;
  color: var(--ps-navy);
  border-color: #b9b9c9;
}

/* ---------- Modal ---------- */
.bm-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: rgba(25, 25, 50, 0.55);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 6vh 16px;
  overflow-y: auto;
}
.bm-modal {
  background: #fff;
  width: 100%;
  max-width: 640px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.3);
  font-family: "Lato", Arial, Helvetica, sans-serif;
}
.bm-modal--sm {
  max-width: 460px;
}
.bm-modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: var(--ps-navy);
  color: #fff;
}
.bm-modal__head h2 {
  font-size: 20px;
  font-weight: 700;
  color: #fff;
  margin: 0;
  text-transform: none;
  font-family: inherit;
}
.bm-modal__close {
  background: none;
  border: 0;
  color: #fff;
  font-size: 22px;
  cursor: pointer;
  line-height: 1;
  padding: 4px 8px;
}
.bm-modal__body {
  padding: 20px;
}
.bm-modal__foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 0 20px 20px;
  flex-wrap: wrap;
}

/* ---------- Toast ---------- */
.bm-toasts {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  z-index: 9500;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
  width: max-content;
  max-width: calc(100vw - 32px);
}
.bm-toast {
  background: var(--ps-navy);
  color: #fff;
  padding: 12px 18px;
  font:
    700 14px/1.4 "Lato",
    Arial,
    sans-serif;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
  animation: bm-toast-in 0.2s ease-out;
}
.bm-toast--ok {
  border-left: 6px solid #5fc27e;
}
.bm-toast--warn {
  border-left: 6px solid var(--ps-bm);
}
@keyframes bm-toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* ---------- Results visualisation (HTML/CSS bars, no chart library) ---------- */
.bm-rpanel {
  background: var(--ps-tile);
  padding: 20px 22px;
  margin-bottom: 14px;
}
.bm-qlabel {
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ps-bm-ink);
  margin-bottom: 4px;
}
.bm-qtext {
  font-size: 18px;
  font-weight: 700;
  color: var(--ps-navy);
  line-height: 1.35;
  margin: 0 0 12px;
  font-family: "Lato", Arial, Helvetica, sans-serif;
  text-transform: none;
}
.bm-answered {
  font-size: 12px;
  color: var(--ps-muted);
  margin: -6px 0 12px;
}
.bm-bars {
  display: grid;
  grid-template-columns: minmax(90px, max-content) 1fr 48px;
  gap: 8px 12px;
  align-items: center;
}
.bm-bar__label {
  font-size: 14px;
  color: var(--ps-text);
}
.bm-bar__track {
  height: 22px;
  background: var(--ps-track);
  position: relative;
}
.bm-bar__fill {
  position: absolute;
  inset: 0 auto 0 0;
  background: var(--ps-navy);
  min-width: 2px;
}
.bm-bar--top .bm-bar__fill {
  background: var(--ps-bm);
}
.bm-bar__value {
  font-weight: 700;
  text-align: right;
  font-size: 14px;
  color: var(--ps-navy);
}
.bm-rnote {
  font-size: 12px;
  color: var(--ps-muted);
  margin-top: 10px;
}
.bm-avg {
  margin-top: 12px;
  font-size: 14px;
}
.bm-avg strong {
  color: var(--ps-navy);
  font-size: 18px;
}
.bm-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.bm-stat {
  background: #fff;
  padding: 14px;
  text-align: center;
}
.bm-stat__value {
  display: block;
  font-size: 26px;
  font-weight: 900;
  color: var(--ps-navy);
  line-height: 1.1;
}
.bm-stat__unit {
  font-size: 13px;
  color: var(--ps-muted);
}
.bm-stat__label {
  display: block;
  margin-top: 6px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ps-bm-ink);
}
.bm-stat--main .bm-stat__value {
  color: var(--ps-bm-ink);
}
.bm-quotes {
  list-style: none;
  margin: 0;
  padding: 0;
}
.bm-quotes li {
  background: #fff;
  padding: 10px 14px;
  margin-bottom: 6px;
  border-left: 4px solid var(--ps-bm);
  font-size: 14px;
}
.bm-quotes li.is-extra {
  display: none;
}
.bm-quotes.is-expanded li.is-extra {
  display: block;
}
.bm-empty-q {
  color: var(--ps-muted);
  font-style: italic;
}
@media (max-width: 560px) {
  .bm-bars {
    grid-template-columns: 1fr 48px;
  }
  .bm-bar__label {
    grid-column: 1 / -1;
    margin-bottom: -4px;
  }
  .bm-stat__value {
    font-size: 20px;
  }
}

/* ---------- Empty states ---------- */
.bm-empty {
  background: var(--ps-tile);
  padding: 32px 20px;
  text-align: center;
  color: var(--ps-muted);
}
.bm-empty p {
  margin-bottom: 14px;
}

/* ---------- Prototype navigator (not part of the product) ---------- */
.proto-fab {
  position: fixed;
  left: 16px;
  bottom: 16px;
  z-index: 9800;
  background: #1d1d2b;
  color: #ffd27a;
  border: 2px dashed #ffd27a;
  padding: 9px 14px;
  font:
    700 12px/1 system-ui,
    -apple-system,
    "Segoe UI",
    sans-serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3);
}
.proto-fab:hover {
  background: #2b2b40;
}
.proto-panel {
  position: fixed;
  left: 16px;
  bottom: 62px;
  z-index: 9800;
  width: 300px;
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 90px);
  overflow-y: auto;
  background: #1d1d2b;
  color: #e9e9f2;
  padding: 16px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.4);
  font:
    13px/1.45 system-ui,
    -apple-system,
    "Segoe UI",
    sans-serif;
  border: 2px dashed #ffd27a;
}
.proto-panel[hidden] {
  display: none;
}
.proto-panel h2 {
  font:
    700 11px/1 system-ui,
    sans-serif;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #ffd27a;
  margin: 14px 0 6px;
}
.proto-panel h2:first-child {
  margin-top: 0;
}
.proto-panel p {
  margin: 0 0 8px;
  color: #b9b9cc;
  font-size: 12px;
  line-height: 1.4;
  font-family: inherit;
}
.proto-panel ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
.proto-panel li a {
  display: block;
  color: #fff;
  text-decoration: none;
  padding: 5px 8px;
  font-size: 13px;
}
.proto-panel li a:hover,
.proto-panel li a[aria-current="page"] {
  background: #33334d;
  color: #ffd27a;
}
.proto-switch {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: #2a2a3d;
  padding: 8px 10px;
  margin-bottom: 6px;
}
.proto-switch button {
  font:
    700 12px/1 system-ui,
    sans-serif;
  padding: 7px 12px;
  border: 0;
  cursor: pointer;
}
.proto-switch .is-on {
  background: #5fc27e;
  color: #102716;
}
.proto-switch .is-off {
  background: #e46a62;
  color: #2a0b09;
}
.proto-reset {
  width: 100%;
  margin-top: 12px;
  background: transparent;
  color: #ffd27a;
  border: 1px solid #ffd27a;
  padding: 8px;
  cursor: pointer;
  font:
    700 12px/1 system-ui,
    sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.proto-reset:hover {
  background: #ffd27a;
  color: #1d1d2b;
}

/* site_core.css indents every list; Benchmark lists sit flush with the content edge. */
.bm ul.bm-list, .bm ul.bm-quotes, .bm ul.bm-opt-list, .bm ul.bm-checklist, .bm ul.bm-pick { margin: 0; padding: 0; list-style: none; }
.bm ul.bm-list > li, .bm ul.bm-quotes > li, .bm ul.bm-opt-list > li, .bm ul.bm-checklist > li, .bm ul.bm-pick > li { margin-left: 0; list-style: none; }

/* Pagination: the site's own #pagination_block links, plus a "Showing x–y of z" count */
.bm-pager { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.bm-pager #pagination_block { margin: 0; display: flex; flex-wrap: wrap; gap: 4px 0; }
.bm-pager #pagination_block a, .bm-pager #pagination_block span { cursor: pointer; }
.bm-pager__count { margin: 0 0 0 auto; font-size: 14px; color: var(--ps-muted); }
body[data-area="admin"] .bm-pager__count { color: #555; }
