/* AI Chat Styles */
/* Chat Container */
#chat-container {
    display: flex;
    flex-direction: column;
    height: 70vh; /* Erhöhte Höhe für bessere Nutzererfahrung */
    border: 1px solid #dee2e6;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
    position: relative;
    background-color: #f8f9fa;
    transition: all 0.3s ease;
}

/* Nachrichten-Bereich */
#chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background-color: #f8f9fa;
    background-image: url("data:image/svg+xml,%3Csvg width='100' height='100' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M11 18c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm48 25c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm-43-7c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zm63 31c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zM34 90c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zm56-76c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zM12 86c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm28-65c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm23-11c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm-6 60c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm29 22c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zM32 63c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm57-13c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm-9-21c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM60 91c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM35 41c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM12 60c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2z' fill='%23e0e0e0' fill-opacity='0.2' fill-rule='evenodd'/%3E%3C/svg%3E");
    scrollbar-width: thin;
}

/* Scrollbar Styling für Webkit-Browser */
#chat-messages::-webkit-scrollbar {
    width: 6px;
}

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

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

#chat-messages::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Message Styling */
.message {
    margin-bottom: 20px;
    padding: 12px 16px;
    border-radius: 18px;
    max-width: 85%;
    position: relative;
    word-wrap: break-word;
    animation: fadeIn 0.3s ease-out;
    line-height: 1.5;
}

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

.user-message {
    background-color: #0d6efd;
    color: white;
    margin-left: auto;
    margin-right: 10px;
    border-bottom-right-radius: 4px;
    box-shadow: 0 2px 5px rgba(13, 110, 253, 0.2);
    transition: transform 0.2s ease;
}

.user-message:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(13, 110, 253, 0.3);
}

.ai-message {
    background-color: white;
    border: 1px solid #e9ecef;
    margin-right: auto;
    margin-left: 10px;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: transform 0.2s ease;
}

.ai-message:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

/* Zeitstempel */
.message-time {
    font-size: 0.7rem;
    color: rgba(108, 117, 125, 0.7);
    margin-top: 5px;
    text-align: right;
}

.user-message .message-time {
    color: rgba(255, 255, 255, 0.8);
}

/* Absender-Avatare */
.message-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    position: absolute;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    color: white;
}

.ai-avatar {
    background-color: #6f42c1;
    left: -14px;
    bottom: -5px;
}

.user-avatar {
    background-color: #198754;
    right: -14px;
    bottom: -5px;
}

/* Markdown Styling für KI-Antworten */
.ai-message pre {
    background-color: #f7f7f7;
    padding: 14px;
    border-radius: 8px;
    overflow-x: auto;
    font-size: 0.9em;
    margin: 12px 0;
    border: 1px solid #e0e0e0;
    transition: background-color 0.2s ease;
    position: relative;
}

.ai-message pre:hover {
    background-color: #f0f0f0;
}

.ai-message pre::before {
    content: attr(data-language);
    display: block;
    position: absolute;
    top: 4px;
    right: 8px;
    font-size: 0.7em;
    color: #6c757d;
    background-color: rgba(255, 255, 255, 0.8);
    padding: 2px 6px;
    border-radius: 4px;
}

.ai-message code {
    background-color: #f7f7f7;
    padding: 2px 4px;
    border-radius: 3px;
    font-size: 0.9em;
    color: #d63384;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
}

.ai-message strong {
    font-weight: 600;
    color: #212529;
}

.ai-message em {
    font-style: italic;
    color: #495057;
}

.ai-message ul, .ai-message ol {
    padding-left: 20px;
    margin: 12px 0;
}

.ai-message a {
    color: #0d6efd;
    text-decoration: none;
    border-bottom: 1px dashed #0d6efd;
    transition: all 0.2s ease;
}

.ai-message a:hover {
    color: #0a58ca;
    border-bottom: 1px solid #0a58ca;
}

/* Chat Input Container */
#chat-input-container {
    display: flex;
    padding: 15px;
    background-color: white;
    border-top: 1px solid #e9ecef;
    align-items: flex-end;
}

