/* Advanced form page fields. Loaded from advanced_form/_form.html, so it applies
   both on the form page itself and where the form is embedded via the chooser block. */

.advanced-form {
    gap: 1rem;
}

.advanced-form .form-control {
    height: auto;
}

.advanced-form h5 {
    margin: 1rem 0;
    font-size: 1.5rem;
}

/* ---------------------------------------------------------------------------
   Checkboxes and radios: box first, label text beside it, same on single
   checkboxes and on checkbox/radio groups.
   --------------------------------------------------------------------------- */
.advanced-form .CheckboxSelectMultiple label,
.advanced-form .RadioSelect label,
.advanced-form .CheckboxInput label {
    display: flex;
    /* box level with the first line, not centred on long multi-line options */
    align-items: flex-start;
    gap: .875rem;
    cursor: pointer;
}

/* the group heading label is not a clickable option row */
.advanced-form .CheckboxSelectMultiple > label,
.advanced-form .RadioSelect > label {
    cursor: default;
}

.advanced-form .CheckboxSelectMultiple > div > div + div,
.advanced-form .RadioSelect > div > div + div {
    margin-top: .5rem;
}

.advanced-form input[type="checkbox"],
.advanced-form input[type="radio"] {
    flex-shrink: 0;
    cursor: pointer;
    transform: none;
}

.advanced-form input[type="checkbox"]:hover,
.advanced-form input[type="radio"]:hover {
    box-shadow: 0 0 0 3px rgba(23, 45, 111, .12);
}

.advanced-form input[type="checkbox"]:focus-visible,
.advanced-form input[type="radio"]:focus-visible {
    outline: 2px solid var(--text-text-primary);
    outline-offset: 2px;
}

/* tick: centred in the box rather than anchored to the bottom-left */
.advanced-form input[type="checkbox"]::before {
    transform-origin: center;
}

/* ---------------------------------------------------------------------------
   Multi-select: styled list box in line with the other fields.
   --------------------------------------------------------------------------- */
.advanced-form select[multiple] {
    width: 100%;
    height: auto;
    max-height: 16rem;
    padding: .375rem;
    overflow-y: auto;
    appearance: none;
    background: var(--surface-surface-invert, #fff);
    border: 1px solid var(--Neutral-200, #D7DADF);
    border-radius: 0;
    color: var(--text-text-primary);
    font-family: inherit;
    font-size: 1rem;
    outline: none;
    box-shadow: none;
}

.advanced-form select[multiple]:focus {
    border-color: var(--text-text-primary);
}

.advanced-form select[multiple] option {
    padding: .5rem .75rem;
    margin-bottom: 2px;
    color: var(--text-text-primary);
    cursor: pointer;
}

.advanced-form select[multiple] option:hover {
    background: rgba(23, 45, 111, .08);
}

/* the gradient forces the colour in Chrome, which otherwise greys out the
   selection whenever the list does not have focus */
.advanced-form select[multiple] option:checked {
    background: var(--text-text-primary) linear-gradient(var(--text-text-primary), var(--text-text-primary));
    color: var(--text-text-invert, #fff);
}

.advanced-form .SelectMultiple .field-hint {
    display: block;
    margin-top: .375rem;
    opacity: .75;
}

/* ---------------------------------------------------------------------------
   File upload button: hover/active colours come from the site-wide rule in
   core/static/css/style.css (.default-form-fields ... ::file-selector-button).
   --------------------------------------------------------------------------- */
.advanced-form input[type="file"] {
    cursor: pointer;
}
