/* Enhanced AI Processing Animation Styles */
/* Seamlessly integrates with existing DrawMagic styles */

/* Enhanced Loading Container */
.enhanced-loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 25px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 15px;
    min-height: 420px;
    box-shadow: 0 15px 35px rgba(102, 126, 234, 0.4);
    position: relative;
    overflow: hidden;
    animation: containerPulse 4s ease-in-out infinite;
}

.enhanced-loading-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 20% 30%, rgba(255, 255, 255, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(255, 255, 255, 0.05) 0%, transparent 50%);
    pointer-events: none;
    animation: backgroundShimmer 8s ease-in-out infinite;
}

@keyframes containerPulse {
    0%, 100% { 
        box-shadow: 0 15px 35px rgba(102, 126, 234, 0.4);
    }
    50% { 
        box-shadow: 0 20px 45px rgba(102, 126, 234, 0.6);
    }
}

@keyframes backgroundShimmer {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Loading Header */
.loading-header {
    color: white;
    text-align: center;
    margin-bottom: 25px;
    z-index: 10;
    position: relative;
}

.loading-title {
    font-size: 1.9rem;
    font-weight: 700;
    margin-bottom: 12px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    font-family: 'Fredoka', sans-serif;
    animation: titleGlow 3s ease-in-out infinite;
}

.loading-subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
    margin-bottom: 8px;
    font-weight: 500;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

@keyframes titleGlow {
    0%, 100% { text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3); }
    50% { text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3), 0 0 20px rgba(255, 255, 255, 0.3); }
}

/* Progress Container */
.progress-container {
    width: 100%;
    max-width: 520px;
    margin-bottom: 25px;
    z-index: 10;
    position: relative;
}

.enhanced-progress {
    height: 14px;
    border-radius: 7px;
    background: rgba(255, 255, 255, 0.2);
    overflow: hidden;
    box-shadow: 
        inset 0 2px 4px rgba(0, 0, 0, 0.2),
        0 2px 8px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.enhanced-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #a855f7, #ec4899, #06b6d4, #10b981);
    background-size: 400% 100%;
    border-radius: 7px;
    transition: width 0.4s ease;
    animation: progressShimmer 3s ease-in-out infinite;
    box-shadow: 
        0 2px 8px rgba(168, 85, 247, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
    position: relative;
}

.enhanced-progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 50%;
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0.4), transparent);
    border-radius: 7px 7px 0 0;
}

@keyframes progressShimmer {
    0% { 
        background-position: -400% 0;
        box-shadow: 0 2px 8px rgba(168, 85, 247, 0.5);
    }
    50% {
        background-position: 0% 0;
        box-shadow: 0 2px 12px rgba(236, 72, 153, 0.7);
    }
    100% { 
        background-position: 400% 0;
        box-shadow: 0 2px 8px rgba(16, 185, 129, 0.5);
    }
}

.time-estimate {
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.95rem;
    text-align: center;
    margin-top: 10px;
    font-weight: 500;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    transition: opacity 0.3s ease;
}

/* Neural Network Container */
.neural-network-container {
    position: relative;
    width: 340px;
    height: 260px;
    margin: 20px 0;
    z-index: 10;
    animation: networkFloat 6s ease-in-out infinite;
}

@keyframes networkFloat {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-5px); }
}

.neural-network-canvas {
    width: 100%;
    height: 100%;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(8px);
    border: 2px solid rgba(255, 255, 255, 0.2);
    box-shadow: 
        0 8px 25px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
}