#chat-input {
    flex-grow: 1;
    padding: 12px 15px;
    border: 1px solid #ced4da;
    border-radius: 24px;
    resize: none;
    overflow-y: auto;
    max-height: 120px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    transition: border-color 0.2s, box-shadow 0.2s;
    line-height: 1.5;
}

#chat-input:focus {
    border-color: #86b7fe;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
    outline: none;
}

#send-button {
    margin-left: 10px;
    border-radius: 50%;
    width: 42px;
    height: 42px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
}

#send-button:hover {
    transform: scale(1.05);
}

#send-button:active {
    transform: scale(0.95);
}

#send-button i {
    font-size: 1.1rem;
}

/* Action Buttons */
.chat-actions {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.chat-action-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.chat-action-btn:hover {
    transform: translateY(-2px);
}

/* Drag & Drop Styling */
.dropzone {
    border: 2px dashed #0d6efd;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    margin-bottom: 15px;
    background-color: rgba(13, 110, 253, 0.05);
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.dropzone:hover, .dropzone.active {
    background-color: rgba(13, 110, 253, 0.1);
}

.dz-message {
    color: #6c757d;
}

#file-upload-form {
    background-color: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 15px;
}

#upload-preview {
    margin: 10px 0;
}

.file-info {
    display: flex;
    align-items: center;
    padding: 10px;
    background-color: white;
    border-radius: 5px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.file-icon {
    font-size: 1.5rem;
    margin-right: 15px;
    color: #0d6efd;
}

.file-details .file-name {
    font-weight: 500;
    margin-bottom: 2px;
}

.file-details .file-size {
    font-size: 0.8rem;
    color: #6c757d;
}

/* Chat-Bereich Drag-and-Drop Overlay */
.chat-file-drop-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(13, 110, 253, 0.1);
    border: 3px dashed #0d6efd;
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 100;
    border-radius: 8px;
}

.chat-file-drop-overlay.active {
    display: flex;
    animation: pulse 1.5s infinite ease-in-out;
}

@keyframes pulse {
    0% { background-color: rgba(13, 110, 253, 0.1); }
    50% { background-color: rgba(13, 110, 253, 0.2); }
    100% { background-color: rgba(13, 110, 253, 0.1); }
}

.chat-file-drop-message {
    background-color: white;
    padding: 15px 25px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Lade-Indikator */
#typing-indicator {
    display: none;
    padding: 10px 15px;
    margin: 0 0 15px 15px;
    color: #6c757d;
    font-style: italic;
    background-color: white;
    border-radius: 18px;
    max-width: fit-content;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    animation: fadeIn 0.3s ease-out;
}

.typing-animation {
    display: inline-flex;
    align-items: center;
    column-gap: 5px;
    margin-left: 5px;
}

.typing-dot {
    width: 6px;
    height: 6px;
    background-color: #6c757d;
    border-radius: 50%;
    animation: typingAnimation 1.2s infinite ease-in-out;
}

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

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

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

@keyframes typingAnimation {
    0%, 100% { transform: translateY(0); opacity: 0.5; }
    50% { transform: translateY(-4px); opacity: 1; }
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    #chat-container {
        height: 60vh;
    }
    
    .message {
        max-width: 90%;
    }
    
    .chat-action-btn {
        padding: 6px 10px;
        font-size: 0.8rem;
    }
}

/* Dark Mode Support (optional) */
@media (prefers-color-scheme: dark) {
    #chat-container {
        background-color: #212529;
        border-color: #343a40;
    }
    
    #chat-messages {
        background-color: #212529;
    }
    
    .ai-message {
        background-color: #343a40;
        border-color: #495057;
        color: #e9ecef;
    }
    
    #chat-input-container {
        background-color: #2b3035;
        border-top-color: #343a40;
    }
    
    #chat-input {
        background-color: #343a40;
        border-color: #495057;
        color: #e9ecef;
    }
    
    #chat-input:focus {
        border-color: #0d6efd;
    }
    
    .ai-message pre, .ai-message code {
        background-color: #2b3035;
        border-color: #495057;
        color: #e9ecef;
    }
    
    #typing-indicator {
        background-color: #343a40;
        color: #e9ecef;
    }
    
    .typing-dot {
        background-color: #adb5bd;
    }
}
