/* ══════════════════════════════════════════════════════════════
   FULL-PAGE LOADING OVERLAY — MCT LIVE MODERN ANIMATION
   ══════════════════════════════════════════════════════════════ */

/* ── Base overlay ── */
.page-loading-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: #050810;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    overflow: hidden;
    transition: opacity 0.8s cubic-bezier(0.4, 0, 0, 1);
}
.page-loading-overlay.fade-out {
    opacity: 0;
    pointer-events: none;
    transform: scale(1.02);
    transition: opacity 0.8s cubic-bezier(0.4, 0, 0, 1), transform 0.8s cubic-bezier(0.4, 0, 0, 1);
}

/* ── Aurora gradient background ── */
.loader-grid {
    position: absolute;
    top: -50%; left: -50%;
    width: 200%; height: 200%;
    background:
        radial-gradient(ellipse at 20% 50%, rgba(59, 130, 246, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 50%, rgba(224, 122, 95, 0.06) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 80%, rgba(99, 102, 241, 0.05) 0%, transparent 50%);
    animation: aurora-shift 12s ease-in-out infinite;
}
@keyframes aurora-shift {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    33%      { transform: translate(2%, -2%) rotate(1deg); }
    66%      { transform: translate(-2%, 1%) rotate(-1deg); }
}

/* ── Scanning line with glow ── */
.loader-scanline {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 1px;
    background: linear-gradient(90deg,
        transparent 0%,
        rgba(59, 130, 246, 0) 15%,
        rgba(59, 130, 246, 0.8) 50%,
        rgba(59, 130, 246, 0) 85%,
        transparent 100%);
    box-shadow:
        0 0 30px 2px rgba(59, 130, 246, 0.3),
        0 0 80px 4px rgba(59, 130, 246, 0.08);
    animation: scan-down 4s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}
@keyframes scan-down {
    0%   { top: -1px; opacity: 0; }
    5%   { opacity: 1; }
    95%  { opacity: 1; }
    100% { top: 100%; opacity: 0; }
}

/* ── Floating particles (upgraded with glow + trails) ── */
.loader-particles {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none;
}
.loader-particles span {
    position: absolute;
    display: block;
    width: 2px; height: 2px;
    background: rgba(59, 130, 246, 0.6);
    border-radius: 50%;
    box-shadow: 0 0 6px rgba(59, 130, 246, 0.3);
    animation: particle-rise linear infinite;
}
.loader-particles span:nth-child(1)  { left: 5%;  animation-duration: 10s; animation-delay: 0s; }
.loader-particles span:nth-child(2)  { left: 14%; animation-duration: 14s; animation-delay: -2s;  background: rgba(224, 122, 95, 0.5); box-shadow: 0 0 6px rgba(224, 122, 95, 0.3); width: 3px; height: 3px; }
.loader-particles span:nth-child(3)  { left: 23%; animation-duration: 11s; animation-delay: -5s; }
.loader-particles span:nth-child(4)  { left: 34%; animation-duration: 13s; animation-delay: -1s;  background: rgba(99, 102, 241, 0.4); box-shadow: 0 0 8px rgba(99, 102, 241, 0.3); width: 3px; height: 3px; }
.loader-particles span:nth-child(5)  { left: 43%; animation-duration: 9s;  animation-delay: -4s; }
.loader-particles span:nth-child(6)  { left: 53%; animation-duration: 12s; animation-delay: -6s;  background: rgba(224, 122, 95, 0.4); box-shadow: 0 0 6px rgba(224, 122, 95, 0.2); }
.loader-particles span:nth-child(7)  { left: 64%; animation-duration: 15s; animation-delay: -3s; }
.loader-particles span:nth-child(8)  { left: 73%; animation-duration: 10s; animation-delay: -7s;  width: 3px; height: 3px; }
.loader-particles span:nth-child(9)  { left: 82%; animation-duration: 13s; animation-delay: -2s;  background: rgba(99, 102, 241, 0.5); box-shadow: 0 0 8px rgba(99, 102, 241, 0.3); }
.loader-particles span:nth-child(10) { left: 91%; animation-duration: 11s; animation-delay: -5s; }
.loader-particles span:nth-child(11) { left: 8%;  animation-duration: 16s; animation-delay: -8s;  background: rgba(224, 122, 95, 0.3); width: 4px; height: 4px; box-shadow: 0 0 10px rgba(224, 122, 95, 0.2); }
.loader-particles span:nth-child(12) { left: 28%; animation-duration: 12s; animation-delay: -4s; }
.loader-particles span:nth-child(13) { left: 48%; animation-duration: 10s; animation-delay: -6s;  background: rgba(59, 130, 246, 0.4); width: 3px; height: 3px; }
.loader-particles span:nth-child(14) { left: 68%; animation-duration: 14s; animation-delay: -1s;  background: rgba(99, 102, 241, 0.3); }
.loader-particles span:nth-child(15) { left: 88%; animation-duration: 11s; animation-delay: -7s;  background: rgba(224, 122, 95, 0.4); box-shadow: 0 0 6px rgba(224, 122, 95, 0.2); }
@keyframes particle-rise {
    0%   { transform: translateY(100vh) translateX(0) scale(0); opacity: 0; }
    5%   { opacity: 0.8; transform: translateY(95vh) scale(1); }
    50%  { transform: translateY(50vh) translateX(20px); }
    95%  { opacity: 0.8; }
    100% { transform: translateY(-5vh) translateX(-10px) scale(0.5); opacity: 0; }
}

/* ── Center content ── */
.loader-center {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    animation: loader-reveal 1s cubic-bezier(0, 0, 0.2, 1) forwards;
}
@keyframes loader-reveal {
    from { opacity: 0; transform: translateY(30px) scale(0.95); filter: blur(8px); }
    to   { opacity: 1; transform: translateY(0) scale(1); filter: blur(0); }
}

/* ── Logo ring — larger, double ring, neon glow ── */
.loader-logo-ring {
    position: relative;
    width: 190px; height: 190px;
    margin-bottom: 32px;
}
.loader-ring-svg {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    transform: rotate(-90deg);
}
.loader-ring-track {
    fill: none;
    stroke: rgba(59, 130, 246, 0.06);
    stroke-width: 1.5;
}
.loader-ring-progress {
    fill: none;
    stroke: url("#ringGradient");
    stroke-width: 2;
    stroke-linecap: round;
    stroke-dasharray: 170 395;
    stroke-dashoffset: 0;
    animation: ring-spin 2s linear infinite, ring-arc-pulse 3s ease-in-out infinite;
    filter: drop-shadow(0 0 8px rgba(59, 130, 246, 0.6));
    transform-origin: center;
}
.loader-ring-pulse {
    fill: none;
    stroke: rgba(224, 122, 95, 0.1);
    stroke-width: 0.5;
    stroke-dasharray: 20 40;
    animation: ring-orbit 8s linear infinite;
}
@keyframes ring-spin {
    from { transform: rotate(-90deg); }
    to   { transform: rotate(270deg); }
}
@keyframes ring-arc-pulse {
    0%, 100% { stroke-dasharray: 170 395; }
    50%      { stroke-dasharray: 120 445; }
}
@keyframes ring-orbit {
    from { transform: rotate(-90deg); }
    to   { transform: rotate(270deg); }
}

/* ── Logo image — bigger, glassmorphism backdrop, breathing glow ── */
.loader-logo-container {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 120px;
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 50%;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    animation: logo-breath 3s ease-in-out infinite;
}
.loader-logo-img {
    width: 100%;
    height: auto;
    filter: brightness(1.15) drop-shadow(0 0 12px rgba(59, 130, 246, 0.2));
}
@keyframes logo-breath {
    0%, 100% {
        transform: translate(-50%, -50%) scale(1);
        box-shadow: 0 0 0 0 rgba(59, 130, 246, 0), 0 0 40px rgba(59, 130, 246, 0.05);
    }
    50% {
        transform: translate(-50%, -50%) scale(1.04);
        box-shadow: 0 0 0 8px rgba(59, 130, 246, 0.03), 0 0 60px rgba(59, 130, 246, 0.1);
    }
}

/* ── Brand text (unused, kept for reference) ── */
.loader-brand-text { display: none; }
.loader-brand-mct { display: none; }
.loader-brand-live { display: none; }

/* ── Tagline with fade-in ── */
.loader-tagline {
    font-family: 'DM Sans', sans-serif;
    font-size: 0.85rem;
    color: rgba(136, 153, 170, 0.8);
    letter-spacing: 0.3em;
    text-transform: uppercase;
    margin-bottom: 36px;
    opacity: 0;
    animation: tagline-fade 0.8s ease-out 0.5s forwards;
}
@keyframes tagline-fade {
    from { opacity: 0; letter-spacing: 0.5em; }
    to   { opacity: 1; letter-spacing: 0.3em; }
}

/* ── Animated chart — wider, more dynamic ── */
.loader-chart {
    width: 320px;
    height: 44px;
    margin-bottom: 32px;
    opacity: 0;
    animation: chart-reveal 0.6s ease-out 0.8s forwards;
}
@keyframes chart-reveal {
    from { opacity: 0; transform: scaleX(0.8); }
    to   { opacity: 0.8; transform: scaleX(1); }
}
.loader-chart-line {
    stroke-dasharray: 600;
    stroke-dashoffset: 600;
    animation: chart-trace 3s cubic-bezier(0.4, 0, 0.2, 1) 1s forwards, chart-pulse 4s ease-in-out 4s infinite;
}
.loader-chart-area {
    opacity: 0;
    animation: chart-area-in 1s ease-out 2.5s forwards;
}
.loader-chart-dot {
    opacity: 0;
    animation: chart-dot-in 0.4s ease-out 3s forwards, chart-dot-glow 2s ease-in-out 3.4s infinite;
}
@keyframes chart-trace {
    to { stroke-dashoffset: 0; }
}
@keyframes chart-pulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.5; }
}
@keyframes chart-area-in {
    to { opacity: 1; }
}
@keyframes chart-dot-in {
    to { opacity: 1; }
}
@keyframes chart-dot-glow {
    0%, 100% { r: 3; filter: drop-shadow(0 0 0 transparent); }
    50%      { r: 5; filter: drop-shadow(0 0 8px rgba(224, 122, 95, 0.6)); }
}

