/* =========================================
   MODERN NEON LOADING SCREEN - ENHANCED
   ========================================= */
:root {
    --loader-bg: #050505; /* Deep black/gray */
    --loader-text: #ffffff;
    --loader-primary: #dc2626; /* Primary Red */
    --loader-glow: rgba(220, 38, 38, 0.6);
    --loader-secondary: #0ea5e9; /* Cyan accent for tech feel */
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background-color: var(--loader-bg);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    transition: opacity 0.5s ease-out, visibility 0.5s ease-out;
    overflow: hidden;
}

.loading-overlay.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

/* --- Tech Background --- */
.tech-bg-grid {
    position: absolute;
    top: 0;
    left: 0;
    width: 200%;
    height: 200%;
    background-image: linear-gradient(
            rgba(220, 38, 38, 0.03) 1px,
            transparent 1px
        ),
        linear-gradient(90deg, rgba(220, 38, 38, 0.03) 1px, transparent 1px);
    background-size: 30px 30px;
    opacity: 0.4;
    transform: perspective(500px) rotateX(60deg) translateY(-100px)
        translateZ(-200px);
    animation: gridMove 20s linear infinite;
    pointer-events: none;
}

.tech-particles .tp {
    position: absolute;
    background: var(--loader-primary);
    border-radius: 50%;
    opacity: 0.3;
    animation: floatParticle 10s infinite linear;
}
.tp-1 {
    top: 20%;
    left: 10%;
    width: 4px;
    height: 4px;
    animation-duration: 15s;
}
.tp-2 {
    top: 80%;
    left: 85%;
    width: 6px;
    height: 6px;
    animation-duration: 20s;
    animation-delay: -5s;
}
.tp-3 {
    top: 40%;
    left: 90%;
    width: 3px;
    height: 3px;
    animation-duration: 12s;
    animation-delay: -2s;
}
.tp-4 {
    top: 70%;
    left: 15%;
    width: 5px;
    height: 5px;
    animation-duration: 18s;
    animation-delay: -8s;
}

.loading-content {
    position: relative;
    text-align: center;
    width: 100%;
    max-width: 480px; /* Slightly wider for logs */
    padding: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 10;
}

/* Typography */
.welcome-text {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--loader-text);
    margin-bottom: 0.5rem;
    opacity: 0;
    animation: fadeInDown 0.8s ease-out forwards;
}

.brand-text {
    position: relative;
    font-size: 3.5rem;
    font-weight: 800;
    color: var(--loader-text);
    margin: 0 0 2rem 0;
    text-transform: uppercase;
    letter-spacing: 2px;
    opacity: 0;
    animation: zoomIn 0.8s ease-out 0.3s forwards;
    -webkit-text-stroke: 1px var(--loader-primary);
}

.brand-text::before {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    color: var(--loader-primary);
    overflow: hidden;
    white-space: nowrap;
    border-right: 2px solid var(--loader-primary);
    animation: typeWriter 3s steps(10) infinite;
    filter: drop-shadow(0 0 10px var(--loader-glow));
    opacity: 0.7;
}

/* Spinner */
.spinner-container {
    margin-bottom: 1.5rem;
    opacity: 0;
    animation: fadeIn 0.5s ease-out 0.6s forwards;
}

.spinner {
    width: 50px;
    height: 50px;
    animation: rotate 2s linear infinite;
}

.spinner .path {
    stroke: var(--loader-primary);
    stroke-linecap: round;
    animation: dash 1.5s ease-in-out infinite;
    filter: drop-shadow(0 0 5px var(--loader-primary));
}

/* System Log */
.system-log-container {
    width: 100%;
    height: 50px; /* Compact height */
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(220, 38, 38, 0.2);
    border-radius: 6px;
    margin-bottom: 1.5rem;
    padding: 8px 12px;
    font-family: "Courier New", monospace;
    font-size: 0.75rem;
    color: #4ade80; /* Terminal Green */
    text-align: left;
    overflow: hidden;
    position: relative;
    opacity: 0;
    animation: fadeIn 0.5s ease-out 0.7s forwards;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.8);
}

.log-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.log-line {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    animation: slideUpLog 0.3s ease-out;
}

/* Progress Bar */
.progress-wrapper {
    width: 100%;
    margin-bottom: 0.8rem;
    opacity: 0;
    animation: slideUp 0.5s ease-out 0.8s forwards;
}

.progress-bar-bg {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
    box-shadow: 0 0 5px rgba(220, 38, 38, 0.1);
}

.progress-bar-fill {
    height: 100%;
    width: 0%;
    background: var(--loader-primary);
    border-radius: 4px;
    box-shadow: 0 0 15px var(--loader-primary);
    transition: width 0.1s linear; /* Smooth linear for smoother simulation */
}

.progress-info {
    margin-top: 0.5rem;
    display: flex;
    justify-content: flex-end;
}

.percentage {
    color: var(--loader-primary);
    font-weight: 700;
    font-size: 1rem;
    text-shadow: 0 0 10px var(--loader-glow);
}

/* Status Text */
.status-wrapper {
    display: flex;
    align-items: center;
    gap: 4px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0;
    animation: fadeIn 0.5s ease-out 1s forwards;
}

.loading-dots span {
    display: inline-block;
    width: 4px;
    height: 4px;
    background-color: var(--loader-primary);
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
}

.loading-dots span:nth-child(1) {
    animation-delay: -0.32s;
}
.loading-dots span:nth-child(2) {
    animation-delay: -0.16s;
}

/* Animations */
@keyframes gridMove {
    0% {
        transform: perspective(500px) rotateX(60deg) translateY(-100px)
            translateZ(-200px);
    }
    100% {
        transform: perspective(500px) rotateX(60deg) translateY(0px)
            translateZ(-200px);
    }
}

@keyframes floatParticle {
    0% {
        transform: translateY(0) translateX(0);
        opacity: 0.3;
    }
    50% {
        transform: translateY(-20px) translateX(10px);
        opacity: 0.6;
    }
    100% {
        transform: translateY(0) translateX(0);
        opacity: 0.3;
    }
}

@keyframes rotate {
    100% {
        transform: rotate(360deg);
    }
}

@keyframes dash {
    0% {
        stroke-dasharray: 1, 150;
        stroke-dashoffset: 0;
    }
    50% {
        stroke-dasharray: 90, 150;
        stroke-dashoffset: -35;
    }
    100% {
        stroke-dasharray: 90, 150;
        stroke-dashoffset: -124;
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes zoomIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes typeWriter {
    0%,
    100% {
        width: 0;
    }
    50% {
        width: 100%;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes bounce {
    0%,
    80%,
    100% {
        transform: scale(0);
    }
    40% {
        transform: scale(1);
    }
}

@keyframes slideUpLog {
    from {
        transform: translateY(10px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}
