/* Reset und Basis-Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #6366f1;
    --primary-hover: #4f46e5;
    --primary-light: #eef2ff;
    --success-color: #22c55e;
    --success-hover: #16a34a;
    --success-light: #f0fdf4;
    --danger-color: #ef4444;
    --danger-hover: #dc2626;
    --danger-light: #fef2f2;
    --warning-color: #f59e0b;
    --warning-light: #fffbeb;
    --secondary-color: #8b5cf6;
    --secondary-hover: #7c3aed;
    --background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    --surface: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    --border-radius: 12px;
    --border-radius-lg: 16px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #ffffff;
    color: var(--text-primary);
    line-height: 1.6;
    padding: 20px;
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

/* Header */
.header {
    margin-bottom: 40px;
    padding: 40px 30px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-xl);
    position: relative;
    overflow: hidden;
}

.header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0) 100%);
    pointer-events: none;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    position: relative;
    z-index: 1;
}

.header-title {
    text-align: center;
    flex: 1;
}

.ai-status {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    background: rgba(255, 255, 255, 0.15);
    padding: 12px 20px;
    border-radius: 8px;
    backdrop-filter: blur(10px);
    min-width: 200px;
}

.ai-status-label {
    font-size: 0.85rem;
    opacity: 0.9;
    margin-bottom: 4px;
}

.ai-status-value {
    font-size: 1rem;
    font-weight: 600;
    color: #fff;
}

@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
    }
    
    .ai-status {
        align-items: center;
        width: 100%;
    }
}

.header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
}

.tab-button {
    flex: 1;
    padding: 15px 20px;
    background: var(--surface);
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.tab-button:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    transform: translateY(-2px);
}

.tab-button.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
    box-shadow: var(--shadow-md);
}

.tab-icon {
    font-size: 1.3rem;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Card */
.card {
    background: var(--surface);
    border-radius: var(--border-radius-lg);
    padding: 35px;
    margin-bottom: 25px;
    box-shadow: var(--shadow-md);
    border: 1px solid rgba(99, 102, 241, 0.1);
    transition: var(--transition);
}

.card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.card h2 {
    font-size: 1.5rem;
    margin-bottom: 10px;
    color: var(--text-primary);
}

.description {
    color: var(--text-secondary);
    margin-bottom: 20px;
}

/* Form Elements */
.form-group {
    margin-bottom: 20px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.form-inline {
    display: flex;
    gap: 15px;
    align-items: flex-end;
    flex-wrap: wrap;
}

.flex-grow {
    flex-grow: 1;
    min-width: 200px;
}

label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.input,
.textarea,
.textarea-large {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.3s;
}

.input:focus,
.textarea:focus,
.textarea-large:focus {
    outline: none;
    border-color: var(--primary-color);
}

.textarea-large {
    min-height: 200px;
    resize: vertical;
}

.textarea {
    resize: vertical;
}

/* Buttons */
.btn {
    padding: 14px 28px;
    border: none;
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 10px;
    white-space: nowrap;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:hover::before {
    width: 300px;
    height: 300px;
}

.btn:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: var(--shadow-lg);
}

.btn:active {
    transform: translateY(-1px) scale(0.98);
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-success {
    background: var(--success-color);
    color: white;
}

.btn-success:hover {
    background: var(--success-hover);
}

.btn-secondary {
    background: var(--secondary-color);
    color: white;
}

.btn-secondary:hover {
    background: #4b5563;
}

.btn-large {
    padding: 15px 30px;
    font-size: 1.1rem;
}

.btn-small {
    padding: 8px 16px;
    font-size: 0.9rem;
    font-weight: 500;
}

.btn-icon {
    font-size: 1.2rem;
    position: relative;
    z-index: 1;
}

.btn > * {
    position: relative;
    z-index: 1;
}

.button-group {
    display: flex;
    gap: 15px;
    justify-content: flex-start;
    margin-top: 20px;
}

/* Loading Spinner */
.loading {
    text-align: center;
    padding: 30px;
    color: var(--text-secondary);
}

.spinner {
    width: 50px;
    height: 50px;
    margin: 0 auto 15px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Status Boxes */
.status-box {
    padding: 15px;
    border-radius: var(--border-radius);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.status-box.info {
    background: #dbeafe;
    color: #1e40af;
    border-left: 4px solid var(--primary-color);
}

.status-box.success {
    background: #d1fae5;
    color: #065f46;
    border-left: 4px solid var(--success-color);
}

.status-box.warning {
    background: #fef3c7;
    color: #92400e;
    border-left: 4px solid var(--warning-color);
}

/* Success Card */
.success-card {
    text-align: center;
    padding: 50px 30px;
}

.success-icon {
    font-size: 4rem;
    margin-bottom: 20px;
}

.success-card h2 {
    color: var(--success-color);
    margin-bottom: 20px;
}

#success-details {
    background: var(--background);
    padding: 20px;
    border-radius: var(--border-radius);
    margin: 20px 0;
    text-align: left;
}

#success-details p {
    margin: 10px 0;
}

#success-details strong {
    color: var(--text-primary);
}

#success-details a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
}

#success-details a:hover {
    text-decoration: underline;
}

