/* One quiet ring for WPAdverts. Visibility remains controlled by each feature;
   animate the ring, not the container, so buttons and overlays stay in place. */
html body .adverts-icon-spinner.animate-spin {
    animation: none !important;
}

html body .adverts-icon-spinner::before,
html body .adverts-update-row .adverts-update-loader::before,
html body .adverts-edit-dialog .adverts-edit-dialog-status.is-loading::before,
html body .adverts-contact-disclosure-panel[data-contact-state="loading"] .adverts-contact-status::before,
html body .adverts-reviews:has(.adverts-reviews-list[aria-busy="true"]) .adverts-reviews-load-status::before,
html body .adverts-review-form[aria-busy="true"] .adverts-review-submit::before,
html body .adverts-favorite-button[aria-busy="true"]::after,
html body [class*="wpa-style-"] .spinner::before,
html body .wpa-styling-tab-form .spinner::before {
    content: '';
    display: inline-block;
    box-sizing: border-box;
    width: var(--adverts-loader-size, 20px);
    height: var(--adverts-loader-size, 20px);
    flex: 0 0 var(--adverts-loader-size, 20px);
    padding: 0;
    margin: 0;
    border: 2px solid #dbe5f5;
    border-top-color: var(--adverts-loader-color, #4169e1);
    border-right-color: var(--adverts-loader-color, #4169e1);
    border-radius: 50%;
    background: transparent;
    box-shadow: none;
    font-family: inherit;
    font-size: 0;
    line-height: 1;
    vertical-align: middle;
    animation: adverts-loader-turn .9s linear infinite;
}

html body .adverts-gallery-upload-update { --adverts-loader-size: 30px; }
html body .wpadverts-image-edit-spinner { --adverts-loader-size: 22px; }
html body .adverts-gallery-upload-update.adverts-icon-spinner::before { vertical-align: middle; }
html body .adverts-gallery-upload-update > .adverts-icon-spinner { line-height: 88px; }

/* Inline status text supplies the accessible loading announcement. */
html body .adverts-edit-dialog .adverts-edit-dialog-status.is-loading::before,
html body .adverts-contact-disclosure-panel[data-contact-state="loading"] .adverts-contact-status::before,
html body .adverts-reviews:has(.adverts-reviews-list[aria-busy="true"]) .adverts-reviews-load-status::before {
    --adverts-loader-size: 18px;
    margin-inline-end: 9px;
    vertical-align: -3px;
}

html body .adverts-review-form .adverts-review-submit { position: relative; padding-inline-end: 38px; }
html body .adverts-review-form[aria-busy="true"] .adverts-review-submit::before {
    --adverts-loader-size: 16px;
    --adverts-loader-color: #fff;
    border-left-color: rgba(255,255,255,.3);
    border-bottom-color: rgba(255,255,255,.3);
    position: absolute;
    inset-inline-end: 12px;
    top: 0;
    bottom: 0;
    margin: auto 0;
}

/* Keep the heart's space while a save is in progress. */
html body .adverts-favorite-button[aria-busy="true"] { position: relative; opacity: 1; }
html body .adverts-favorite-button[aria-busy="true"] .adverts-favorite-icon { visibility: hidden; }
html body .adverts-favorite-button[aria-busy="true"]::after { position: absolute; inset: 0; margin: auto; }

/* The old license GIF is replaced with markup, with the same JS visibility flag. */
html body .adverts-update-row .adverts-update-loader { display: inline-block; height: 20px; padding: 0; vertical-align: middle; }
html body .adverts-update-row .adverts-update-loader.adverts-off { display: none; }

/* WordPress's shared .spinner is changed only inside this plugin's styling UI. */
html body [class*="wpa-style-"] .spinner,
html body .wpa-styling-tab-form .spinner { background: none; }

/* Existing block SVG rings keep their hidden flags and use the same motion. */
html body svg.wpa-reveal-spinner,
html body svg.wpa-utility-spinner { color: #4169e1; animation: adverts-loader-turn .9s linear infinite; }
html body svg.wpa-reveal-spinner circle,
html body svg.wpa-utility-spinner circle { stroke: #dbe5f5; opacity: 1; }
html body svg.wpa-reveal-spinner path,
html body svg.wpa-utility-spinner path { opacity: 1; }

@keyframes adverts-loader-turn { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
    html body .adverts-icon-spinner::before,
    html body .adverts-update-row .adverts-update-loader::before,
    html body .adverts-edit-dialog .adverts-edit-dialog-status.is-loading::before,
    html body .adverts-contact-disclosure-panel[data-contact-state="loading"] .adverts-contact-status::before,
    html body .adverts-reviews:has(.adverts-reviews-list[aria-busy="true"]) .adverts-reviews-load-status::before,
    html body .adverts-review-form[aria-busy="true"] .adverts-review-submit::before,
    html body .adverts-favorite-button[aria-busy="true"]::after,
    html body [class*="wpa-style-"] .spinner::before,
    html body .wpa-styling-tab-form .spinner::before,
    html body svg.wpa-reveal-spinner,
    html body svg.wpa-utility-spinner { animation: none !important; }
}
