/* =========================================================
   FPLyzer — Unified Loading Overlay Design System
   Single source of truth for all page loading overlays.
   Colors: #38003C (purple), #00FF87 (green), #E90052 (pink)
   ========================================================= */

/* ── Backdrop ── */
.loading-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(56, 0, 60, 0.96), rgba(30, 0, 50, 0.96));
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

/* Show the overlay by adding .active class via JavaScript */
.loading-overlay.active {
    display: flex;
}

/* ── Card ── */
.loading-content {
    text-align: center;
    background: rgba(18, 8, 32, 0.92);
    padding: 40px 36px 32px;
    border-radius: 22px;
    border: 2px solid rgba(0, 255, 135, 0.28);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    max-width: 420px;
    width: 90%;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.04);
}

/* ── Spinner ── */
.loading-spinner {
    width: 64px;
    height: 64px;
    border: 4px solid rgba(255, 255, 255, 0.08);
    border-top: 4px solid #00FF87;
    border-radius: 50%;
    animation: overlaySpinAnim 0.9s linear infinite;
    margin: 0 auto 20px;
}

/* ── Text ── */
.loading-text h3 {
    color: #ffffff;
    font-size: 1.2rem;
    font-weight: 700;
    margin: 0 0 6px;
    font-family: 'Montserrat', sans-serif;
}

.loading-text p {
    color: rgba(255, 255, 255, 0.55);
    font-size: 0.88rem;
    margin: 0;
    font-family: 'Montserrat', sans-serif;
    line-height: 1.5;
}

/* ── Steps list ── */
.loading-steps {
    display: flex;
    flex-direction: column;
    gap: 7px;
    margin: 22px 0 18px;
    text-align: left;
}

.loading-step {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 9px 13px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.03);
    border-left: 3px solid transparent;
    opacity: 0.3;
    transition: opacity 0.4s ease, background 0.4s ease, border-color 0.4s ease;
}

.loading-step.active {
    opacity: 1;
    background: rgba(0, 255, 135, 0.08);
    border-left-color: #00FF87;
}

.loading-step.completed {
    opacity: 0.6;
    background: rgba(0, 255, 135, 0.04);
    border-left-color: rgba(0, 255, 135, 0.25);
}

.loading-step-icon {
    font-size: 1.05rem;
    width: 22px;
    text-align: center;
    flex-shrink: 0;
    transition: transform 0.3s ease;
}

.loading-step.active .loading-step-icon {
    animation: overlayPulseAnim 1s ease-in-out infinite;
}

.loading-step-text {
    flex: 1;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.8);
    font-family: 'Montserrat', sans-serif;
    font-weight: 500;
}

.loading-step-check {
    font-size: 0.8rem;
    color: #00FF87;
    font-weight: 700;
    opacity: 0;
    transition: opacity 0.3s ease;
    flex-shrink: 0;
}

.loading-step.completed .loading-step-check {
    opacity: 1;
}

/* ── Progress bar ── */
.loading-progress {
    background: rgba(255, 255, 255, 0.07);
    border-radius: 6px;
    height: 5px;
    overflow: hidden;
}

.loading-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #00FF87, #E90052);
    border-radius: 6px;
    width: 0%;
    transition: width 0.55s ease;
}

/* ── Keyframes ── */
@keyframes overlaySpinAnim {
    0%   { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes overlayPulseAnim {
    0%, 100% { transform: scale(1); }
    50%       { transform: scale(1.25); }
}

/* ── RTL support ── */
[dir="rtl"] .loading-steps {
    text-align: right;
}

[dir="rtl"] .loading-step {
    border-left: none;
    border-right: 3px solid transparent;
}

[dir="rtl"] .loading-step.active {
    border-left: none;
    border-right-color: #00FF87;
}

[dir="rtl"] .loading-step.completed {
    border-left: none;
    border-right-color: rgba(0, 255, 135, 0.25);
}
