/*
 * rx-form.css
 * RX form containers, table rows, fields, reusable sections and actions.
 */

.rx_form_container
{
    width: 100%;
}


.rx_form_container h2
{
    margin: 0 0 13px 0;

    color: #273947;
    font-size: 1.02rem;
    font-weight: 650;
}


/*
 * Every row participates in the same CSS table. A visible field is
 * one table cell containing the complete label + control pair.
 *
 * The table fills the pane. Columns therefore share the available
 * width, and the input/output expands to use all space left after
 * the fixed-width label.
 */
.rx_form
{
    --rx_form_label_width: 105px;

    display: table;

    width: 100%;

    table-layout: fixed;

    border-collapse: separate;
    border-spacing: 18px 7px;
}


.rx_form_row
{
    display: table-row;
}


.rx_form_field
{
    display: table-cell;

    min-width: 0;

    vertical-align: middle;
}


.rx_form_field_content
{
    width: 100%;

    display: flex;
    align-items: center;

    min-width: 0;
}


.rx_form_field label,
.rx_form_output_label
{
    flex: 0 0 var(--rx_form_label_width);

    margin-right: 8px;

    color: var(--rx-text-muted);
    font-size: 0.84rem;
    font-weight: 650;

    text-align: right;
    vertical-align: middle;
}




.rx_form_field label a
{
    color: inherit;
    text-decoration: none;
}


.rx_form_field label a:hover
{
    color: var(--rx-primary);
    text-decoration: underline;
}

.rx_form_field label::after,
.rx_form_output_label::after
{
    content: ':';
}


.rx_form_field input,
.rx_form_field select,
.rx_form_output
{
    /*
     * Fill everything remaining in the table column.
     * --rx_control_preferred_width remains available as a hint for
     * minimum sizing, but never prevents expansion.
     */
    flex: 1 1 var(--rx_control_preferred_width, 160px);

    width: 0;
    min-width: 70px;
}


.rx_form_field input,
.rx_form_field select
{
    min-height: 34px;

    padding: 6px 9px;

    color: var(--rx-text);
    background: #ffffff;

    border: 1px solid var(--rx-border-strong);
    border-radius: 5px;

    font: inherit;
    outline: none;

    transition:
        border-color 100ms ease,
        box-shadow 100ms ease,
        background-color 100ms ease;
}


.rx_form_field input:hover,
.rx_form_field select:hover
{
    border-color: #86a7b9;
}


.rx_form_field input:focus,
.rx_form_field select:focus
{
    border-color: var(--rx-primary);
    box-shadow: 0 0 0 3px var(--rx-focus-ring);
}


.rx_form_field input:invalid,
.rx_form_field select:invalid
{
    border-color: var(--rx-danger);
}


.rx_form_field input[readonly]
{
    color: var(--rx-text-muted);
    background: var(--rx-surface-soft);
    border-color: var(--rx-border);
}


.rx_form_output
{
    min-height: 34px;

    display: flex;
    align-items: center;

    padding: 6px 9px;

    color: #294958;
    background: #edf6fa;

    border: 1px solid #bdd6e2;
    border-radius: 5px;

    overflow-wrap: anywhere;
    white-space: normal;
}



/* ------------------------------------------------------------------ */
/* Reusable form sections                                             */
/* ------------------------------------------------------------------ */

.rx_form_section
{
    width: 100%;

    margin-top: 18px;
    padding-top: 2px;

    border-top: 1px solid var(--rx-border);
}


.rx_form_section_title
{
    display: inline-block;

    margin: -1px 0 4px 0;
    padding: 5px 12px;

    color: #ffffff;
    background: var(--rx-primary);

    border-left: 5px solid var(--rx-secondary);
    border-radius: 0 4px 4px 0;

    font-size: 0.88rem;
    font-weight: 700;
    letter-spacing: 0.01em;
}


.rx_form_section .rx_form
{
    margin-top: 1px;
}


.rx_form_section .rx_form_output
{
    background: #f1f8fb;
    border-color: #c4dce7;
}


.rx_form_actions
{
    display: flex;
    justify-content: flex-start;

    margin-top: 14px;
    padding-top: 12px;

    border-top: 1px solid #e7ebef;
}


.rx_form_actions button
{
    min-width: 110px;

    padding: 9px 16px;

    color: #ffffff;
    background: var(--rx-primary);

    border: 1px solid var(--rx-primary-hover);
    border-radius: 5px;

    font: inherit;
    font-weight: 650;

    cursor: pointer;

    transition:
        background-color 100ms ease,
        border-color 100ms ease,
        box-shadow 100ms ease;
}


.rx_form_actions button:hover
{
    background: var(--rx-primary-hover);
}


@media (max-width: 760px)
{
    .rx_form,
    .rx_form_row,
    .rx_form_field
    {
        display: block;
        width: 100%;
    }

    .rx_form_row
    {
        margin-bottom: 10px;
    }

    .rx_form_field
    {
        margin-bottom: 7px;
    }

    .rx_form_field_content
    {
        width: 100%;
    }

    .rx_form_field label,
    .rx_form_output_label
    {
        flex-basis: 105px;
    }

    .rx_form_field input,
    .rx_form_field select,
    .rx_form_output
    {
        width: 0;
        min-width: 0;
    }
}
