/* =============================================================================
   W7 form controls — WiSDoM 7 "Form Builder" input skin
   -----------------------------------------------------------------------------
   One sheet for the whole family: W7_text_input, W7_memo_input,
   W7_integer_input, W7_decimal_input, W7_dropdown, W7_datetime_input,
   W7_time_input, W7_checkbox, W7_radio_group / W7_radio (all framed by
   W7_form_field), plus the two
   non-input controls W7_label (.w7fc-heading) and W7_hyperlink (.w7fc-link).

   The design's PREVIEW skin is the default (.fb-pvin in the mock): 13.5px DM
   Sans, #212529 text, 9px/12px padding, 1px #dee2e6 border, 8px radius, white
   ground; focus = primary border + 3px 15% primary ring; disabled = #f1f3f5
   ground with #adb5bd text. The caption (.fb-lbl) is 11px/600 uppercase with
   .08em tracking in #6c757d. Every literal above is expressed through the
   Template.css tokens (--tpl-*, tenant --color-* first) so the controls follow
   the active theme and dark mode with no extra rules.

   Loaded for every consumer via _content/wbi_core_layout/css/layout.css.

   SIZE CONTRACT (per .w7fc wrapper — override on a container to re-density a
   whole form):
     --w7fc-h      control height           (38px md / 34px sm)
     --w7fc-fs     font size                (13.5px md / 13px sm)
     --w7fc-px     horizontal padding       (12px md / 11px sm)
     --w7fc-radius corner radius            (--tpl-radius-md, 8px)
   COLOUR CONTRACT:
     --w7fc-border / --w7fc-bg / --w7fc-fg / --w7fc-ph (placeholder)
     --w7fc-accent (focus border, checked box, selected option, links)
     --w7fc-ring   (focus halo, derived from --w7fc-accent)
   ========================================================================== */

