/* ============================================================
   VEXA — Loading System (Page Transition + Button Spinner)
   Lightweight, GPU-accelerated, identity-aligned (neon/glass)
   ============================================================ */

/* ---------- 1. Full-page Loading Overlay ---------- */
#vexa-loader {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 22px;
    background: rgba(5, 5, 5, 0.82);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

#vexa-loader.is-active {
    opacity: 1;
    visibility: visible;
}

/* Concentric neon ring spinner */
#vexa-loader .vexa-loader-ring {
    position: relative;
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#vexa-loader .vexa-loader-ring::before,
#vexa-loader .vexa-loader-ring::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 9999px;
    border: 2px solid transparent;
}

#vexa-loader .vexa-loader-ring::before {
    border-top-color: var(--vexa-blue, #0066FF);
    border-right-color: var(--vexa-blue, #0066FF);
    animation: vexaSpin 0.9s linear infinite;
    box-shadow: 0 0 14px rgba(0, 102, 255, 0.45);
}

#vexa-loader .vexa-loader-ring::after {
    inset: 9px;
    border-bottom-color: var(--vexa-green, #39FF14);
    border-left-color: var(--vexa-green, #39FF14);
    animation: vexaSpinReverse 1.2s linear infinite;
    box-shadow: 0 0 12px rgba(57, 255, 20, 0.4);
}

#vexa-loader .vexa-loader-text {
    font-family: 'Orbitron', 'Sora', sans-serif;
    font-size: 12px;
    letter-spacing: 0.28em;
    text-transform: uppercase;
    color: rgba(191, 199, 213, 0.7);
    display: flex;
    align-items: center;
    gap: 3px;
}

#vexa-loader .vexa-loader-text .dot {
    width: 4px;
    height: 4px;
    border-radius: 9999px;
    background: var(--vexa-green, #39FF14);
    box-shadow: 0 0 8px var(--vexa-green, #39FF14);
    animation: vexaPulseDot 1.2s ease-in-out infinite;
}
#vexa-loader .vexa-loader-text .dot:nth-child(2) { animation-delay: 0.2s; }
#vexa-loader .vexa-loader-text .dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes vexaSpin {
    to { transform: rotate(360deg); }
}
@keyframes vexaSpinReverse {
    to { transform: rotate(-360deg); }
}
@keyframes vexaPulseDot {
    0%, 100% { opacity: 0.3; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.4); }
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
    #vexa-loader .vexa-loader-logo,
    #vexa-loader .vexa-loader-ring::before,
    #vexa-loader .vexa-loader-ring::after,
    #vexa-loader .vexa-loader-text .dot {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
    }
}

/* ---------- 2. Inline Button Spinner ---------- */
.vexa-btn-spinner {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.vexa-btn-spinner .vexa-spin {
    width: 15px;
    height: 15px;
    border-radius: 9999px;
    border: 2px solid rgba(255, 255, 255, 0.25);
    border-top-color: #fff;
    animation: vexaSpin 0.7s linear infinite;
    flex-shrink: 0;
}

/* When a submit button is loading, hide its original label/svg and show spinner */
button[data-vexa-loading="1"] {
    position: relative;
    pointer-events: none;
}
button[data-vexa-loading="1"] .vexa-btn-label {
    opacity: 0.55;
}
button[data-vexa-loading="1"] .vexa-spin {
    display: inline-block;
}
.vexa-spin { display: none; }
