/* ========================================
   SAL FORM COMPONENTS — Inverse
   Input / Form Group on dark / inverse backgrounds
   Based on SAL Website Design System:
     Default  Figma node-id: 338:4467
     Focus    Figma node-id: 338:4459
     Error    Figma node-id: 338:4443
     Disabled Figma node-id: 338:4427
   ======================================== */

/* --- Input Group --- */
.sal-form-group-inverse {
    display: flex;
    flex-direction: column;
    gap: var(--sa-space-s);
}

/* --- Label ---
   Default: text/secondary-inverse = #f5f5f8
   Unlike global-form.css (text/secondary = #3f3f54), inverse uses lighter #f5f5f8 */
.sal-form-group-inverse label {
    font-size: 16px;
    font-weight: 700;
    line-height: 24px;
    color: var(--sa-text-secondary-inverse, #f5f5f8);
}

/* Focus: label upgrades to text/primary-inverse = white */
.sal-form-group-inverse:focus-within label {
    color: var(--sa-text-primary-inverse, #ffffff);
}

/* Disabled: label dims to text/disabled */
.sal-form-group-inverse.is-disabled label {
    color: var(--sa-text-disabled, #8b8b9e);
}

/* --- Input Field ---
   Default: bg=input-inverse (#fcfcfc), border=border-default (#e0e0e6) 1px */
.sal-form-group-inverse input {
    width: 100%;
    padding: var(--sa-space-m) var(--sa-space-l);
    font-size: 20px;
    font-weight: 400;
    line-height: 28px;
    color: var(--sa-text-primary, #222236);
    background: var(--sa-background-input-inverse, #fcfcfc);
    border: 1px solid var(--sa-border-default, #e0e0e6);
    border-radius: var(--sa-border-radius-xs, 4px);
    box-sizing: border-box;
    box-shadow: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

/* Focus: border-input-focus (#40aef3) + input-selected-inverse bg
   Box-shadow used to simulate 2px visual without causing 1→2px layout shift */
.sal-form-group-inverse input:focus {
    outline: none;
    border-color: var(--sa-border-input-focus, #40aef3);
    box-shadow: 0 0 0 1px var(--sa-border-input-focus, #40aef3);
    background: var(--sa-background-input-selected-inverse, #ffffff);
}

/* Error: border-negative (#cf2531), bg-negative (#fce8e8), text-negative (#cf2531) */
.sal-form-group-inverse.is-error input {
    border-color: var(--sa-border-negative, #cf2531);
    box-shadow: 0 0 0 1px var(--sa-border-negative, #cf2531);
    background: var(--sa-background-negative, #fce8e8);
    color: var(--sa-text-negative, #cf2531);
}

/* Success */
.sal-form-group-inverse.is-success input {
    border-color: var(--sa-border-positive, #169f32);
    box-shadow: 0 0 0 1px var(--sa-border-positive, #169f32);
}

/* Disabled: dark muted bg (#6a6a7e), muted border (#8b8b9e), muted text */
.sal-form-group-inverse input:disabled,
.sal-form-group-inverse.is-disabled input {
    background: var(--sa-background-input-disabled-inverse, #6a6a7e);
    border-color: var(--sa-border-inverse-bold, #8b8b9e);
    box-shadow: none;
    color: var(--sa-text-disabled, #8b8b9e);
    cursor: not-allowed;
}

/* --- Placeholder ---
   Default: text/tertiary = #55556a (same as global-form.css) */
.sal-form-group-inverse input::placeholder {
    color: var(--sa-text-tertiary, #55556a);
}

/* Error: placeholder inherits negative color */
.sal-form-group-inverse.is-error input::placeholder {
    color: var(--sa-text-negative, #cf2531);
}

/* Disabled: placeholder dims */
.sal-form-group-inverse input:disabled::placeholder,
.sal-form-group-inverse.is-disabled input::placeholder {
    color: var(--sa-text-disabled, #8b8b9e);
}

/* --- Help Text ---
   Default: text/secondary-inverse = #f5f5f8
   Differs from global-form.css which uses text/secondary (#3f3f54) */
.sal-form-group-inverse .sal-form-help-text {
    display: flex;
    align-items: center;
    gap: var(--sa-space-s);
    height: 20px;
    overflow: hidden;
    font-size: 14px;
    font-weight: 400;
    line-height: 20px;
    color: var(--sa-text-secondary-inverse, #f5f5f8);
}

@media (max-width: 393px) {
    .sal-form-group-inverse .sal-form-help-text {
        height: unset !important;
    }
}

.sal-form-group-inverse .sal-form-help-text i {
    flex-shrink: 0;
    font-size: 16px;
    width: 16px;
    height: 16px;
    line-height: 16px;
}

/* Error: BOTH help text AND icon are white (text/primary-inverse = #ffffff)
   ⚠ Key inverse difference vs global-form.css:
     - global-form.css: error icon = var(--sa-icon-negative) red  (#cf2531)
     - inverse:         error icon = var(--sa-text-primary-inverse) WHITE
   Rationale: on a dark card, the red field + red help text icon is visually
   sufficient; the help text label and icon stay white for readability. */
.sal-form-group-inverse.is-error .sal-form-help-text {
    color: var(--sa-text-primary-inverse, #ffffff);
}

.sal-form-group-inverse.is-error .sal-form-help-text i {
    color: var(--sa-text-primary-inverse, #ffffff);
}

/* Success: icon uses positive color (same as global-form.css) */
.sal-form-group-inverse.is-success .sal-form-help-text i {
    color: var(--sa-icon-positive, #169f32);
}

/* Disabled: help text dims to text/disabled */
.sal-form-group-inverse.is-disabled .sal-form-help-text {
    color: var(--sa-text-disabled, #8b8b9e);
}

/* --- Success Square Indicator --- */
.sal-form-group-inverse .sal-form-success-square {
    display: inline-block;
    width: 10px;
    height: 10px;
    background-color: var(--sa-icon-positive, #169f32);
    border-radius: 2px;
    flex-shrink: 0;
}