/* Ticket History */
.ticket-info {
    background: var(--background);
    padding: 20px;
    border-radius: var(--border-radius);
    margin-bottom: 20px;
}

.ticket-info h3 {
    margin-bottom: 10px;
}

.ticket-history {
    max-height: 500px;
    overflow-y: auto;
}

.ticket-article {
    background: var(--background);
    padding: 20px;
    border-radius: var(--border-radius);
    margin-bottom: 15px;
    border-left: 4px solid var(--primary-color);
}

.ticket-article.internal {
    border-left-color: var(--warning-color);
    background: #fef3c7;
}

.article-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.article-from {
    font-weight: 600;
    color: var(--text-primary);
}

.article-body {
    line-height: 1.6;
    word-wrap: break-word;
}

.article-body p {
    margin: 0 0 1em 0;
}

.article-body br {
    line-height: 1.6;
}

.article-body div {
    margin: 0.5em 0;
}

.article-body blockquote {
    border-left: 3px solid #ccc;
    margin: 1em 0;
    padding-left: 1em;
    color: #666;
    font-style: italic;
}

/* Kosten-Anzeige */
.cost-info {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 15px;
    margin: 15px 0;
}

.cost-info h4 {
    margin: 0 0 10px 0;
    color: #495057;
    font-size: 1rem;
}

.cost-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    font-size: 0.9rem;
}

.cost-item {
    display: flex;
    justify-content: space-between;
    padding: 5px 0;
    border-bottom: 1px solid #e9ecef;
}

.cost-item:last-child {
    border-bottom: none;
    font-weight: bold;
    color: #28a745;
}

.cost-label {
    color: #6c757d;
}

.cost-value {
    color: #495057;
    font-weight: 500;
}

.form-text {
    color: #6c757d;
    font-size: 0.85rem;
    line-height: 1.4;
    margin-top: 5px;
}

.form-control {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 1rem;
    background-color: #fff;
    transition: border-color 0.3s ease;
}

.form-control:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

/* Provider Konfiguration */
.provider-config {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 20px;
    margin: 15px 0;
}

.provider-config h4 {
    margin: 0 0 15px 0;
    color: #495057;
    font-size: 1.1rem;
}

.provider-config .form-group {
    margin-bottom: 15px;
}

.provider-config .form-group:last-child {
    margin-bottom: 0;
}

