/*
 * base.css — Reset, CSS variables, typography, global elements
 *
 * Accounting palette (colors sourced from common.css), pvm-style token structure.
 */

/* ─── Fonts ──────────────────────────────────────────────────────────────── */

@font-face {
  font-family: 'Inter';
  src: url('../fonts/InterVariable.ttf') format('truetype');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

/* ─── Custom Properties ─────────────────────────────────────────────────── */

:root {
  /* Hint to browser this is a light document (native form controls, scrollbars). */
  color-scheme: light;

  /* Colors — accounting defaults (calibrated: off-pure for designed feel) */
  --color-bg:               #fbfbfc;   /* warm near-white, cuts glare vs pure #fff */
  --color-text:             #1a1d22;   /* ink black — gentler than #000, still reads as black */
  --color-text-soft:        #2a2f37;
  --color-nav-bg:           #69c;
  --color-nav-text:         #ffffff;
  --color-nav-hover:        rgba(255, 255, 255, 0.8);
  --color-nav-hover-text:   #1a1d22;
  --color-accent:           #69c;       /* accounting brand — kept */
  --color-accent-hover:     #5a8fb2;
  --color-accent-text:      #ffffff;

  /* Link text — match body text. Accent reserved for interactive
     affordances (focus ring, active tab, pagination hover), not body links. */
  --color-link:             #1a1d22;
  --color-muted:            #5a6470;   /* readable gray, lighter than your #3f3e3e */
  --color-muted-light:      #9aa3ad;
  --color-muted-lighter:    #d8dde3;
  --color-border:           #2a2f37;   /* charcoal, not pure #000 — softer rules */
  --color-border-soft:      #d8dde3;   /* cooler tint than #ccc */
  --color-divider-heavy:    #2a2f37;   /* heavy section divider on report rows */
  --color-divider-thin:     #d8dde3;   /* thin section divider on report rows */
  --tooltip-bg:             rgba(0, 0, 0, 0.85);
  --tooltip-text:           #ffffff;
  --shadow-card:            0 1px 2px rgba(0, 0, 0, 0.04), 0 1px 3px rgba(0, 0, 0, 0.06);
  --shadow-card-hover:      0 4px 12px rgba(0, 0, 0, 0.08), 0 2px 4px rgba(0, 0, 0, 0.06);
  --color-row-hover:        #e2e8f0;
  --color-badge-bg:         rgba(84, 84, 84, 0.8);

  /* Form fields — text inputs, selects, textareas. Light defaults; dark
     overrides in main.dark.css. Lets the dark theme drop its !important
     override block. Checkbox/radio drive off these too. */
  --input-bg:               #ffffff;
  --input-fg:               #1a1d22;
  --input-border:           #d8dde3;

  /* Button semantic palette — consumed by .btn-{danger,success,warning,dark}
     in components/widgets.css. Dark theme rebinds the base/-hover tokens;
     glow stays as a transparent halo so it works on either bg. */
  --color-danger:             #dc2626;
  --color-danger-hover:       #b91c1c;
  --color-danger-glow:        rgba(220, 38, 38, 0.30);
  --color-success-strong:     #16a34a;
  --color-success-strong-hov: #15803d;
  --color-success-glow:       rgba(22, 163, 74, 0.30);
  --color-warning-strong:     #f59e0b;
  --color-warning-strong-hov: #d97706;
  --color-warning-glow:       rgba(245, 158, 11, 0.30);
  --color-dark-strong:        #1f2937;
  --color-dark-strong-hover:  #111827;
  --color-dark-glow:          rgba(31, 41, 55, 0.30);
  --color-heading-bg:       #f1f3f6;   /* cooler tint, pairs with #69c accent */
  --color-heading-text:     #1a1d22;
  --color-subheading:       #334155;
  --color-focus-ring:       #69c;
  --color-focus-ring-soft:  rgba(102, 153, 204, 0.25);

  /* Hover / keyboard-selection states for dropdown lists, autocomplete,
     menus. One pair, used by combobox.css and any other list-like surface.
     Light: hover = soft slate band, selection = brand blue. */
  --color-hover-bg:         #8abef3;
  --color-hover-text:       #1a1d22;
  --color-selection-bg:     #69c;
  --color-selection-text:   #ffffff;

  /* Row colors */
  --color-row-alt-light:    #efefef;  /* alternating-row light */
  --color-row-alt-dark:     #dcdcdc;  /* alternating-row dark */
  --color-row-even:         #edf2f7;  /* ColGroupLight */
  --color-row-alt:          #dce6ef;  /* ColGroupDark */
  --color-quick-add:        #cff0d4;
  --color-quick-filter:     #f0eecf;
  --color-filter-bg:        #f2f9fd;

  /* Semantic row pairs (from .purpleRow/.blueRow/.redRow/.orangeRow/.yellowRow/.greenRow) */
  --row-purple-even: #E8F;  --row-purple-odd: #D7F;
  --row-blue-even:   #7DF;  --row-blue-odd:   #6CF;
  --row-red-even:    #FAA;  --row-red-odd:    #F98;
  --row-orange-even: #FD7;  --row-orange-odd: #FC6;
  --row-yellow-even: #FF5;  --row-yellow-odd: #FF8;
  --row-green-even:  #CFB;  --row-green-odd:  #AFA;

  /* Alert backgrounds */
  --color-notice-bg:        #e1ebf5;  --color-notice-border:  #b5d4fe;
  --color-warning-bg:       #fff7c0;  --color-warning-border: #f7d229;
  --color-error-bg:         #ffc7c0;  --color-error-border:   #f07070;
  --color-success-bg:       #dff0d8;  --color-success-border: #29f733;
  --color-bank-balance:     #0008FF;

  /* Validation / upload states */
  --color-required:         #f07070;
  --color-warn-border:      #f7d229;
  --color-upload:           #6c3;
  --color-upload-light:     #cfc;
  --color-pass-1:           #f00;
  --color-pass-3:           #f93;
  --color-pass-4:           #6f6;
  --color-pass-6:           #6c3;

  /* Typography — keep accounting's current system font stack for Classic familiarity;
     Inter is used only when a page wants the modern look via explicit rule. */
  --font-base:              'Inter', system-ui, 'Segoe UI', verdana, arial, helvetica, sans-serif;
  --font-heading:           'Inter', 'Segoe UI', verdana, arial, helvetica, sans-serif;
  --font-size-base:         10pt;
  --font-size-sm:           9pt;
  --font-size-xs:           8pt;
  --font-size-h2:           14pt;
  --font-size-h3:           12pt;
  --font-size-h4:           11pt;

  /* Layout */
  --page-max-width:        1200px;
  --sidebar-width:         150px;

  /* Form field widths (fixed values, match common.css conventions) */
  --field-checkgap:         18px;
  --field-third:            50px;
  --field-half:             75px;
  --field-twothirds:       100px;
  --field-single:          150px;
  --field-onepointfive:    225px;
  --field-double:          300px;
  --field-triple:          450px;
  --field-quadruple:       600px;

  /* Border radius */
  --radius-sm:              0.25rem;
  --radius:                 0.375rem;
  --radius-md:              0.5rem;
  --radius-lg:              0.75rem;

  /* Spacing */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
}

/* ─── Box Sizing ─────────────────────────────────────────────────────────── */

*,
*::before,
*::after {
  box-sizing: border-box;
}

/* ─── Reset ──────────────────────────────────────────────────────────────── */

html, body {
  height: 100%;
  border: 0;
  margin: 0;
  padding: 0;
  position: relative;
}

body {
  background-color: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-base);
  font-size: var(--font-size-base);
  line-height: 1.4;
}

