/**
 * Enhanced Loading & Product Animations
 * Improves both loading overlay and product animations with sophisticated effects
 */

/* Enhanced Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    background: var(--bg-primary);
    background-image: radial-gradient(circle at 50% 50%, rgba(108, 99, 255, 0.05) 0%, transparent 70%),
                      radial-gradient(circle at 80% 20%, rgba(0, 191, 166, 0.05) 0%, transparent 60%);
    z-index: 9999;
    transition: opacity 0.5s ease, visibility 0.5s ease;
    overflow: hidden; /* Ensure animations don't overflow */
}

.loading-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 90%;
    max-width: 600px;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-radius: 16px;
    border: 1px solid rgba(108, 99, 255, 0.1);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2), 
                0 0 20px rgba(108, 99, 255, 0.1),
                0 0 40px rgba(0, 191, 166, 0.05);
    padding: 2.5rem;
    position: relative;
    overflow: hidden; /* Keep content within bounds */
}

.loading-logo {
    font-family: 'Orbitron', sans-serif;
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 2rem;    background: linear-gradient(135deg, #6c63ff 0%, #00bfa6 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: pulse-glow 2s infinite ease-in-out;
    position: relative;
    text-shadow: 0 0 10px rgba(108, 99, 255, 0.3);
}

@keyframes pulse-glow {
    0% {
        filter: drop-shadow(0 0 8px rgba(108, 99, 255, 0.3));
        transform: scale(1);
    }
    50% {
        filter: drop-shadow(0 0 12px rgba(108, 99, 255, 0.5));
        transform: scale(1.05);
    }
    100% {
        filter: drop-shadow(0 0 8px rgba(108, 99, 255, 0.3));
        transform: scale(1);
    }
}

.logo-vigthoria {
    letter-spacing: 1px;
}

.logo-io {
    font-weight: 400;
}

.loading-message {
    font-family: 'Rajdhani', sans-serif;
    font-size: 1.2rem;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
    opacity: 0.9;
    text-align: center;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    letter-spacing: 0.5px;
}

.loading-message::after {
    content: '...';
    display: inline-block;
    width: 1.5em;
    animation: dots 1.5s infinite steps(4, end);
    overflow: hidden;
    vertical-align: bottom;
}

@keyframes dots {
    0%, 20% {
        content: '.';
    }
    40% {
        content: '..';
    }
    60% {
        content: '...';
    }
    80%, 100% {
        content: '';
    }
}

.loading-progress {
    width: 100%;
    height: 6px;
    background: rgba(108, 99, 255, 0.2);
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 2.5rem;
    position: relative;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.2);
}

.loading-progress-bar {
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, #6c63ff 0%, #00bfa6 100%);
    border-radius: 6px;
    animation: progress-animation 3s ease-in-out forwards;
    box-shadow: 0 0 10px rgba(108, 99, 255, 0.5);
    position: relative;
}

.loading-progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, 
                rgba(255, 255, 255, 0.1) 0%, 
                rgba(255, 255, 255, 0.2) 50%, 
                rgba(255, 255, 255, 0.1) 100%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite linear;
}

@keyframes shimmer {
    0% {
        background-position: 100% 0;
    }
    100% {
        background-position: -100% 0;
    }
}

.loading-product-preview {
    width: 100%;
    height: 250px;
    border-radius: 12px;
    overflow: hidden;
    background-color: rgba(15, 23, 42, 0.8);
    position: relative;
    border: 1px solid rgba(108, 99, 255, 0.2);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2), 0 0 12px rgba(108, 99, 255, 0.1);
}

.loading-product-preview::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at 50% 50%, rgba(108, 99, 255, 0.05) 0%, transparent 70%);
    pointer-events: none;
    z-index: 1;
}

.preview-animation-container {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2;
}

/* Product preview animation elements */
.preview-product {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80%;
    height: auto;
    max-height: 80%;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.preview-product.active {
    opacity: 1;
}

.preview-operator,
.preview-coder,
.preview-llmchat,
.preview-agent,
.preview-navigator,
.preview-board {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 90%;
    height: auto;
    max-height: 90%;
    background-color: rgba(30, 41, 59, 0.8);
    border-radius: 8px;
    border: 1px solid rgba(108, 99, 255, 0.3);
    padding: 10px;
    color: #f8fafc;
    font-family: 'Rajdhani', sans-serif;
    overflow: auto;
    opacity: 0;
}

/* Animations */
@keyframes pulse-scale {
    0%, 100% {
        transform: scale(1);
        opacity: 0.9;
    }
    50% {
        transform: scale(1.05);
        opacity: 1;
    }
}

@keyframes progress-animation {
    0% {
        width: 0;
    }
    10% {
        width: 10%;
    }
    30% {
        width: 40%;
    }
    50% {
        width: 60%;
    }
    70% {
        width: 75%;
    }
    90% {
        width: 90%;
    }
    100% {
        width: 100%;
    }
}

@keyframes product-fade-in {
    0% {
        opacity: 0;
        transform: translate(-50%, -40%);
    }
    100% {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}

/* Enhanced Product Animations - Improvements */
.animated-placeholder {
    perspective: 1000px;
    transform-style: preserve-3d;
}

.operator-interface,
.chat-interface,
.agent-interface,
.navigator-interface,
.board-interface,
.studio-interface,
.app-interface {
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    right: auto !important;
    bottom: auto !important;
    margin: 0 auto !important;
    transform: translate(-50%, -50%) !important;
    width: 90% !important;
    max-width: 90% !important;
    height: auto !important;
    max-height: 90% !important;
    overflow: auto !important;
    z-index: 10 !important;
    box-sizing: border-box !important;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2) !important;
    backdrop-filter: blur(5px) !important;
    -webkit-backdrop-filter: blur(5px) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
}
