/* Universal Forms — HCMevolve design system (tokens, type, controls), scoped to .uf so it
   never restyles the host application. Generated from the HCMevolve SaaS design system. */

.uf {
  /* ── COLOR ── canonical hcm-* tokens. Always reference these. ── */

  /* Brand */
  --hcm-primary:        #2096EB;   /* Active states, links */
  --hcm-primary-dark:   #1878BF;   /* Button hover / pressed */
  --hcm-primary-light:  #EBF5FD;   /* Ghost fill, selected rows */
  --hcm-foam:           #F3F9FE;   /* Input bg, secondary fills */
  --hcm-link-water:     #D0E2F1;   /* Borders, dividers, table rules */
  --hcm-hippie:         #6794B7;   /* Field labels, column headers */

  /* Status */
  --hcm-mantis:         #73D071;   /* Success, active, paid */
  --hcm-mantis-lt:      #EDF9ED;   /* Success badge bg */
  --hcm-carnation:      #F56363;   /* Error, danger, delete */
  --hcm-carnation-lt:   #FEF0F0;   /* Error badge bg */
  --hcm-sun:            #FBB80E;   /* Warning, edit actions */
  --hcm-sun-lt:         #FFF8E7;   /* Warning badge bg */

  /* Text */
  --hcm-text:           #1E293B;   /* Primary body, data values */
  --hcm-text-sec:       #526070;   /* Supporting text */
  --hcm-text-ter:       #8896A6;   /* Placeholders, disabled */

  /* Surfaces */
  --hcm-surface:        #FFFFFF;   /* Cards, button text */
  --hcm-surface-alt:    #F6F8FB;   /* Alt rows, page chrome */
  --hcm-bg:             #EFF3F8;   /* Application background */

  /* ── LEGACY ALIASES ────────────────────────────────────────────
     Existing class names in components.css and layouts reference
     the variables below. They map onto the hcm-* canonical set so
     the design stays consistent. Do NOT add new aliases — use
     hcm-* directly in new work. */
  --cerulean:        var(--hcm-primary);
  --cerulean-dark:   var(--hcm-primary-dark);
  --cerulean-light:  var(--hcm-primary-light);
  --cerulean-pale:   var(--hcm-primary-light);
  --blumine:         var(--hcm-primary-dark);   /* dark navy not in palette — using primary-dark; confirm */
  --deep-blue:       var(--hcm-primary-dark);
  --hippie-blue:     var(--hcm-hippie);
  --green-active:    var(--hcm-mantis);
  --green-bg:        var(--hcm-mantis-lt);
  --red-inactive:    var(--hcm-carnation);
  --red-bg:          var(--hcm-carnation-lt);
  --amber:           var(--hcm-sun);
  --amber-bg:        var(--hcm-sun-lt);
  --orange:          #F88216;
  --purple:          #7E71D0;
  --teal:            #38C1CA;
  --black:           var(--hcm-text);
  --trout:           var(--hcm-text-sec);
  --regent-gray:     var(--hcm-text-ter);
  --water-blue:      var(--hcm-link-water);
  --foam:            var(--hcm-foam);
  --ice:             var(--hcm-primary-light);
  --paper:           var(--hcm-surface);

  /* ── SURFACES & BORDERS ───────────────────────────────────────── */
  --bg-app:          var(--hcm-bg);
  --bg-workspace:    var(--hcm-foam);
  --bg-card:         var(--hcm-surface);
  --bg-sub-menu:     var(--hcm-surface);
  --bg-main-menu:    var(--hcm-primary-dark);
  --bg-top-menu:     var(--hcm-primary);
  --border-default:  var(--hcm-link-water);
  --border-subtle:   #E8EEF5;

  /* ── TYPOGRAPHY ───────────────────────────────────────────────── */
  --font-family:     "Roboto", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono:       "Roboto Mono", ui-monospace, "SF Mono", Menlo, monospace;

  /* sizes — every UI text uses one of these */
  --fs-h1:  28px;  /* page headings */
  --fs-h2:  24px;  /* section headings */
  --fs-h4:  20px;  /* card titles, modal headings */
  --fs-h8:  16px;  /* table column headers, tab labels */
  --fs-b6:  14px;  /* body emphasis, button labels */
  --fs-b7:  14px;  /* body copy, form values */
  --fs-b9:  12px;  /* badges, chips, compact data, meta */
  --fs-b10: 10px;  /* micro labels */

  --lh-tight: 1.2;  /* @kind font */
  --lh-body:  1.5;   /* @kind font */

  --fw-regular:  400; /* @kind font */
  --fw-medium:   500; /* @kind font */
  --fw-semibold: 600; /* @kind font */
  --fw-bold:     700; /* @kind font */

  /* ── SPACING (4px base) ───────────────────────────────────────── */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 20px;
  --s-6: 24px;
  --s-8: 32px;
  --s-10: 40px;
  --s-12: 48px;

  /* ── RADII ────────────────────────────────────────────────────── */
  --r-2:   2px;
  --r-4:   4px;
  --r-6:   6px;
  --r-8:   8px;
  --r-12:  12px;
  --r-16:  16px;
  --r-pill: 999px;

  /* ── SHADOWS ──────────────────────────────────────────────────── */
  --shadow-xs:  0 1px 2px rgba(15, 22, 32, 0.04);
  --shadow-sm:  0 1px 3px rgba(15, 22, 32, 0.06), 0 1px 2px rgba(15, 22, 32, 0.04);
  --shadow-md:  0 4px 8px rgba(15, 22, 32, 0.06), 0 2px 4px rgba(15, 22, 32, 0.04);
  --shadow-lg:  0 12px 32px rgba(15, 22, 32, 0.08);
  --shadow-card: 0 4px 4px rgba(0, 0, 0, 0.04);

  /* ── LAYOUT ZONES (Web Layout 03) ─────────────────────────────── */
  --w-main-menu: 240px;
  --w-sub-menu:  240px;
  --h-top-menu:  58px;

  /* ── MOTION ───────────────────────────────────────────────────── */
  --ease-out:    cubic-bezier(0.2, 0.7, 0.2, 1); /* @kind other */
  --dur-fast:    120ms;                           /* @kind other */
  --dur:         180ms;                           /* @kind other */

  /* ── CONTROLS ─────────────────────────────────────────────────── */
  --ctl-h-sm: 28px;
  --ctl-h-md: 36px;
  --ctl-h-lg: 44px;
  font-family: var(--font-family);
  font-size: var(--fs-b7);
  line-height: var(--lh-body);
  color: var(--hcm-text);
}
.uf *, .uf *::before, .uf *::after { box-sizing: border-box; }
.uf button { font: inherit; }
.uf a { color: var(--hcm-primary); text-decoration: none; }

