/* React AI Investment Advisor Chat - Sophisticated Design */

.ai-advisor-chat-react {
    background: rgba(24, 26, 35, 1);
    border: none;
    border-radius: 0.5rem;
    margin: 0;
    overflow: hidden;
    box-shadow: none;
    backdrop-filter: blur(20px);
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* Header */
.ai-chat-header {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: var(--text-inverse);
    padding: 20px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.ai-chat-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ai-robot-icon {
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    animation: pulse 2s infinite;
}

.ai-chat-title h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
}

.ai-status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.15);
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 500;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success-color);
    animation: pulse 2s infinite;
}

.status-dot.offline {
    background: var(--error-color);
    animation: none;
}

.test-connection-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-inverse);
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s ease;
}

.test-connection-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

/* Messages Container */
.ai-chat-messages-container {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: rgba(20, 22, 30, 1);
}

.ai-chat-messages-container::-webkit-scrollbar {
    width: 6px;
}

.ai-chat-messages-container::-webkit-scrollbar-track {
    background: transparent;
}

.ai-chat-messages-container::-webkit-scrollbar-thumb {
    background: var(--text-muted);
    border-radius: 2px;
}

/* Welcome Message */
.ai-welcome-message {
    display: flex;
    gap: 16px;
    padding: 24px;
    background: rgba(24, 26, 35, 0.5);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    animation: slideInUp 0.5s ease-out;
    box-shadow: var(--shadow-sm);
}

.ai-avatar {
    width: 52px;
    height: 52px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-inverse);
    font-size: 22px;
    flex-shrink: 0;
    box-shadow: var(--shadow-md);
    animation: pulse 2s infinite;
}

.welcome-content h4 {
    color: var(--text-primary);
    margin: 0 0 8px 0;
    font-size: 16px;
    font-weight: 600;
}

.welcome-content p {
    color: var(--text-secondary);
    margin: 0 0 16px 0;
    font-size: 14px;
    line-height: 1.5;
}

/* Quick Suggestions */
.quick-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.suggestion-btn {
    background: var(--bg-elevated);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    padding: 10px 18px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
    position: relative;
    overflow: hidden;
}

.suggestion-btn:hover {
    background: var(--primary-color);
    color: var(--text-inverse);
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.suggestion-btn:active {
    transform: translateY(0);
    transition: all 0.1s;
}

.suggestion-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

.suggestion-btn:hover::before {
    left: 100%;
}

/* Chat Messages */
.ai-message {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    animation: slideInUp 0.3s ease-out;
}

.ai-message.user {
    flex-direction: row-reverse;
}

.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    flex-shrink: 0;
}

.ai-message.user .message-avatar {
    background: var(--primary-color);
    color: var(--text-inverse);
}

.ai-message.ai .message-avatar {
    background: rgba(40, 42, 50, 1);
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.ai-message.error .message-avatar {
    background: var(--error-color);
    color: var(--text-inverse);
}

.message-content {
    max-width: 70%;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
    position: relative;
}

.ai-message.user .message-content {
    background: var(--primary-color);
    color: var(--text-inverse);
    border-bottom-right-radius: 2px;
}

.ai-message.ai .message-content {
    background: rgba(40, 42, 50, 1);
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-bottom-left-radius: 2px;
}

.ai-message.error .message-content {
    background: var(--error-color);
    color: var(--text-inverse);
    border-bottom-left-radius: 2px;
}

.message-text {
    margin-bottom: 4px;
}

.message-text strong {
    font-weight: 600;
}

.message-text em {
    font-style: italic;
}

.message-time {
    font-size: 11px;
    opacity: 0.7;
    margin-top: 4px;
}

/* Typing Indicator */
.ai-message.typing .message-content {
    background: rgba(40, 42, 50, 1);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-bottom-left-radius: 2px;
    padding: 16px;
}

.typing-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
}

.typing-dots {
    display: flex;
    gap: 4px;
}

.typing-dot {
    width: 6px;
    height: 6px;
    background: var(--text-muted);
    border-radius: 50%;
    animation: typingDot 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; }

/* Input Container */
.ai-chat-input-container {
    padding: 20px;
    background: var(--bg-secondary);
    border-top: 1px solid var(--card-border);
}

.input-wrapper {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    margin-bottom: 12px;
}

.ai-chat-input {
    flex: 1;
    background: var(--bg-surface);
    border: 1px solid var(--card-border);
    border-radius: 2px;
    padding: 12px 16px;
    color: var(--text-primary);
    font-size: 14px;
    resize: none;
    min-height: 44px;
    max-height: 100px;
    font-family: inherit;
    transition: border-color 0.2s ease;
}

.ai-chat-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 217, 36, 0.1);
}

.ai-chat-input:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.ai-chat-input::placeholder {
    color: var(--text-muted);
}

.ai-send-btn {
    background: var(--primary-color);
    border: none;
    border-radius: 2px;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-inverse);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 16px;
}

.ai-send-btn:hover:not(:disabled) {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.ai-send-btn:disabled {
    background: var(--text-muted);
    cursor: not-allowed;
    transform: none;
}

/* Disclaimer */
.ai-disclaimer {
    color: var(--text-muted);
    font-size: 11px;
    text-align: center;
    line-height: 1.4;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    max-width: 400px;
    margin: 0 auto;
}

.ai-disclaimer i {
    color: var(--warning-color);
    flex-shrink: 0;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .ai-advisor-chat-react {
        height: 400px;
    }
    
    .ai-chat-messages-container {
        padding: 16px;
        gap: 12px;
    }
    
    .ai-welcome-message {
        padding: 16px;
        flex-direction: column;
        text-align: center;
    }
    
    .ai-avatar {
        align-self: center;
        margin-bottom: 12px;
    }
    
    .quick-suggestions {
        justify-content: center;
    }
    
    .suggestion-btn {
        font-size: 11px;
        padding: 6px 12px;
    }
    
    .message-content {
        max-width: 85%;
    }
    
    .ai-chat-input-container {
        padding: 16px;
    }
    
    .ai-disclaimer {
        font-size: 10px;
    }
}

/* Animations */
@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes typingDot {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}