/* Lokale KI Sektion (für Kompatibilität) */
.local-ai-section {
    background: linear-gradient(135deg, #e8f5e8 0%, #f0f8f0 100%);
    border: 1px solid #c3e6c3;
    border-radius: 8px;
    padding: 20px;
    margin: 15px 0;
}

.local-ai-section h4 {
    margin: 0 0 15px 0;
    color: #2d5a2d;
    font-size: 1.1rem;
}

.local-ai-section .form-group {
    margin-bottom: 15px;
}

.local-ai-section .form-group:last-child {
    margin-bottom: 0;
}

/* Einstellungen Hilfe */
.settings-help {
    background: linear-gradient(135deg, #e3f2fd 0%, #f3e5f5 100%);
    border: 1px solid #bbdefb;
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0;
}

.settings-help h4 {
    margin: 0 0 15px 0;
    color: #1976d2;
    font-size: 1.1rem;
}

.settings-help p {
    margin: 0 0 10px 0;
    color: #424242;
    line-height: 1.5;
}

.settings-help p:last-child {
    margin-bottom: 0;
}

/* Kunden-Übersicht */
.overview-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.overview-header h3 {
    margin: 0 0 15px 0;
    font-size: 1.3rem;
}

.overview-stats {
    display: flex;
    gap: 30px;
}

.stat-item {
    text-align: center;
}

.stat-number {
    display: block;
    font-size: 2rem;
    font-weight: bold;
    margin-bottom: 5px;
}

.stat-label {
    font-size: 0.9rem;
    opacity: 0.9;
}

.ai-summary {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    color: white;
}

.ai-summary h4 {
    margin: 0 0 15px 0;
    font-size: 1.2rem;
}

.summary-content {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    padding: 15px;
    line-height: 1.6;
    white-space: pre-wrap;
}

.summary-cost {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    font-size: 0.9rem;
    opacity: 0.9;
}

.tickets-list {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
}

.tickets-list h4 {
    margin: 0 0 20px 0;
    color: #495057;
}

.ticket-item {
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 15px;
    margin-bottom: 15px;
    transition: all 0.2s ease;
}

.ticket-item:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

.ticket-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
}

.ticket-title {
    font-weight: bold;
    color: #495057;
    margin: 0;
    flex: 1;
}

.ticket-title a:hover {
    color: #007bff !important;
    text-decoration: underline !important;
}

.ticket-meta a:hover {
    text-decoration: underline !important;
}

.ticket-meta {
    display: flex;
    gap: 15px;
    font-size: 0.9rem;
    color: #6c757d;
}

.ticket-status {
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: bold;
}

.ticket-status.open {
    background: #d4edda;
    color: #155724;
}

.ticket-status.closed {
    background: #f8d7da;
    color: #721c24;
}

.ticket-status.pending {
    background: #fff3cd;
    color: #856404;
}

.ticket-preview {
    color: #6c757d;
    font-size: 0.9rem;
    line-height: 1.4;
    margin-top: 10px;
}

/* Ticket List Container (für schnelle Ticket-Auswahl) */
.ticket-list-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ticket-list-item {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.ticket-list-item:hover {
    background: #f8f9fa;
    border-color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transform: translateX(4px);
}

.ticket-list-item h4 {
    margin: 0 0 8px 0;
    color: var(--text-primary);
    font-size: 1rem;
}

.ticket-list-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.ticket-list-status {
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
    background: var(--primary-light);
    color: var(--primary-color);
}

/* Autocomplete */
.autocomplete-wrapper {
    position: relative;
}

.suggestions-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #dee2e6;
    border-top: none;
    border-radius: 0 0 6px 6px;
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.suggestion-item {
    padding: 12px 15px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.2s ease;
}

.suggestion-item:last-child {
    border-bottom: none;
}

.suggestion-item:hover {
    background: #f8f9fa;
}

.suggestion-name {
    font-weight: bold;
    color: #495057;
    display: block;
    margin-bottom: 4px;
}

.suggestion-email {
    color: #6c757d;
    font-size: 0.9rem;
    display: block;
}

.suggestion-org {
    color: #007bff;
    font-size: 0.85rem;
    display: block;
    margin-top: 4px;
}

.selected-customer {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px;
    border-radius: 6px;
    margin-top: 10px;
}

.selected-customer-name {
    font-weight: bold;
    font-size: 1.1rem;
    margin-bottom: 5px;
}

.selected-customer-email {
    opacity: 0.9;
    font-size: 0.9rem;
}

.selected-customer-org {
    opacity: 0.9;
    font-size: 0.9rem;
    margin-top: 5px;
}

.selected-customer-remove {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
    margin-top: 10px;
    font-size: 0.9rem;
}

.selected-customer-remove:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Checkbox */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-weight: normal;
}

.checkbox-label input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

/* Alert */
.alert {
    position: fixed;
    top: 20px;
    right: 20px;
    max-width: 400px;
    padding: 20px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    display: flex;
    gap: 15px;
    align-items: flex-start;
    animation: slideIn 0.3s ease-out;
    z-index: 1000;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.alert-error {
    background: #fee2e2;
    border-left: 4px solid var(--danger-color);
    color: #991b1b;
}

.alert-icon {
    font-size: 1.5rem;
}

.alert-content {
    flex: 1;
}

.alert-content strong {
    display: block;
    margin-bottom: 5px;
}

.alert-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: inherit;
    opacity: 0.7;
}

.alert-close:hover {
    opacity: 1;
}

/* Settings Page Styles */
.settings-info {
    background: #dbeafe;
    padding: 15px;
    border-radius: var(--border-radius);
    margin-bottom: 25px;
    border-left: 4px solid var(--primary-color);
}

.settings-info p {
    margin: 0;
    color: #1e40af;
}

.form-hint {
    display: block;
    margin-top: 5px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.form-hint a {
    color: var(--primary-color);
    text-decoration: none;
}

.form-hint a:hover {
    text-decoration: underline;
}

.security-list {
    list-style: none;
    padding: 0;
    margin: 20px 0;
}

.security-list li {
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
}

.security-list li:last-child {
    border-bottom: none;
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

/* Success Alert */
.alert-success {
    background: #d1fae5;
    border-left: 4px solid var(--success-color);
    color: #065f46;
}

/* Responsive */
@media (max-width: 768px) {
    .header h1 {
        font-size: 1.8rem;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .form-inline {
        flex-direction: column;
        align-items: stretch;
    }

    .button-group {
        flex-direction: column;
    }

    .tabs {
        flex-direction: column;
    }

    .alert {
        left: 20px;
        right: 20px;
        max-width: none;
    }
}

/* ===== CHATBOT STYLES ===== */

/* Chat Container */
.chat-container {
    display: flex;
    flex-direction: column;
    height: 600px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    background: var(--surface);
    overflow: hidden;
}

/* Chat Messages */
.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: #f8fafc;
}

.chat-messages::-webkit-scrollbar {
    width: 6px;
}

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

.chat-messages::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Message Styles */
.message {
    display: flex;
    gap: 12px;
    max-width: 80%;
    animation: messageSlideIn 0.3s ease-out;
}

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

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

.bot-message {
    align-self: flex-start;
}

/* Message Avatar */
.message-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}

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

.bot-message .message-avatar {
    background: var(--success-color);
    color: white;
}

/* Message Content */
.message-content {
    flex: 1;
    min-width: 0;
}

.message-text {
    background: var(--surface);
    padding: 12px 16px;
    border-radius: 18px;
    box-shadow: var(--shadow-sm);
    word-wrap: break-word;
    white-space: pre-wrap;
    line-height: 1.5;
}

.user-message .message-text {
    background: var(--primary-color);
    color: white;
    border-bottom-right-radius: 4px;
}

.bot-message .message-text {
    background: var(--surface);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-bottom-left-radius: 4px;
}

.message-time {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 4px;
    text-align: right;
}

.user-message .message-time {
    text-align: left;
}

/* Chat Input */
.chat-input-container {
    border-top: 1px solid var(--border-color);
    background: var(--surface);
    padding: 16px;
}

.chat-input-wrapper {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    margin-bottom: 12px;
}

.chat-input {
    flex: 1;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 12px 16px;
    font-family: inherit;
    font-size: 0.9rem;
    resize: vertical;
    min-height: 44px;
    max-height: 120px;
    transition: border-color 0.2s ease;
}

.chat-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.chat-send-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    padding: 12px 20px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 100px;
    justify-content: center;
}

.chat-send-btn:hover:not(:disabled) {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.chat-send-btn:disabled {
    background: var(--secondary-color);
    cursor: not-allowed;
    transform: none;
}

/* Document Badge in Chat */
.document-badge {
    background: var(--secondary-color);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 12px 16px;
    margin: 8px 0;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.2s ease;
}

.document-badge:hover {
    background: #e5e5e5;
}

.document-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.document-info {
    flex: 1;
    min-width: 0;
}

.document-name {
    font-weight: 500;
    color: var(--text-color);
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.document-stats {
    font-size: 0.75rem;
    color: var(--secondary-text);
    display: flex;
    gap: 12px;
}

.document-stats span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.document-processing {
    opacity: 0.6;
    animation: pulse 1.5s ease-in-out infinite;
}

/* Chat Model Selector */
.chat-model-selector {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
}

.chat-model-selector .form-group {
    margin-bottom: 0;
}

.chat-model-selector label {
    font-weight: 600;
    color: #495057;
    margin-bottom: 8px;
    display: block;
}

.chat-model-selector select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ced4da;
    border-radius: 6px;
    font-size: 0.95rem;
    background: white;
    transition: border-color 0.2s ease;
}

.chat-model-selector select:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

.chat-model-selector .form-hint {
    margin-top: 6px;
    font-size: 0.85rem;
    color: #6c757d;
}

/* Help Section Styles */
.help-section {
    line-height: 1.8;
}

.help-section h4 {
    color: var(--primary-color);
    margin-top: 25px;
    margin-bottom: 15px;
    font-size: 1.15rem;
}

.help-list {
    margin: 15px 0;
    padding-left: 25px;
}

.help-list li {
    margin: 10px 0;
    line-height: 1.7;
}

.help-list li strong {
    color: var(--primary-color);
}

.help-list ul {
    margin-top: 10px;
}

.help-box {
    padding: 18px 22px;
    border-radius: var(--border-radius);
    margin: 20px 0;
    border-left: 4px solid;
    background: rgba(255, 255, 255, 0.5);
}

.help-box.info {
    border-left-color: var(--primary-color);
    background: var(--primary-light);
}

.help-box.success {
    border-left-color: var(--success-color);
    background: var(--success-light);
}

.help-box.warning {
    border-left-color: var(--warning-color);
    background: var(--warning-light);
}

.help-note {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin: 10px 0;
    padding-left: 15px;
    border-left: 3px solid var(--border-color);
}

.code-block {
    background: #1e293b;
    color: #e2e8f0;
    padding: 18px 22px;
    border-radius: var(--border-radius);
    overflow-x: auto;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9rem;
    line-height: 1.6;
    margin: 15px 0;
    border: 1px solid #334155;
}

code {
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary-color);
    padding: 3px 8px;
    border-radius: 4px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9em;
}

/* Chat Actions */
.chat-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success-color);
    animation: pulse 2s infinite;
}

