/*------------------------------------*\
    
    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 */
}

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

/* CF7 Validation (Remove if not using CF7) */

/* Individual field error messages */
.wpcf7 .wpcf7-not-valid-tip {
    color: var(--charcoal);
    font-size: 10px;
    font-weight: bold;
    text-transform: uppercase;
    margin-top: 6px;
    position: relative;

    &:before {
        content: "";
        display: block;
        position: absolute;
        top: -42px;
        right: 6px;
        width: 28px;
        height: 28px;
        background-image: url('/wp-content/themes/awg/assets/img/icon-error.svg');
        background-size: contain;
        background-repeat: no-repeat;
        background-position: center;
    }
}

.choices + .wpcf7-not-valid-tip {
    &:before {
        right: 36px;
    }
}

textarea + .wpcf7-not-valid-tip {
    &:before {
        top: -46px;
    }
}

/* Entire form error message */
.wpcf7-response-output {

}

/* Styling for fields that have errors */
select.wpcf7-not-valid,
textarea.wpcf7-not-valid,
input.wpcf7-not-valid,
.wpcf7-not-valid .choices,
.wpcf7-not-valid .choices__inner {
    border-color: var(--charcoal);
    border-left: 4px solid var(--charcoal);
}

/* Adding CF7 Spinner for loading */
.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;
    }
}

.wpcf7 [type="submit"] {
    &:after {
        opacity: 1;
        transition: opacity 0.3s ease-in-out;
    }

    &:before {
        content: "";
        display: block;
        position: absolute;
        top: 16px;
        right: 20px;
        width: 20px;
        height: 20px;
        border-radius: 50%;
        border: 2px solid var(--charcoal);
        border-top: 2px solid transparent;
        animation: spin 1s linear infinite;
        opacity: 0;
        transition: opacity 0.3s ease-in-out;
    }
}

.wpcf7-form.submitting [type="submit"] {
    background-color: #ccc;
    pointer-events: none;
    cursor: not-allowed;

    &:after {
        opacity: 0;
    }

    &:before {
        opacity: 1;
    }
}