/* Loading Screen Styles - Extracted from inline CSS for better caching and performance */

/* CSS Variables */
:root {
    --primary-color: #4a86e8;
    --secondary-color: #6d9eeb;
    --accent-color: #9fc5e8;
    --background-color: #fafafa;
    --text-color: #333;
    --shadow-color: rgba(0, 0, 0, 0.05);
    --progress-bg-color: rgba(0, 0, 0, 0.05);
    --info-text-color: rgba(0, 0, 0, 0.5);
    --code-text-color: rgba(0, 0, 0, 0.4);
    --tag-bg-color: rgba(74, 134, 232, 0.1);
    --shine-gradient: rgba(255, 255, 255, 0.5);
}

/* Dark Theme Variables */
:root.dark-theme {
    --primary-color: #6ba3f5;
    --secondary-color: #8bb5f0;
    --accent-color: #a5c7f2;
    --background-color: #1a1a1a;
    --text-color: #e0e0e0;
    --shadow-color: rgba(255, 255, 255, 0.05);
    --progress-bg-color: rgba(255, 255, 255, 0.1);
    --info-text-color: rgba(255, 255, 255, 0.7);
    --code-text-color: rgba(255, 255, 255, 0.6);
    --tag-bg-color: rgba(107, 163, 245, 0.2);
    --shine-gradient: rgba(255, 255, 255, 0.3);
}

/* Loading Container */
.loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100vh;
    width: 100%;
    position: fixed;
    top: 0;
    left: 0;
    background-color: var(--background-color);
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
}

/* Main Loader */
.loader {
    position: relative;
    width: 120px;
    height: 120px;
    margin-bottom: 40px;
}

/* Optimized Ripple Effects - Reduced from 3 to 2 for better performance */
.ripple {
    position: absolute;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    border: 2px solid var(--primary-color);
    opacity: 0;
    animation: ripple 2s cubic-bezier(0.165, 0.84, 0.44, 1) infinite;
}

.ripple:nth-child(2) {
    animation-delay: 1s;
}

@keyframes ripple {
    0% {
        transform: scale(0.1);
        opacity: 1;
    }
    100% {
        transform: scale(1);
        opacity: 0;
    }
}

/* Core Circle */
.core {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 30px;
    height: 30px;
    background-color: var(--primary-color);
    border-radius: 50%;
    box-shadow: 0 0 10px 2px rgba(74, 134, 232, 0.3);
    z-index: 2;
}

/* Pulse Effect */
.pulse {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 60px;
    background-color: rgba(74, 134, 232, 0.2);
    border-radius: 50%;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0% {
        transform: translate(-50%, -50%) scale(0.8);
    }
    50% {
        transform: translate(-50%, -50%) scale(1);
    }
    100% {
        transform: translate(-50%, -50%) scale(0.8);
    }
}

/* Simplified Orbital System - Reduced from 3 to 2 orbits */
.orbit {
    position: absolute;
    top: 50%;
    left: 50%;
    border-radius: 100%;
    border: 1px solid rgba(74, 134, 232, 0.2);
}

.orbit:nth-child(2) {
    width: 90px;
    height: 90px;
    margin-top: -45px;
    margin-left: -45px;
}

.orbit:nth-child(3) {
    width: 110px;
    height: 110px;
    margin-top: -55px;
    margin-left: -55px;
}

.orbit-particle {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 8px;
    height: 8px;
    margin-top: -4px;
    margin-left: -4px;
    border-radius: 100%;
    background-color: var(--primary-color);
}

.orbit:nth-child(2) .orbit-particle {
    animation: orbit 2s linear infinite;
}

.orbit:nth-child(3) .orbit-particle {
    animation: orbit 3s linear infinite reverse;
    background-color: var(--secondary-color);
}

@keyframes orbit {
    0% {
        transform: rotate(0deg) translateX(35px) rotate(0deg);
    }
    100% {
        transform: rotate(360deg) translateX(35px) rotate(-360deg);
    }
}

/* Floating Particles Container */
.floating-particles {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    overflow: hidden;
    z-index: -1;
}

.float-particle {
    position: absolute;
    width: 3px;
    height: 3px;
    background-color: var(--primary-color);
    border-radius: 50%;
    opacity: 0.3;
    animation: float 8s infinite linear;
}

@keyframes float {
    0% {
        transform: translateY(0) translateX(0);
        opacity: 0;
    }
    10% {
        opacity: 0.3;
    }
    90% {
        opacity: 0.3;
    }
    100% {
        transform: translateY(-30vh) translateX(30px);
        opacity: 0;
    }
}

