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

:root {
    /* Professional Color Palette - Academic Blue & Gray */
    --primary-900: #1e3a8a;
    --primary-800: #1e40af;
    --primary-700: #1d4ed8;
    --primary-600: #2563eb;
    --primary-500: #3b82f6;
    --primary-400: #60a5fa;
    
    --neutral-50: #fafafa;
    --neutral-100: #f5f5f5;
    --neutral-200: #e5e5e5;
    --neutral-300: #d4d4d4;
    --neutral-400: #a3a3a3;
    --neutral-500: #737373;
    --neutral-600: #525252;
    --neutral-700: #404040;
    --neutral-800: #262626;
    --neutral-900: #171717;
    
    --success-600: #16a34a;
    --success-100: #dcfce7;
    --warning-600: #ea580c;
    --warning-100: #fed7aa;
    
    /* Semantic Colors */
    --background: #fafafa;
    --surface: #ffffff;
    --surface-hover: #f5f5f5;
    --border: #e5e5e5;
    --text-primary: #171717;
    --text-secondary: #525252;
    --text-tertiary: #a3a3a3;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    
    /* Border Radius */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 15px;
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--background);
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Header */
.header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 0;
    z-index: 100;
}

.header-inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1.25rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.header-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.header-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.header-title h1 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.header-title p {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    margin-top: 0.125rem;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.header-badge {
    padding: 0.375rem 0.75rem;
    background: var(--neutral-100);
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

/* Container */
.container {
    flex: 1;
    display: flex;
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
    padding: 0;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: 280px;
    background: var(--surface);
    border-right: 1px solid var(--border);
    padding: 1.5rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.sidebar-section h3 {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-tertiary);
    margin-bottom: 0.875rem;
}

.sidebar-section-content {
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
}

.quick-action {
    padding: 0.75rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    text-align: left;
    width: 100%;
}

.quick-action:hover {
    background: var(--surface-hover);
    border-color: var(--primary-300);
}

.quick-action-icon {
    color: var(--primary-600);
    flex-shrink: 0;
}

.quick-action-content {
    flex: 1;
}

.quick-action-title {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.125rem;
}

.quick-action-desc {
    font-size: 0.75rem;
    color: var(--text-tertiary);
    line-height: 1.4;
}

/* Chat Main */
.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--surface);
    overflow: hidden;
}

.messages {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Message Styles */
.message {
    display: flex;
    gap: 0.875rem;
    animation: messageSlide 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

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

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-md);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--neutral-100);
    color: var(--text-secondary);
}

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

.message.ai .message-avatar {
    background: var(--neutral-800);
    color: white;
}

.message-content {
    max-width: 65%;
    padding: 0.875rem 1rem;
    border-radius: var(--radius-lg);
    font-size: 0.9375rem;
    line-height: 1.6;
    min-width: 400px;
}

.message.ai .message-content {
    max-width: 85%;
    min-width: 600px;
}

.message.user .message-content {
    background: var(--primary-600);
    color: white;
}

.message.ai .message-content {
    background: var(--neutral-50);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

/* Response Sections */
.response-section {
    margin: 1.25rem 0;
}

.response-section h4 {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Data Tables */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8125rem;
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
    table-layout: auto;
}

.data-table thead {
    background: var(--neutral-50);
    border-bottom: 1px solid var(--border);
}

.data-table th {
    padding: 0.625rem 0.75rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.data-table td {
    padding: 0.75rem;
    border-bottom: 1px solid var(--border);
    color: var(--text-primary);
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.data-table tbody tr:hover {
    background: var(--neutral-50);
}

/* Dimension Badges */
.dimension-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.625rem;
    border-radius: var(--radius-sm);
    font-size: 0.6875rem;
    font-weight: 500;
    font-family: 'Fira Code', monospace;
}

.badge-zeitlich { background: #dbeafe; color: #1e40af; }
.badge-räumlich { background: #dcfce7; color: #166534; }
.badge-inhaltlich { background: #fef3c7; color: #92400e; }
.badge-methodisch { background: #e0e7ff; color: #4338ca; }

/* Meta Card */
.meta-card {
    background: var(--neutral-50);
    padding: 0.875rem 1rem;
    border-radius: var(--radius-md);
    border-left: 3px solid var(--primary-600);
    margin-bottom: 1rem;
    font-size: 0.8125rem;
}

.meta-card strong {
    color: var(--primary-700);
    font-weight: 600;
}

/* Input Area */
.input-area {
    padding: 1.25rem 1.5rem;
    background: var(--surface);
    border-top: 1px solid var(--border);
}

.input-wrapper {
    display: flex;
    gap: 0.75rem;
    align-items: flex-end;
}

.input-container {
    flex: 1;
    position: relative;
}

#messageInput {
    width: 100%;
    padding: 0.875rem 1rem;
    padding-right: 3rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 0.9375rem;
    font-family: inherit;
    color: var(--text-primary);
    resize: none;
    transition: all 0.15s ease;
    background: var(--surface);
    line-height: 1.5;
}

#messageInput:focus {
    outline: none;
    border-color: var(--primary-500);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.08);
}

#messageInput::placeholder {
    color: var(--text-tertiary);
}

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

.send-btn:hover:not(:disabled) {
    background: var(--primary-700);
}

.send-btn:disabled {
    background: var(--neutral-300);
    cursor: not-allowed;
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 0.25rem;
    padding: 0.5rem 0;
}

.typing-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--neutral-400);
    animation: subtleTyping 1.2s ease-in-out infinite;
}

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

@keyframes subtleTyping {
    0%, 60%, 100% { opacity: 0.3; transform: scale(1); }
    30% { opacity: 1; transform: scale(1.1); }
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 6rem 2rem;
    color: var(--text-tertiary);
}

.empty-state-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 1.5rem;
    background: var(--neutral-100);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--neutral-400);
}

.empty-state h2 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.empty-state p {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* Markdown Content Styling */
.markdown-content strong {
    font-weight: 600;
    color: var(--primary-700);
}

.markdown-content em {
    font-style: italic;
    color: var(--text-secondary);
}

.markdown-content ul {
    list-style: disc;
    padding-left: 1.5rem;
    margin: 0.75rem 0;
}

.markdown-content li {
    margin-bottom: 0.5rem;
    line-height: 1.6;
}

.markdown-content p {
    margin-bottom: 0.875rem;
}

.markdown-content p:last-child {
    margin-bottom: 0;
}

/* Scrollbar */
.messages::-webkit-scrollbar,
.sidebar::-webkit-scrollbar {
    width: 6px;
}

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

.messages::-webkit-scrollbar-thumb,
.sidebar::-webkit-scrollbar-thumb {
    background: var(--neutral-300);
    border-radius: 3px;
}

.messages::-webkit-scrollbar-thumb:hover,
.sidebar::-webkit-scrollbar-thumb:hover {
    background: var(--neutral-400);
}

/* Responsive */
@media (max-width: 1024px) {
    .sidebar {
        display: none;
    }
}

@media (max-width: 768px) {
    .header-inner {
        padding: 1rem;
    }

    .header-right {
        display: none;
    }

    .messages {
        padding: 1rem;
    }

    .message-content {
        max-width: 90%;
        min-width: unset;
    }

    .message.ai .message-content {
        max-width: 90%;
        min-width: unset;
    }

    .input-area {
        padding: 1rem;
    }
}

