/* Thymind Chat UI - Modern Design */

/* Chat Container Styles */
.chat-wrapper {
    height: 600px;
    display: flex;
    flex-direction: column;
    background: linear-gradient(135deg, #f5f7fa 0%, #e9ecef 100%);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
}

.chat-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.chat-header h2 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
}

.chat-header .status {
    display: flex;
    align-items: center;
    font-size: 0.875rem;
    opacity: 0.9;
}

.chat-header .status-dot {
    width: 8px;
    height: 8px;
    background: #4ade80;
    border-radius: 50%;
    margin-right: 8px;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(74, 222, 128, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(74, 222, 128, 0);
    }
}

/* Messages Container */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: white;
}

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

.chat-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Welcome Message */
.chat-welcome {
    text-align: center;
    padding: 40px 20px;
    animation: fadeIn 0.5s ease-out;
}

.chat-welcome i {
    color: #8b5cf6;
    margin-bottom: 20px;
}

.chat-welcome h4 {
    color: #1e293b;
    font-weight: 600;
    margin-bottom: 12px;
}

.chat-welcome p {
    color: #64748b;
    max-width: 500px;
    margin: 0 auto 8px;
}

/* Message Bubbles */
.message {
    display: flex;
    animation: slideIn 0.3s ease-out;
    max-width: 100%;
}

.message-user {
    justify-content: flex-end;
}

.message-ai {
    justify-content: flex-start;
}

.message-bubble {
    max-width: 70%;
    padding: 12px 18px;
    border-radius: 18px;
    position: relative;
    word-wrap: break-word;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s ease;
}

.message-bubble:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.message-user .message-bubble {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-bottom-right-radius: 4px;
    margin-left: 50px;
}

.message-ai .message-bubble {
    background: #f1f5f9;
    color: #334155;
    border-bottom-left-radius: 4px;
    margin-right: 50px;
}

/* Message Content */
.message-content {
    font-size: 15px;
    line-height: 1.6;
    margin: 0;
}

.message-user .message-content {
    color: white;
}

/* Formatted Content Styles */
.message-content strong {
    font-weight: 700;
    color: inherit;
}

.message-content em {
    font-style: italic;
    color: inherit;
}

/* Bullet Point Styling */
.message-content .chat-bullet {
    display: inline-block;
    width: 20px;
    height: 20px;
    line-height: 20px;
    text-align: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 50%;
    font-size: 14px;
    margin-right: 8px;
    font-weight: bold;
    vertical-align: middle;
}

.message-ai .message-content .chat-bullet {
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
}

/* Add spacing and indentation for bullet lists */
.message-content br + .chat-bullet {
    margin-left: 0;
}

.message-content br {
    display: block;
    content: "";
    margin-top: 8px;
}

/* Message Time */
.message-time {
    font-size: 11px;
    margin-top: 6px;
    opacity: 0.7;
}

.message-user .message-time {
    text-align: right;
    color: rgba(255, 255, 255, 0.8);
}

.message-ai .message-time {
    text-align: left;
    color: #64748b;
}

/* Avatar */
.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.message-user .message-avatar {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    margin-left: 12px;
    order: 1;
}

.message-ai .message-avatar {
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
    color: white;
    margin-right: 12px;
}

/* Message Row */
.message-row {
    display: flex;
    align-items: flex-end;
    gap: 8px;
}

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

/* Chat Input */
.chat-input-wrapper {
    padding: 20px;
    background: white;
    border-top: 1px solid #e2e8f0;
}

.chat-input-form {
    display: flex;
    gap: 12px;
    align-items: center;
}

.chat-input-field {
    flex: 1;
    padding: 12px 20px;
    border: 2px solid #e2e8f0;
    border-radius: 25px;
    font-size: 15px;
    resize: none;
    outline: none;
    transition: all 0.3s ease;
    background: #f8fafc;
}

.chat-input-field:focus {
    border-color: #8b5cf6;
    background: white;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

.chat-input-field::placeholder {
    color: #94a3b8;
}

.chat-send-button {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 10px rgba(102, 126, 234, 0.3);
}

.chat-send-button:hover:not(:disabled) {
    transform: scale(1.05);
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.4);
}

.chat-send-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.chat-send-button i {
    font-size: 18px;
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    align-items: center;
    padding: 12px 18px;
    background: #f1f5f9;
    border-radius: 18px;
    border-bottom-left-radius: 4px;
    max-width: 80px;
}

.typing-indicator span {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #94a3b8;
    margin: 0 2px;
    animation: typing 1.4s infinite;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.5;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

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

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Code Blocks */
.message-bubble pre.code-block {
    background: #1e293b;
    color: #e2e8f0;
    padding: 12px;
    border-radius: 8px;
    margin: 8px 0;
    overflow-x: auto;
}

.message-bubble code.inline-code {
    background: rgba(139, 92, 246, 0.1);
    color: #7c3aed;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 14px;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .chat-wrapper {
        height: 100vh;
        border-radius: 0;
    }
    
    .message-bubble {
        max-width: 85%;
    }
    
    .message-user .message-bubble {
        margin-left: 20px;
    }
    
    .message-ai .message-bubble {
        margin-right: 20px;
    }
    
    .chat-header h2 {
        font-size: 1.25rem;
    }
    
    .message-avatar {
        width: 32px;
        height: 32px;
        font-size: 16px;
    }
}

/* Error Messages */
.chat-error {
    background: #fee2e2;
    color: #991b1b;
    padding: 12px 16px;
    border-radius: 8px;
    margin: 12px 0;
    animation: slideIn 0.3s ease-out;
}

/* Loading State */
.message-loading {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 18px;
    background: #f1f5f9;
    border-radius: 18px;
    color: #64748b;
    animation: slideIn 0.3s ease-out;
}

.message-loading .spinner-border {
    width: 16px;
    height: 16px;
    border-width: 2px;
}