/* ========================================
   Redesign form controls — shell-level
   Loaded with marketing / catalog so native
   checkboxes, selects, scrollbars, and helper
   text don’t flash light-theme chrome.
   Scope: body.tbp-marketing | body.tbp-catalog
   ======================================== */

body.tbp-marketing,
body.tbp-catalog {
  color-scheme: dark;
  accent-color: var(--gray);
}

/* Helper / muted copy — beat marketing inherit hammers
   (body.tbp-marketing:not(.tbp-catalog) .small|p|… { color: inherit !important }) */
body.tbp-marketing:not(.tbp-catalog) .form-text,
body.tbp-marketing:not(.tbp-catalog) .text-muted,
body.tbp-marketing:not(.tbp-catalog) .small,
body.tbp-marketing:not(.tbp-catalog) p.auth-page__lede,
body.tbp-marketing:not(.tbp-catalog) p.auth-page__assure,
body.tbp-marketing:not(.tbp-catalog) p.auth-page__oauth-label,
body.tbp-marketing:not(.tbp-catalog) p.auth-page__links,
body.tbp-marketing .form-text,
body.tbp-marketing .text-muted,
body.tbp-marketing .small,
body.tbp-marketing .auth-page__lede,
body.tbp-marketing .auth-page__assure,
body.tbp-marketing .auth-page__oauth-label,
body.tbp-marketing .auth-page__links,
body.tbp-catalog .form-text,
body.tbp-catalog .text-muted,
body.tbp-catalog .small,
body.tbp-catalog .auth-page__lede,
body.tbp-catalog .auth-page__assure,
body.tbp-catalog .auth-page__oauth-label,
body.tbp-catalog .auth-page__links {
  color: var(--muted) !important;
}

body.tbp-marketing:not(.tbp-catalog) .auth-page__links a,
body.tbp-marketing .auth-page__links a,
body.tbp-catalog .auth-page__links a {
  color: var(--gray) !important;
}

body.tbp-marketing:not(.tbp-catalog) .auth-page__links a:hover,
body.tbp-marketing .auth-page__links a:hover,
body.tbp-catalog .auth-page__links a:hover {
  color: var(--text) !important;
}

/* Field labels — same as catalog filters / document forms (--gray, not body --text) */
body.tbp-marketing .form-label,
body.tbp-marketing .col-form-label,
body.tbp-marketing .form-check-label,
body.tbp-catalog .form-label,
body.tbp-catalog .col-form-label,
body.tbp-catalog .form-check-label {
  color: var(--gray) !important;
}

body.tbp-marketing .form-text a,
body.tbp-catalog .form-text a {
  color: var(--gray) !important;
}

/* Soft info/success alerts — beat marketing div inherit → --text */
body.tbp-marketing:not(.tbp-catalog) div.alert-primary,
body.tbp-marketing:not(.tbp-catalog) div.alert-info,
body.tbp-marketing:not(.tbp-catalog) div.alert-success,
body.tbp-marketing .alert-primary,
body.tbp-marketing .alert-info,
body.tbp-marketing .alert-success,
body.tbp-catalog .alert-primary,
body.tbp-catalog .alert-info,
body.tbp-catalog .alert-success {
  color: var(--muted) !important;
}

body.tbp-marketing:not(.tbp-catalog) .alert-primary strong,
body.tbp-marketing:not(.tbp-catalog) .alert-info strong,
body.tbp-marketing:not(.tbp-catalog) .alert-success strong,
body.tbp-marketing .alert-primary strong,
body.tbp-marketing .alert-info strong,
body.tbp-marketing .alert-success strong,
body.tbp-catalog .alert-primary strong,
body.tbp-catalog .alert-info strong,
body.tbp-catalog .alert-success strong {
  color: var(--gray) !important;
}

body.tbp-marketing .form-text a:hover,
body.tbp-catalog .form-text a:hover {
  color: var(--text) !important;
}

