/* =============================================================================
   ui-visibility-fix.css  — GLOBAL VISIBILITY-ONLY OVERRIDES
   Loaded LAST on every page. Fixes white-on-white text, invisible/faded buttons,
   hover/focus/active states, hidden placeholders, and cut quantity numbers.

   RULES OF THIS FILE:
   - Visibility / contrast / state colors ONLY. No layout, spacing-redesign,
     fonts, or geometry changes.
   - Class-scoped selectors only — NO blanket `button{}` / `input{}` colour/bg
     that would repaint intentional secondary/ghost styles.
   - Colour/background rules that assume a light surface are scoped to
     `html:not(.viya-dv)` so dark mode (dark.css) is never broken.
   - Blue = #2563eb, hover #1d4ed8, disabled bg #e5e7eb / text #64748b.
   To revert everything: remove the single <link> to this file.
   ============================================================================= */

/* 1. PRIMARY BUTTONS — blue in every interactive state, grey only when disabled.
      (Blue in both light & dark mode.) */
.btn-primary, .btn.btn-primary, button.btn-primary,
.btn-primary:hover, .btn.btn-primary:hover,
.btn-primary:focus, .btn.btn-primary:focus,
.btn-primary:active, .btn.btn-primary:active,
.btn-primary:focus-visible, .btn.btn-primary:focus-visible {
  background: #2563eb !important;
  color: #ffffff !important;
  border-color: #2563eb !important;
  opacity: 1 !important;
}
.btn-primary:hover:not(:disabled), .btn.btn-primary:hover:not(:disabled) {
  background: #1d4ed8 !important;
  border-color: #1d4ed8 !important;
}
.btn-primary:disabled, .btn.btn-primary:disabled,
.btn-primary[disabled], .btn.btn-primary[disabled],
.btn-primary.disabled, .btn.btn-primary.disabled {
  background: #e5e7eb !important;
  color: #64748b !important;
  border-color: #e5e7eb !important;
  opacity: 1 !important;
}
/* Tabler icons inside primary buttons use currentColor → keep them white/grey too */
.btn-primary > i, .btn.btn-primary > i,
.btn-primary > .ti, .btn.btn-primary > .ti { color: inherit !important; }

/* 1b. ADD / SAVE / QUICK-ADD buttons (the primary-action classes used across the
       app) — same blue treatment so they can never render white/invisible. */
.btn-save, .btn-add, .qa-add-btn, #qaAddBtn, .wave-save, .quick-add-btn,
.btn-save:hover, .btn-add:hover, .qa-add-btn:hover, #qaAddBtn:hover, .wave-save:hover, .quick-add-btn:hover,
.btn-save:focus, .btn-add:focus, .qa-add-btn:focus, #qaAddBtn:focus, .wave-save:focus, .quick-add-btn:focus,
.btn-save:active, .btn-add:active, .qa-add-btn:active, #qaAddBtn:active, .wave-save:active, .quick-add-btn:active {
  background: #2563eb !important;
  color: #ffffff !important;
  border-color: #2563eb !important;
  opacity: 1 !important;
}
.btn-save:hover:not(:disabled), .btn-add:hover:not(:disabled), .qa-add-btn:hover:not(:disabled),
#qaAddBtn:hover:not(:disabled), .wave-save:hover:not(:disabled), .quick-add-btn:hover:not(:disabled) {
  background: #1d4ed8 !important;
  border-color: #1d4ed8 !important;
}
.btn-save:disabled, .btn-add:disabled, .qa-add-btn:disabled, #qaAddBtn:disabled,
.wave-save:disabled, .quick-add-btn:disabled,
.btn-save[disabled], .btn-add[disabled], .qa-add-btn[disabled], #qaAddBtn[disabled] {
  background: #e5e7eb !important;
  color: #64748b !important;
  border-color: #e5e7eb !important;
  opacity: 1 !important;
}

/* 2. ICON BUTTONS — never invisible. A bare icon button must not be white-on-white.
      Only sets a readable colour when the button has NO explicit text colour. */
.icon-btn:not([style*="color"]),
.act-btn:not([style*="color"]) { color: #334155; }

/* 3. INPUTS / SEARCH — readable dark text + visible placeholder (light mode only;
      dark.css owns dark-mode inputs). Backgrounds/borders left to page design. */
html:not(.viya-dv) input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]),
html:not(.viya-dv) textarea,
html:not(.viya-dv) select { color: #0f172a !important; }
input::placeholder, textarea::placeholder { color: #64748b !important; opacity: 1 !important; }
input::-webkit-input-placeholder, textarea::-webkit-input-placeholder { color: #64748b !important; opacity: 1 !important; }
/* So a truly unstyled input is never a blank white box. `:where()` gives this ZERO
   specificity, so ANY page rule (even a bare `input{}`) overrides it — it only
   fills the gap where the page sets no border/background. Light mode only. */
:where(html:not(.viya-dv)) input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):not([type="hidden"]):not([type="file"]),
:where(html:not(.viya-dv)) textarea,
:where(html:not(.viya-dv)) select {
  background-color: #ffffff;
  border: 1px solid #dbe3f0;
}

/* 4. QUANTITY CONTROLS — number always visible, never cut (fits 1–3 digits). */
.qty-val, .qa-qty-val, input.qty-input, input.qty-value, .gas-qty-control .qty-value, .gas-qty-control .qty-val {
  min-width: 48px !important;
  max-width: none !important;
  overflow: visible !important;
  text-overflow: clip !important;
  text-align: center;
  -webkit-text-fill-color: #0f172a;
}
html:not(.viya-dv) .qty-val, html:not(.viya-dv) .qa-qty-val,
html:not(.viya-dv) input.qty-input { color: #0f172a !important; }

/* 5. TABS — inactive tabs stay dark/readable (not faded). Active-tab styling is
      left to each page (usually a blue pill). Light mode only. */
html:not(.viya-dv) .td-tab:not(.active),
html:not(.viya-dv) .tab:not(.active),
html:not(.viya-dv) .trip-tab:not(.active),
html:not(.viya-dv) .tab-line:not(.active) { color: #334155 !important; }

/* 7. TABLE / ACTION DROPDOWNS — visible item text on white menus (light mode). */
html:not(.viya-dv) .dd-menu, html:not(.viya-dv) .more-menu,
html:not(.viya-dv) .td-row-menu, html:not(.viya-dv) .action-menu,
html:not(.viya-dv) .inv-action-menu { background: #ffffff !important; }
html:not(.viya-dv) .dd-item,
html:not(.viya-dv) .more-menu button, html:not(.viya-dv) .more-menu a,
html:not(.viya-dv) .td-row-menu button, html:not(.viya-dv) .td-row-menu a,
html:not(.viya-dv) .action-menu button, html:not(.viya-dv) .action-item,
html:not(.viya-dv) .inv-action-menu button, html:not(.viya-dv) .inv-action-menu a {
  color: #0f172a !important;
}
/* keep danger/delete items red, not forced dark */
html:not(.viya-dv) .dd-item.danger, html:not(.viya-dv) .dd-item.delete,
html:not(.viya-dv) .more-menu .danger, html:not(.viya-dv) .td-row-menu .danger {
  color: #dc2626 !important;
}