/* H1 — Page headings (28 / 600) */
.uf .h1, .uf h1.h1 {
  font-size: var(--fs-h1);
  font-weight: var(--fw-semibold);
  line-height: var(--lh-tight);
  color: var(--black);
}
/* H2 — Section headings (24 / 600) */
.uf .h2, .uf h2.h2 {
  font-size: var(--fs-h2);
  font-weight: var(--fw-semibold);
  line-height: var(--lh-tight);
  color: var(--black);
}
/* H4 Medium — Card titles, modal headings (20 / 500) */
.uf .h4-medium {
  font-size: var(--fs-h4);
  font-weight: var(--fw-medium);
  line-height: var(--lh-tight);
  color: var(--black);
}
/* H8 Medium — Table column headers, tab labels (16 / 500) */
.uf .h8-medium {
  font-size: var(--fs-h8);
  font-weight: var(--fw-medium);
  line-height: var(--lh-tight);
  color: var(--black);
}
/* B6 Medium — Body emphasis, button labels (14 / 500) */
.uf .b6-medium {
  font-size: var(--fs-b6);
  font-weight: var(--fw-medium);
  line-height: var(--lh-body);
}
/* B7 Regular — Body copy, form values (14 / 400) */
.uf .b7-regular {
  font-size: var(--fs-b7);
  font-weight: var(--fw-regular);
  line-height: var(--lh-body);
}
/* B9 Medium — Badges, chips, compact data (12 / 500) */
.uf .b9-medium {
  font-size: var(--fs-b9);
  font-weight: var(--fw-medium);
  line-height: var(--lh-body);
}
/* B9 Regular — Meta, timestamps (12 / 400) */
.uf .b9-regular {
  font-size: var(--fs-b9);
  font-weight: var(--fw-regular);
  line-height: var(--lh-body);
  color: var(--regent-gray);
}
/* B10 Medium — Micro labels (10 / 500) */
.uf .b10-medium {
  font-size: var(--fs-b10);
  font-weight: var(--fw-medium);
  line-height: var(--lh-body);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--hippie-blue);
}

