/* ═══ LavaMalis — Global Loader & Progress ═══ */

.lava-top-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    width: 0;
    background: linear-gradient(90deg, #6366f1, #8b5cf6, #06b6d4);
    z-index: 100000;
    transition: width 0.3s ease;
    box-shadow: 0 0 12px rgba(99, 102, 241, 0.6);
}

.lava-global-loader {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(10, 10, 20, 0.55);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.lava-global-loader.show {
    opacity: 1;
    pointer-events: auto;
}

.lava-loader-card {
    text-align: center;
    padding: 32px 40px;
    border-radius: 20px;
    background: var(--lava-glass, rgba(255, 255, 255, 0.95));
    border: 1px solid var(--lava-glass-border, rgba(255, 255, 255, 0.4));
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.25);
    min-width: 160px;
}

.lava-loader-ring {
    width: 52px;
    height: 52px;
    margin: 0 auto 16px;
    border-radius: 50%;
    border: 3px solid rgba(99, 102, 241, 0.15);
    border-top-color: #6366f1;
    border-right-color: #8b5cf6;
    animation: lavaSpin 0.75s linear infinite;
}

.lava-loader-dots {
    display: flex;
    gap: 6px;
    justify-content: center;
    margin-bottom: 14px;
}

.lava-loader-dots span {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    animation: lavaBounce 1.2s ease-in-out infinite;
}

.lava-loader-dots span:nth-child(2) { animation-delay: 0.15s; }
.lava-loader-dots span:nth-child(3) { animation-delay: 0.3s; }

.lava-loader-text {
    font-size: 0.9rem;
    color: var(--text-secondary, #64748b);
    font-weight: 600;
}

@keyframes lavaSpin {
    to { transform: rotate(360deg); }
}

@keyframes lavaBounce {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
    40% { transform: scale(1); opacity: 1; }
}

/* Button loading */
.btn-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.85;
}

.btn-loading .btn-text { opacity: 0; }

.btn-loading .btn-spinner {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-spinner i {
    animation: lavaSpin 0.7s linear infinite;
}

/* Upgrade legacy overlay */
.loading-overlay {
    background: rgba(10, 10, 20, 0.55) !important;
    backdrop-filter: blur(8px);
    z-index: 99998 !important;
}

.loading-overlay .loading-spinner {
    background: var(--lava-glass, rgba(255, 255, 255, 0.95));
    border: 1px solid var(--lava-glass-border, rgba(99, 102, 241, 0.2));
    border-radius: 20px;
    padding: 28px 36px;
}

.loading-overlay .loading-spinner i {
    color: #6366f1 !important;
    font-size: 2.2rem;
}

.loading-overlay .loading-spinner::before {
    content: '';
    display: block;
    width: 48px;
    height: 48px;
    margin: 0 auto 12px;
    border-radius: 50%;
    border: 3px solid rgba(99, 102, 241, 0.15);
    border-top-color: #6366f1;
    animation: lavaSpin 0.75s linear infinite;
}

.loading-overlay .loading-spinner i.fa-spinner {
    display: none;
}

/* Page enter */
body.lava-app {
    animation: pageFadeIn 0.4s ease;
}

@keyframes pageFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Inline field loading */
.field-loading {
    position: relative;
}

.field-loading::after {
    content: '';
    position: absolute;
    left: 12px;
    top: 50%;
    width: 18px;
    height: 18px;
    margin-top: -9px;
    border: 2px solid rgba(99, 102, 241, 0.2);
    border-top-color: #6366f1;
    border-radius: 50%;
    animation: lavaSpin 0.6s linear infinite;
}

[dir="ltr"] .field-loading::after {
    left: auto;
    right: 12px;
}
