/* AI Thinking Animation Styles */

.ai-thinking-container {
    display: none;
    position: fixed;
    top: 20px;
    right: 20px;
    width: 400px;
    max-height: 80vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 16px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    color: white;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.ai-thinking-container.thinking-visible {
    opacity: 1;
    transform: translateX(0);
}

/* Header */
.thinking-header {
    display: flex;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.05);
    border-radius: 16px 16px 0 0;
}

.ai-brain-icon {
    margin-right: 12px;
    font-size: 24px;
    color: #ffd700;
}

.ai-brain-icon i {
    transition: all 0.3s ease;
}

.ai-brain-icon i.brain-pulse {
    animation: brainPulse 1.5s infinite;
}

.ai-brain-icon i.brain-processing {
    animation: brainSpin 2s linear infinite;
    color: #00bfff;
}

.ai-brain-icon i.brain-glow {
    animation: brainGlow 1s ease-in-out infinite alternate;
    color: #32cd32;
}

.ai-brain-icon i.brain-success {
    animation: brainSuccess 0.8s ease-out;
    color: #00ff00;
}

@keyframes brainPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); opacity: 0.8; }
}

@keyframes brainSpin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes brainGlow {
    from { filter: brightness(1) drop-shadow(0 0 5px currentColor); }
    to { filter: brightness(1.3) drop-shadow(0 0 15px currentColor); }
}

@keyframes brainSuccess {
    0% { transform: scale(1); }
    50% { transform: scale(1.3); }
    100% { transform: scale(1); }
}

.thinking-title {
    flex: 1;
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    background: linear-gradient(45deg, #ffd700, #ffed4e);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.thinking-status {
    display: flex;
    align-items: center;
}

.thinking-dots {
    display: flex;
    gap: 4px;
    justify-content: center;
}

.thinking-dots span {
    width: 6px;
    height: 6px;
    background: #007bff;
    border-radius: 50%;
    animation: thinkingDots 1.5s infinite;
}

.thinking-dots span:nth-child(1) { animation-delay: 0s; }
.thinking-dots span:nth-child(2) { animation-delay: 0.15s; }
.thinking-dots span:nth-child(3) { animation-delay: 0.3s; }

@keyframes thinkingDots {
    0%, 60%, 100% { 
        opacity: 0.3;
        transform: scale(0.8);
    }
    30% { 
        opacity: 1;
        transform: scale(1.2);
    }
}

/* Content */
.thinking-content {
    padding: 20px;
}

.current-thought {
    margin-bottom: 15px;
}

.thought-main {
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 8px;
    min-height: 20px;
    line-height: 1.4;
}

.thought-detail {
    font-size: 13px;
    opacity: 0.8;
    line-height: 1.3;
    font-style: italic;
    min-height: 16px;
}

.thinking-progress {
    background: rgba(255, 255, 255, 0.1);
    height: 4px;
    border-radius: 2px;
    overflow: hidden;
    margin-top: 15px;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #ffd700, #ffed4e);
    width: 0%;
    transition: width 0.5s ease;
    border-radius: 2px;
}

/* History */
.thinking-history {
    max-height: 300px;
    overflow-y: auto;
    padding: 0 20px 20px;
    scroll-behavior: smooth;
}

.thinking-history::-webkit-scrollbar {
    width: 4px;
}

.thinking-history::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
}

.thinking-history::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
}

.history-item {
    display: flex;
    align-items: flex-start;
    margin-bottom: 12px;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s ease;
}

.history-item.history-item-visible {
    opacity: 1;
    transform: translateY(0);
}

.history-step {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    margin-right: 10px;
    flex-shrink: 0;
    margin-top: 2px;
}

.history-content {
    flex: 1;
}

.history-thought {
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 3px;
    line-height: 1.3;
}

.history-detail {
    font-size: 11px;
    opacity: 0.7;
    line-height: 1.2;
}

/* Responsive */
@media (max-width: 768px) {
    .ai-thinking-container {
        position: fixed;
        top: 10px;
        left: 10px;
        right: 10px;
        width: auto;
        max-height: 70vh;
    }
    
    .thinking-header {
        padding: 15px;
    }
    
    .thinking-content {
        padding: 15px;
    }
    
    .thinking-history {
        padding: 0 15px 15px;
    }
}

/* Integration with search interface */
.search-container.thinking-active {
    margin-right: 420px;
    transition: margin-right 0.5s ease;
}

@media (max-width: 768px) {
    .search-container.thinking-active {
        margin-right: 0;
        margin-top: 200px;
        transition: margin-top 0.5s ease;
    }
}

/* Dark theme support */
@media (prefers-color-scheme: dark) {
    .ai-thinking-container {
        background: linear-gradient(135deg, #2d3748 0%, #4a5568 100%);
        border-color: rgba(255, 255, 255, 0.05);
    }
}