.uf .mono { font-family: var(--font-mono); }

/* HCMevolve — Component styles. Reference tokens.css. */

/* ── BUTTONS ───────────────────────────────────────────────────
   Symmetric padding; auto-sizes to content. Optional left/right icon.
   3 sizes: sm / md (default) / lg.
   5 variants: primary, ghost, danger, edit-inline, delete-inline. */

.uf .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: var(--ctl-h-md);
  padding: 0 16px;
  font-family: var(--font-family);
  font-size: var(--fs-b6);
  font-weight: var(--fw-medium);
  line-height: 1;
  border-radius: var(--r-8);
  border: 1px solid transparent;
  background: transparent;
  color: inherit;
  cursor: pointer;
  white-space: nowrap;
  transition:
    background var(--dur) var(--ease-out),
    color var(--dur) var(--ease-out),
    border-color var(--dur) var(--ease-out),
    box-shadow var(--dur) var(--ease-out);
}
.uf .btn:focus-visible { outline: 2px solid var(--cerulean); outline-offset: 2px; }

/* Disabled — stops button-mashing and signals "not ready yet".
   Overrides any variant; hover does nothing. Apply via [disabled]
   attribute (preferred — also blocks clicks/keyboard) or .is-disabled
   class (visual only, for non-button elements). */
.uf .btn[disabled], .uf .btn.is-disabled {
  background: var(--hcm-surface-alt) !important;
  color: var(--hcm-text-ter) !important;
  border-color: var(--hcm-link-water) !important;
  cursor: not-allowed;
  box-shadow: none;
  pointer-events: none;
}
.uf .btn[disabled]:hover, .uf .btn.is-disabled:hover {
  background: var(--hcm-surface-alt) !important;
  color: var(--hcm-text-ter) !important;
  border-color: var(--hcm-link-water) !important;
}

/* Sizes — symmetric L/R padding, scales with content */
.uf .btn--sm { height: var(--ctl-h-sm); padding: 0 12px; font-size: var(--fs-b9); gap: 6px; border-radius: var(--r-6); }
.uf .btn--md { height: var(--ctl-h-md); padding: 0 16px; font-size: var(--fs-b6); gap: 8px; }
.uf .btn--lg { height: var(--ctl-h-lg); padding: 0 20px; font-size: var(--fs-b6); gap: 10px; }

/* Icon-only — same height, square. Icon parameter on both sides is just .btn i:first-child / :last-child */
.uf .btn .btn-icon { display: inline-flex; }
.uf .btn--icon-only { width: var(--ctl-h-md); padding: 0; }
.uf .btn--icon-only.btn--sm { width: var(--ctl-h-sm); }
.uf .btn--icon-only.btn--lg { width: var(--ctl-h-lg); }

/* 01. Primary — One per page, primary action */
.uf .btn--primary {
  background: var(--cerulean);
  color: var(--paper);
  border-color: var(--cerulean);
}
.uf .btn--primary:hover { background: var(--cerulean-dark); border-color: var(--cerulean-dark); }

