/* Scoped to listing/account/checkout pages by ct-listing-flow-ui.php. */
#rtcl-form-builder-container,
.rtcl-checkout-content {
    --rtcl-primary-color: #316c6c;
    --rtcl-link-color: #316c6c;
}

#ct-package-selection :is(button, a):focus-visible,
.ct-package-banner:focus-visible,
#rtcl-form-builder-container :is(button, a, input, textarea, select):focus-visible,
#rtcl-checkout-form :is(button, a, input, select):focus-visible {
    outline: 3px solid #274949;
    outline-offset: 3px;
}

.ct-package-card:focus-within {
    border-color: #316c6c;
}

/* Give each item a defined place instead of wrapping three flex items. */
#rtcl-checkout-form .ct-checkout-auto-package {
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px 12px;
    box-sizing: border-box;
    max-width: 100%;
    padding: 16px 20px;
    margin-bottom: 20px;
    background: #edf5f4;
    border: 1px solid #accbc8;
    border-radius: 8px;
}

#rtcl-checkout-form .ct-checkout-package-title {
    grid-column: 2;
    min-width: 0;
    margin: 0;
    color: #274949;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

#rtcl-checkout-form .ct-checkout-package-price {
    grid-column: 3;
    margin: 0;
    color: #274949;
    font-size: 18px;
    font-weight: 700;
    line-height: 1.5;
    white-space: nowrap;
}

#ct-package-selection .ct-package-banner-inner {
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr) auto;
}

#ct-package-selection .ct-banner-text strong {
    line-height: 1.5;
}

#ct-package-selection .ct-banner-price {
    display: block;
    margin-top: 4px;
    color: #274949;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.5;
    white-space: nowrap;
}

#rtcl-form-builder-container .rtcl-fb-field-content,
#rtcl-form-builder-container .rtcl-fb-column,
#rtcl-form-builder-container .rtcl_wp_editor_wrap,
#rtcl-checkout-form .rtcl-form-group {
    min-width: 0;
}

#rtcl-form-builder-container .rtcl-fb-errors {
    color: #b42318;
    font-size: 14px;
    line-height: 1.5;
}

#rtcl-form-builder-container .rtcl-file-upload-instruction {
    color: #555;
    line-height: 1.6;
    overflow-wrap: anywhere;
}

#rtcl-form-builder-container .ant-btn-primary,
#rtcl-checkout-form button[type="submit"] {
    background: #316c6c;
    border-color: #316c6c;
    color: #fff;
    min-height: 44px;
    height: auto;
    white-space: normal;
}

#rtcl-form-builder-container .ant-btn-primary:hover:not(:disabled),
#rtcl-checkout-form button[type="submit"]:hover:not(:disabled) {
    background: #274949;
    border-color: #274949;
    color: #fff;
}

#rtcl-payment-methods .rtcl-payment-method > label {
    min-height: 44px;
    gap: 12px;
    flex-wrap: wrap;
}

#rtcl-payment-methods .rtcl-payment-method-input {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    line-height: 1.5;
}

#rtcl-payment-methods input[type="radio"] {
    flex: 0 0 auto;
    width: 18px;
    height: 18px;
    margin: 0;
    accent-color: #316c6c;
}

#rtcl-payment-methods .rtcl-payment-method-icons {
    max-width: 100%;
}

#rtcl-payment-methods .payment_box {
    overflow-wrap: anywhere;
}

@media (max-width: 600px) {
    .rtcl-form-page .rtcl-post-form-wrap,
    .rtcl-checkout-content {
        padding: 16px;
    }

    #ct-package-selection .ct-card-inner {
        padding: 24px 16px;
    }

    #ct-package-selection .ct-package-banner-inner,
    #rtcl-checkout-form .ct-checkout-auto-package {
        grid-template-columns: 28px minmax(0, 1fr);
        align-items: start;
        padding: 14px;
        gap: 6px 12px;
    }

    #rtcl-checkout-form .ct-checkout-auto-package > .ct-banner-check {
        grid-column: 1;
        grid-row: 1 / 3;
    }

    #rtcl-checkout-form .ct-checkout-package-title {
        grid-column: 2;
        grid-row: 1;
    }

    #rtcl-checkout-form .ct-checkout-package-price {
        grid-column: 2;
        grid-row: 2;
    }

    #ct-package-selection .ct-package-banner-inner > .ct-change-package {
        grid-column: 2;
        justify-self: start;
    }

    #ct-package-selection .ct-select-package-btn {
        width: 100%;
    }

    #rtcl-form-builder-container :is(input, textarea, select, .ant-select-selection-item),
    #rtcl-checkout-form :is(input, select, textarea) {
        font-size: 16px;
    }

    #rtcl-form-builder-container .rtcl-fb-field-wrap.label-left .rtcl-fb-field,
    #rtcl-form-builder-container .rtcl-fb-field-wrap.label-right .rtcl-fb-field {
        flex-direction: column;
    }

    #rtcl-form-builder-container .rtcl-fb-field-label {
        width: auto;
    }

    #rtcl-payment-methods ul.rtcl-list-group li.rtcl-list-group-item {
        padding: 12px;
    }

    #rtcl-payment-methods .payment_box,
    #rtcl-payment-methods .payment_box fieldset {
        padding: 12px;
    }

    #rtcl-checkout-form button[type="submit"] {
        width: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    #ct-package-selection .ct-package-card,
    #ct-package-selection .ct-select-package-btn {
        transition: none;
        transform: none;
    }
}
