/**
 * Cortex C-mark spinner — replaces Bootstrap/FA loaders system-wide.
 * Color follows the user's shell accent: var(--shell-accent).
 */
:root {
    --plus-c-spinner-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cpath d='M72 30C66.5 23.5 58.5 20 50 20C33.4 20 20 33.4 20 50C20 66.6 33.4 80 50 80C58.5 80 66.5 76.5 72 70' fill='none' stroke='%23000' stroke-width='12' stroke-linecap='butt'/%3E%3Ccircle cx='72' cy='50' r='8' fill='%23000'/%3E%3C/svg%3E");
}

@keyframes plus-c-spin {
    to {
        transform: rotate(360deg);
    }
}

/* Utility + Bootstrap spinner overrides */
.plus-c-spinner,
.spinner-border,
.spinner-grow,
.spinner-border-sm,
.spinner-grow-sm {
    display: inline-block;
    width: 1.5rem;
    height: 1.5rem;
    vertical-align: -0.125em;
    border: 0 !important;
    border-right-color: transparent !important;
    border-radius: 0 !important;
    opacity: 1 !important;
    background-color: var(--shell-accent, #1d7eff) !important;
    background-image: none !important;
    -webkit-mask: var(--plus-c-spinner-mask) center / contain no-repeat !important;
    mask: var(--plus-c-spinner-mask) center / contain no-repeat !important;
    animation: plus-c-spin 0.85s linear infinite !important;
}

.spinner-border-sm,
.spinner-grow-sm,
.plus-c-spinner--sm {
    width: 1rem;
    height: 1rem;
}

.plus-c-spinner--lg {
    width: 2.5rem;
    height: 2.5rem;
}

.plus-c-spinner--xl {
    width: 3.25rem;
    height: 3.25rem;
}

/* Font Awesome loading icons → Cortex C */
.fa-spinner::before,
.fa-circle-notch::before,
.fa-sync::before,
.fa-sync-alt::before,
.fa-redo::before,
.fa-redo-alt::before,
.fa-refresh::before,
.fas.fa-spinner::before,
.fas.fa-circle-notch::before,
.fas.fa-sync::before,
.fas.fa-sync-alt::before,
.fas.fa-redo::before,
.fas.fa-redo-alt::before,
.fas.fa-refresh::before,
.far.fa-spinner::before,
.far.fa-circle-notch::before {
    content: "" !important;
    display: inline-block !important;
    width: 1em;
    height: 1em;
    background-color: var(--shell-accent, currentColor) !important;
    -webkit-mask: var(--plus-c-spinner-mask) center / contain no-repeat !important;
    mask: var(--plus-c-spinner-mask) center / contain no-repeat !important;
    animation: none;
}

/* Keep spin when FA spin class (or parent expects motion) */
.fa-spin.fa-spinner::before,
.fa-spin.fa-circle-notch::before,
.fa-spin.fa-sync::before,
.fa-spin.fa-sync-alt::before,
.fa-spin.fa-redo::before,
.fa-spin.fa-redo-alt::before,
.fa-spin.fa-refresh::before,
.fa-spinner.fa-spin::before,
.fa-circle-notch.fa-spin::before,
.fa-sync.fa-spin::before,
.fa-sync-alt.fa-spin::before,
.fa-refresh.fa-spin::before,
.loading-spinner .fa-spinner::before,
.loading-spinner .fa-circle-notch::before,
.data-table-loading .fa-spinner::before,
.loading-row .fa-spinner::before,
.overlay > .fa-refresh::before,
.overlay > .fa-spinner::before,
.overlay > .fa-sync-alt::before {
    animation: plus-c-spin 0.85s linear infinite !important;
}

.cortex-mark {
    display: block;
    width: 1.5rem;
    height: 1.5rem;
}

.cortex-mark__arc {
    fill: none;
    stroke: var(--shell-accent, #138496);
    stroke-width: 12;
    stroke-linecap: butt;
}

.cortex-mark__dot {
    fill: var(--shell-accent, #138496);
}

.cortex-mark.is-spinning {
    animation: plus-c-spin 0.85s linear infinite;
    transform-origin: 50% 50%;
}

/* Always spin common loader icons even without fa-spin */
.fa-spinner::before,
.fa-circle-notch::before {
    animation: plus-c-spin 0.85s linear infinite !important;
}

@media (prefers-reduced-motion: reduce) {
    .plus-c-spinner,
    .spinner-border,
    .spinner-grow,
    .spinner-border-sm,
    .spinner-grow-sm,
    .fa-spinner::before,
    .fa-circle-notch::before,
    .fa-spin.fa-spinner::before,
    .fa-spin.fa-circle-notch::before,
    .fa-spin.fa-sync::before,
    .fa-spin.fa-sync-alt::before,
    .fa-spin.fa-refresh::before,
    .cortex-mark.is-spinning {
        animation-duration: 1.7s !important;
    }
}
