/**
 * assets/css/auth-loader.css
 *
 * SCHOLTRIX UNIFIED AUTH AUTO-LOADER UI
 * High-performance, modern loading UI for all authentication and registration pages:
 *  - Indeterminate top progress bar with brand gradient
 *  - Glassmorphic full-screen auto-loader overlay with pulsing brand aura
 *  - Responsive dark/light theme adaptation
 *  - Button loading micro-states with animated spinners
 */

:root {
    --auth-loader-brand: var(--brand, #2563eb);
    --auth-loader-brand-rgb: var(--brand-rgb, 37, 99, 235);
}

/* ── 1. Top Linear Progress Bar ────────────────────────────────────────────── */
#auth-top-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 3.5px;
    z-index: 9999999;
    background: linear-gradient(
        90deg, 
        var(--auth-loader-brand) 0%, 
        #38bdf8 50%, 
        var(--auth-loader-brand) 100%
    );
    background-size: 200% 100%;
    box-shadow: 0 0 14px rgba(var(--auth-loader-brand-rgb), 0.7);
    transition: width 0.35s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
    opacity: 0;
    pointer-events: none;
}

#auth-top-progress.active {
    opacity: 1;
    animation: authShimmer 1.5s infinite linear;
}

@keyframes authShimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ── 2. Full-Screen Backdrop Overlay Auto-Loader ──────────────────────────── */
#auth-loader-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999998;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, 0.52);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1), 
                visibility 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

#auth-loader-overlay.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* ── 3. Loader Card ───────────────────────────────────────────────────────── */
.auth-loader-card {
    background: rgba(255, 255, 255, 0.98);
    color: #1e293b;
    border-radius: 22px;
    padding: 34px 28px;
    width: 90%;
    max-width: 360px;
    text-align: center;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25), 
                0 0 0 1px rgba(255, 255, 255, 0.8) inset;
    transform: scale(0.9) translateY(12px);
    transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

#auth-loader-overlay.active .auth-loader-card {
    transform: scale(1) translateY(0);
}

/* Dark mode compatibility */
[data-bs-theme="dark"] .auth-loader-card,
.dark-mode .auth-loader-card {
    background: rgba(30, 41, 59, 0.96);
    color: #f8fafc;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5), 
                0 0 0 1px rgba(255, 255, 255, 0.1) inset;
}

/* ── 4. Pulsing Icon & Outer Spinning Ring ────────────────────────────────── */
.auth-loader-spinner-wrap {
    position: relative;
    width: 76px;
    height: 76px;
    margin: 0 auto 18px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-loader-ring {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 3.5px solid rgba(var(--auth-loader-brand-rgb), 0.15);
    border-top-color: var(--auth-loader-brand);
    border-right-color: var(--auth-loader-brand);
    animation: authSpin 0.9s cubic-bezier(0.55, 0.15, 0.45, 0.85) infinite;
}

.auth-loader-center-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    background: rgba(var(--auth-loader-brand-rgb), 0.1);
    color: var(--auth-loader-brand);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.65rem;
    overflow: hidden;
    animation: authPulse 1.8s ease-in-out infinite;
}

.auth-loader-center-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 6px;
}

@keyframes authSpin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes authPulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(0.92); opacity: 0.85; }
}

/* ── 5. Typography & Animated Loading Dots ────────────────────────────────── */
.auth-loader-title {
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 6px;
    color: inherit;
    letter-spacing: -0.01em;
}

.auth-loader-subtitle {
    font-size: 0.84rem;
    color: #64748b;
    margin-bottom: 0;
    line-height: 1.45;
}

[data-bs-theme="dark"] .auth-loader-subtitle,
.dark-mode .auth-loader-subtitle {
    color: #94a3b8;
}

.auth-loader-dots span {
    animation: authDotBlink 1.4s infinite;
    animation-fill-mode: both;
}

.auth-loader-dots span:nth-child(2) { animation-delay: 0.2s; }
.auth-loader-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes authDotBlink {
    0% { opacity: 0.2; }
    20% { opacity: 1; }
    100% { opacity: 0.2; }
}

/* ── 6. Form Submit Button Loading State ───────────────────────────────────── */
button.auth-btn-loading,
input[type="submit"].auth-btn-loading {
    position: relative;
    pointer-events: none !important;
    opacity: 0.88 !important;
    cursor: wait !important;
    transition: all 0.2s ease;
}

.auth-btn-spinner {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    vertical-align: -0.125em;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: authSpin 0.75s linear infinite;
    margin-right: 0.5rem;
}
