/* Spec: DESIGN.md › Components › Inputs ({component.text-input}, {component.textarea}) + Selectors ({component.select-trigger}) — the shared 32px/8px geometry layer */
/* ============================================================================
   controls.css - unified form-control language (global-control-restyle).

   Loaded LAST (after portal-ui.css) in parts/resources.html so it wins the
   cascade. Owns the single 32px height + 8px radius flip for text inputs,
   native selects, SlimSelect, tail.select, pagination controls, and date-picker
   triggers, plus the joined-group treatment (.input-group restyle + .ctl-group).

   Rules:
   - height  = var(--ctl-h)   (32px; defined in this file's :root below)
   - radius  = var(--r-ctl)   (8px;  defined in portal-ui.css :root)
   - Never hand-edit vendor minified sheets (logicom-custom / slimselect /
     tail.select / daterangepicker) - override them here.
   - Only set height + border-radius on shared classes so dark.css keeps owning
     background/border colour in dark mode (it loads earlier, we win on geometry).
   - Design spec: tickets/global-control-restyle/global-control-restyle-design.md
   ============================================================================ */

:root {
    /* Single control height token. Defined here (this restyle stays self-contained and does
       not touch portal-ui.css); controls.css loads last, so :root --ctl-h wins globally and
       is available to buttons.css's var(--ctl-h, 32px) at computed-value time. */
    --ctl-h: 32px;
}

/* ============================================================================
   Per-family flips - single height var(--ctl-h) + 8px corners var(--r-ctl).
   Only geometry is set here so dark.css keeps owning colour in dark mode.
   ============================================================================ */

/* ---- Text inputs / native selects / textareas ------------------------------------- */
.form-control:not(textarea) {
    height: var(--ctl-h);
    border-radius: var(--r-ctl);
}
/* Exemptions: hidden backer selects (height:0) and tall multi-row listboxes stay as-is. */
select.form-control[size]:not([size="1"]),
select.form-control[multiple],
select[style*="height:0"],
select[style*="height: 0"] {
    height: auto;
}
textarea.form-control { border-radius: var(--r-ctl); }

/* ---- SlimSelect (single + multi) --------------------------------------------------- */
/* Height forced (beats vendor + legacy !important). Radius is NOT !important so the
   pagination pager's higher-specificity square corners still win (re-squared below). */
.ss-main .ss-single-selected { height: var(--ctl-h) !important; }
.ss-main .ss-single-selected,
.ss-main .ss-multi-selected { border-radius: var(--r-ctl); }
.ss-main .ss-multi-selected {
    min-height: var(--ctl-h) !important;
    height: auto !important;
}

/* ---- tail.select multiselect ------------------------------------------------------- */
/* The wrapper class tail.select emits is `.tail-select` (see tail.select-full.min.js init()),
   not `.select` - the old selector matched nothing, so the control kept the vendor 3px corners
   and never picked up the shared control height. The caret cap and dropdown panel corners are
   rounded in portal-ui.css (the two pieces this height/radius flip does not reach). */
.tail-select .select-label {
    min-height: var(--ctl-h);
    border-radius: var(--r-ctl) !important;   /* beats the vendor 3px */
}

/* ---- Date-range picker trigger (a div, not an input) ------------------------------- */
.date-range-picker {
    height: var(--ctl-h);
    box-sizing: border-box;
    padding-top: 0;
    padding-bottom: 0;
    border-radius: var(--r-ctl);
}

/* ============================================================================
   Joined groups
   ============================================================================ */

/* Bootstrap .input-group already renders flush (Bootstrap squares the inner corners);
   here we hold every member at 32px and re-tint the grey addon so input+icon / input+
   button read as ONE control. The input's outer-left radius comes from the .form-control
   rule above; the trailing button's outer-right corner from buttons.css. */
.input-group > .form-control,
.input-group > .input-group-addon,
.input-group .input-group-btn > .btn { height: var(--ctl-h); }

.input-group-addon {
    background-color: var(--srf, #fff);
    border-color: var(--line, #ebedf2);
    color: var(--ink-2, #4B5158);
    border-radius: var(--r-ctl);          /* outer corner; Bootstrap squares the joined side */
}
/* Opt-out: genuine static unit labels (%, $, units) keep the stock grey chip. */
.input-group-addon.addon-unit {
    background-color: #eee;
    border-color: #ccc;
    color: #555;
}

/* .ctl-group - flex join for mixed widgets (SlimSelect, toggle, button, icon) that
   Bootstrap's table-model input-group cannot join. Children sit flush; only the
   group's outer corners round. */
.ctl-group { display: inline-flex; align-items: stretch; }
.ctl-group > * { height: var(--ctl-h); }
.ctl-group > .ss-main { min-height: var(--ctl-h); }
.ctl-group > :not(:first-child) { margin-left: -1px; }
/* Doubled .ctl-group class raises specificity above the per-family .form-control /
   .ss-main / .btn radius rules so the join corners actually win. */
.ctl-group.ctl-group > * { border-radius: 0; }
.ctl-group.ctl-group > :first-child,
.ctl-group.ctl-group > :first-child .ss-single-selected {
    border-top-left-radius: var(--r-ctl);
    border-bottom-left-radius: var(--r-ctl);
}
.ctl-group.ctl-group > :last-child,
.ctl-group.ctl-group > :last-child .ss-single-selected {
    border-top-right-radius: var(--r-ctl);
    border-bottom-right-radius: var(--r-ctl);
}
.ctl-group > :focus-within,
.ctl-group > :hover { position: relative; z-index: 1; }

/* ============================================================================
   Login / system-shell buttons
   ============================================================================ */

/* The standalone auth shells (/system/login, /manage, /forgot, change-password,
   2FA, welcome) load `common-fragments :: system-head`, NOT `parts/resources :: head`,
   so buttons.css - which gives every portal .btn the shared 8px corner (--btn-r) -
   never reaches them and the full-width .btn-block auth buttons keep the legacy
   theme's smaller radius. Re-apply the shared 8px control corner here (scoped to the
   .form-login card). Only the radius is set, so the buttons stay full-width. */
.form-login .btn { border-radius: var(--r-ctl); }

/* The brand schema paints primary buttons with a mismatched lighter-orange border
   (e.g. logicom.schema.css `.btn-primary { border-color: #ed9f2b }` on a #d23a12 fill),
   and the theme swaps it to navy on :focus. buttons.css neutralizes both with a
   transparent border on authenticated pages; mirror that here so the auth buttons read
   as a clean flat fill. The background paints under the (now transparent) border, so the
   fill colour is seamless. A keyboard-only focus ring keeps the control accessible once
   the theme's focus border is gone (matches the portal's --btn-focus behaviour). */
.form-login .btn-primary { border-color: transparent !important; }
.form-login .btn:focus-visible { box-shadow: var(--focus); }

/* Label + switch row (login "Remember me"): one line at every width, label left, switch right,
   both centred on the row - the former col-sm-6 pair stacked the switch under the label on phones. */
.form-login .login-switch-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.form-login .login-switch-row > label {
    margin: 0;
    cursor: pointer;
}
