/* ═══════════════════════════════════════════════════════════
   LedgerIQ Analysis Loader — Cinematic Pre-loader
   Bloomberg terminal meets luxury spa
   ═══════════════════════════════════════════════════════════ */

#liq-analysis-loader {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.4s ease;
}

#liq-analysis-loader.lal-visible {
    opacity: 1;
}

#liq-analysis-loader.lal-exit {
    opacity: 0;
    transition: opacity 0.45s ease-in;
}

/* ── Backdrop ───────────────────────────────────────── */

.lal-backdrop {
    position: absolute;
    inset: 0;
    background: linear-gradient(145deg, #070f0d 0%, #0c1f1a 25%, #132e25 55%, #0a1914 100%);
    z-index: 0;
}

.lal-backdrop::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 50% 40% at 20% 30%, rgba(74, 144, 128, 0.08) 0%, transparent 70%),
        radial-gradient(ellipse 40% 50% at 80% 70%, rgba(110, 218, 194, 0.05) 0%, transparent 70%);
    animation: lalBackdropShift 8s ease-in-out infinite alternate;
}

@keyframes lalBackdropShift {
    from { opacity: 0.6; }
    to   { opacity: 1; }
}

/* Subtle grid overlay */
.lal-backdrop::after {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(74, 144, 128, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(74, 144, 128, 0.03) 1px, transparent 1px);
    background-size: 40px 40px;
    opacity: 0.5;
}

/* ── Particles ──────────────────────────────────────── */

.lal-particles {
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    overflow: hidden;
}

.lal-particle {
    position: absolute;
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: rgba(110, 218, 194, 0.6);
    box-shadow: 0 0 6px rgba(110, 218, 194, 0.4);
    animation: lalParticleFloat 3s ease-in-out forwards;
    opacity: 0;
}

@keyframes lalParticleFloat {
    0%   { opacity: 0; transform: translateY(0) scale(0.5); }
    15%  { opacity: 0.8; }
    50%  { opacity: 0.5; transform: translateY(-30px) scale(1); }
    100% { opacity: 0; transform: translateY(-60px) scale(0.3); }
}

.lal-particle-burst {
    animation: lalParticleBurst 0.8s ease-out forwards;
}

@keyframes lalParticleBurst {
    0%   { opacity: 1; transform: translate(0, 0) scale(1); }
    100% { opacity: 0; transform: translate(calc(cos(var(--angle)) * 80px), calc(sin(var(--angle)) * 80px)) scale(0.2); }
}

/* ── Content ────────────────────────────────────────── */

.lal-content {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    max-width: 480px;
    width: 100%;
    padding: 0 2rem;
}

/* ── Phase dots ─────────────────────────────────────── */

.lal-phase-dots {
    display: flex;
    gap: 10px;
    margin-bottom: 2.5rem;
}

.lal-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(110, 218, 194, 0.15);
    transition: all 0.4s ease;
}

.lal-dot.active {
    background: rgba(110, 218, 194, 0.5);
}

.lal-dot.current {
    background: #6EDAC2;
    box-shadow: 0 0 8px rgba(110, 218, 194, 0.5);
    transform: scale(1.3);
}

/* ── Icon ring ──────────────────────────────────────── */

.lal-icon-ring {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    margin-bottom: 2rem;
    transition: transform 0.3s cubic-bezier(0.34, 1.2, 0.64, 1);
}

.lal-icon-pulse {
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 1.5px solid rgba(110, 218, 194, 0.2);
    animation: lalPulseRing 2s ease-in-out infinite;
}

@keyframes lalPulseRing {
    0%, 100% { transform: scale(1); opacity: 0.6; border-color: rgba(110, 218, 194, 0.2); }
    50%      { transform: scale(1.15); opacity: 0; border-color: rgba(110, 218, 194, 0.05); }
}

.lal-icon-inner {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(74, 144, 128, 0.2) 0%, rgba(110, 218, 194, 0.1) 100%);
    border: 1px solid rgba(110, 218, 194, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6EDAC2;
    box-shadow: 0 0 30px rgba(74, 144, 128, 0.12), 0 0 8px rgba(110, 218, 194, 0.08) inset;
    animation: lalIconBreathe 3s ease-in-out infinite;
}

