* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* handz.on Farbpalette */
    --primary-color: #c4d600;        /* Limonen-Grün */
    --primary-hover: #a8b800;        /* Dunkleres Grün für Hover */
    --bg-color: #0a0a0a;             /* Schwarzer Hintergrund */
    --sidebar-bg: #1a1a1a;           /* Dunkelgrau für Sidebar */
    --message-user-bg: #2a2a2a;      /* Dunkelgrau für User-Nachrichten */
    --message-assistant-bg: #1a1a1a; /* Dunkelgrau für Assistant */
    --border-color: #333333;         /* Dunkelgraue Borders */
    --text-color: #ffffff;           /* Weiße Schrift */
    --text-light: #b0b0b0;           /* Helles Grau für sekundären Text */
    --accent-color: #c4d600;         /* Limonen-Grün Akzent */
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

header {
    text-align: center;
    margin-bottom: 1px;
}

header h1 {
    font-size: 2rem;
    color: var(--text-color);
    margin-bottom: 1px;
    margin-top: 0;  /* Remove default top margin */
}

.header-logo {
    transform: scale(1);  /* Enlarges by 150% */
    margin-bottom: 0px;  /* Adjust based on original logo height */
}

.subtitle {
    color: var(--text-light);
    font-size: 0.9rem;
    margin-top: 0;  /* Remove default top margin */
}

/* Main Content - Changed to Flexbox */
.main-content {
    display: flex;
    gap: 20px;
    flex: 1;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    flex: 0 0 400px;
    background: var(--sidebar-bg);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    gap: 20px;
    border: 1px solid var(--border-color);
}

/* Hide sidebar */
.sidebar.hidden {
    display: none;
}

/* Center chat when sidebar is hidden */
.main-content:has(.sidebar.hidden) {
    justify-content: center;
}

.main-content:has(.sidebar.hidden) .chat-container {
    max-width: 1200px;
    width: 100%;
}

.settings h3,
.stats h3 {
    font-size: 1.1rem;
    margin-bottom: 15px;
    color: var(--text-color);
    border-bottom: 2px solid var(--accent-color);
    padding-bottom: 8px;
}

.setting-group {
    margin-bottom: 15px;
}

.setting-group label {
    display: block;
    font-size: 0.9rem;
    color: var(--text-light);
    margin-bottom: 5px;
}

.setting-group input[type="text"] {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.9rem;
    background-color: var(--message-user-bg);
    color: var(--text-color);
    transition: border-color 0.2s;
}

.setting-group input[type="text"]:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(196, 214, 0, 0.2);
}

.setting-group input[type="checkbox"] {
    margin-right: 8px;
    accent-color: var(--accent-color);
}

.stats {
    border-top: 1px solid var(--border-color);
    padding-top: 20px;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    font-size: 0.9rem;
}

.stat-label {
    color: var(--text-light);
}

.stat-value {
    font-weight: 600;
    color: var(--text-color);
}

.clear-button {
    width: 100%;
    padding: 10px;
    background-color: var(--accent-color);
    color: #000000;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    margin-top: auto;
    transition: all 0.2s;
}

.clear-button:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
}

/* Chat Container */
.chat-container {
    flex: 1;
    background: var(--sidebar-bg);
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    background-color: #000000;
}

.message {
    display: flex;
    animation: fadeIn 0.3s ease-in;
}

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

.message-content {
    max-width: 70%;
    padding: 12px 16px;
    border-radius: 12px;
    word-wrap: break-word;
}

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

.message.user .message-content {
    background-color: var(--message-user-bg);
    color: var(--text-color);
    border: 1px solid var(--border-color);
}

.message.assistant {
    justify-content: flex-start;
    align-items: flex-start;
}

.message.assistant .message-content {
    background-color: var(--message-assistant-bg);
    color: var(--text-color);
    min-width: 300px;
    max-width: 70%;
    width: fit-content;
    border: 1px solid var(--border-color);
}

.message-sources {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    font-size: 0.8rem;
    color: var(--text-light);
}

.source-item {
    margin: 5px 0;
}

.source-tag {
    display: inline-block;
    background-color: rgba(196, 214, 0, 0.2);
    padding: 4px 10px;
    border-radius: 4px;
    margin-right: 5px;
    margin-top: 5px;
    cursor: help;
    transition: background-color 0.2s;
    border: 1px solid rgba(196, 214, 0, 0.4);
    color: var(--text-color);
}

.source-tag:hover {
    background-color: rgba(196, 214, 0, 0.3);
}

.source-tag strong {
    color: var(--accent-color);
    margin-left: 5px;
}

/* Contact Button */
.contact-button {
    display: block;
    margin: 20px auto;
    padding: 16px 32px;
    background-color: var(--accent-color);
    color: #000000;
    text-decoration: none;
    font-size: 16px;
    font-weight: bold;
    border-radius: 8px;
    text-align: center;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(196, 214, 0, 0.3);
    width: 100%;
    max-width: 325px;
}

.contact-button:hover {
    background-color: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(196, 214, 0, 0.4);
}

