/* GenesisOS shared theme - the ONE place the brand colors and the font are defined.
   Loaded by the app (before app.css) and by the marketing site (before style.css), so the two always match:
   change a value here and both follow.

   Deliberately NOT in here: the status colors (status badges, status pills, "trend up"). Those stay in
   app.css under --bos-badge-*, because every badge color must stay clearly different from every other one,
   and the brand blue/purple/teal/green below are too close to each other for that. */
:root {
  --bos-font: Inter, system-ui, -apple-system, 'Segoe UI', sans-serif;   /* the marketing site's stack, now used by the app too */

  --bos-navy: #0d1b3e;
  --bos-navy-light: #1e2b4c;
  --bos-banner-gradient: linear-gradient(135deg, #0b1f4d, #123a8f);   /* dark-blue banner: marketing proof band, free strip, and the header of resource emails (emails cannot read variables, so mkt_email_banner() holds a copy) */
  --bos-section-gradient: linear-gradient(135deg, #0b1f4d, #123a8f 55%, #3156ff);   /* dark-blue section bars (the Add Contact / Add Property windows): the banner navy ending in the primary-button blue */
  --bos-blue: #3156ff;
  --bos-blue-light: #e8ecff;
  --bos-blue2: #5d36f6;
  --bos-purple: #7848ff;
  --bos-purple-light: #f0ebff;
  --bos-teal: #17a89b;
  --bos-teal-light: #e5f5f4;
  --bos-green: #159b73;
  --bos-green-light: #e5f4f0;
  --bos-orange: #ff9a3d;
  --bos-orange-light: #fff4ea;

  --bos-cream: #fffaf4;
  --bos-soft: #f5f9ff;
  --bos-muted: #64718a;
  --bos-border: #e4e9f2;
  --bos-surface-alt: #fafbfc;   /* the faint off-white behind table headers, summary strips and read-only panels */
  --bos-text: #1f2937;
  --bos-radius-sm: 6px;
  --bos-radius-md: 10px;
  --bos-radius-pill: 999px;

  /* The primary blue as plain numbers (for rgba() and for Bootstrap's own link variables), and the button gradient. */
  --bos-blue-rgb: 49, 86, 255;
  --bos-blue-deep: #253be2;
  --bos-blue-deep-rgb: 37, 59, 226;
  --bos-btn-gradient: linear-gradient(135deg, var(--bos-blue), var(--bos-blue-deep));
  --bos-btn-gradient-hover: linear-gradient(135deg, #274aed, #1d32cf);
  --bos-btn-shadow: 0 8px 22px rgba(var(--bos-blue-rgb), .18);
  /* The G brand mark (marketing header, app sidebar): cyan > brand blue > brand purple, with a soft blue glow. */
  --bos-brand-gradient: linear-gradient(145deg, #08b8e8, var(--bos-blue) 48%, var(--bos-purple));
  --bos-brand-shadow: 0 7px 20px rgba(var(--bos-blue-rgb), .22);
  /* Typography scale - the ONE place text sizes are defined (all rem). Shared by the app, the
     portals and the marketing site; pick the closest step instead of a new one-off value.
     xs: captions, tiny labels  |  sm: secondary text, small labels  |  base: body and card text (the default)
     md: emphasized text, subheads  |  lg: compact card titles, section headings  |  xl: card titles, KPI values
     2xl: large numbers (prices, stats)  |  3xl: price amounts.
     Marketing page titles use Bootstrap's display classes: display-3 = 4rem, home hero display-2 = 4rem (capped),
     section titles display-5 = 3rem. */
  --bos-fs-xs: 0.75rem;
  --bos-fs-sm: 0.875rem;
  --bos-fs-base: 1rem;
  --bos-fs-md: 1.125rem;
  --bos-fs-lg: 1.25rem;
  --bos-fs-xl: 1.5rem;
  --bos-fs-2xl: 2rem;
  --bos-fs-3xl: 3rem;
  --bos-btn-shadow-compact: 0 3px 10px rgba(var(--bos-blue-rgb), .22);   /* the app's smaller glow - its screens carry far more buttons than a marketing page */

  /* Bootstrap's own "blue": plain links, and everything built on Bootstrap's "primary" (text-primary, bg-primary, border-primary...), now use the brand blue. */
  --bs-primary: var(--bos-blue);
  --bs-primary-rgb: var(--bos-blue-rgb);
  --bs-link-color: var(--bos-blue);
  --bs-link-color-rgb: var(--bos-blue-rgb);
  --bs-link-hover-color: var(--bos-blue-deep);
  --bs-link-hover-color-rgb: var(--bos-blue-deep-rgb);
}

/* The "OS" in the GenesisOS wordmark (app sidebar and marketing header/footer): the same blue as the G tile. */
.brand-os { color: var(--bos-blue); }

/* Primary buttons - the marketing site's look, moved here so the app can use the very same one. */
.btn-primary { background: var(--bos-btn-gradient); border-color: transparent; box-shadow: var(--bos-btn-shadow); }
.btn-primary:hover { background: var(--bos-btn-gradient-hover); border-color: transparent; }
.btn-outline-primary { border-color: #9baeff; color: #2142dc; }
.btn-outline-primary:hover { background: #eef2ff; color: #2142dc; border-color: #6f88ff; }

/* Ticked checkboxes / radios / switches and their focus glow: brand blue instead of Bootstrap's blue. */
.form-check-input:checked,
.form-check-input[type=checkbox]:indeterminate { background-color: var(--bos-blue); border-color: var(--bos-blue); }
.form-check-input:focus { border-color: var(--bos-blue); box-shadow: 0 0 0 .25rem rgba(var(--bos-blue-rgb), .25); }

/* ===== Form controls and select styling (was genesis-forms.css; merged so the app and marketing site load one shared file) ===== */
/* GenesisOS shared form behavior - loaded by the app (before app.css) and by the marketing site (before style.css),
   so every input, textarea and dropdown looks and behaves the same on both. */

/* Applies to every placeholder in the app - inputs, textareas, search
   fields - not just specific ones, since this is a global visual
   preference, not tied to any one form or component. */
::placeholder {
  opacity: 0.4 !important;
}
::-webkit-input-placeholder {
  opacity: 0.4 !important;
}
::-moz-placeholder {
  opacity: 0.4 !important;
}
:-ms-input-placeholder {
  opacity: 0.4 !important;
}

/* Placeholder disappears while the field is focused (being actively
   clicked into/typed in), and reappears on its own once focus moves
   away - :focus already reverts automatically on blur, so this needs
   no JS at all despite the show/hide behavior. */
:focus::placeholder {
  opacity: 0 !important;
}
:focus::-webkit-input-placeholder {
  opacity: 0 !important;
}
:focus::-moz-placeholder {
  opacity: 0 !important;
}
:focus:-ms-input-placeholder {
  opacity: 0 !important;
}


/* Custom-styled replacement for every native <select> - see initCustomSelects() in genesis-select.js.
   Sized/bordered to match Bootstrap's own .form-select/.form-control look. */
.bos-custom-select {
  position: relative;
}
.bos-custom-select-trigger {
  width: 100%;
  text-align: left;
  background: #fff;
  border: 1px solid var(--bos-border);
  border-radius: var(--bos-radius-sm);
  padding: 0.375rem 2.25rem 0.375rem 0.75rem;
  font-size: var(--bos-fs-base);
  font-family: inherit;
  color: var(--bos-text);
  position: relative;
  cursor: pointer;
  /* A plain <button> can still carry browser/OS-specific default
     appearance (shadows, outlines, rendering quirks) even with an
     explicit border set - a native <input>/<select> never has to
     contend with this. Resetting it here is what makes the two
     genuinely match, rather than merely specifying the same border
     values on paper. */
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  box-shadow: none;
}
/* A custom-select trigger used for a check-style field (the payee picker on Add/Edit Transaction,
   see .js-payee-select) needs to look exactly like the plain .bos-check-line-input fields next to
   it - an underline only, no box - but .bos-custom-select-trigger's own white background/full
   border above (same specificity, later in this file, so it normally wins) was overriding that.
   Scoped to this one combination so every other custom-select trigger elsewhere in the app keeps
   its normal boxed look untouched. */
.bos-custom-select-trigger.bos-check-line-input {
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--bos-text);
  border-radius: 0;
  padding-bottom: 9px;
}
.bos-custom-select-trigger.bos-check-line-input:focus {
  border-bottom-color: var(--bos-blue);
  box-shadow: none;
}
.bos-custom-select-sizer {
  display: block;
  height: 0;
  overflow: hidden;
  visibility: hidden;
}
.bos-custom-select-sizer > span {
  display: block;
  white-space: nowrap;
}
.bos-custom-select-trigger-text {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bos-custom-select-trigger::after {
  content: "";
  position: absolute;
  right: 0.75rem;
  top: 50%;
  width: 10px;
  height: 10px;
  transform: translateY(-65%) rotate(45deg);
  border-right: 2px solid #666;
  border-bottom: 2px solid #666;
  pointer-events: none;
}
.bos-custom-select-trigger:focus {
  outline: none;
  border-color: var(--bos-blue);
  box-shadow: 0 0 0 0.2rem var(--bos-blue-light);
}
.bos-custom-select-disabled .bos-custom-select-trigger {
  background: #e9ecef;
  cursor: not-allowed;
  opacity: 0.75;
}
/* Matches the same placeholder look every native
   ::placeholder gets (see the global rule near the top of this file) -
   the custom trigger is a styled div/button standing in for a real
   <select>, so it never inherited that behavior on its own. Only
   applies when the trigger is currently showing the placeholder-like
   empty-value option (see the is-placeholder class in
   initCustomSelects()), never a real selected value. */
.bos-custom-select-trigger.is-placeholder .bos-custom-select-trigger-text {
  opacity: 0.4;
}
/* The panel is what's actually shown/positioned/moved to <body> now (see initCustomSelects()) -
   wraps the optional search box and the option list together as one unit, so they move and
   position as a pair instead of the search box being left behind while only the list relocates. */
.bos-custom-select-panel {
  display: none;
  position: absolute;
  top: calc(100% + 2px);
  left: 0;
  z-index: 2000;
  min-width: 100%;
  width: max-content;
  max-width: 90vw;
  background: #fff;
  border: 1px solid var(--bos-border);
  border-radius: var(--bos-radius-sm);
  box-shadow: 0 4px 12px rgba(15, 23, 41, 0.12);
}
.bos-custom-select-panel.show {
  display: block;
}
.bos-custom-select-search {
  display: block;
  width: 100%;
  box-sizing: border-box;
  border: none;
  border-bottom: 1px solid var(--bos-border);
  border-radius: var(--bos-radius-sm) var(--bos-radius-sm) 0 0;
  padding: 0.5rem 0.75rem;
  font-size: var(--bos-fs-base);
  font-family: inherit;
  color: var(--bos-text);
}
.bos-custom-select-search:focus {
  outline: none;
  background: var(--bos-blue-light);
}
/* The app's global :focus::placeholder rule (near the top of this file) hides a placeholder the
   instant its input is focused - correct for a normal field, which the person clicked into
   themselves, so they already saw the hint first. This search box auto-focuses itself the moment
   the dropdown opens (see initCustomSelects() in app.js), before the person has had any chance to
   read it - so that global rule was hiding "Search..." before anyone could ever actually see it.
   Overridden here, narrowly, so this one input keeps its placeholder visible while focused; every
   other input in the app keeps the original hide-on-focus behavior untouched. */
.bos-custom-select-search:focus::placeholder {
  opacity: 0.4 !important;
}
.bos-custom-select-search:focus::-webkit-input-placeholder {
  opacity: 0.4 !important;
}
.bos-custom-select-search:focus::-moz-placeholder {
  opacity: 0.4 !important;
}
.bos-custom-select-search:focus:-ms-input-placeholder {
  opacity: 0.4 !important;
}
.bos-custom-select-list {
  max-height: 240px;
  overflow-y: auto;
  margin: 0;
  padding: 4px 0;
  list-style: none;
}
.bos-custom-select-empty {
  padding: 0.5rem 0.75rem;
  font-size: var(--bos-fs-base);
  color: var(--bos-muted);
  cursor: default;
}
/* One per <optgroup> (see genesis-select.js's buildList()) - a plain, non-pickable heading, matching how a
   native <select> renders an optgroup's own label: bold, muted, no hover/active state of its own. Styled
   as a clear section header (accent bar + color + shaded band), not just a bold row, so it doesn't read
   as a pickable option at a glance - the plain bold-text version used to blend in with the real choices
   below it. */
.bos-custom-select-group-label {
  padding: 0.45rem 0.75rem 0.3rem 0.6rem;
  margin: 0.25rem 0 0;
  font-size: var(--bos-fs-sm);
  font-weight: 700;
  letter-spacing: .03em;
  color: var(--bos-blue);
  background: var(--bos-surface-alt);
  border-left: 3px solid var(--bos-blue);
  cursor: default;
  white-space: nowrap;
}
.bos-custom-select-group-label:first-child {
  margin-top: 0;
}
.bos-custom-select-option {
  padding: 0.5rem 0.75rem;
  font-size: var(--bos-fs-base);
  cursor: pointer;
  white-space: nowrap;
}
/* Every option that belongs to a visible <optgroup> (set in genesis-select.js's buildList()) - indented
   under its group label so the grouping reads structurally, not just by the label's own styling. */
.bos-custom-select-option.is-grouped {
  padding-left: 1.5rem;
}
.bos-custom-select-option:hover,
.bos-custom-select-option:focus {
  background: var(--bos-blue-light);
  outline: none;
}
/* The empty-value choice ("— None —", "Choose...") reads like every other placeholder: same faded look as the trigger's .is-placeholder text. */
.bos-custom-select-option.is-empty-option {
  opacity: 0.4;
}
/* A disabled <option>: greyed out, no hover, cannot be clicked. */
.bos-custom-select-option.is-disabled {
  color: #9aa1ad;
  cursor: not-allowed;
}
.bos-custom-select-option.is-disabled:hover {
  background: transparent;
}
.bos-custom-select-option.active {
  font-weight: 600;
  color: var(--bos-blue);
}
.bos-custom-select-option.is-empty-option.active {
  font-weight: 400;
  color: inherit;
}


/* Flash messages (see showAjaxFlash in app.js on the app, showFormToast in assets/js/app.js on the marketing site; shared by both). Everyday messages: small centered card that fades after ~5s.
   Errors: full-width banner under the page header that stays until closed. */
.bos-flash, .bos-flash-error { display: flex; align-items: flex-start; gap: 12px; font-size: var(--bos-fs-base); color: var(--bos-navy); transition: opacity .3s ease; }
.bos-flash { position: fixed; top: 24px; transform: translateX(-50%); z-index: 2000; width: min(420px, calc(100vw - 32px)); padding: 14px 14px 17px; background: #fff; border: 1px solid var(--bos-border); border-radius: 12px; box-shadow: 0 12px 32px rgba(13, 27, 62, .18); overflow: hidden; }
.bos-flash .bos-flash-icon { color: var(--bos-green); font-size: 1.25rem; line-height: 1.2; }
.bos-flash .bos-flash-text { flex: 1; min-width: 0; padding-right: .5rem; }
.bos-flash .bos-flash-close { color: #98a2b3; }
.bos-flash-bar { position: absolute; left: 0; bottom: 0; height: 3px; width: 100%; background: var(--bos-green); }
.bos-flash-error { position: fixed; z-index: 2000; padding: 12px 24px; background: #fdecee; border-bottom: 1px solid #f6c6cb; color: #8a1c28; }
.bos-flash-error .bos-flash-icon { color: var(--bs-danger, #dc3545); font-size: 1.125rem; line-height: 1.4; }
.bos-flash-error .bos-flash-text { flex: 1; min-width: 0; }
.bos-flash-close { background: none; border: 0; padding: 0 0 0 .5rem; color: inherit; opacity: .6; line-height: 1.4; }
.bos-flash-close:hover { opacity: 1; }
.bos-flash-out { opacity: 0; }
