/* Bordures et focus partagés par les réservations, les commandes et l’éditeur de mails. */
@layer tmt-reservation-fields {
    form.cart:has(.tmt-r-form, .wcf-public-day),
    :where(#tmt-mail-form, #order_data, #partial-payments-box, #tmt-agency-address, form.tmt-profile-form, form.tmt-payment-form, form.tmt-address-form, form.tmt-sepa-editor) {
        --tmt-field-border: #d6e1e1;
        --tmt-field-focus: #008996;

        & :is(.tmt-r-field-error, .wcf-form-error, [aria-invalid="true"]),
        & select:is(.tmt-r-field-error, .wcf-form-error, [aria-invalid="true"]) + .select2-container {
            --tmt-field-border: #ae1616;
        }
    }

    :where(form.tmt-profile-form, form.tmt-payment-form, form.tmt-address-form) { --tmt-field-border: var(--tmt-border, #d6e1e1); }

    form.tmt-sepa-editor :is(input[type="text"], input[type="email"], input[type="date"], input[type="number"], textarea),
    form.tmt-profile-form .tmt-profile-field input.input-text,
    form.tmt-address-form .form-row :is(input.input-text, select:not(.select2-hidden-accessible), .select2-selection),
    #tmt-agency-address .tmt-agency-address-fields :is(input, select),
    form.tmt-payment-form .tmt-payment-field:not(.tmt-sepa-day) :is(input[type="number"], select),
    form.cart:has(.tmt-r-form, .wcf-public-day) :is(input:not([type]), input:is([type="text"], [type="date"], [type="email"], [type="tel"], [type="password"], [type="search"], [type="number"]), textarea, select:not(.select2-hidden-accessible), .select2-selection),
    #partial-payments-box :is(input[type="text"], input[type="date"], input[type="number"], select:not(.select2-hidden-accessible)),
    :where(#order_data div.edit_address .form-field, #order_data .wc-order-status, #order_data .wc-customer-user) :is(input:not([type]), input:is([type="text"], [type="email"], [type="tel"], [type="number"]), textarea, select:not(.select2-hidden-accessible), .select2-selection),
    :where(#order_data) :is(.wcf-header-date summary, input[name="order_date"], input[name="order_date_hour"], input[name="order_date_minute"], #wcf-team-draft),
    :where(#tmt-mail-form) label > :is(input[type="text"], input[type="email"], input[type="url"], input[type="number"], textarea, select) {
        border-color: var(--tmt-field-border) !important;
        border-radius: 0 !important;

        &:focus {
            outline: 2px solid var(--tmt-field-focus) !important;
            outline-offset: 2px !important;
            box-shadow: none !important;
        }
    }

    :where(#order_data) .tmt-order-billing-options input[type="checkbox"]:focus-visible,
    :where(#order_data div.edit_address, #order_data .wc-order-status, #order_data .wc-customer-user) :is(.select2-container--open, .select2-container--focus) .select2-selection,
    form.cart:has(.tmt-r-form, .wcf-public-day) :is(.select2-container--open, .select2-container--focus) .select2-selection {
        outline: 2px solid var(--tmt-field-focus) !important;
        outline-offset: 2px !important;
        box-shadow: none !important;
    }

    form.cart:has(.tmt-r-form, .wcf-public-day) {
        & :is(.tmt-participant-count, .tmt-option-stepper, .quantity):has(input:not([type="button"], [type="submit"]):focus) {
            outline: 2px solid var(--tmt-field-focus) !important;
            outline-offset: 2px !important;
            box-shadow: none !important;
        }

        /* Le compteur reçoit un seul contour, autour du groupe « moins, nombre, plus ». */
        & :is(.tmt-participant-count, .tmt-option-stepper, .quantity),
        & .quantity :is(.minus, .plus, .wcf-step-down, .wcf-step-up) {
            border-color: var(--tmt-field-border) !important;
        }
        & :is(.tmt-participant-count, .tmt-option-stepper, .quantity) input:not([type="button"], [type="submit"]):focus {
            outline: none !important;
        }
    }
}

/* Champs de la fiche commande, en-tête et règlement. */
#order_data :is(input[name="order_date"], input[name="order_date_hour"], input[name="order_date_minute"]) {
    box-sizing: border-box;
    min-height: var(--wcf-field-height, 40px);
    font-size: 14px;
}

#order_data :is(div.edit_address .form-field, .wc-order-status, .wc-customer-user),
#partial-payments-box {
    --wcf-field-height: 40px;

    & :is(input:not([type=checkbox],[type=radio],[type=hidden]), textarea, select:not(.select2-hidden-accessible), .select2-selection--single) {
        box-sizing: border-box;
        min-height: var(--wcf-field-height);
        background-color: #fff;
        color-scheme: light;
        color: #172c3d;
        font-family: inherit;
        font-size: 14px;
        font-weight: 400;
        box-shadow: none;
    }
    & :is(input:not([type=checkbox],[type=radio],[type=hidden]), textarea) {
        padding: 7px 12px;
        padding-inline-end: var(--tmt-field-end-padding, 12px);
    }
    & :is(select:not(.select2-hidden-accessible), .select2-selection--single) { height: var(--wcf-field-height); margin: 0; }
    & select:not(.select2-hidden-accessible) { padding-inline: 12px 36px; }
}

#order_data :is(div.edit_address .form-field, .wc-order-status, .wc-customer-user) {
    & > .select2-container { display: block; min-width: 0; }
    & .select2-selection--single { position: relative; }
    & .select2-selection--single :is(.select2-selection__rendered, .select2-selection__arrow) {
        height: calc(var(--wcf-field-height) - 2px) !important;
        line-height: calc(var(--wcf-field-height) - 2px) !important;
    }
    & .select2-selection__rendered {
        box-sizing: border-box;
        width: 100%;
        min-width: 0;
        padding-inline: 12px 2px;
        color: inherit;
        font-size: inherit !important;
    }
    & .select2-selection__arrow { top: 0; background-position: center; }
    & .select2-selection__clear { margin-block-start: 0; margin-inline-start: 6px; }
}

#partial-payments-box :is(input[type="text"], input[type="number"], input[type="date"], select:not(.select2-hidden-accessible)) {
    height: var(--wcf-field-height);
    margin: 0;
    line-height: 1.4;
}
