/**
 * Styles for Streaming Pipeline Components
 * Enhanced animations and visual effects
 */

/* Code Loading Animation */
.message-code-loading {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 20px;
    margin: 10px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    min-height: 80px;
    position: relative;
    overflow: hidden;
}

.message-code-loading::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, 
        transparent 0%, 
        rgba(255, 255, 255, 0.4) 50%, 
        transparent 100%);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

.message-code-wave-container {
    display: flex;
    gap: 4px;
    align-items: end;
    height: 30px;
}

.message-code-wave-bar {
    width: 4px;
    background: linear-gradient(to top, #007bff, #0056b3);
    border-radius: 2px;
    animation: wave 1.5s ease-in-out infinite;
}

.message-code-wave-bar:nth-child(1) { animation-delay: 0s; }
.message-code-wave-bar:nth-child(2) { animation-delay: 0.1s; }
.message-code-wave-bar:nth-child(3) { animation-delay: 0.2s; }
.message-code-wave-bar:nth-child(4) { animation-delay: 0.3s; }
.message-code-wave-bar:nth-child(5) { animation-delay: 0.4s; }

@keyframes wave {
    0%, 100% { height: 8px; }
    50% { height: 24px; }
}

.message-code-loading-text {
    color: #6c757d;
    font-size: 14px;
    font-weight: 500;
    letter-spacing: 0.5px;
}

/* HTML Loading Animation - Special styling */
.message-html-loading {
    background: linear-gradient(135deg, #fff5f5 0%, #fee2e2 100%);
    border: 1px solid #fca5a5;
}

.message-html-loading .message-code-loading-text {
    color: #b91c1c;
    font-weight: 600;
}

/* Thinking Block Styles */
.message-thinking-loading {
    background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
    border: 1px solid #ffeaa7;
    border-radius: 8px;
    padding: 16px;
    margin: 10px 0;
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 60px;
    position: relative;
    overflow: hidden;
}

.message-thinking-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: rgba(255, 193, 7, 0.2);
    border-radius: 50%;
}

.message-thinking-brain {
    display: flex;
    gap: 2px;
    align-items: center;
}

.message-thinking-dot {
    width: 6px;
    height: 6px;
    background: #856404;
    border-radius: 50%;
    animation: thinking-pulse 1.4s ease-in-out infinite;
}

.message-thinking-dot:nth-child(1) { animation-delay: 0s; }
.message-thinking-dot:nth-child(2) { animation-delay: 0.2s; }
.message-thinking-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes thinking-pulse {
    0%, 80%, 100% { opacity: 0.3; transform: scale(1); }
    40% { opacity: 1; transform: scale(1.2); }
}

.message-thinking-text {
    color: #856404;
    font-size: 14px;
    font-weight: 500;
    font-style: italic;
}

/* Final Thinking Block */
.message-thinking-block {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    margin: 10px 0;
    overflow: hidden;
    transition: all 0.3s ease;
}

.message-thinking-block:hover {
    border-color: #007bff;
    box-shadow: 0 2px 8px rgba(0, 123, 255, 0.1);
}

.message-thinking-header {
    background: linear-gradient(135deg, #e9ecef 0%, #f8f9fa 100%);
    padding: 12px 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    user-select: none;
    transition: background-color 0.2s ease;
}

.message-thinking-header:hover {
    background: linear-gradient(135deg, #dee2e6 0%, #e9ecef 100%);
}

.message-thinking-title {
    flex: 1;
    font-weight: 600;
    color: #495057;
    font-size: 14px;
}

.message-thinking-toggle {
    color: #6c757d;
    font-size: 12px;
    transition: transform 0.2s ease;
}

.message-thinking-content {
    padding: 16px;
    background: #ffffff;
    border-top: 1px solid #e9ecef;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        max-height: 0;
        padding-top: 0;
        padding-bottom: 0;
    }
    to {
        opacity: 1;
        max-height: 500px;
        padding-top: 16px;
        padding-bottom: 16px;
    }
}

.message-thinking-text {
    font-family: 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.5;
    color: #495057;
    white-space: pre-wrap;
    word-wrap: break-word;
    margin: 0;
}

/* Regular Links (from TextProcessor) - Powder Blue */
.message-content a {
    color: #87CEEB;
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: all 0.2s ease;
    position: relative;
}

.message-content a:hover {
    color: #B0E0E6;
    border-bottom-color: #B0E0E6;
    background: rgba(135, 206, 235, 0.1);
    border-radius: 2px;
    padding: 1px 2px;
}

.message-content a:visited {
    color: #FFFFFF;
    opacity: 0.8;
}

.message-content a:visited:hover {
    color: #FFFFFF;
    background: rgba(255, 255, 255, 0.1);
    border-bottom-color: #FFFFFF;
}

/* Enhanced Links (from LinkProcessor) */
.message-link {
    color: #007bff;
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: all 0.2s ease;
}

.message-link:hover {
    color: #0056b3;
    border-bottom-color: #0056b3;
}

.message-link.enhanced {
    padding: 2px 4px;
    background: rgba(0, 123, 255, 0.05);
    border-radius: 3px;
    position: relative;
}

.message-link.enhanced:hover {
    background: rgba(0, 123, 255, 0.1);
    transform: translateY(-1px);
}

/* Math Loading (Future) */
.message-math-loading {
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    border: 1px solid #90caf9;
    border-radius: 4px;
    padding: 8px 12px;
    color: #1565c0;
    font-size: 13px;
    font-style: italic;
    display: inline-block;
    animation: math-pulse 2s ease-in-out infinite;
}

@keyframes math-pulse {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 1; }
}

/* Performance Optimizations */
.message-code-loading,
.message-thinking-loading {
    will-change: transform;
    backface-visibility: hidden;
}

.message-code-wave-bar,
.message-thinking-dot {
    will-change: transform, opacity;
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    .message-code-wave-bar,
    .message-thinking-dot,
    .message-code-loading::before,
    .message-math-loading {
        animation: none;
    }
    
    .message-thinking-content {
        animation: none;
    }
    
    .message-link.enhanced:hover {
        transform: none;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .message-code-loading {
        background: linear-gradient(135deg, #2d3748 0%, #1a202c 100%);
        border-color: #4a5568;
        color: #e2e8f0;
    }
    
    .message-thinking-loading {
        background: linear-gradient(135deg, #744210 0%, #553c0a 100%);
        border-color: #744210;
    }
    
    .message-thinking-block {
        background: #2d3748;
        border-color: #4a5568;
    }
    
    .message-thinking-header {
        background: linear-gradient(135deg, #4a5568 0%, #2d3748 100%);
    }
    
    .message-thinking-content {
        background: #1a202c;
        border-color: #4a5568;
    }
    
    .message-thinking-text {
        color: #e2e8f0;
    }
}