/* 02. Ghost — Secondary actions */
.uf .btn--ghost {
  background: var(--cerulean-light);
  color: var(--cerulean);
  border-color: var(--cerulean);
}
.uf .btn--ghost:hover { background: var(--cerulean-pale); }

/* 03. Danger — Destructive actions only */
.uf .btn--danger {
  background: var(--red-inactive);
  color: var(--paper);
  border-color: var(--red-inactive);
}
.uf .btn--danger:hover { background: #E55050; border-color: #E55050; }

/* 04. Edit inline — Table row edit */
.uf .btn--edit-inline {
  background: var(--amber);
  color: var(--paper);
  border-color: var(--amber);
}
.uf .btn--edit-inline:hover { background: #E5A700; border-color: #E5A700; }

/* 05. Delete inline — Table row delete */
.uf .btn--delete-inline {
  background: var(--red-inactive);
  color: var(--paper);
  border-color: var(--red-inactive);
}
.uf .btn--delete-inline:hover { background: #E55050; border-color: #E55050; }


/* ── FORM FIELDS ───────────────────────────────────────────────── */
.uf .field { display: flex; flex-direction: column; gap: 6px; }
.uf .field-label {
  font-size: var(--fs-b10);
  font-weight: var(--fw-medium);
  color: var(--hippie-blue);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.uf .field-label .req { color: var(--red-inactive); margin-left: 2px; }

.uf .input, .uf .select, .uf .textarea {
  width: 100%;
  height: var(--ctl-h-md);
  padding: 0 12px;
  background: var(--foam);
  border: 0;
  border-bottom: 1px solid var(--water-blue);
  border-radius: 0;
  font: inherit;
  font-size: var(--fs-b7);
  font-weight: var(--fw-medium);
  color: var(--black);
  outline: none;
  transition: border-color var(--dur) var(--ease-out);
}
.uf .input::placeholder, .uf .textarea::placeholder { color: var(--hippie-blue); font-weight: var(--fw-regular); }
.uf .input:hover, .uf .select:hover, .uf .textarea:hover { border-bottom-color: var(--hippie-blue); }
.uf .input:focus, .uf .select:focus, .uf .textarea:focus { border-bottom-color: var(--cerulean); border-bottom-width: 2px; }
.uf .textarea { height: auto; min-height: 88px; padding: 10px 12px; resize: vertical; }
.uf .select {
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='none'><path d='M3 4.5L6 7.5L9 4.5' stroke='%232096EB' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-color: var(--foam);
  padding-right: 32px;
}

.uf .input-group { position: relative; display: flex; align-items: center; }
.uf .input-group .input { padding-left: 36px; }
.uf .input-group .input-icon {
  position: absolute; left: 12px;
  color: var(--cerulean);
  pointer-events: none;
  font-size: 14px;
}

/* Checkbox / Radio */
.uf .check {
  display: inline-flex; align-items: center; gap: 8px;
  cursor: pointer;
}
.uf .check input[type="checkbox"], .uf .check input[type="radio"] {
  appearance: none;
  width: 18px; height: 18px;
  border: 1.5px solid var(--water-blue);
  border-radius: var(--r-4);
  background: var(--paper);
  cursor: pointer;
  display: grid; place-items: center;
  transition: border-color var(--dur), background var(--dur);
}
.uf .check input[type="radio"] { border-radius: 50%; }
.uf .check input:checked { background: var(--cerulean); border-color: var(--cerulean); }
.uf .check input[type="checkbox"]:checked::after {
  content: ""; width: 10px; height: 10px;
  background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10' fill='none'><path d='M1.5 5.2L4 7.5L8.5 2.5' stroke='white' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/></svg>") center/contain no-repeat;
}
.uf .check input[type="radio"]:checked::after {
  content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--paper);
}

/* Switch */
.uf .switch { position: relative; display: inline-block; width: 36px; height: 20px; }
.uf .switch input { opacity: 0; width: 0; height: 0; }
.uf .switch-track {
  position: absolute; inset: 0; background: var(--water-blue);
  border-radius: var(--r-pill); transition: background var(--dur);
}
.uf .switch-track::before {
  content: ""; position: absolute; top: 2px; left: 2px;
  width: 16px; height: 16px; background: var(--paper);
  border-radius: 50%; transition: transform var(--dur);
  box-shadow: var(--shadow-xs);
}
.uf .switch input:checked + .switch-track { background: var(--cerulean); }
.uf .switch input:checked + .switch-track::before { transform: translateX(16px); }


/* ── BADGES / CHIPS ───────────────────────────────────────────── */
.uf .badge {
  display: inline-flex; align-items: center; gap: 6px;
  height: 22px; padding: 0 10px;
  border-radius: var(--r-pill);
  font-size: var(--fs-b9);
  font-weight: var(--fw-medium);
  background: var(--foam); color: var(--trout);
  border: 1px solid var(--water-blue);
  white-space: nowrap;
}
.uf .badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.uf .badge--ok { background: var(--green-bg); color: #2E7C36; border-color: transparent; }
.uf .badge--warn { background: var(--amber-bg); color: #8A5C09; border-color: transparent; }
.uf .badge--danger { background: var(--red-bg); color: #993737; border-color: transparent; }
.uf .badge--info { background: var(--cerulean-pale); color: var(--blumine); border-color: transparent; }
.uf .badge--neutral { background: var(--foam); color: var(--trout); }


/* ── CARDS ─────────────────────────────────────────────────────── */
.uf .card {
  background: var(--bg-card);
  border: 1px solid var(--water-blue);
  border-radius: var(--r-8);
  box-shadow: var(--shadow-card);
}
.uf .card-header { padding: 14px 18px; border-bottom: 1px solid var(--water-blue); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.uf .card-body { padding: 18px; }
.uf .card-footer { padding: 12px 18px; border-top: 1px solid var(--water-blue); display: flex; justify-content: flex-end; gap: 8px; }


/* sub menu */
.uf .wl3-sub-menu {
  width: var(--w-sub-menu);
  background: var(--bg-sub-menu);
  border-right: 1px solid var(--water-blue);
  display: flex; flex-direction: column;
  flex-shrink: 0;
  overflow-y: auto;
  padding: 14px 0;
}
.uf .wl3-sub-menu .sm-section { padding: 6px 18px 10px; color: var(--hippie-blue); font-size: var(--fs-b10); font-weight: var(--fw-medium); text-transform: uppercase; letter-spacing: 0.06em; }
.uf .wl3-sub-menu .sm-item {
  display: flex; align-items: center;
  padding: 11px 18px;
  color: var(--trout);
  font-size: var(--fs-b6);
  font-weight: var(--fw-regular);
  cursor: pointer;
  transition: background var(--dur);
}
.uf .wl3-sub-menu .sm-item:hover { background: var(--foam); }
.uf .wl3-sub-menu .sm-item.is-active {
  background: var(--cerulean-pale);
  color: var(--cerulean);
  font-weight: var(--fw-medium);
  border-left: 3px solid var(--cerulean);
  padding-left: 15px;
}
.uf .wl3-sub-menu .sm-item .sm-chev { margin-left: auto; color: var(--hippie-blue); font-size: 11px; }
.uf .wl3-sub-menu .sm-item.is-active .sm-chev { color: var(--cerulean); }


/* hover helpers (replaces inline hover styles in the design) */
.uf .uf-hover-foam:hover { background: var(--hcm-foam) !important; }
.uf .uf-hover-danger:hover { background: var(--hcm-carnation-lt) !important; }
.uf .uf-hover-primary:hover { background: var(--hcm-primary-light) !important; color: var(--hcm-primary-dark) !important; }
.uf .btn:disabled { background: var(--hcm-surface-alt) !important; color: var(--hcm-text-ter) !important; border-color: var(--hcm-link-water) !important; cursor: not-allowed; }
.uf .fa-spin { animation: uf-spin 1s linear infinite; }
@keyframes uf-spin { to { transform: rotate(360deg); } }
