﻿/* ===========================
   Lagom Preloader (global)
   =========================== */

/* Controle de visibilidade do overlay */
#preloader[hidden] {
    display: none !important;
}

/* Overlay: abaixo de Swal2 e modais Bootstrap */
.lagom-preloader {
    position: fixed;
    inset: 0;
    z-index: 1040; /* Swal2 ~1100+, Modal ~1055 */
    pointer-events: auto; /* bloqueia cliques no conteúdo enquanto visível */
}

html.is-loading {
    overflow: hidden;
}

/* Garante SweetAlert2 acima do preloader (caso o tema mude z-index) */
.swal2-container {
    z-index: 1100;
}

/* Backdrop com awareness de tema */
:root {
    --lagom-preloader-bg: rgba(255, 255, 255, .96); /* claro */
}

[data-bs-theme="dark"] {
    --lagom-preloader-bg: rgba(21, 25, 29, .85); /* escuro */
}

.lagom-preloader__backdrop {
    position: absolute;
    inset: 0;
    background: var(--lagom-preloader-bg);
    backdrop-filter: blur(2px);
}

.lagom-preloader__status {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* ===========================
   Spinner "chase" (Samply-like)
   =========================== */

.lagom-preloader .spinner-chase {
    position: relative;
    width: 40px;
    height: 40px;
    animation: spinner-chase 2.5s infinite linear both;
    /* herda a cor do texto: use .text-primary/.text-secondary etc. */
}

.lagom-preloader .chase-dot {
    width: 100%;
    height: 100%;
    position: absolute;
    left: 0;
    top: 0;
    animation: chase-dot 2s infinite ease-in-out both;
}

    .lagom-preloader .chase-dot:before {
        content: "";
        display: block;
        width: 25%;
        height: 25%;
        background-color: currentColor;
        border-radius: 100%;
        animation: chase-dot-before 2s infinite ease-in-out both;
    }

    /* Delays para as 6 bolinhas */
    .lagom-preloader .chase-dot:nth-child(1) {
        animation-delay: -1.1s;
    }

    .lagom-preloader .chase-dot:nth-child(2) {
        animation-delay: -1.0s;
    }

    .lagom-preloader .chase-dot:nth-child(3) {
        animation-delay: -0.9s;
    }

    .lagom-preloader .chase-dot:nth-child(4) {
        animation-delay: -0.8s;
    }

    .lagom-preloader .chase-dot:nth-child(5) {
        animation-delay: -0.7s;
    }

    .lagom-preloader .chase-dot:nth-child(6) {
        animation-delay: -0.6s;
    }

/* Keyframes */
@keyframes spinner-chase {
    100% {
        transform: rotate(360deg);
    }
}

@keyframes chase-dot {
    80%, 100% {
        transform: rotate(360deg);
    }
}

@keyframes chase-dot-before {
    0%, 100% {
        transform: scale(1.0);
    }

    50% {
        transform: scale(0.4);
    }
}

/* Acessibilidade: reduzir movimento */
@media (prefers-reduced-motion: reduce) {
    .lagom-preloader .spinner-chase,
    .lagom-preloader .chase-dot,
    .lagom-preloader .chase-dot:before {
        animation: none !important;
    }
}
