* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
:root {
    --primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --secondary: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --bg-dark: #0f0f23;
    --bg-medium: #1a1a2e;
    --bg-light: #16213e;
    --text-white: #ffffff;
    --text-gray: #b8b8d1;
    --text-muted: #6c7293;
    --user-bubble: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --bot-bubble: #2a2a40;
    --border: #3d3d56;
    --success: #00ff88;
    --error: #ff6b6b;
    --code-bg: #1e1e1e;
    --code-border: #444;
    --inline-code-bg: #333;
}
body {
    font-family: system-ui, -apple-system, sans-serif;
    background: var(--bg-dark);
    color: var(--text-white);
    height: 100vh;
    display: flex;
    flex-direction: column;
}
.chat-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    max-width: 1000px;
    width: 100%;
    margin: 0 auto;
    background: var(--bg-medium);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}
.header {
    background: var(--primary);
    padding: 20px 30px;
    position: relative;
    min-height: 120px;
}
.header-main {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
}
.header-title {
    flex: 1;
}
.header h1 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 5px;
}
.header .subtitle {
    font-size: 14px;
    opacity: 0.9;
}
.status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    margin-top: 5px;
}
.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success);
    animation: pulse 2s infinite;
}
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}
.header-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
}
.topic-selector {
    display: flex;
    align-items: center;
    gap: 15px;
}
.current-topic {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.9);
    background: rgba(255, 255, 255, 0.1);
    padding: 8px 12px;
    border-radius: 15px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    min-width: 140px;
}
.topic-icon {
    font-size: 16px;
}
.custom-topic-selector {
    position: relative;
    display: inline-block;
    min-width: 200px;
}
.topic-trigger {
    background: var(--bg-medium);
    border: 1px solid var(--border);
    border-radius: 15px;
    padding: 10px 40px 10px 15px;
    color: var(--text-white);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    user-select: none;
    position: relative;
    min-height: 40px;
    white-space: nowrap;
}
.topic-trigger:hover {
    background: var(--bg-light);
    border-color: #667eea;
    transform: translateY(-1px);
}
.topic-trigger.active {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
}
.topic-trigger::after {
    content: '';
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 6px solid var(--text-gray);
    transition: all 0.3s ease;
}
.topic-trigger.active::after {
    transform: translateY(-50%) rotate(180deg);
    border-top-color: #667eea;
}
.topic-trigger:hover::after {
    border-top-color: #667eea;
}
.topic-option-icon {
    font-size: 16px;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
}
.topic-dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-medium);
    border: 1px solid var(--border);
    border-radius: 15px;
    margin-top: 5px;
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}
.topic-dropdown-menu.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
.topic-option {
    padding: 12px 15px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.topic-option:last-child {
    border-bottom: none;
}
.topic-option:hover {
    background: var(--bg-light);
    color: #667eea;
}
.topic-option.selected {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.2), rgba(118, 75, 162, 0.2));
    color: #667eea;
    font-weight: 500;
}
.topic-option-content {
    flex: 1;
}
.topic-option-name {
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 2px;
}
.topic-option-desc {
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.3;
}
.topic-dropdown-menu::-webkit-scrollbar {
    width: 6px;
}
.topic-dropdown-menu::-webkit-scrollbar-track {
    background: var(--bg-light);
    border-radius: 3px;
}
.topic-dropdown-menu::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}
.controls {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}
.btn-simple {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 20px;
    padding: 8px 15px;
    color: white;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
    text-decoration: none;
}
.btn-simple:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}
.messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    scroll-behavior: smooth;
}
.messages::-webkit-scrollbar {
    width: 6px;
}
.messages::-webkit-scrollbar-track {
    background: var(--bg-light);
}
.messages::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}
.message {
    margin-bottom: 16px;
    animation: slideIn 0.3s ease-out;
}
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
.message-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 10px;
}
.message-wrapper.user {
    justify-content: flex-end;
}
.message-bubble {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 18px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    overflow-wrap: normal;
    word-wrap: normal;
    word-break: normal;
    hyphens: normal;
    line-height: 1.5;
    white-space: normal;
}
.message-bubble.user {
    max-width: 100%;
    background: var(--user-bubble);
    color: white;
}
.message-bubble.bot {
    background: var(--bot-bubble);
    color: var(--text-white);
    border: 1px solid var(--border);
}
.message-bubble pre {
    background: var(--code-bg);
    border: 1px solid var(--code-border);
    border-radius: 8px;
    padding: 12px;
    margin: 8px 0;
    overflow-x: auto;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.4;
    position: relative;
    border-left: 4px solid #667eea;
}
.message-bubble pre::before {
    content: attr(data-language);
    position: absolute;
    top: -25px;
    right: 8px;
    background: #667eea;
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 10px;
    text-transform: uppercase;
    font-weight: bold;
}
.message-bubble pre code {
    background: none;
    border: none;
    padding: 0;
    border-radius: 0;
    font-size: inherit;
    color: #f8f8f2;
    display: block;
}
.message-bubble code:not(pre code) {
    background: var(--inline-code-bg);
    color: #ff79c6;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.9em;
    border: 1px solid var(--code-border);
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
.message-bubble code .keyword {
    color: #ff79c6;
    font-weight: bold;
}
.message-bubble code .string {
    color: #50fa7b;
}
.message-bubble code .comment {
    color: #6272a4;
    font-style: italic;
}
.message-bubble code .number {
    color: #bd93f9;
}
.message-bubble code .function {
    color: #8be9fd;
}
.message-bubble code .variable {
    color: #ffb86c;
}
.message-bubble code .operator {
    color: #ff79c6;
}
.message-bubble code .tag {
    color: #ff79c6;
}
.message-bubble code .attribute {
    color: #50fa7b;
}
.code-header {
    background: #2d3748;
    color: #a0aec0;
    padding: 8px 12px;
    border-radius: 8px 8px 0 0;
    font-size: 12px;
    border: 1px solid var(--code-border);
    border-bottom: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.code-language {
    font-weight: bold;
    text-transform: uppercase;
}
.copy-code-btn {
    background: #4a5568;
    border: none;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 11px;
    transition: background 0.2s;
}
.copy-code-btn:hover {
    background: #2d3748;
}
.code-header + pre {
    border-radius: 0 0 8px 8px;
    margin-top: 0;
}
.code-header + pre::before {
    display: none; 
}
.message-time {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
}
.avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}
.avatar.user {
    background: var(--user-bubble);
    color: white;
}
.avatar.bot {
    background: var(--secondary);
    color: white;
}
.typing-indicator {
    display: none;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
}
.typing-indicator.show {
    display: flex;
}
.typing-dots {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    background: var(--bot-bubble);
    border-radius: 18px;
    border: 1px solid var(--border);
}
.typing-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
    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);
    }
    30% {
        transform: translateY(-10px);
    }
}
.input-area {
    background: var(--bg-light);
    border-top: 1px solid var(--border);
    padding: 20px;
}
.input-form {
    display: flex;
    gap: 12px;
    align-items: flex-end;
}
.input-wrapper {
    flex: 1;
}
.input-field {
    width: 100%;
    background: var(--bg-medium);
    border: 1px solid var(--border);
    border-radius: 25px;
    padding: 12px 20px;
    color: var(--text-white);
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: all 0.3s ease;
}
.input-field:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}
.input-field::placeholder {
    color: var(--text-muted);
}
.send-button {
    background: var(--primary);
    border: none;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}
