/* Chat Module */
.chat-module {
    display: flex; flex-direction: column;
    height: calc(100vh - var(--topbar-h) - var(--sp-12));
    max-height: 700px;
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius-xl); overflow: hidden;
}

.chat-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: var(--sp-4) var(--sp-5); border-bottom: 1px solid var(--border);
}

.chat-header h3 {
    font-size: var(--text-lg); font-weight: 600; color: var(--text-primary);
    display: flex; align-items: center; gap: var(--sp-2);
}

.chat-messages {
    flex: 1; overflow-y: auto; padding: var(--sp-5);
    display: flex; flex-direction: column; gap: var(--sp-4);
}

.chat-message {
    display: flex; gap: var(--sp-3);
    max-width: 85%; animation: fadeIn var(--dur-normal);
}

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

.msg-avatar {
    width: 28px; height: 28px; border-radius: var(--radius-full);
    display: flex; align-items: center; justify-content: center;
    font-size: var(--text-xs); font-weight: 700; flex-shrink: 0;
}

.chat-message.user .msg-avatar {
    background: linear-gradient(135deg, var(--accent), var(--purple));
    color: white;
}

.chat-message.assistant .msg-avatar {
    background: var(--green-muted); color: var(--green);
}

.msg-bubble {
    padding: var(--sp-3) var(--sp-4);
    border-radius: var(--radius-lg); font-size: var(--text-sm);
    line-height: 1.6;
}

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

.chat-message.assistant .msg-bubble {
    background: var(--bg-elevated); color: var(--text-primary);
    border-bottom-left-radius: 4px;
}

.msg-time {
    font-size: var(--text-xs); color: var(--text-muted);
    margin-top: var(--sp-1);
}

.chat-message.user .msg-time { text-align: right; }

/* Typing indicator */
.typing-indicator {
    display: flex; gap: 4px; padding: var(--sp-3) var(--sp-4);
    background: var(--bg-elevated); border-radius: var(--radius-lg);
    width: fit-content;
}

.typing-dot {
    width: 6px; height: 6px; border-radius: 50%;
    background: var(--text-muted);
    animation: typingBounce 1.4s infinite ease-in-out;
}

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

@keyframes typingBounce {
    0%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-6px); }
}

/* Quick actions */
.chat-quick-actions {
    display: flex; gap: var(--sp-2); padding: var(--sp-3) var(--sp-5);
    overflow-x: auto; border-top: 1px solid var(--border);
}

.quick-btn {
    padding: var(--sp-2) var(--sp-3); background: var(--bg-elevated);
    border: 1px solid var(--border); border-radius: var(--radius-full);
    color: var(--text-secondary); font-size: var(--text-xs);
    cursor: pointer; white-space: nowrap; font-family: var(--font-sans);
    transition: all var(--dur-fast);
}

.quick-btn:hover {
    border-color: var(--accent); color: var(--accent);
    background: var(--accent-muted);
}

/* Input bar */
.chat-input-bar {
    display: flex; gap: var(--sp-2);
    padding: var(--sp-4) var(--sp-5);
    border-top: 1px solid var(--border);
    background: var(--bg-surface);
}

.chat-input-bar input {
    flex: 1; padding: var(--sp-3) var(--sp-4);
    background: var(--bg-input); border: 1px solid var(--border);
    border-radius: var(--radius-full); color: var(--text-primary);
    font-size: var(--text-sm); font-family: var(--font-sans); outline: none;
}

.chat-input-bar input:focus { border-color: var(--accent); }

.chat-input-bar button {
    padding: var(--sp-3) var(--sp-5);
    background: linear-gradient(135deg, var(--accent), #5580E0);
    color: white; border: none; border-radius: var(--radius-full);
    font-size: var(--text-sm); font-weight: 600; cursor: pointer;
    font-family: var(--font-sans); transition: box-shadow var(--dur-fast);
}

.chat-input-bar button:hover { box-shadow: var(--shadow-glow); }

/* Fehlermeldung in der Chat-Bubble */
.msg-bubble.msg-error {
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.35);
    color: #fca5a5;
}

/* Markdown-Rendering in Chat-Bubbles */
.msg-bubble h3,
.msg-bubble h4 {
    margin: 0.4em 0 0.2em;
    font-size: 0.95em;
    font-weight: 700;
}
.msg-bubble ul,
.msg-bubble ol {
    margin: 0.3em 0;
    padding-left: 1.4em;
}
.msg-bubble li { margin: 0.1em 0; }
.msg-bubble strong { font-weight: 700; }
.msg-bubble em { font-style: italic; }
.msg-bubble code {
    background: rgba(0,0,0,0.25);
    border-radius: 4px;
    padding: 0.1em 0.35em;
    font-family: monospace;
    font-size: 0.88em;
}
.msg-bubble pre {
    background: rgba(0,0,0,0.3);
    border-radius: 6px;
    padding: 0.6em 0.8em;
    overflow-x: auto;
    margin: 0.4em 0;
}
.msg-bubble pre code {
    background: none;
    padding: 0;
    font-size: 0.85em;
}
.msg-bubble hr {
    border: none;
    border-top: 1px solid rgba(255,255,255,0.15);
    margin: 0.5em 0;
}

