* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: #343541;
    color: #ffffff;
    height: 100vh;
    height: 100dvh; /* Dynamic viewport height für mobile */
    overflow: hidden;
    position: fixed; /* Verhindert Scrollen des Body */
    width: 100%;
}

.chat-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh; /* Dynamic viewport height für mobile */
    max-width: 768px;
    margin: 0 auto;
    background-color: #343541;
}

.chat-header {
    padding: 20px;
    border-bottom: 1px solid #4d4d4f;
    background-color: #40414f;
    text-align: center;
}

.chat-header h1 {
    font-size: 24px;
    font-weight: 600;
    color: #ffffff;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    -webkit-overflow-scrolling: touch; /* Smooth scrolling auf iOS */
}

.message {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.user-message {
    justify-content: flex-end;
}

.assistant-message {
    justify-content: flex-start;
}

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
    background-color: #10a37f;
    overflow: hidden;
}

.avatar-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.user-message .message-avatar {
    background-color: #5436da;
}

.message-content {
    max-width: 70%;
    padding: 12px 16px;
    border-radius: 18px;
    background-color: #40414f;
    word-wrap: break-word;
    line-height: 1.5;
}

.user-message .message-content {
    background-color: #5436da;
}

.message-content p {
    margin: 0;
    white-space: pre-wrap;
}

.chat-input-container {
    padding: 20px;
    border-top: 1px solid #4d4d4f;
    background-color: #343541;
}

.chat-input-wrapper {
    position: relative;
    display: flex;
    align-items: flex-end;
    background-color: #40414f;
    border-radius: 24px;
    padding: 12px 16px;
    border: 1px solid #4d4d4f;
    transition: border-color 0.2s;
}

.chat-input-wrapper:focus-within {
    border-color: #10a37f;
}

#messageInput {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    color: #ffffff;
    font-size: 16px;
    line-height: 1.5;
    resize: none;
    min-height: 24px;
    max-height: 120px;
    font-family: inherit;
}

#messageInput::placeholder {
    color: #8e8ea0;
}

.send-button {
    background-color: #10a37f;
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s;
    margin-left: 8px;
    color: #ffffff;
}

.image-upload-button {
    background-color: #4d4d4f;
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s;
    margin-left: 8px;
    color: #ffffff;
    font-size: 16px;
}

.image-upload-button:hover {
    background-color: #6d6d6f;
}

.image-preview {
    max-width: 200px;
    max-height: 200px;
    border-radius: 8px;
    margin: 8px 0;
    object-fit: cover;
}

.structured-list {
    background-color: #2d2d30;
    border-radius: 8px;
    padding: 16px;
    margin: 12px 0;
    border-left: 4px solid #10a37f;
}

.structured-list h4 {
    color: #10a37f;
    margin-bottom: 12px;
    font-size: 16px;
}

.structured-list ul {
    margin: 0;
    padding-left: 20px;
}

.structured-list li {
    margin-bottom: 6px;
    line-height: 1.4;
}

.priority-high {
    color: #ff6b6b;
    font-weight: 600;
}

.priority-medium {
    color: #ffd93d;
    font-weight: 500;
}

.priority-low {
    color: #6bcf7f;
}

.send-button:hover:not(:disabled) {
    background-color: #0d8a6b;
}

.send-button:disabled {
    background-color: #4d4d4f;
    cursor: not-allowed;
}

.loading-indicator {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    background-color: #40414f;
    padding: 12px 20px;
    border-radius: 18px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.loading-dots {
    display: flex;
    gap: 4px;
    align-items: center;
}

.loading-dots span {
    width: 8px;
    height: 8px;
    background-color: #10a37f;
    border-radius: 50%;
    animation: loading-bounce 1.4s ease-in-out infinite both;
}

.loading-dots span:nth-child(1) {
    animation-delay: -0.32s;
}

.loading-dots span:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes loading-bounce {
    0%, 80%, 100% {
        transform: scale(0);
    }
    40% {
        transform: scale(1);
    }
}

/* Scrollbar Styling */
.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: #4d4d4f;
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #6d6d6f;
}

/* Responsive Design */
@media (max-width: 768px) {
    body {
        height: 100vh;
        height: 100dvh;
        position: fixed;
        width: 100%;
        overflow: hidden;
    }
    
    .chat-container {
        max-width: 100%;
        height: 100vh;
        height: 100dvh;
        position: relative;
    }
    
    .message-content {
        max-width: 85%;
    }
    
    .chat-header {
        padding: 16px;
        padding-top: max(16px, env(safe-area-inset-top));
        flex-shrink: 0;
    }
    
    .chat-messages {
        padding: 16px;
        flex: 1;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        min-height: 0; /* Wichtig für Flexbox */
    }
    
    .chat-input-container {
        padding: 16px;
        padding-bottom: max(16px, env(safe-area-inset-bottom));
        flex-shrink: 0;
        position: sticky;
        bottom: 0;
        background-color: #343541;
        border-top: 1px solid #4d4d4f;
    }
    
    /* Input-Focus Verhalten */
    #messageInput:focus {
        transform: translateY(0);
    }
    
    /* Fallback für ältere Browser ohne dvh support */
    @supports not (height: 100dvh) {
        body {
            height: calc(100vh - 60px);
        }
        
        .chat-container {
            height: calc(100vh - 60px);
        }
    }
}
