/* ComptaPlus — préchargeur et protection contre le double envoi (voir anti-double-submit.js). */
.cp-btn-spinner {
    display: inline-block;
    width: 1em;
    height: 1em;
    margin-right: .45em;
    vertical-align: -.15em;
    border: .15em solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: cp-spin .7s linear infinite;
}

[aria-busy="true"] { cursor: progress; }

.cp-preloader {
    position: fixed;
    inset: 0;
    z-index: 2000; /* au-dessus des modals Bootstrap (1055) */
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, .45);
    opacity: 0;
    visibility: hidden;
    transition: opacity .15s ease, visibility .15s ease;
    cursor: progress;
}

.cp-preloader.is-visible { opacity: 1; visibility: visible; }

.cp-preloader-box {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .7rem 1.1rem;
    border-radius: .5rem;
    background: #fff;
    color: #212529;
    font: 500 .95rem/1.2 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    box-shadow: 0 .25rem 1rem rgba(0, 0, 0, .12);
    border: 1px solid rgba(0, 0, 0, .08);
}

.cp-preloader-spinner {
    width: 1.25rem;
    height: 1.25rem;
    border: .18rem solid #0d6efd;
    border-right-color: transparent;
    border-radius: 50%;
    animation: cp-spin .7s linear infinite;
}

/* Barre de progression en haut de page pendant un chargement. */
.cp-topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 2001;
    height: 4px;
    overflow: hidden;
    pointer-events: none;
    opacity: 0;
    transition: opacity .15s ease;
}

.cp-topbar.is-visible { opacity: 1; }

.cp-topbar::before {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: -40%;
    width: 40%;
    background: linear-gradient(90deg, rgba(13, 110, 253, 0), #0d6efd 40%, #4f46e5);
    box-shadow: 0 0 8px rgba(13, 110, 253, .6);
    animation: cp-topbar 1.1s ease-in-out infinite;
}

html.cp-loading, html.cp-loading body { cursor: progress; }

@keyframes cp-topbar { to { left: 100%; } }

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

@media (prefers-reduced-motion: reduce) {
    .cp-btn-spinner, .cp-preloader-spinner { animation-duration: 2s; }
}

@media print { .cp-preloader, .cp-btn-spinner, .cp-topbar { display: none !important; } }