.contact-button:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(196, 214, 0, 0.3);
}

/* Chat Input */
.chat-input-container {
    border-top: 1px solid var(--border-color);
    padding: 20px;
    padding-bottom: 16px;  /* NEW: Smaller bottom padding */
    display: flex;
    flex-direction: column;
    gap: 8px;  /* REDUCED: Less space between dock and input */
    background-color: var(--sidebar-bg);
}


/* NEW: Quick Replies Dock */
.quick-replies-dock {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 0;
    padding-top: 4px;  /* NEW: Small top padding for buttons */
    height: 42px;
    margin-top: -16px;
    align-content: flex-start;
    align-items: flex-start;  /* NEW: Align to top */
    overflow: hidden;
}

/* Force dock to always take space even when empty */
.quick-replies-dock:empty::before {
    content: '';
    display: block;
    height: 42px;
    width: 1px;
}

/* NEW: Input Row Wrapper */
.input-row {
    display: flex;
    gap: 10px;
}

#messageInput {
    flex: 1;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.95rem;
    resize: none;
    font-family: inherit;
    max-height: 120px;
    transition: border-color 0.2s;
    background-color: var(--message-user-bg);
    color: var(--text-color);
}

#messageInput:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(196, 214, 0, 0.2);
}

#sendButton {
    padding: 12px 24px;
    background-color: var(--accent-color);
    color: #000000;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    transition: all 0.2s;
}

#sendButton:hover:not(:disabled) {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
}

#sendButton:disabled {
    background-color: var(--border-color);
    cursor: not-allowed;
    color: var(--text-light);
}

/* Loading spinner */
.loading {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(0, 0, 0, 0.3);
    border-radius: 50%;
    border-top-color: #000000;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

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

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

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

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

/* Responsive */
@media (max-width: 768px) {
    .main-content {
        flex-direction: column;
    }

    .sidebar {
        order: 2;
        flex: 0 0 auto;
    }

    .message-content {
        max-width: 85%;
    }
}

.logo-link {
    display: inline-block;
    margin-bottom: 0px;
}

.header-logo {
    width: 300px;
    height: auto;
    cursor: pointer;
    transition: opacity 0.2s;
}

.header-logo:hover {
    opacity: 0.8;
}

.quick-reply-button {
    background-color: #2d3748;
    border: 2px solid #c4d600;
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.quick-reply-button:hover {
    background-color: #c4d600;
    color: #1a202c;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(196, 214, 0, 0.3);
}

.quick-reply-button:active {
    transform: translateY(0);
}


/* Contact Button Below Chat Input */
.bottom-contact-container {
    padding: 15px 20px;
    background-color: var(--sidebar-bg);
    border-top: 1px solid var(--border-color);
    text-align: center;
}

.contact-button-bottom {
    display: inline-block;
    padding: 12px 28px;
    background-color: var(--accent-color);
    color: #000000;
    text-decoration: none;
    font-size: 15px;
    font-weight: bold;
    border-radius: 8px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(196, 214, 0, 0.3);
}

.contact-button-bottom:hover {
    background-color: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(196, 214, 0, 0.4);
}

.contact-button-bottom:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(196, 214, 0, 0.3);
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0px;
    padding: 4px 8px;  /* Reduced from 0px - adjust values as needed */
    background-color: transparent;  /* Change to your desired color */
    border-radius: 0px;
    width: fit-content;
    margin: 0 auto;
}

.typing-dots {
    display: flex;
    gap: 4px;
    align-items: center;  /* Keeps dots vertically aligned during animation */
    height: 18px;  /* Add fixed height to prevent layout shifts */
}

.typing-dots span {
    width: 8px;
    height: 8px;
    background-color: #ffffff;
    border-radius: 50%;
    animation: typing-bounce 1.4s infinite ease-in-out;
    display: block;  /* Ensures proper rendering */
}


.typing-dots span:nth-child(1) {
    animation-delay: 0s;
}

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

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

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

.email-link {
    color: #3b82f6;
    text-decoration: underline;
    cursor: pointer;
    transition: color 0.2s ease;
}

.email-link:hover {
    color: #2563eb;
    text-decoration: none;
}

/* Toggle Controls Container */
.toggle-controls {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 100;
}

.toggle-item {
    display: flex;
    align-items: center;
    gap: 10px;
    background: white;
    padding: 8px 16px;
    border-radius: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .3s;
    border-radius: 24px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: #4CAF50;
}

input:checked + .slider:before {
    transform: translateX(26px);
}

#sidebarModeText, #streamingModeText {
    font-size: 14px;
    font-weight: 500;
    color: #333;
    min-width: 120px;
}

/* Add this to ensure main-content adjusts properly */
.main-content.sidebar-hidden {
    margin-left: 0;
}

/* Farewell separator styling */
.farewell-separator {
    width: 100%;
    height: 1px;
    background: linear-gradient(to right, transparent, #e5e7eb, transparent);
    margin: 1.5rem 0;
    position: relative;
}

/* Optional: Style text after separator differently */
.message.assistant .message-content p {
    line-height: 1.6;
}
