﻿/* Ribbon-matched loader theme
   Uses: --feature-accent, --feature-border (set in your theme root)
   If not set, we fall back to sky blue + light gray. */
:root {
    --feature-accent: var(--feature-accent, #0ea5e9);
    --feature-border: var(--feature-border, #e3e3e3);
    --loader-veil: rgba(0,0,0,.28);
}

/* ---- Full-screen overlays (both class names supported) ---- */
.spinner-container,
.spinner-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    /* ribbon-tinted veil + soft blur */
    background: radial-gradient(40% 50% at 50% 40%, color-mix(in srgb, var(--feature-accent) 12%, transparent) 0%, transparent 70%), var(--loader-veil);
    backdrop-filter: blur(2px);
}

/* ---- Circular spinner with glow ---- */
.spinner {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    border: 6px solid color-mix(in srgb, var(--feature-accent) 25%, transparent);
    border-top-color: var(--feature-accent);
    box-shadow: 0 0 0 1px rgba(255,255,255,.25) inset;
    animation: loader-spin 1s linear infinite, loader-glow .9s ease-in-out infinite alternate;
}

/* Optional caption under spinner */
.spinner-container p {
    color: #fff;
    margin-top: 1rem;
    font-size: 1.1rem;
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(0,0,0,.35);
}

/* ---- Progress underline (top, slim) ---- */
.progress-container {
    height: 2px;
    position: relative;
    display: inline-block;
}

.progress-underline {
    position: relative;
    height: 2px;
    width: 98vw; /* fixed 98w -> 98vw */
    background-color: var(--feature-border);
    overflow: hidden;
    margin-left: 50%;
    transform: translateX(-50%);
}

    .progress-underline .progress-bar {
        height: 100%;
        background-color: var(--feature-accent);
        width: 0%;
        animation: loading-progress 1.8s ease-in-out infinite;
    }

.static-underline {
    height: 1px;
    width: 98vw;
    background-color: var(--feature-border);
    margin-left: 50%;
    transform: translateX(-50%);
}

/* ---- Hourglass (works with inline SVG or icon fonts) ---- */
.hourglass-spinner {
    width: 120px;
    height: 240px;
    display: flex;
    justify-content: center;
    align-items: center;
    animation: loader-spin 4s linear infinite;
}

.hourglass {
    color: var(--feature-accent);
    fill: var(--feature-accent);
}

/* ---- Keyframes (deduped) ---- */
@keyframes loader-spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes loader-glow {
    from {
        box-shadow: 0 0 10px color-mix(in srgb, var(--feature-accent) 55%, transparent);
    }

    to {
        box-shadow: 0 0 18px color-mix(in srgb, var(--feature-accent) 75%, transparent);
    }
}

@keyframes loading-progress {
    0% {
        width: 0%;
    }

    50% {
        width: 55%;
    }

    100% {
        width: 100%;
    }
}
