/* Loading Animations CSS */

:root {
    --bg-primary: #0f0a1a;
    --bg-secondary: #1a1225;
    --bg-tertiary: #251a35;
    --bg-elevated: #2d1f42;
    --purple-400: #c084fc;
    --purple-500: #a855f7;
    --text-primary: #f8fafc;
    --text-muted: #94a3b8;
    --text-dim: #64748b;
    --border-subtle: rgba(139, 92, 246, 0.15);
    --border-medium: rgba(139, 92, 246, 0.25);
    --accent-gradient: linear-gradient(135deg, #a855f7 0%, #7c3aed 50%, #6366f1 100%);
    --glass-bg: rgba(139, 92, 246, 0.08);
    --glass-hover: rgba(139, 92, 246, 0.12);
}

/* Loading spinner */
.loading-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid var(--border-subtle);
    border-top-color: var(--purple-500);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Enhanced Loading States */
.model-loading {
    position: relative;
    overflow: hidden;
}

.model-loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(168, 85, 247, 0.2), transparent);
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

.model-loading .model-icon {
    animation: pulse 1.5s ease-in-out infinite;
}

.model-loading .model-name {
    color: var(--purple-400);
}

.model-loading .model-desc {
    color: var(--text-dim);
    font-style: italic;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Progress Bar */
.progress-bar {
    width: 100%;
    height: 3px;
    background: var(--border-subtle);
    border-radius: 2px;
    overflow: hidden;
    margin-top: 8px;
}

.progress-fill {
    height: 100%;
    background: var(--accent-gradient);
    border-radius: 2px;
    transition: width 0.3s ease;
    position: relative;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: progressShimmer 1s infinite;
}

@keyframes progressShimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* Loading Status Badge */
.loading-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 2px 8px;
    background: rgba(168, 85, 247, 0.1);
    border: 1px solid rgba(168, 85, 247, 0.3);
    border-radius: 12px;
    font-size: 10px;
    color: var(--purple-300);
    font-weight: 500;
    margin-left: auto;
}

.loading-status .loading-spinner {
    width: 10px;
    height: 10px;
    border-width: 1.5px;
}

/* Enhanced Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    animation: fadeInUp 0.4s ease-out;
}

.typing-bubble {
    background: var(--glass-bg);
    border: 1px solid var(--border-subtle);
    border-radius: 16px;
    padding: 16px 20px;
    position: relative;
    min-width: 280px;
    max-width: 400px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(10px);
}

.typing-status {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 12px;
    font-style: italic;
}

.typing-dots {
    display: flex;
    gap: 6px;
    margin-bottom: 12px;
    align-items: center;
}

.typing-dot {
    width: 8px;
    height: 8px;
    background: var(--purple-400);
    border-radius: 50%;
    animation: typingBounce 1.4s infinite ease-in-out;
}

.typing-dot:nth-child(1) { animation-delay: -0.32s; }
.typing-dot:nth-child(2) { animation-delay: -0.16s; }
.typing-dot:nth-child(3) { animation-delay: 0s; }

@keyframes typingBounce {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1.2);
        opacity: 1;
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Tool Spinner */
.tool-spinner {
    width: 12px;
    height: 12px;
    border: 1.5px solid rgba(168, 85, 247, 0.2);
    border-top-color: var(--purple-400);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    flex-shrink: 0;
}

.tool-item.completed .tool-spinner {
    animation: none;
    border: none;
    background: #10b981;
    border-radius: 50%;
}

.tool-item.completed .tool-spinner::after {
    content: '✓';
    color: white;
    font-size: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

/* Avatar Loading Ring */
.avatar-loading-ring {
    position: absolute;
    inset: -3px;
    border: 2px solid transparent;
    border-top-color: var(--purple-400);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}
