/* ==========================================
   DEEPSEEK CHAT INTERFACE
   ========================================== */
.chat-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - var(--header-height) - var(--nav-height) - 48px);
    width: 100%;
    max-width: none;
    margin: 0;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: all var(--transition-normal);
}

.main-container.full-width .chat-container {
    height: calc(100vh - var(--header-height) - var(--nav-height));
    border-radius: 0;
    border: none;
}

.chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

.chat-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.deepseek-avatar {
    background: linear-gradient(135deg, #1a73e8, #8ab4f8);
}

.chat-title h3 {
    font-size: 16px;
    font-weight: 600;
    margin: 0;
}

.chat-status {
    font-size: 12px;
    color: var(--text-secondary);
}

.chat-action-btn {
    padding: 8px;
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    border-radius: var(--radius-full);
    transition: all var(--transition-fast);
}

.chat-action-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.chat-history {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    background: var(--bg-secondary);
}

.chat-welcome-message {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    color: var(--text-secondary);
    padding: 20px;
}

.welcome-logo {
    width: 64px;
    height: 64px;
    background: var(--bg-tertiary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
    color: var(--primary-blue);
}

.chat-welcome-message h2 {
    font-size: 24px;
    margin-bottom: 10px;
    color: var(--text-primary);
}

.chat-examples {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-top: 24px;
}

.chat-examples button {
    padding: 10px 16px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-full);
    color: var(--text-primary);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-size: 14px;
}

.chat-examples button:hover {
    background: var(--bg-hover);
    border-color: var(--primary-blue);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.chat-message {
    display: flex;
    gap: 16px;
    max-width: 85%;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chat-message.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.chat-message.ai {
    align-self: flex-start;
}

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 14px;
    font-weight: bold;
}

.user-avatar-small {
    background: var(--primary-blue);
    color: white;
}

.ai-avatar-small {
    background: linear-gradient(135deg, #1a73e8, #8ab4f8);
    color: white;
}

.message-bubble {
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 15px;
    line-height: 1.5;
    position: relative;
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
}

.chat-message.user .message-bubble {
    background: var(--primary-blue);
    color: white;
    border-bottom-right-radius: 4px;
}

.chat-message.ai .message-bubble {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-bottom-left-radius: 4px;
    color: var(--text-primary);
}

.chat-input-area {
    padding: 16px;
    background: var(--bg-primary);
    border-top: 1px solid var(--border-color);
}

.chat-input-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    padding: 12px 16px;
    transition: all var(--transition-normal);
}

.chat-input-wrapper:focus-within {
    background: var(--bg-primary);
    border-color: var(--primary-blue);
    box-shadow: var(--shadow-focus);
}

.chat-input-wrapper textarea {
    flex: 1;
    border: none;
    background: transparent;
    font-family: inherit;
    font-size: 15px;
    resize: none;
    max-height: 120px;
    outline: none;
    color: var(--text-primary);
    padding: 0;
    line-height: 1.5;
}

#chat-send-btn {
    background: var(--primary-blue);
    color: white;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

#chat-send-btn:hover {
    background: var(--primary-blue-hover);
    transform: scale(1.05);
}

#chat-send-btn:disabled {
    background: var(--text-muted);
    cursor: not-allowed;
    transform: none;
}

.chat-disclaimer {
    font-size: 11px;
    color: var(--text-muted);
    text-align: center;
    margin-top: 8px;
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 4px 0;
}

.typing-bubble {
    padding: 16px 20px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    border-bottom-left-radius: 4px;
    display: inline-block;
}

.typing-dot {
    width: 6px;
    height: 6px;
    background: var(--text-muted);
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out both;
}

.typing-dot:nth-child(1) {
    animation-delay: -0.32s;
}

.typing-dot:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes typing {

    0%,
    80%,
    100% {
        transform: scale(0);
    }

    40% {
        transform: scale(1);
    }
}

/* Sources in Chat */
.chat-sources {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-light);
    font-size: 12px;
}

.chat-sources-title {
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
    text-transform: uppercase;
    font-size: 11px;
}

.chat-answer-content {
    white-space: pre-wrap;
}

.source-item {
    padding: 8px;
    background: var(--bg-tertiary);
    border-radius: 8px;
    margin-bottom: 8px;
    border: 1px solid transparent;
    transition: all var(--transition-fast);
}

.source-item:hover {
    border-color: var(--border-color);
    background: var(--bg-hover);
}

.source-title {
    font-weight: 500;
    color: var(--primary-blue);
    text-decoration: none;
    display: block;
    margin-bottom: 4px;
    font-size: 13px;
}

.source-meta {
    font-size: 11px;
    color: var(--text-muted);
}