/* ==========================================================================
   VIPR Guide Design -- components the theme does not style
   --------------------------------------------------------------------------
   Bootstrap 5.3.8 ships fully: nav-tabs, modal, toast, tooltip, accordion,
   spinner, offcanvas and form-range are all in the bundled CSS and JS. The
   theme (main.css) simply never styles them. So these are THEMING gaps, not
   capability gaps -- we use Bootstrap's markup, JS and ARIA wiring and only
   restyle, which keeps the keyboard and screen-reader behaviour we would
   otherwise have to reimplement and get wrong.
   ========================================================================== */

/* ------------------------------------------------------------- navbar fixup */

/* main.css hard-codes `grid-template-columns: 1fr 480px 1fr !important` for the
   middle search pill. This tool has no global search, so without this override
   the navbar keeps a 480px hole in the middle. */
.navbar-custom { grid-template-columns: 1fr auto !important; }

.navbar-context {
  display: flex; align-items: center; gap: 0.5rem;
  font-size: 0.82rem; color: var(--text-muted-green);
}
.navbar-context .bi { font-size: 0.95rem; }

/* ---------------------------------------------------------------- nav tabs */

.nav-tabs-vipr {
  border-bottom: 1px solid var(--border-light);
  gap: 0.25rem;
  flex-wrap: wrap;
}
.nav-tabs-vipr .nav-link {
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  background: transparent;
  color: var(--text-muted-green);
  font-weight: 600;
  font-size: 0.86rem;
  padding: 0.6rem 0.95rem;
  transition: color .15s, border-color .15s, background .15s;
}
.nav-tabs-vipr .nav-link:hover { color: var(--text-main); background: #F4F7F5; }
.nav-tabs-vipr .nav-link.active {
  color: var(--brand-forest-dark);
  background: transparent;
  border-bottom-color: var(--brand-lime);
}
.nav-tabs-vipr .nav-link:focus-visible { outline: 0; box-shadow: var(--focus-ring); }
.nav-tabs-vipr .nav-link .bi { margin-right: 0.35rem; }

/* ------------------------------------------------------------------- modal */

.modal-content {
  border: 0;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
}
.modal-header {
  border-bottom: 1px solid var(--border-light);
  padding: 1.25rem 1.5rem;
}
.modal-title { font-weight: 700; letter-spacing: -0.02em; }
.modal-body { padding: 1.5rem; }
.modal-footer { border-top: 1px solid var(--border-light); padding: 1rem 1.5rem; gap: 0.5rem; }
.modal-backdrop.show { background-color: #051C12; opacity: 0.55; }

/* ------------------------------------------------------------------- toast */

.toast-container { position: fixed; bottom: 1.25rem; right: 1.25rem; z-index: 1090; }
.toast {
  border: 0;
  border-left: 4px solid var(--brand-lime);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  background: #FFFFFF;
  font-size: 0.86rem;
}
.toast .toast-body { padding: 0.75rem 0.9rem; color: var(--text-main); }
.toast.toast-ok    { border-left-color: var(--sys-green); }
.toast.toast-err   { border-left-color: var(--sys-red); }
.toast.toast-warn  { border-left-color: var(--sys-orange); }

/* ----------------------------------------------------------------- tooltip */

.tooltip-inner {
  background: var(--brand-forest-dark);
  color: #FFFFFF;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  padding: 0.4rem 0.6rem;
  max-width: 22rem;
  text-align: left;
}
.tooltip.bs-tooltip-top .tooltip-arrow::before { border-top-color: var(--brand-forest-dark); }
.tooltip.bs-tooltip-bottom .tooltip-arrow::before { border-bottom-color: var(--brand-forest-dark); }
.tooltip.bs-tooltip-start .tooltip-arrow::before { border-left-color: var(--brand-forest-dark); }
.tooltip.bs-tooltip-end .tooltip-arrow::before { border-right-color: var(--brand-forest-dark); }

/* --------------------------------------------------------------- accordion */

.accordion-item { border: 1px solid var(--border-light); border-radius: var(--radius-lg) !important; margin-bottom: 0.6rem; overflow: hidden; }
.accordion-button {
  background: #FFFFFF; color: var(--text-main); font-weight: 600; font-size: 0.9rem;
  padding: 0.95rem 1.15rem; box-shadow: none;
}
.accordion-button:not(.collapsed) { background: #F6FAF2; color: var(--brand-forest-dark); box-shadow: none; }
.accordion-button:focus { box-shadow: var(--focus-ring); border-color: transparent; }
.accordion-button::after { filter: grayscale(1) brightness(0.4); }
.accordion-body { padding: 0 1.15rem 1.15rem; font-size: 0.88rem; color: var(--text-main); }

/* ------------------------------------------------------- spinner, progress */

.spinner-border { --bs-spinner-border-width: 0.18em; color: var(--brand-forest-medium); }
.progress-thin {
  height: 6px; border-radius: 999px; background: var(--border-light);
  overflow: hidden;
}
.progress-thin .progress-bar { background: var(--brand-lime); transition: width .12s linear; }

/* ------------------------------------------------------------ range slider */

.form-range-vipr { width: 100%; height: 1.4rem; background: transparent; -webkit-appearance: none; appearance: none; }
.form-range-vipr:focus { outline: 0; }
.form-range-vipr::-webkit-slider-runnable-track {
  height: 6px; border-radius: 999px;
  background: linear-gradient(to right, var(--brand-forest-medium) 0%, var(--brand-forest-medium) var(--fill, 50%), var(--border-light) var(--fill, 50%), var(--border-light) 100%);
}
.form-range-vipr::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 18px; height: 18px; margin-top: -6px;
  border-radius: 50%; background: var(--brand-lime);
  border: 2px solid var(--brand-forest-dark); cursor: pointer;
}
.form-range-vipr:focus::-webkit-slider-thumb { box-shadow: var(--focus-ring); }
.form-range-vipr::-moz-range-track { height: 6px; border-radius: 999px; background: var(--border-light); }
.form-range-vipr::-moz-range-progress { height: 6px; border-radius: 999px; background: var(--brand-forest-medium); }
.form-range-vipr::-moz-range-thumb {
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--brand-lime); border: 2px solid var(--brand-forest-dark); cursor: pointer;
}

/* The integer equivalent of a percentage threshold. Shown next to every slider,
   because ">80% of 32" is 26, not 25.6, and a user must be able to see that. */
.threshold-readout {
  font-family: var(--font-mono); font-size: 0.8rem;
  background: #F4F7F5; border: 1px solid var(--border-light);
  border-radius: var(--radius-sm); padding: 0.3rem 0.55rem;
  color: var(--text-main);
}

/* --------------------------------------------------------------- drop zone */

.dropzone {
  border: 2px dashed rgba(11, 19, 15, 0.14);
  border-radius: var(--radius-xl);
  background: #F8FAF9;
  padding: 2rem 1.5rem;
  text-align: center;
  transition: border-color .18s, background .18s;
  cursor: pointer;
}
.dropzone:hover { border-color: rgba(11, 19, 15, 0.28); }
.dropzone.is-dragover { border-color: var(--brand-lime); background: var(--brand-lime-translucent); }
.dropzone:focus-visible { outline: 0; box-shadow: var(--focus-ring); }
.dropzone-icon { font-size: 1.9rem; color: var(--text-muted-green); opacity: .65; }
.dropzone-hint { font-size: 0.8rem; color: var(--text-muted-green); }
.dropzone-file {
  display: inline-flex; align-items: center; gap: 0.5rem;
  background: #FFFFFF; border: 1px solid var(--border-light);
  border-radius: 999px; padding: 0.35rem 0.75rem; font-size: 0.82rem;
}

/* ------------------------------------------------------------------- chips */

.chip {
  display: inline-flex; align-items: center; gap: 0.3rem;
  border-radius: 999px; padding: 0.16rem 0.55rem;
  font-size: 0.7rem; font-weight: 700; letter-spacing: 0.02em;
  text-transform: uppercase; white-space: nowrap;
}
/* The published / heuristic distinction. These two must never look alike. */
.chip-published { background: var(--basis-pub-bg); color: var(--basis-pub-fg); }
.chip-heuristic { background: var(--basis-heu-bg); color: var(--basis-heu-fg); }
.chip-neutral   { background: #F1F3F2; color: var(--text-muted-green); }
.chip-system    { background: var(--brand-forest-medium); color: #FFFFFF; text-transform: none; }

/* Check status markers. Advisory items use the NEUTRAL grey variants on purpose:
   a heuristic must not render as a green tick that looks like validation. */
.status-dot-check {
  display: inline-block; width: 0.55rem; height: 0.55rem; border-radius: 50%;
  flex: 0 0 auto; margin-top: 0.42rem;
}
.status-pass .status-dot-check { background: var(--sys-green); }
.status-fail .status-dot-check { background: var(--sys-red); }
.status-warn .status-dot-check { background: var(--sys-orange); }
.status-info .status-dot-check { background: #94A3B8; }
.status-na   .status-dot-check { background: #CBD5D1; }

.check-row { display: flex; gap: 0.7rem; padding: 0.6rem 0; border-bottom: 1px dashed var(--border-light); }
.check-row:last-child { border-bottom: 0; }
.check-label { font-weight: 600; font-size: 0.86rem; }
.check-value { font-family: var(--font-mono); font-size: 0.8rem; color: var(--text-main); }
.check-detail { font-size: 0.78rem; color: var(--text-muted-green); margin-top: 0.15rem; }

/* Advisory block: visually quieter than the published block, by design. */
.advisory-panel { background: #FAFBFA; border: 1px dashed var(--border-light); border-radius: var(--radius-lg); padding: 1rem 1.15rem; }
.advisory-caption { font-size: 0.76rem; color: var(--text-muted-green); font-style: italic; }

/* ------------------------------------------------------- misc small things */

.kbd {
  font-family: var(--font-mono); font-size: 0.74rem;
  background: #F1F3F2; border: 1px solid rgba(11, 19, 15, 0.14);
  border-bottom-width: 2px; border-radius: 4px; padding: 0.05rem 0.3rem;
}
.stat-mini { display: flex; flex-direction: column; gap: 0.1rem; }
.stat-mini-label { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted-green); font-weight: 700; }
.stat-mini-value { font-size: 1.05rem; font-weight: 800; font-family: var(--font-mono); }
.empty-state { text-align: center; padding: 2.5rem 1rem; color: var(--text-muted-green); }
.copy-btn-group { display: flex; flex-wrap: wrap; gap: 0.4rem; }

/* The code block used for commands in the README-ish panels. */
.cmd {
  font-family: var(--font-mono); font-size: 0.8rem;
  background: var(--brand-forest-dark); color: #DDF7A8;
  border-radius: var(--radius-md); padding: 0.6rem 0.8rem;
  overflow-x: auto; white-space: pre;
}

/* Visible focus everywhere, since this tool is used with the keyboard a lot. */
a:focus-visible, button:focus-visible, [tabindex]:focus-visible,
.btn-custom:focus-visible, .form-control-custom:focus-visible, .form-select-custom:focus-visible {
  outline: 0 !important;
  box-shadow: var(--focus-ring) !important;
}

/* Screen-reader-only text, for the live regions that announce results. */
.visually-hidden-focusable:not(:focus):not(:focus-within) {
  position: absolute !important; width: 1px; height: 1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap;
}

/* Reserve the chrome's space so injecting it causes no layout shift. */
[data-shell="sidebar"] { display: block; }
[data-shell="navbar"] { display: block; min-height: var(--navbar-height); }
[data-shell="page-header"] { display: block; }

/* A <noscript> explanation: this tool computes everything in the browser. */
.noscript-warning {
  margin: 2rem auto; max-width: 40rem;
  border: 2px solid var(--sys-orange); border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem; background: #FFF7ED;
}

@media (max-width: 991.98px) {
  .navbar-context { display: none; }
}
