/* The client form's styles (Views/Shared/Forms/_ClientForm, _FormField), on the template's (instarc.css).
   Shared by the tenant application and the self-service app. */

/* A client's or subject's form (Views/Client/Forms, js/client/forms): the builder's layout fields, a tag's section,
   the composite fields' groups (phone, address, identity), the typeaheads' lists, the signature pad, and the states
   the rules give a field. Colours through the tokens, so both themes read. */
.ia-form-heading {
    margin: 1rem 0 0.25rem;
    color: var(--ia-dark);
    font-weight: 600;
    line-height: 1.3;
}

.ia-form-heading-h1 { font-size: 1.5rem; }
.ia-form-heading-h2 { font-size: 1.3125rem; }
.ia-form-heading-h3 { font-size: 1.125rem; }
.ia-form-heading-h4 { font-size: 1rem; }
.ia-form-heading-h5 { font-size: 0.9375rem; }
.ia-form-heading-h6 { font-size: 0.8125rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ia-muted); }

.ia-form-divider {
    margin: 0.75rem 0 1rem;
    border-color: var(--ia-border);
    opacity: 1;
}

.ia-form-spacer { height: 1.25rem; }

/* A tag's section: its own heading over its fields, opened and closed by its tag's box. */
.ia-tag-section {
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--ia-border);
}

.ia-tag-section-title {
    float: none;
    width: auto;
    margin-bottom: 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--ia-muted);
}

/* A field a rule disabled or made read only. */
.field-disabled .form-label,
.field-readonly .form-label { opacity: 0.7; }

/* The phone's code and the address's country and postal code share one input group with the main box. */
.ia-phone-group > .ia-phone-country,
.ia-address-group > .ia-address-country,
.ia-address-group > .ia-address-postal {
    display: flex;
    flex: 0 0 auto;
}

.ia-phone-group > .ia-phone-country { width: 9.5rem; }
.ia-address-group > .ia-address-country { width: 12rem; }
.ia-address-group > .ia-address-postal { width: 7.5rem; }

.ia-phone-group > .ia-phone-country .ia-search-select,
.ia-address-group > .ia-address-country .ia-search-select { width: 100%; }

.ia-phone-group > .ia-phone-country .ia-search-select-toggle,
.ia-phone-group > .ia-phone-country > .form-select,
.ia-address-group > .ia-address-country .ia-search-select-toggle,
.ia-address-group > .ia-address-country > .form-select {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

.ia-address-group > .ia-address-postal > .form-control {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    margin-left: -1px;
}

.ia-phone-group > .ia-phone-country .ia-search-select-text,
.ia-address-group > .ia-address-country .ia-search-select-text {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Identity information: country, type, number and dates side by side, each with its own small label. */
.ia-identity {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: flex-end;
}

.ia-identity-cell { flex: 0 0 auto; min-width: 0; }
.ia-identity-country { width: 15rem; }
.ia-identity-type { width: 12.5rem; }
.ia-identity-date { width: 11rem; }
.ia-identity-number { flex: 1 1 10rem; }

/* The typeaheads' lists open under their box. */
.ia-lookup-results,
.ia-address-results,
.ia-reference-results {
    max-height: 15rem;
    overflow-y: auto;
}

.ia-reference-display { cursor: pointer; }

/* The signature pad: white with black ink in both themes, a signature being ink on paper. */
.ia-signature-pad {
    overflow: hidden;
    border: 1px solid var(--ia-border);
    border-radius: var(--ia-radius);
    background: #ffffff;
}

.ia-signature-pad canvas {
    display: block;
    width: 100%;
    cursor: crosshair;
    touch-action: none;
}

.ia-signature-pad.is-signed { border-color: color-mix(in srgb, var(--ia-risk-low) 60%, var(--ia-border)); }
.ia-signature-pad.is-invalid { border-color: var(--bs-form-invalid-border-color, #dc3545); }

.ia-signature-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.375rem 0.5rem;
    border-top: 1px solid #e6e6ea;
    background: #f7f7f9;
    color: #5d596c;
}

/* A required document row with no file, when the save was refused. */
.required-missing { outline: 1px solid var(--bs-form-invalid-border-color, #dc3545); outline-offset: 2px; border-radius: var(--ia-radius); }

@media (max-width: 575.98px) {
    .ia-identity-country,
    .ia-identity-type,
    .ia-identity-date { width: 100%; }
    .ia-address-group > .ia-address-country { width: 100%; }
    .ia-address-group { flex-wrap: wrap; }
    .ia-address-group > .ia-address-country .ia-search-select-toggle,
    .ia-address-group > .ia-address-country > .form-select { border-radius: var(--ia-radius); margin-bottom: 0.25rem; }
}