/* Progress Bar Styles */
.progress-container {
    width: 320px;
    height: 4px;
    background-color: var(--progress-bg-color);
    border-radius: 2px;
    margin: 40px auto 15px;
    overflow: hidden;
    position: relative;
}

.progress-bar {
    height: 100%;
    width: 0;
    background-color: var(--primary-color);
    border-radius: 2px;
    transition: width 0.3s ease-out;
    position: relative;
}

/* Optimized Progress Bar Shine Effect */
.progress-bar::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg,
        transparent 0%,
        var(--shine-gradient) 50%,
        transparent 100%);
    transform: translateX(-100%);
    animation: shine 1.5s infinite;
}

@keyframes shine {
    100% {
        transform: translateX(100%);
    }
}

/* Progress Text */
.progress-text {
    font-size: 14px;
    color: var(--text-color);
    text-align: center;
    margin-bottom: 20px;
    letter-spacing: 0.5px;
}

/* Info Text */
.info-text {
    font-size: 12px;
    color: var(--info-text-color);
    text-align: center;
    max-width: 320px;
    line-height: 1.6;
}

/* Code Animation */
.code-animation {
    font-family: 'Courier New', monospace;
    font-size: 12px;
    color: var(--code-text-color);
    text-align: center;
    margin-top: 20px;
    height: 16px;
    overflow: hidden;
}

.code-line {
    white-space: nowrap;
    overflow: hidden;
    border-right: 2px solid var(--primary-color);
    animation: typing 4s steps(60) infinite, blink-caret 0.75s step-end infinite;
}

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

@keyframes blink-caret {
    from, to {
        border-color: transparent;
    }
    50% {
        border-color: var(--primary-color);
    }
}

/* Tags */
.tags {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 20px;
}

.tag {
    padding: 4px 10px;
    background-color: var(--tag-bg-color);
    border-radius: 12px;
    font-size: 10px;
    color: var(--primary-color);
    display: inline-flex;
    align-items: center;
    animation: fadeIn 0.5s ease-in-out forwards;
    opacity: 0;
}

.tag:nth-child(1) {
    animation-delay: 0.2s;
}

.tag:nth-child(2) {
    animation-delay: 0.4s;
}

.tag:nth-child(3) {
    animation-delay: 0.6s;
}

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

.tag::before {
    content: "";
    display: inline-block;
    width: 4px;
    height: 4px;
    background-color: var(--primary-color);
    border-radius: 50%;
    margin-right: 5px;
}

/* Simplified Exit Animation Keyframes - Subtle and Elegant */
@keyframes exitFade {
    0% {
        opacity: 1;
        transform: scale(1);
    }
    100% {
        opacity: 0;
        transform: scale(0.95);
    }
}

@keyframes exitSlideUp {
    0% {
        opacity: 1;
        transform: translateY(0);
    }
    100% {
        opacity: 0;
        transform: translateY(-30px);
    }
}

@keyframes exitSlideDown {
    0% {
        opacity: 1;
        transform: translateY(0);
    }
    100% {
        opacity: 0;
        transform: translateY(30px);
    }
}

@keyframes exitScale {
    0% {
        opacity: 1;
        transform: scale(1);
    }
    100% {
        opacity: 0;
        transform: scale(0.8);
    }
}


/* Simplified Exit Animation Classes - Subtle and Elegant */
.loading-container.exiting {
    animation: exitFade 0.5s ease-out forwards;
}

.loader.exiting {
    animation: exitScale 0.4s ease-out forwards;
}

.progress-container.exiting {
    animation: exitSlideDown 0.3s ease-out forwards;
}

.progress-text.exiting {
    animation: exitSlideUp 0.3s ease-out forwards;
}

.code-animation.exiting {
    animation: exitFade 0.3s ease-out forwards;
}

.tags.exiting,
.tag.exiting {
    animation: exitFade 0.4s ease-out forwards;
}

.info-text.exiting {
    animation: exitSlideUp 0.3s ease-out forwards;
}

.pulse.exiting {
    animation: exitScale 0.4s ease-out forwards;
}

.ripple.exiting {
    animation: exitScale 0.4s ease-out forwards;
}

.float-particle.exiting,
.orbit-particle.exiting {
    animation: exitFade 0.5s ease-out forwards;
}

.core.exiting {
    animation: exitScale 0.4s ease-out forwards;
}

/* Compose App Container */
#codegen-root {
    width: 100vw;
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    overflow: hidden;
}