@keyframes lalIconBreathe {
    0%, 100% { box-shadow: 0 0 20px rgba(74, 144, 128, 0.1), 0 0 6px rgba(110, 218, 194, 0.06) inset; }
    50%      { box-shadow: 0 0 40px rgba(74, 144, 128, 0.2), 0 0 12px rgba(110, 218, 194, 0.12) inset; }
}

/* Complete state — checkmark glow */
.lal-complete .lal-icon-inner {
    background: linear-gradient(135deg, rgba(74, 144, 128, 0.35) 0%, rgba(110, 218, 194, 0.2) 100%);
    border-color: rgba(110, 218, 194, 0.4);
    animation: lalCompleteGlow 0.6s ease forwards;
}

@keyframes lalCompleteGlow {
    0%   { box-shadow: 0 0 20px rgba(74, 144, 128, 0.1); transform: scale(1); }
    50%  { box-shadow: 0 0 50px rgba(110, 218, 194, 0.35); transform: scale(1.08); }
    100% { box-shadow: 0 0 35px rgba(110, 218, 194, 0.25); transform: scale(1); }
}

/* ── Phase text ─────────────────────────────────────── */

.lal-phase-text {
    font-family: 'Fraunces', Georgia, serif;
    font-size: 1.25rem;
    font-weight: 500;
    color: #EDF5F0;
    text-align: center;
    letter-spacing: -0.02em;
    margin-bottom: 0.375rem;
    transition: opacity 0.25s ease, transform 0.25s ease;
    min-height: 1.8rem;
}

.lal-phase-sub {
    font-family: 'DM Sans', sans-serif;
    font-size: 0.82rem;
    color: rgba(190, 210, 200, 0.55);
    text-align: center;
    letter-spacing: 0.01em;
    margin-bottom: 1.75rem;
    transition: opacity 0.3s ease 0.1s;
    min-height: 1.2rem;
}

/* ── Counter ────────────────────────────────────────── */

.lal-counter {
    font-family: 'JetBrains Mono', monospace;
    text-align: center;
    margin-bottom: 1.5rem;
    min-height: 2rem;
    transition: opacity 0.3s ease;
}

.lal-counter-num {
    font-size: 1.75rem;
    font-weight: 700;
    color: #6EDAC2;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.03em;
}

.lal-counter-suffix {
    display: block;
    font-size: 0.72rem;
    color: rgba(190, 210, 200, 0.45);
    font-weight: 400;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    margin-top: 0.25rem;
}

/* ── Progress bar ───────────────────────────────────── */

.lal-progress-track {
    width: 100%;
    max-width: 320px;
    height: 3px;
    background: rgba(110, 218, 194, 0.08);
    border-radius: 3px;
    position: relative;
    overflow: visible;
    margin-bottom: 1.5rem;
}

.lal-progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #3a7265, #6EDAC2);
    border-radius: 3px;
    transition: none; /* JS handles this */
    position: relative;
}

.lal-progress-glow {
    position: absolute;
    top: -3px;
    left: 0%;
    width: 6px;
    height: 9px;
    border-radius: 50%;
    background: #6EDAC2;
    box-shadow: 0 0 12px rgba(110, 218, 194, 0.6), 0 0 4px rgba(110, 218, 194, 0.8);
    opacity: 0.8;
}

/* ── Module cascade ─────────────────────────────────── */

.lal-modules {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
    max-width: 400px;
    opacity: 0;
    transition: opacity 0.4s ease;
    min-height: 0;
}

.lal-module-chip {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 100px;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.7rem;
    font-weight: 500;
    color: rgba(190, 210, 200, 0.7);
    background: rgba(74, 144, 128, 0.1);
    border: 1px solid rgba(110, 218, 194, 0.1);
    opacity: 0;
    transform: translateY(8px) scale(0.9);
    animation: lalChipIn 0.35s ease forwards;
}

@keyframes lalChipIn {
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ── Responsive ─────────────────────────────────────── */

@media (max-width: 480px) {
    .lal-phase-text { font-size: 1.1rem; }
    .lal-counter-num { font-size: 1.5rem; }
    .lal-icon-ring { width: 68px; height: 68px; }
    .lal-icon-inner { width: 54px; height: 54px; }
    .lal-progress-track { max-width: 260px; }
}

/* ── Reduced motion ─────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
    .lal-particle,
    .lal-icon-pulse,
    .lal-module-chip,
    .lal-backdrop::before {
        animation: none !important;
    }
    .lal-particle { display: none; }
    .lal-icon-inner { animation: none; }
}
