/* ============================================================
   saas-loader.css — Morphing blob loader (theme-aware)
   ============================================================ */

#saas-global-loader {
    position: fixed;
    inset: 0;
    z-index: 2147483000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: color-mix(in srgb, color-mix(in srgb, var(--theme-primary, #0b6d6d) 30%, #0a1012) 72%, transparent);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity .2s ease, visibility .2s ease;
}
#saas-global-loader.show {
    opacity: 1;
    visibility: visible;
    pointer-events: none;
}
#saas-global-loader.saas-initial {
    background: color-mix(in srgb, color-mix(in srgb, var(--theme-primary, #0b6d6d) 30%, #0a1012) 88%, transparent);
    transition: none;
    animation: saas-loader-failsafe 0s linear 15s forwards;
}



/* ── Center box ── */
.saas-loader-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

/* ══════════════════════════════════════
   SHIELD LOADER
══════════════════════════════════════ */
.sl-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
}

.sl-main-svg {
    width: 210px;
    height: 197px;
    overflow: visible;
}

/* Circuit nest rotates */
.sl-ring-group {
    transform-origin: 503px 470px;
    animation: sl-nest-sway 3s ease-in-out infinite;
}
.sl-flow { stroke-dasharray: 110 900; animation: sl-flow 1.5s linear infinite; }
.sl-flow1 { animation-duration: 2s; animation-delay: -1s; }
.sl-flow2 { animation-duration: 1.2s; animation-delay: -2s; }
.sl-node { animation: sl-node-pulse 1.1s ease-in-out infinite; }

/* Sparkle twinkles */
.sl-sparkle-g {
    animation: sl-sparkle-twinkle 1s ease-in-out infinite;
    transform-origin: 985px 935px;
}

/* Loading text */
.saas-loader-brand {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    font-size: .95rem;
    font-weight: 600;
    letter-spacing: .08em;
    color: #8fa5a8;
    animation: sl-text-fade 1.1s ease-in-out infinite;
}

/* ══════════════════════════════════════
   KEYFRAMES
══════════════════════════════════════ */
@keyframes sl-nest-sway { 0%,100% { transform: rotate(-4deg); } 50% { transform: rotate(4deg); } }
@keyframes sl-flow { from { stroke-dashoffset: 0; } to { stroke-dashoffset: -1010; } }
@keyframes sl-node-pulse { 0%,100% { opacity: .55; } 50% { opacity: 1; } }
@keyframes sl-shield-pulse-unused {
    0%,100% { transform: scale(1); }
    50%      { transform: scale(1.04); }
}
@keyframes sl-sparkle-twinkle {
    0%,100% { opacity: .25; transform: scale(.7) rotate(0deg); }
    50%      { opacity: 1;   transform: scale(1.2) rotate(15deg); }
}
@keyframes sl-text-fade {
    0%,100% { opacity: .35; }
    50%      { opacity: .85; }
}
@keyframes saas-loader-failsafe {
    to { opacity: 0; visibility: hidden; pointer-events: none; }
}
@media (prefers-reduced-motion: reduce) {
    .sl-ring-group, .sl-flow, .sl-node, .sl-sparkle-g,
    .saas-loader-brand { animation: none; }
}

/* Theme-aware accents */
#saas-global-loader { --sl-acc: color-mix(in srgb, var(--theme-primary, #0b6d6d) 40%, #fff); }
#saas-global-loader path[stroke="#7fae9f"] { stroke: var(--sl-acc); }
#saas-global-loader circle[stroke="#7fae9f"] { stroke: var(--sl-acc); }
#saas-global-loader circle[fill="#7fae9f"], #saas-global-loader circle[stroke="#7fae9f"] + circle { fill: var(--sl-acc); }
#saas-global-loader path[stroke="#566673"] { stroke: color-mix(in srgb, var(--theme-primary, #0b6d6d) 35%, #5a6670); }
#saas-global-loader #sl-bowl stop:first-child, #saas-global-loader #sl-tail stop:first-child { stop-color: color-mix(in srgb, var(--theme-primary, #0b6d6d) 35%, #fff); }
#saas-global-loader #sl-bowl stop:last-child { stop-color: color-mix(in srgb, var(--theme-primary, #0b6d6d) 60%, #fff); }
#saas-global-loader #sl-tail stop:last-child { stop-color: color-mix(in srgb, var(--theme-primary, #0b6d6d) 50%, #667785); }
#saas-global-loader path[fill="#14233b"] { fill: color-mix(in srgb, var(--theme-primary, #0b6d6d) 25%, #0c1626); }
#saas-global-loader circle[fill="#1a2a2e"] { fill: color-mix(in srgb, var(--theme-primary, #0b6d6d) 25%, #0c1416); }
.saas-loader-brand { color: color-mix(in srgb, var(--theme-primary, #0b6d6d) 35%, #fff); }
