/* AI Loader Container */
#ai-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 11, 30, 0.9);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease;
}

#ai-overlay.active {
    opacity: 1;
    pointer-events: all;
}

/* Central "Brain" / Core */
.ai-core {
    position: relative;
    width: 120px;
    height: 120px;
    margin-bottom: 40px;
}

.ai-core-circle {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 2px solid transparent;
    border-top-color: var(--primary);
    border-left-color: var(--accent);
    animation: core-spin 2s linear infinite;
    box-shadow: 0 0 30px rgba(108, 92, 231, 0.3);
}

.ai-core-circle::before {
    content: '';
    position: absolute;
    top: 10px;
    left: 10px;
    right: 10px;
    bottom: 10px;
    border-radius: 50%;
    border: 2px solid transparent;
    border-top-color: var(--accent);
    border-right-color: var(--primary);
    animation: core-spin 3s linear infinite reverse;
}

.ai-core-circle::after {
    content: '';
    position: absolute;
    top: 25px;
    left: 25px;
    right: 25px;
    bottom: 25px;
    border-radius: 50%;
    background: radial-gradient(circle, var(--primary), transparent);
    animation: core-pulse 1.5s ease-in-out infinite alternate;
    opacity: 0.6;
}

/* Scanning Grid Background */
.ai-grid {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        linear-gradient(rgba(108, 92, 231, 0.1) 1px, transparent 1px),
        linear-gradient(90deg, rgba(108, 92, 231, 0.1) 1px, transparent 1px);
    background-size: 40px 40px;
    transform: perspective(500px) rotateX(60deg);
    opacity: 0.2;
    animation: grid-move 20s linear infinite;
}

/* Animated Text */
.ai-text-container {
    text-align: center;
    font-family: 'Courier New', monospace;
    color: var(--text-main);
    z-index: 2;
    height: 60px;
    /* Fixed height for text transition */
}

.ai-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 8px;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 2px;
    text-shadow: 0 0 10px var(--primary);
}

.ai-status {
    font-size: 14px;
    color: var(--accent);
    opacity: 0.8;
}

/* Data Stream Effect (Optional decoration) */
.ai-stream {
    position: absolute;
    width: 2px;
    height: 100px;
    background: linear-gradient(to bottom, transparent, var(--accent), transparent);
    opacity: 0;
}

@keyframes core-spin {
    0% {
        transform: rotate(0deg);
    }

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

@keyframes core-pulse {
    0% {
        transform: scale(0.8);
        opacity: 0.4;
    }

    100% {
        transform: scale(1.1);
        opacity: 0.8;
    }
}

@keyframes grid-move {
    0% {
        transform: perspective(500px) rotateX(60deg) translateY(0);
    }

    100% {
        transform: perspective(500px) rotateX(60deg) translateY(40px);
    }
}