.w7fc {
    --w7fc-h: 38px;
    --w7fc-fs: 0.84375rem; /* 13.5px */
    --w7fc-px: 12px;
    --w7fc-radius: var(--tpl-radius-md, 8px);

    --w7fc-border: var(--tpl-border-strong, #dee2e6);
    --w7fc-bg: var(--tpl-surface, #ffffff);
    --w7fc-fg: var(--tpl-text, #212529);
    --w7fc-ph: var(--tpl-text-disabled, #adb5bd);
    --w7fc-accent: var(--color-primary, var(--tpl-primary, #0d6efd));
    --w7fc-ring: color-mix(in srgb, var(--w7fc-accent) 15%, transparent);
    --w7fc-danger: var(--tpl-danger, #dc3545);

    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
    box-sizing: border-box;
    font-family: var(--tpl-font-family, 'DM Sans', system-ui, sans-serif);
    color: var(--w7fc-fg);
}

.w7fc--sm { --w7fc-h: 34px; --w7fc-fs: 0.8125rem; --w7fc-px: 11px; }
/* DevExpress SizeMode.Large (the drop-down family's SizeMode parameter). */
.w7fc--lg { --w7fc-h: 42px; --w7fc-fs: 0.9375rem; --w7fc-px: 14px; }

/* ── Caption / hint / validation (W7_form_field) ─────────────────────────── */
.w7fc__label {
    display: block;
    margin: 0;
    font-size: var(--tpl-fs-xs, 0.6875rem);
    font-weight: var(--tpl-fw-semibold, 600);
    letter-spacing: var(--tpl-tracking-label, 0.08em);
    text-transform: uppercase;
    line-height: 1.3;
    color: var(--tpl-text-subtle, #6c757d);
}

.w7fc__msg {
    font-size: var(--tpl-fs-sm, 0.75rem);
    line-height: 1.4;
    color: var(--tpl-text-subtle, #6c757d);
}
.w7fc__msg--error { color: var(--w7fc-danger); }

/* ── The input skin (input, textarea, dropdown field) ───────────────────── */
.w7fc__input {
    display: block;
    width: 100%;
    box-sizing: border-box;
    height: var(--w7fc-h);
    margin: 0;
    padding: 0 var(--w7fc-px);
    font-family: inherit;
    font-size: var(--w7fc-fs);
    font-weight: var(--tpl-fw-regular, 400);
    line-height: 1.4;
    color: var(--w7fc-fg);
    background: var(--w7fc-bg);
    border: 1px solid var(--w7fc-border);
    border-radius: var(--w7fc-radius);
    outline: none;
    appearance: none;
    -webkit-appearance: none;
    /* Only the focus ring animates. background / border-color are deliberately NOT
       transitioned: they resolve theme tokens through the wrapper's --w7fc-* vars and
       Chromium keeps a transitioned property on its stale value when <html data-theme>
       flips (the input is not restyled until something else invalidates it), which left
       white inputs on a dark page. */
    transition: box-shadow .15s var(--tpl-ease, ease);
}
.w7fc__input::placeholder { color: var(--w7fc-ph); opacity: 1; }

.w7fc__input:focus,
.w7fc__input:focus-within {
    border-color: var(--w7fc-accent);
    box-shadow: 0 0 0 3px var(--w7fc-ring);
}

.w7fc__input:disabled,
.w7fc--disabled .w7fc__input {
    background: var(--tpl-surface-hover-strong, #f1f3f5);
    color: var(--tpl-text-disabled, #adb5bd);
    cursor: not-allowed;
}
/* --w7fc-readonly-bg (set it on a container) re-colours read-only inputs — e.g.
   `--w7fc-readonly-bg: var(--w7fc-bg)` keeps them white, as the Viewer's
   designer-disabled dropdowns always were. Not declared on .w7fc on purpose, so a
   container's value is inherited. */
.w7fc__input[readonly]:not(:disabled),
.w7fc--readonly .w7fc__input { background: var(--w7fc-readonly-bg, var(--tpl-surface-muted, #f8f9fa)); }

.w7fc--invalid .w7fc__input,
.w7fc__input.border-danger { border-color: var(--w7fc-danger) !important; }
.w7fc--invalid .w7fc__input:focus,
.w7fc--invalid .w7fc__input:focus-within {
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--w7fc-danger) 18%, transparent);
}

/* Memo */
textarea.w7fc__input {
    height: auto;
    min-height: calc(var(--w7fc-h) * 2);
    padding: 9px var(--w7fc-px);
    line-height: 1.6;
    resize: vertical;
}
textarea.w7fc__input--noresize { resize: none; }

/* Native date / time controls: keep the skin, let the browser draw the picker. */
.w7fc__input[type="date"],
.w7fc__input[type="datetime-local"],
.w7fc__input[type="time"] { padding-right: calc(var(--w7fc-px) - 2px); }
.w7fc__input::-webkit-calendar-picker-indicator { cursor: pointer; opacity: .6; }
.w7fc__input::-webkit-calendar-picker-indicator:hover { opacity: 1; }

/* ── Input + addon button (date/time "set to now") ───────────────────────── */
.w7fc__wrap { position: relative; display: flex; align-items: stretch; min-width: 0; }
.w7fc__wrap > .w7fc__input { flex: 1 1 auto; min-width: 0; }
.w7fc__wrap--addon > .w7fc__input { padding-right: calc(var(--w7fc-h) + 4px); }

.w7fc__addon-btn {
    position: absolute;
    top: 1px;
    right: 1px;
    bottom: 1px;
    width: calc(var(--w7fc-h) - 2px);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 0;
    border-left: 1px solid var(--w7fc-border);
    border-radius: 0 calc(var(--w7fc-radius) - 1px) calc(var(--w7fc-radius) - 1px) 0;
    background: var(--tpl-surface-muted, #f8f9fa);
    color: var(--tpl-text-subtle, #6c757d);
    font-size: 12px;
    cursor: pointer;
    transition: color .15s;
}
.w7fc__addon-btn:hover { background: var(--tpl-surface-hover-strong, #f1f3f5); color: var(--w7fc-accent); }
.w7fc__addon-btn:disabled { cursor: not-allowed; color: var(--tpl-text-disabled, #adb5bd); }

/* ── Numeric spin (integer / decimal) ─────────────────────────────────────── */
.w7fc__num { position: relative; display: flex; min-width: 0; }
.w7fc__num > .w7fc__input { flex: 1 1 auto; min-width: 0; -moz-appearance: textfield; }
.w7fc__num > .w7fc__input::-webkit-outer-spin-button,
.w7fc__num > .w7fc__input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.w7fc__num--spin > .w7fc__input { padding-right: calc(var(--w7fc-px) + 26px); }

.w7fc__spin {
    position: absolute;
    top: 1px;
    right: 1px;
    bottom: 1px;
    width: 26px;
    display: flex;
    flex-direction: column;
    border-left: 1px solid var(--w7fc-border);
    border-radius: 0 calc(var(--w7fc-radius) - 1px) calc(var(--w7fc-radius) - 1px) 0;
    overflow: hidden;
    background: var(--tpl-surface-muted, #f8f9fa);
}
.w7fc__spin-btn {
    flex: 1 1 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--tpl-text-subtle, #6c757d);
    font-size: 9px;
    line-height: 1;
    cursor: pointer;
    transition: color .12s;
}
.w7fc__spin-btn + .w7fc__spin-btn { border-top: 1px solid var(--w7fc-border); }
.w7fc__spin-btn:hover { background: var(--tpl-surface-hover-strong, #f1f3f5); color: var(--w7fc-accent); }
.w7fc__spin-btn:disabled { color: var(--tpl-text-disabled, #adb5bd); cursor: not-allowed; background: transparent; }

/* ── Checkbox ────────────────────────────────────────────────────────────── */
.w7fc__check {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-height: 24px;
    margin: 0;
    font-size: var(--w7fc-fs);
    color: var(--w7fc-fg);
    cursor: pointer;
    user-select: none;
}
.w7fc__check.is-locked { cursor: not-allowed; }

.w7fc__check-input {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: 0;
    padding: 0;
    opacity: 0;
    pointer-events: none;
}

.w7fc__check-box {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 18px;
    height: 18px;
    box-sizing: border-box;
    border-radius: 5px;
    border: 1.5px solid var(--tpl-grey-400, #ced4da);
    background: var(--w7fc-bg);
    color: #ffffff;
    font-size: 10px;
    /* border-color + box-shadow only (see the .w7fc__input note on stale transitions). */
    transition: border-color .15s var(--tpl-ease, ease), box-shadow .15s var(--tpl-ease, ease);
}
.w7fc__check-box > i { opacity: 0; transform: scale(.6); transition: opacity .12s, transform .12s; }

.w7fc__check-input:checked + .w7fc__check-box { background: var(--w7fc-accent); border-color: var(--w7fc-accent); }
.w7fc__check-input:checked + .w7fc__check-box > i { opacity: 1; transform: scale(1); }
.w7fc__check-input:focus-visible + .w7fc__check-box { box-shadow: 0 0 0 3px var(--w7fc-ring); border-color: var(--w7fc-accent); }
.w7fc__check:hover .w7fc__check-input:not(:disabled) + .w7fc__check-box { border-color: var(--w7fc-accent); }
.w7fc__check-input:disabled + .w7fc__check-box { background: var(--tpl-surface-hover-strong, #f1f3f5); border-color: var(--tpl-grey-300, #dee2e6); }
.w7fc__check-input:disabled:checked + .w7fc__check-box { background: var(--tpl-grey-400, #ced4da); border-color: var(--tpl-grey-400, #ced4da); }
.w7fc__check-input:disabled ~ .w7fc__check-caption { color: var(--tpl-text-disabled, #adb5bd); }
.w7fc--invalid .w7fc__check-box,
.w7fc__check-input.border-danger + .w7fc__check-box { border-color: var(--w7fc-danger); }

.w7fc__check-caption { line-height: 1.3; }

/* ── Radio buttons (W7_radio_group, W7_radio) ────────────────────────────── */
/* An 18px circle (16 sm / 20 lg) that fills with the accent and shows a white
   centre dot when picked — the checkbox's sibling. The real <input type=radio>
   is visually hidden but keeps focus and the browser's arrow-key navigation.
   Read-only groups render DISABLED inputs (no pick possible) inside .is-readonly
   items; those keep the normal colours, only real disabling greys out.
   Only box-shadow / opacity / transform animate (stale-transition note above). */
.w7fc__radios,
.w7fc__radio {
    --w7fc-radio-size: 18px;
    --w7fc-radio-dot: 8px;
}
.w7fc--sm .w7fc__radios,
.w7fc--sm .w7fc__radio { --w7fc-radio-size: 16px; --w7fc-radio-dot: 6px; }
.w7fc--lg .w7fc__radios,
.w7fc--lg .w7fc__radio { --w7fc-radio-size: 20px; --w7fc-radio-dot: 9px; }

.w7fc__radios {
    display: flex;
    min-width: 0;
    font-size: var(--w7fc-fs);
    color: var(--w7fc-fg);
}
.w7fc__radios--vertical { flex-direction: column; align-items: flex-start; gap: 8px; }
.w7fc__radios--horizontal { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px 24px; }
.w7fc__radios--vertical.w7fc__radios--stretch { align-items: stretch; }
.w7fc__radios--horizontal.w7fc__radios--stretch > .w7fc__radio { flex: 1 1 0; }
.w7fc__radios--stretch > .w7fc__radio,
.w7fc__radio--stretch { display: flex; }
.w7fc__radio--stretch { width: 100%; }
.w7fc__radios:focus-visible { outline: none; border-radius: 6px; box-shadow: 0 0 0 3px var(--w7fc-ring); }
.w7fc__radios-empty { color: var(--tpl-text-subtle, #6c757d); line-height: 1.3; }

.w7fc__radio {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-height: 24px;
    min-width: 0;
    max-width: 100%;
    margin: 0;
    font-size: var(--w7fc-fs);
    color: var(--w7fc-fg);
    cursor: pointer;
    user-select: none;
}
.w7fc__radio.is-disabled { cursor: not-allowed; }
.w7fc__radio.is-readonly { cursor: default; }

/* [ItemLabelPosition / LabelPosition] Left: caption before the circle. */
.w7fc__radio--label-left .w7fc__radio-caption { order: -1; }

/* [ItemAlignment / Alignment] — the item is stretched to the group's width. */
.w7fc__radio--align-left { justify-content: flex-start; }
.w7fc__radio--align-right { justify-content: flex-end; }
.w7fc__radio--align-center { justify-content: center; }
.w7fc__radio--align-between { justify-content: space-between; }
.w7fc__radio--align-around { justify-content: space-around; }

.w7fc__radio-input {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: 0;
    padding: 0;
    opacity: 0;
    pointer-events: none;
}

.w7fc__radio-dot {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: var(--w7fc-radio-size);
    height: var(--w7fc-radio-size);
    box-sizing: border-box;
    border-radius: 50%;
    border: 1.5px solid var(--tpl-grey-400, #ced4da);
    background: var(--w7fc-bg);
    color: #ffffff;
    font-size: calc(var(--w7fc-radio-size) * .5);
    transition: box-shadow .15s var(--tpl-ease, ease);
}
.w7fc__radio-dot::after {
    content: "";
    width: var(--w7fc-radio-dot);
    height: var(--w7fc-radio-dot);
    border-radius: 50%;
    background: currentColor;
    opacity: 0;
    transform: scale(.4);
    transition: opacity .12s, transform .12s;
}
.w7fc__radio-dot--icon::after { display: none; }
.w7fc__radio-icon { opacity: 0; transform: scale(.6); transition: opacity .12s, transform .12s; }

.w7fc__radio-input:checked + .w7fc__radio-dot { background: var(--w7fc-accent); border-color: var(--w7fc-accent); }
.w7fc__radio-input:checked + .w7fc__radio-dot::after,
.w7fc__radio-input:checked + .w7fc__radio-dot > .w7fc__radio-icon { opacity: 1; transform: scale(1); }
.w7fc__radio-input:focus-visible + .w7fc__radio-dot { box-shadow: 0 0 0 3px var(--w7fc-ring); border-color: var(--w7fc-accent); }
.w7fc__radio:hover .w7fc__radio-input:not(:disabled) + .w7fc__radio-dot { border-color: var(--w7fc-accent); }

.w7fc__radio.is-disabled .w7fc__radio-dot { background: var(--tpl-surface-hover-strong, #f1f3f5); border-color: var(--tpl-grey-300, #dee2e6); }
.w7fc__radio.is-disabled .w7fc__radio-input:checked + .w7fc__radio-dot { background: var(--tpl-grey-400, #ced4da); border-color: var(--tpl-grey-400, #ced4da); }
.w7fc__radio.is-disabled .w7fc__radio-caption { color: var(--tpl-text-disabled, #adb5bd); }

.w7fc--invalid .w7fc__radio-dot,
.w7fc__radio-input.border-danger + .w7fc__radio-dot { border-color: var(--w7fc-danger); }
.w7fc--valid .w7fc__radio-dot { border-color: var(--tpl-success, #198754); }
.w7fc--valid .w7fc__radio-input:checked + .w7fc__radio-dot { background: var(--tpl-success, #198754); }

/* [ItemLabelWrapMode / LabelWrapMode] */
.w7fc__radio-caption { min-width: 0; line-height: 1.3; overflow-wrap: anywhere; }
.w7fc__radio--nowrap .w7fc__radio-caption { white-space: nowrap; overflow-wrap: normal; }
.w7fc__radio--ellipsis .w7fc__radio-caption { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; overflow-wrap: normal; }

/* ── Dropdown ────────────────────────────────────────────────────────────── */
/* The drop-down family (W7_dropdown, W7_combobox, W7_tagbox, W7_dropdown_box,
   W7_dropdown_window) has its own sheet: W7_dropdown.css, imported by
   layout.css right after this one (it reads the --w7fc-* contract above). */

/* ── W7_label — heading control ──────────────────────────────────────────── */
.w7fc-heading {
    margin: 0;
    font-family: var(--tpl-font-family, 'DM Sans', system-ui, sans-serif);
    font-weight: var(--tpl-fw-semibold, 600);
    line-height: 1.3;
    letter-spacing: var(--tpl-tracking-tight, -0.01em);
    color: var(--primary-label-color, var(--tpl-text, #212529));
}
.w7fc-heading--sm { font-size: 0.9375rem; } /* 15px */
.w7fc-heading--md { font-size: 1.125rem; }  /* 18px */
.w7fc-heading--lg { font-size: 1.375rem; }  /* 22px */
.w7fc-heading--bold { font-weight: var(--tpl-fw-bold, 700); }
.w7fc-heading--muted { color: var(--tpl-text-subtle, #6c757d); }

/* ── W7_hyperlink ────────────────────────────────────────────────────────── */
.w7fc-link {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-family: var(--tpl-font-family, 'DM Sans', system-ui, sans-serif);
    font-size: 0.84375rem; /* 13.5px */
    color: var(--color-primary, var(--tpl-primary, #0d6efd));
    text-decoration: none;
    transition: color .15s;
}
.w7fc-link:hover { color: var(--tpl-primary-hover, #0b5ed7); text-decoration: underline; }
.w7fc-link:focus-visible { outline: none; border-radius: 4px; box-shadow: 0 0 0 3px color-mix(in srgb, var(--tpl-primary, #0d6efd) 25%, transparent); }
.w7fc-link__icon { font-size: 0.8em; }
.w7fc-link__icon--ext { font-size: 10.5px; }
.w7fc-link--disabled { color: var(--tpl-text-disabled, #adb5bd); pointer-events: none; }