/* ─── Form Field Defaults ────────────────────────────────────────────────── */
/* Low-specificity base for every text input, select, textarea — themed via
   --input-* tokens. Lets main.dark.css drop its !important override block:
   theme switches just rebind the tokens at :root. Button-type inputs,
   checkbox/radio, file, and hidden are excluded — they have their own
   styling rules in forms.css. */

input:not(:where([type=submit], [type=button], [type=reset], [type=checkbox], [type=radio], [type=file], [type=hidden])),
select,
textarea {
  background-color: var(--input-bg);
  color: var(--input-fg);
  border-color: var(--input-border);
}

/* ─── Tables ─────────────────────────────────────────────────────────────── */

table {
  border-collapse: collapse;
}

/* Financial report frozen header + section separators (theme-aware) */
/* jquery.float.js clones thead and strips .float, so match FinancialHead alone */
table thead.FinancialHead {
  background: var(--color-bg);
  border-bottom: 2px solid var(--color-divider-heavy);
}
td.FinancialSubtotal { border-top: 1px solid var(--color-divider-thin); }
td.FinancialTotal    { border-top: 2px solid var(--color-divider-heavy); }

/* Nursery order shipping popover */
.shipFloater {
  z-index: 90000;
  position: absolute;
}
.shipFloater.FloatingFloater {
  z-index: 90001;
}
.shipFloat {
  border: 2px solid var(--color-border);
  background: var(--color-bg);
  display: none;
  -webkit-box-shadow: var(--shadow-card);
          box-shadow: var(--shadow-card);
}

/* ─── Links ──────────────────────────────────────────────────────────────── */