body.tbp-marketing .form-text strong,
body.tbp-catalog .form-text strong {
  color: var(--gray) !important;
  font-weight: 600;
}

/* Text / search / textarea */
body.tbp-marketing input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]),
body.tbp-marketing textarea,
body.tbp-marketing .form-control,
body.tbp-catalog input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]),
body.tbp-catalog textarea,
body.tbp-catalog .form-control {
  color-scheme: dark;
  background-color: var(--panel-bg) !important;
  color: var(--text) !important;
  border: var(--border-width) solid var(--border-hover) !important;
  border-radius: var(--radius-sm);
}

body.tbp-marketing input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]):focus,
body.tbp-marketing textarea:focus,
body.tbp-marketing .form-control:focus,
body.tbp-catalog input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]):focus,
body.tbp-catalog textarea:focus,
body.tbp-catalog .form-control:focus {
  outline: none;
  background-color: var(--panel-bg) !important;
  border-color: var(--gray) !important;
  color: var(--text) !important;
  box-shadow: none !important;
}

body.tbp-marketing input::placeholder,
body.tbp-marketing textarea::placeholder,
body.tbp-marketing .form-control::placeholder,
body.tbp-catalog input::placeholder,
body.tbp-catalog textarea::placeholder,
body.tbp-catalog .form-control::placeholder {
  color: var(--muted);
  opacity: 1;
}

/* Selects — control + options muted */
body.tbp-marketing select,
body.tbp-marketing .form-select,
body.tbp-catalog select,
body.tbp-catalog .form-select {
  color-scheme: dark;
  background-color: var(--panel-bg);
  color: var(--gray);
  border: var(--panel-border);
  border-radius: var(--radius-sm);
}

body.tbp-marketing select:focus,
body.tbp-marketing .form-select:focus,
body.tbp-catalog select:focus,
body.tbp-catalog .form-select:focus {
  outline: none;
  border-color: var(--gray);
  box-shadow: none;
}

body.tbp-marketing select option,
body.tbp-catalog select option {
  background-color: var(--panel-bg);
  color: var(--muted);
}

body.tbp-marketing select option:checked,
body.tbp-catalog select option:checked {
  background-color: var(--panel-bg-muted);
  color: var(--muted);
}

/* Native + Bootstrap checkboxes / radios */
body.tbp-marketing input[type="checkbox"],
body.tbp-marketing input[type="radio"],
body.tbp-catalog input[type="checkbox"],
body.tbp-catalog input[type="radio"],
body.tbp-marketing .form-check-input,
body.tbp-catalog .form-check-input {
  color-scheme: dark;
  accent-color: var(--gray);
  background-color: var(--panel-bg);
  border-color: var(--border-hover);
}

body.tbp-marketing .form-check-input:checked,
body.tbp-catalog .form-check-input:checked {
  background-color: var(--gray);
  border-color: var(--gray);
}

body.tbp-marketing .form-check-input:focus,
body.tbp-catalog .form-check-input:focus {
  border-color: var(--gray);
  box-shadow: 0 0 0 0.2rem var(--solo-dim);
}

/* Scrollbars (WebKit) — selects, filter panes, list areas */
body.tbp-marketing *,
body.tbp-catalog * {
  scrollbar-width: thin;
  scrollbar-color: var(--border) var(--surface);
}

body.tbp-marketing *::-webkit-scrollbar,
body.tbp-catalog *::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

body.tbp-marketing *::-webkit-scrollbar-track,
body.tbp-catalog *::-webkit-scrollbar-track {
  background: var(--surface);
}

body.tbp-marketing *::-webkit-scrollbar-thumb,
body.tbp-catalog *::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: var(--radius-pill);
  border: 2px solid var(--surface);
}

body.tbp-marketing *::-webkit-scrollbar-thumb:hover,
body.tbp-catalog *::-webkit-scrollbar-thumb:hover {
  background: var(--gray);
}