.send-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}
.send-button svg {
    width: 20px;
    height: 20px;
    fill: white;
}
.welcome {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}
.welcome h3 {
    font-size: 20px;
    margin-bottom: 10px;
    color: var(--text-gray);
}
.quick-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 20px;
    justify-content: center;
}
.quick-action {
    background: var(--bg-light);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 8px 16px;
    font-size: 12px;
    color: var(--text-gray);
    cursor: pointer;
    transition: all 0.3s ease;
}
.quick-action:hover {
    background: var(--border);
    transform: translateY(-2px);
}
.message-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
    opacity: 0;
    transition: opacity 0.3s ease;
}
.message:hover .message-actions {
    opacity: 1;
}
.action-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    transition: all 0.3s ease;
}
.action-btn:hover {
    background: var(--border);
    color: var(--text-gray);
}
.dislike-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    transition: all 0.3s ease;
}
.dislike-btn:hover {
    background: rgba(255, 107, 107, 0.2);
    color: var(--error);
}
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 20px;
    border-radius: 12px;
    font-size: 14px;
    z-index: 1000;
    transform: translateX(100%);
    opacity: 0;
    transition: all 0.3s ease;
}
.toast.show {
    transform: translateX(0);
    opacity: 1;
}
.toast.success {
    background: var(--success);
    color: var(--bg-dark);
}
.toast.error {
    background: var(--error);
    color: white;
}
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}
.modal.show {
    display: flex;
}
.modal-content {
    background: var(--bg-medium);
    border-radius: 20px;
    padding: 30px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}
