/*------------------------------------*\
    
    WebFX CF7 Customizations - Global styling for all CF7 Forms

    Add custom CF7 form styling to this file if it should be applied to all CF7 forms on the site
    Otherwise, put your block-specific styles in individual block stylesheets so that various block-specific styles aren't loaded on every CF7 form

\*------------------------------------*/


/* Default Radio/Checkbox Style (if using CF7) */
.wpcf7-radio .wpcf7-list-item,
.wpcf7-checkbox .wpcf7-list-item {
    display: inline-block;
    margin-right: 15px;
    margin-bottom: 10px;
    /* incase items go to 2 lines */
    margin-left: 0;
    /* CF7 indents every item by 1em via a margin shorthand */
}

.wpcf7-radio .wpcf7-list-item-label,
.wpcf7-checkbox .wpcf7-list-item-label {
    margin-left: 5px;
}

/**
 * CF7 Validation (Remove if not using CF7)
 *
 * Colors come from the shared form tokens in forms.css so CF7 and Gravity Forms report errors the
 * same way. CF7's own stylesheet loads after this file, so each rule below carries an extra class to
 * outweigh the plugin default without resorting to !important.
 */

/* Individual field error messages */
.wpcf7-form .wpcf7-not-valid-tip {
    display: block;
    margin-top: var(--form-label-gap);
    color: var(--form-error-color);
    font-size: 0.875em;
    font-weight: 400;
}

/**
 * Entire form message
 *
 * "display" is deliberately left alone here - CF7 uses it to hide this element while the form is
 * initialising, resetting and submitting.
 */
.wpcf7 .wpcf7-form .wpcf7-response-output {
    margin: var(--form-field-gap) 0 0;
    padding: var(--form-control-padding);
    border: 0;
    border-left: 3px solid transparent;
    border-radius: var(--form-control-radius);
    font-size: 0.9375em;
}

/* Successful submission */
.wpcf7 .wpcf7-form.sent .wpcf7-response-output {
    border-left-color: var(--form-success-color);
    background-color: var(--form-success-background);
    color: var(--form-success-color);
}

/* Validation errors, spam blocks and send failures */
.wpcf7 .wpcf7-form.invalid .wpcf7-response-output,
.wpcf7 .wpcf7-form.unaccepted .wpcf7-response-output,
.wpcf7 .wpcf7-form.payment-required .wpcf7-response-output,
.wpcf7 .wpcf7-form.spam .wpcf7-response-output,
.wpcf7 .wpcf7-form.failed .wpcf7-response-output,
.wpcf7 .wpcf7-form.aborted .wpcf7-response-output {
    border-left-color: var(--form-error-color);
    background-color: var(--form-error-background);
    color: var(--form-error-color);
}

/**
 * Styling for fields that have errors
 *
 * The Choices.js selector is needed because Choices hides the real <select> (the element CF7 flags
 * as invalid) inside its own markup, so the visible box has to be matched through it.
 */
.wpcf7-form .wpcf7-form-control.wpcf7-not-valid,
.wpcf7-form .choices__inner:has(.wpcf7-not-valid) {
    background-color: var(--form-error-background);
    outline: 1px solid var(--form-error-color);
    outline-offset: 0;
}

/* Keeps the error color on focus while still growing the ring, so focus stays obvious */
.wpcf7-form .wpcf7-form-control.wpcf7-not-valid:focus {
    outline-width: var(--form-focus-ring-width);
}

/* Adding the CF7 Spinner Animation */
.wpcf7-spinner {
    visibility: hidden;
    display: inline-block;
    background-color: #23282d;
    /* Dark Gray 800 */
    opacity: 0.75;
    width: 24px;
    height: 24px;
    border: none;
    border-radius: 100%;
    padding: 0;
    margin: 0 24px;
    position: relative;
}

.form-submitting .wpcf7-spinner {
    visibility: visible;
}

.wpcf7-spinner::before {
    content: '';
    position: absolute;
    background-color: #fbfbfc;
    /* Light Gray 100 */
    top: 4px;
    left: 4px;
    width: 6px;
    height: 6px;
    border: none;
    border-radius: 100%;
    transform-origin: 8px 8px;
    animation-name: spin;
    animation-duration: 1000ms;
    animation-timing-function: linear;
    animation-iteration-count: infinite;
}

@media (prefers-reduced-motion: reduce) {
    .wpcf7-spinner::before {
        animation-name: blink;
        animation-duration: 2000ms;
    }
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

@keyframes blink {
    from {
        opacity: 0;
    }

    50% {
        opacity: 1;
    }

    to {
        opacity: 0;
    }
}