/* Chat Container Styles */
.chat-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 140px);
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

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

/* Custom Scrollbar */
.chat-messages::-webkit-scrollbar {
    width: 8px;
}

.chat-messages::-webkit-scrollbar-track {
    background: var(--bg-darker);
    border-radius: 4px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: var(--accent-primary);
    border-radius: 4px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: var(--accent-primary-hover);
}

/* Welcome Message */
.welcome-message {
    text-align: center;
    padding: 40px 20px;
    max-width: 600px;
    margin: auto;
}

.welcome-icon {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    font-size: 36px;
    color: white;
}

.welcome-message h3 {
    font-size: 28px;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.welcome-message p {
    color: var(--text-secondary);
    font-size: 16px;
    margin-bottom: 30px;
    line-height: 1.6;
}

/* Suggestion Buttons */
.suggestions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    margin-top: 20px;
}

.suggestion-btn {
    background: var(--card-bg-lighter);
    border: 1px solid var(--border-color);
    padding: 12px 16px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    color: var(--text-primary);
    font-size: 14px;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 8px;
}

.suggestion-btn i {
    color: var(--accent-primary);
}

.suggestion-btn:hover {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.suggestion-btn:hover i {
    color: white;
}

/* Message Bubbles */
.message {
    display: flex;
    gap: 12px;
    max-width: 85%;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

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

.message.user .message-avatar {
    background: var(--accent-primary);
    color: white;
}

.message.assistant .message-avatar {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: white;
}

.message-content {
    flex: 1;
}

.message-bubble {
    padding: 12px 16px;
    border-radius: 12px;
    line-height: 1.6;
}

.message.user .message-bubble {
    background: var(--accent-primary);
    color: white;
    border-bottom-right-radius: 4px;
}

.message.assistant .message-bubble {
    background: var(--card-bg-lighter);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-bottom-left-radius: 4px;
}

.message-time {
    font-size: 11px;
    color: var(--text-tertiary);
    margin-top: 4px;
    padding: 0 4px;
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
}

.typing-dot {
    width: 8px;
    height: 8px;
    background: var(--text-tertiary);
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

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

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

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

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

.chat-input-wrapper {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    background: var(--bg-darker);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 8px 12px;
    transition: border-color 0.3s ease;
}

.chat-input-wrapper:focus-within {
    border-color: var(--accent-primary);
}

.chat-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 15px;
    resize: none;
    max-height: 120px;
    min-height: 24px;
    line-height: 1.5;
    font-family: inherit;
}

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

.send-btn {
    width: 40px;
    height: 40px;
    background: var(--accent-primary);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.send-btn:hover {
    background: var(--accent-primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.send-btn:disabled {
    background: var(--bg-lighter);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Chat Info */
.chat-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
    font-size: 12px;
}

.model-badge {
    color: var(--text-tertiary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.model-badge i {
    color: var(--accent-primary);
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
}

.status-indicator.online {
    color: var(--status-success);
}

.status-indicator.offline {
    color: var(--status-error);
}

.status-indicator i {
    font-size: 8px;
    animation: pulse 2s infinite;
}

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

/* Code Blocks in Messages */
.message-bubble pre {
    background: var(--bg-darker);
    padding: 12px;
    border-radius: 6px;
    overflow-x: auto;
    margin: 8px 0;
}

.message-bubble code {
    font-family: 'Courier New', monospace;
    font-size: 13px;
}

.message-bubble p {
    margin: 8px 0;
}

.message-bubble p:first-child {
    margin-top: 0;
}

.message-bubble p:last-child {
    margin-bottom: 0;
}

/* Loading State */
.loading-message {
    text-align: center;
    color: var(--text-tertiary);
    padding: 20px;
}

/* Error Message */
.error-message {
    background: var(--status-error-light);
    border: 1px solid var(--status-error);
    color: var(--status-error);
    padding: 12px 16px;
    border-radius: 8px;
    margin: 8px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.error-message i {
    font-size: 18px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .chat-container {
        height: calc(100vh - 120px);
    }

    .message {
        max-width: 95%;
    }

    .suggestions {
        grid-template-columns: 1fr;
    }

    .welcome-message {
        padding: 20px 10px;
    }

    .welcome-icon {
        width: 60px;
        height: 60px;
        font-size: 28px;
    }
}