.modal-title {
    font-size: 20px;
    font-weight: 600;
}
.close-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 24px;
    cursor: pointer;
}
.greeting-message {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 18px;
    padding: 16px 20px;
    margin-bottom: 20px;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
    animation: slideIn 0.3s ease-out;
}
.greeting-message .greeting-text {
    font-size: 16px;
    font-weight: 500;
    color: white;
    margin-bottom: 8px;
}
.greeting-message .greeting-subtitle {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.9);
}
@media (max-width: 768px) {
    .chat-container {
        height: 100vh;
        margin: 0;
    }
    .header {
        padding: 15px 20px;
        min-height: auto;
    }
    .header-main {
        flex-direction: column;
        gap: 10px;
        margin-bottom: 10px;
    }
    .header-controls {
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
    }
    .topic-selector {
        flex-direction: column;
        gap: 10px;
        align-items: stretch;
    }
    .current-topic {
        justify-content: center;
        min-width: auto;
        width: 100%;
    }
    .custom-topic-selector {
        width: 100%;
        min-width: auto;
    }
    .topic-trigger {
        padding: 12px 40px 12px 15px;
        min-height: 44px;
        font-size: 16px; 
    }
    .topic-option {
        padding: 15px;
    }
    .controls {
        justify-content: center;
    }
    .btn-simple {
        flex: 1;
        min-width: 0;
        text-align: center;
    }
    .messages {
        padding: 15px;
    }
    .message-bubble {
        max-width: 85%;
    }
    .input-area {
        padding: 15px;
    }
    .message-bubble pre {
        font-size: 12px;
        padding: 10px;
    }
    .code-header {
        padding: 6px 10px;
        font-size: 11px;
    }
    .copy-code-btn {
        padding: 3px 6px;
        font-size: 10px;
    }
}
@media (max-width: 480px) {
    .header h1 {
        font-size: 22px;
    }
    .controls {
        flex-direction: column;
        gap: 8px;
    }
    .btn-simple {
        width: 100%;
    }
    .modal-content {
        padding: 20px;
        width: 95%;
    }
}
    /* Code-Box breiter machen */
    .message-bubble pre {
        min-width: 500px !important;
        max-width: 800px !important;
}
    /* Message-Bubble passt sich an Code-Breite an */
    .message-bubble:has(pre) {
        max-width: none !important;
        width: fit-content !important;
}
    /* Code-Schriftgrösse überschreiben */
    .message-bubble pre {
        font-size: 13px !important;
}
/*    .message-bubble pre code {
        font-size: 15px !important;
}
*/