/* ─── Body lock while global loader is visible ───────────────────────────── */

body.global-loader-active {
    overflow: hidden;
}

/* ─── Global splash — minimal, no branding ───────────────────────────────── */

.global-loader-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: var(--z-global-loader);
    animation: glIn 0.18s ease both;
}

@keyframes glIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.global-loader-overlay.global-loader--hiding {
    animation: glOut 0.16s ease both;
    pointer-events: none;
}

@keyframes glOut {
    to { opacity: 0; }
}

.global-loader-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    animation: glContentIn 0.3s cubic-bezier(0.2, 0, 0, 1) 0.04s both;
}

@keyframes glContentIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0);   }
}

/* ── Shimmer progress bar ───────────────────────────────────────────────── */

.global-loader-track {
    width: 120px;
    height: 2px;
    background: #e8ecf4;
    border-radius: 99px;
    overflow: hidden;
}

.global-loader-bar {
    height: 100%;
    width: 45%;
    border-radius: 99px;
    background: linear-gradient(90deg, var(--primary) 0%, #6096ff 50%, var(--primary) 100%);
    background-size: 200% 100%;
    animation: glBarSlide 1.5s ease-in-out infinite;
}

@keyframes glBarSlide {
    0%   { transform: translateX(-120%); }
    100% { transform: translateX(320%);  }
}

/* ── Three dots ─────────────────────────────────────────────────────────── */

.global-loader-dots {
    display: flex;
    align-items: center;
    gap: 6px;
}

.global-loader-dots span {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--primary);
    opacity: 0.2;
    animation: glDot 1.2s ease-in-out infinite;
}

.global-loader-dots span:nth-child(1) { animation-delay: 0s;    }
.global-loader-dots span:nth-child(2) { animation-delay: 0.18s; }
.global-loader-dots span:nth-child(3) { animation-delay: 0.36s; }

@keyframes glDot {
    0%, 100% { opacity: 0.2; transform: scale(0.8); }
    50%       { opacity: 1;   transform: scale(1.2); }
}

/* ─── Inline section loader (tab areas) ──────────────────────────────────── */

.tab-loader {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--overlay-light);
    backdrop-filter: blur(2px);
    z-index: 10;
    border-radius: inherit;
    animation: tlIn 0.12s ease both;
}

@keyframes tlIn  { from { opacity: 0; } to { opacity: 1; } }

.tab-loader.hiding { animation: tlOut 0.2s ease both; }

@keyframes tlOut { to { opacity: 0; } }

.tab-loader-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-3);
}

.tab-loader-spinner {
    position: relative;
    width: 28px;
    height: 28px;
}

.tab-loader-spinner .spinner-ring {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 2px solid transparent;
    border-top-color: var(--primary);
    animation: spin 0.85s linear infinite;
}

.tab-loader-spinner .spinner-ring:nth-child(2) {
    inset: 5px;
    border-top-color: rgba(var(--primary-rgb), 0.3);
    animation-direction: reverse;
    animation-duration: 1.2s;
}

.tab-loader-message {
    font-size: var(--font-size-xs);
    color: var(--text-subtle);
    font-weight: var(--font-weight-medium);
}

/* ─── Shared keyframes ───────────────────────────────────────────────────── */

@keyframes spin     { to { transform: rotate(360deg); } }
@keyframes dotPulse { 0%, 80%, 100% { opacity: .3; transform: scale(.75); } 40% { opacity: 1; transform: scale(1); } }