.neural-network-canvas:hover {
    border-color: rgba(255, 255, 255, 0.3);
    box-shadow: 
        0 12px 35px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

/* Close Button */
.enhanced-close-btn {
    position: absolute;
    top: 18px;
    right: 18px;
    background: rgba(255, 255, 255, 0.95);
    border: none;
    border-radius: 8px;
    padding: 8px 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #6366f1;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 30;
    box-shadow: 
        0 4px 12px rgba(0, 0, 0, 0.15),
        0 2px 6px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    line-height: 1.1;
    white-space: nowrap;
}

.enhanced-close-btn:hover {
    background: white;
    transform: scale(1.05);
    color: #4f46e5;
    box-shadow: 
        0 6px 16px rgba(0, 0, 0, 0.2),
        0 3px 8px rgba(0, 0, 0, 0.15);
}

.enhanced-close-btn:active {
    transform: scale(1.02);
}

/* Status Messages */
.status-messages {
    color: white;
    text-align: center;
    z-index: 10;
    margin-top: 20px;
    position: relative;
}

.status-message {
    opacity: 0.85;
    font-size: 0.95rem;
    margin: 8px 0;
    transition: all 0.3s ease;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    font-weight: 500;
}

.current-status {
    font-weight: 600;
    opacity: 1;
    color: #fbbf24;
    font-size: 1.05rem;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    animation: statusPulse 2s ease-in-out infinite;
    position: relative;
}

.current-status::before {
    content: '';
    position: absolute;
    left: -15px;
    top: 50%;
    transform: translateY(-50%);
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #fbbf24;
    animation: dotPulse 1.5s ease-in-out infinite;
}

@keyframes statusPulse {
    0%, 100% { 
        opacity: 1;
        transform: translateY(0);
    }
    50% { 
        opacity: 0.8;
        transform: translateY(-2px);
    }
}

@keyframes dotPulse {
    0%, 100% { 
        opacity: 1;
        transform: translateY(-50%) scale(1);
    }
    50% { 
        opacity: 0.6;
        transform: translateY(-50%) scale(1.2);
    }
}

/* Integration with existing modal fullscreen styles */
.modal.loading-active .enhanced-loading-container {
    border-radius: 0 !important;
    min-height: 100vh !important;
    width: 100% !important;
    margin: 0 !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    padding: 40px 20px !important;
}

/* Responsive Design */
@media (max-width: 768px) {
    .enhanced-loading-container {
        padding: 20px 15px;
        min-height: 380px;
    }
    
    .loading-title {
        font-size: 1.6rem;
    }
    
    .loading-subtitle {
        font-size: 1rem;
    }
    
    .neural-network-container {
        width: 300px;
        height: 220px;
    }
    
    .progress-container {
        max-width: 90%;
    }
    
    .enhanced-close-btn {
        padding: 6px 10px;
        top: 15px;
        right: 15px;
        font-size: 0.7rem;
    }
    
    .status-message {
        font-size: 0.9rem;
    }
    
    .current-status {
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .enhanced-loading-container {
        padding: 15px 10px;
        min-height: 350px;
    }
    
    .loading-title {
        font-size: 1.4rem;
    }
    
    .neural-network-container {
        width: 260px;
        height: 180px;
    }
    
    .status-messages {
        margin-top: 15px;
    }
    
    .status-message {
        font-size: 0.85rem;
        margin: 6px 0;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .enhanced-loading-container {
        border: 2px solid white;
    }
    
    .neural-network-canvas {
        border-color: white;
    }
    
    .enhanced-progress {
        background: rgba(255, 255, 255, 0.3);
        border: 1px solid white;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .enhanced-loading-container,
    .loading-title,
    .neural-network-container,
    .current-status,
    .enhanced-progress-bar {
        animation: none;
    }
    
    .enhanced-close-btn:hover {
        transform: scale(1.05);
    }
}

/* Dark mode adjustments */
@media (prefers-color-scheme: dark) {
    .enhanced-loading-container {
        background: linear-gradient(135deg, #4c1d95 0%, #581c87 100%);
    }
    
    .enhanced-close-btn {
        background: rgba(255, 255, 255, 0.9);
        color: #7c3aed;
    }
    
    .enhanced-close-btn:hover {
        background: white;
        color: #6d28d9;
    }
}