a {
  color: var(--color-link);
  text-decoration: underline;
  font-weight: 500;
}
a:hover,
a:active {
  text-decoration: none;
}
a:focus-visible {
  outline: 2px solid var(--color-focus-ring);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* ─── Typography ─────────────────────────────────────────────────────────── */

div.content h2 {
  clear: both;
  margin: 0 -10px 8px;
  font-size: var(--font-size-h2);
  color: var(--color-text);
  background: var(--color-heading-bg);
  padding: 8px 10px 8px 20px;
  border-bottom: 2px solid var(--color-accent);
  border-radius: 0;
}
div.content h2:after {
  content: '.';
  clear: both;
  display: block;
  height: 0;
  text-indent: -9999em;
}
div.content h2 span.Notes,
div.content h2 span.notes {
  color: var(--color-muted-lighter);
  padding-left: 10px;
  font-size: var(--font-size-sm);
  font-weight: normal;
  font-style: italic;
}
div.content h2 span.Notes select {
  color: var(--color-muted-lighter);
  font-style: italic;
}
div.content h2 span.Notes.Dark,
div.content h2 span.Notes.Dark select {
  color: var(--color-muted);
}

div.content h2 span.HasLinks {
  float: left;
}
div.content h2 br {
  clear: both;
}

div.content h3,
div.content h4 {
  clear: both;
  font-family: var(--font-heading);
}
div.content h3 {
  padding-left: 10px;
  font-size: var(--font-size-h3);
  font-weight: bold;
  color: var(--color-heading-text);
  border-bottom: 1px solid var(--color-muted-light);
  margin-top: 10px;
  margin-bottom: 5px;
}
div.content h4 {
  font-weight: normal;
  padding-left: 20px;
  color: var(--color-subheading);
  font-size: var(--font-size-h4);
}
div.content h5 { padding-left: 25px; }
div.content h6 { padding-left: 30px; }

div.content h3.light,
div.content h4.light {
  color: #f5a77d;
}
div.content h3 span.notes,
div.content h4 span.notes {
  color: var(--color-muted-light);
  padding-left: 10px;
  font-size: 12px;
  font-weight: normal;
  font-style: italic;
}
div.content h3 span.notes.right,
div.content h4 span.notes.right {
  float: right;
}
div.content h3 span.star {
  font-weight: bold;
  font-size: 32px;
  line-height: 11px;
  vertical-align: bottom;
  margin-left: -10px;
  margin-right: 5px;
  color: #6E7649;
}
div.content h3.collapse,
div.content h4.collapse {
  cursor: pointer;
  background: url('../../../images/control_down.png') center left no-repeat;
  padding-left: 25px;
  margin-left: -5px;
}
div.content h3.collapse.up,
div.content h4.collapse.up {
  background: url('../../../images/control_right.png') center left no-repeat;
}
div.content h3.single {
  padding-left: var(--sidebar-width);
  margin-top: 10px;
  margin-bottom: 4px;
}
div.content h2.collapse {
  cursor: pointer;
  background: url('../../../images/control_down.png') 8px center no-repeat;
  padding-left: 28px;
  margin-left: -10px;
}
div.content h2.collapse.up {
  background: url('../../../images/control_right.png') 8px center no-repeat;
}

/* Heading section links (right-aligned) */
div.content h2 span.Links,
div.content h3 span.Links,
div.content h4 span.Links {
  position: relative;
  z-index: 1;
  display: inline;
  float: right;
  clear: none;
  font-size: var(--font-size-base);
  margin-right: 10px;
  font-weight: normal;
  line-height: 22px;
  vertical-align: bottom;
}
div.content h3 span.Links,
div.content h4 span.Links {
  margin-top: -5px;
}
div.content h2 span.Links a {
  text-decoration: none;
}

/* Section-link dropdown Menu */
div.content h2 span.Links div.Menu {
  position: absolute;
  display: none;
  background: var(--color-bg);
  border: 2px solid var(--color-accent);
}
div.content h2 span.Links div.Menu a {
  display: block;
  white-space: nowrap;
  padding: 5px 10px;
}
div.content h2 span.Links div.Menu a:hover {
  background: var(--color-accent);
  color: var(--color-accent-text);
}

/* Tabs in H2 — reduce bottom padding so the border-merge trick works */
div.content h2:has(span.tabs) {
  padding-bottom: 0;
}
div.content h2 span.tabs {
  display: inline-block;
  margin-left: 10px;
  margin-bottom: -7px;
}
div.content h2 span.tabs a {
  display: block;
  float: left;
  padding: 1px 6px 0 6px;
  margin: -3px 0 0 10px;
  border: 2px solid var(--color-accent);
  border-bottom: none;
  background: var(--color-bg);
  text-decoration: none;
}
div.content h2 span.tabs a.selected,
div.content h2 span.tabs a:hover {
  background: var(--color-accent);
  color: var(--color-accent-text);
}

/* ─── AJAX error indicator ───────────────────────────────────────────────── */

#GlobalAjax {
  position: absolute;
  opacity: 0.8;
  background: #f00;
  font-weight: bold;
  color: #fff;
  padding: 2px;
}

/* ─── Code blocks ────────────────────────────────────────────────────────── */

pre.code-block {
  background: var(--color-heading-bg);
  border: 1px solid var(--color-border);
}

/* ─── Reduced motion ─────────────────────────────────────────────────────── */
/* Honor OS-level prefers-reduced-motion. Neutralizes transitions/animations
   across the new theme stylesheets (buttons, cards, blockmenu hovers, sort
   icons, etc.). Classic (common.css) is unaffected. !important here is the
   documented WCAG exception — overrides any later transition declaration. */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
  }
}