/* ── Status — sleek progress bar + animated text ── */
.loader-status {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    opacity: 0;
    animation: status-fade-in 0.5s ease-out 1.2s forwards;
}
@keyframes status-fade-in {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}
.loader-status-dots {
    width: 200px;
    height: 2px;
    background: rgba(59, 130, 246, 0.08);
    border-radius: 1px;
    overflow: hidden;
    position: relative;
}
.loader-status-dots span {
    display: none;
}
.loader-status-dots::after {
    content: '';
    position: absolute;
    top: 0; left: -40%;
    width: 40%; height: 100%;
    background: linear-gradient(90deg, transparent, #3b82f6, #e07a5f, transparent);
    border-radius: 1px;
    animation: progress-slide 1.8s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}
@keyframes progress-slide {
    0%   { left: -40%; }
    100% { left: 100%; }
}
.loader-status-text {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.78rem;
    color: rgba(85, 102, 119, 0.7);
    letter-spacing: 0.08em;
}

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
    .page-loading-overlay {
        transition: none;
    }
    .page-loading-overlay.fade-out {
        transform: none;
        transition: opacity 0.1s ease-out;
    }
    .loader-grid {
        animation: none;
    }
    .loader-scanline {
        animation: none;
        display: none;
    }
    .loader-particles span {
        animation: none;
        opacity: 0.5;
    }
    .loader-center {
        animation: none;
        opacity: 1;
    }
    .loader-ring-progress,
    .loader-ring-pulse {
        animation: none;
    }
    .loader-logo-container {
        animation: none;
    }
    .loader-tagline {
        animation: none;
        opacity: 1;
    }
    .loader-chart {
        animation: none;
        opacity: 0.8;
    }
    .loader-chart-line {
        animation: none;
        stroke-dashoffset: 0;
        opacity: 1;
    }
    .loader-chart-area {
        animation: none;
        opacity: 1;
    }
    .loader-chart-dot {
        animation: none;
        opacity: 1;
    }
    .loader-status {
        animation: none;
        opacity: 1;
    }
    .loader-status-dots::after {
        animation: none;
        left: 0;
        width: 100%;
    }
}