.status-indicator.typing {
    background: var(--warning-color);
}

.status-indicator.error {
    background: var(--danger-color);
    animation: none;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px 16px;
    background: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: 18px;
    border-bottom-left-radius: 4px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.typing-dots {
    display: flex;
    gap: 2px;
}

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

.typing-dot:nth-child(1) { animation-delay: -0.32s; }
.typing-dot:nth-child(2) { animation-delay: -0.16s; }
.typing-dot:nth-child(3) { animation-delay: 0s; }

@keyframes typingDot {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Responsive Chat */
@media (max-width: 768px) {
    .chat-container {
        height: 500px;
    }
    
    .message {
        max-width: 90%;
    }
    
    .chat-input-wrapper {
        flex-direction: column;
        align-items: stretch;
    }
    
    .chat-send-btn {
        min-width: auto;
    }
    
    .chat-actions {
        flex-direction: column;
        gap: 8px;
        align-items: stretch;
    }
}

/* ========================================
   MODAL FÜR ÄHNLICHKEITS-SUCHE
   ======================================== */

.modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease-out;
}

.modal-content {
    background: white;
    border-radius: 16px;
    width: 90%;
    max-width: 600px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease-out;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px;
    border-bottom: 2px solid #f0f0f0;
}

.modal-header h2 {
    font-size: 1.5rem;
    color: #333;
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 2rem;
    color: #999;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: all 0.2s;
}

.modal-close:hover {
    background: #f0f0f0;
    color: #333;
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 20px 24px;
    border-top: 2px solid #f0f0f0;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

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

