/* Autoscroll für den Chat: #eliot-chat-messages */
#eliot-chat-messages {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
    overflow-y: auto;
    min-height: 200px;
    max-height: 400px;
    scroll-behavior: smooth;
    padding: 20px;
}

/* Make the overall chat box a column with limited height so inner scrolling is used */
#eliot-chat {
    display: flex;
    flex-direction: column;
    /* Responsive height: use viewport but cap it */
    height: min(60vh, 720px);
    max-height: 720px;
}

#eliot-chat-body {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0; /* important for flex children to allow scrolling */
    overflow: hidden;
}

#eliot-chat-input-bar {
    flex: 0 0 auto;
}

/* Header innerhalb einer eliot-chat-message */
.eliot-chat-message .message-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    margin-bottom: 6px;
    color: #667eea;
    font-size: 0.9em;
}
.eliot-chat-message .author-emoji { font-size: 1.0em; }
.eliot-chat-message .author-name { opacity: 0.9; }
.eliot-chat-message.eliot-chat-user .message-header { justify-content: flex-end; color: white; }
.eliot-chat-message.eliot-chat-user .author-emoji { margin-left: 8px; }
.eliot-chat-message.eliot-chat-user .author-name { margin-right: 6px; }
.eliot-chat-message.eliot-chat-user .message-header { color: white; }
.eliot-chat-message.eliot-chat-bot .message-header { color: #2c3e50; }

/* Bubble styles for new chat markup */
.eliot-chat-message {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    max-width: 85%;
    width: fit-content;
}
.eliot-chat-message.eliot-chat-user {
    align-self: flex-end;
    align-items: flex-end;
}
.chat-bubble {
    padding: 12px 16px;
    border-radius: 14px;
    box-shadow: 0 6px 18px rgba(0,0,0,0.06);
    word-break: break-word;
    line-height: 1.4;
}
.chat-bubble-bot {
    background: #f0f2f5;
    color: #222;
    border-bottom-left-radius: 6px;
}
.chat-bubble-user {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-bottom-right-radius: 6px;
}
.chat-bubble-typing { background: transparent; box-shadow: none; padding: 6px 10px; }
.typing-dots span { display: inline-block; margin: 0 2px; color: #667eea; font-weight: 700; animation: blink 1s infinite; }
/*
============================================================
  PDF Allrounder - SEP Interactive (Simon Erich Plath)
  Made with ❤️ for Steffi
  Copyright © 2025 - All Rights Reserved
============================================================

  🤖 Eliot der kleine - Styles
============================================================
*/

/* Container */
.eliot-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - 60px);
}

/* Header mit Avatar */
.eliot-header {
    display: flex;
    align-items: center;
    gap: 25px;
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 20px;
    color: white;
    margin-bottom: 20px;
    box-shadow: 0 10px 40px rgba(102, 126, 234, 0.3);
}

/* Animierter Avatar */
.eliot-avatar {
    width: 100px;
    height: 100px;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 5px 20px rgba(0,0,0,0.2);
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.avatar-face {
    width: 80px;
    height: 80px;
    position: relative;
}

.eye {
    width: 16px;
    height: 20px;
    background: #333;
    border-radius: 50%;
    position: absolute;
    top: 20px;
    animation: blink 4s infinite;
}

.eye.left { left: 15px; }
.eye.right { right: 15px; }

.eye::after {
    content: '';
    width: 6px;
    height: 6px;
    background: white;
    border-radius: 50%;
    position: absolute;
    top: 4px;
    left: 3px;
}

@keyframes blink {
    0%, 96%, 100% { transform: scaleY(1); }
    98% { transform: scaleY(0.1); }
}

.mouth {
    width: 30px;
    height: 15px;
    border: 4px solid #333;
    border-top: none;
    border-radius: 0 0 30px 30px;
    position: absolute;
    bottom: 15px;
    left: 50%;
    transform: translateX(-50%);
    animation: talk 2s ease-in-out infinite;
}

@keyframes talk {
    0%, 100% { height: 15px; }
    50% { height: 12px; }
}

.eliot-intro h1 {
    margin: 0 0 8px 0;
    font-size: 1.8em;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
}

.eliot-intro .subtitle {
    margin: 0 0 5px 0;
    opacity: 0.9;
    font-size: 1.1em;
}

.eliot-intro .hint {
    margin: 0;
    opacity: 0.8;
    font-size: 0.95em;
}

/* Chat Container */
.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: white;
    border-radius: 20px;
    box-shadow: 0 5px 30px rgba(0,0,0,0.1);
    overflow: hidden;
}

.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    min-height: 400px;
    max-height: 500px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* Nachrichten */
.message {
    max-width: 80%;
    padding: 15px 20px;
    border-radius: 20px;
    animation: messageIn 0.3s ease-out;
    line-height: 1.5;
}

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

.message.user {
    align-self: flex-end;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-bottom-right-radius: 5px;
}

.message.eliot {
    align-self: flex-start;
    background: #f0f2f5;
    color: #333;
    border-bottom-left-radius: 5px;
}

.message.eliot .message-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    font-weight: 600;
    color: #667eea;
}

.message.eliot .message-content {
    white-space: pre-wrap;
}

.message.eliot .message-content a {
    color: #667eea;
    text-decoration: underline;
}

.message.eliot .feedback-prompt {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid rgba(0,0,0,0.1);
    font-size: 0.85em;
    color: #666;
}

.message.eliot .feedback-prompt button {
    background: none;
    border: 1px solid #ddd;
    padding: 5px 12px;
    border-radius: 15px;
    cursor: pointer;
    margin-left: 8px;
    transition: all 0.2s;
}

.message.eliot .feedback-prompt button:hover {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 5px;
    padding: 15px 20px;
    background: #f0f2f5;
    border-radius: 20px;
    width: fit-content;
}

.typing-indicator span {
    width: 10px;
    height: 10px;
    background: #667eea;
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

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

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

/* Schnellaktionen */
.quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 15px 20px;
    background: #f8f9fa;
    border-top: 1px solid #eee;
}

.quick-btn {
    padding: 10px 18px;
    background: white;
    border: 2px solid #667eea;
    border-radius: 25px;
    color: #667eea;
    font-size: 0.9em;
    cursor: pointer;
    transition: all 0.2s;
}

.quick-btn:hover {
    background: #667eea;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3);
}

/* Eingabebereich */
.chat-input-area {
    padding: 20px;
    background: #f8f9fa;
    border-top: 1px solid #eee;
}

.input-wrapper {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

.input-wrapper textarea {
    flex: 1;
    padding: 15px 20px;
    border: 2px solid #e0e0e0;
    border-radius: 25px;
    font-size: 1em;
    resize: none;
    min-height: 50px;
    max-height: 150px;
    transition: border-color 0.2s;
    font-family: inherit;
}

.input-wrapper textarea:focus {
    outline: none;
    border-color: #667eea;
}

.btn-send {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 1.3em;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-send:hover {
    transform: scale(1.1);
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
}

.btn-send:active {
    transform: scale(0.95);
}

.input-hints {
    margin-top: 10px;
    font-size: 0.85em;
    color: #888;
    text-align: center;
}

/* Footer */
.eliot-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    margin-top: 20px;
    background: white;
    border-radius: 15px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.eliot-footer .footer-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #888;
    font-size: 0.85em;
}

.eliot-footer .footer-logo {
    height: 98px;
    width: auto;
    opacity: 0.7;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #666;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #ccc;
}

.status-dot.online {
    background: #4caf50;
    box-shadow: 0 0 10px rgba(76, 175, 80, 0.5);
    animation: pulse 2s infinite;
}

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

.learn-stats {
    font-size: 0.9em;
    color: #888;
}

/* Feedback Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-overlay.active {
    display: flex;
}

.feedback-modal {
    background: white;
    border-radius: 20px;
    width: 90%;
    max-width: 450px;
    overflow: hidden;
    animation: modalIn 0.3s ease-out;
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.feedback-modal .modal-header {
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.feedback-modal .modal-header h3 {
    margin: 0;
}

.feedback-modal .modal-close {
    background: none;
    border: none;
    color: white;
    font-size: 1.5em;
    cursor: pointer;
    opacity: 0.8;
}

.feedback-modal .modal-close:hover {
    opacity: 1;
}

.feedback-modal .modal-body {
    padding: 25px;
}

.feedback-modal .modal-body p {
    margin: 0 0 20px 0;
    font-size: 1.1em;
    text-align: center;
}

.feedback-options {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.feedback-btn {
    padding: 15px 30px;
    border: none;
    border-radius: 15px;
    font-size: 1.1em;
    cursor: pointer;
    transition: all 0.2s;
}

.feedback-btn.positive {
    background: #e8f5e9;
    color: #4caf50;
}

.feedback-btn.positive:hover {
    background: #4caf50;
    color: white;
    transform: scale(1.05);
}

.feedback-btn.negative {
    background: #ffebee;
    color: #f44336;
}

.feedback-btn.negative:hover {
    background: #f44336;
    color: white;
    transform: scale(1.05);
}

.correction-area {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.correction-area label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    color: #333;
}

.correction-area textarea {
    width: 100%;
    padding: 15px;
    border: 2px solid #e0e0e0;
    border-radius: 15px;
    min-height: 100px;
    resize: vertical;
    margin-bottom: 15px;
    font-family: inherit;
}

.correction-area textarea:focus {
    outline: none;
    border-color: #667eea;
}

/* Spezielle Nachrichten-Elemente */
.message-link-list {
    margin: 10px 0;
    padding-left: 0;
    list-style: none;
}

.message-link-list li {
    padding: 8px 0;
    border-bottom: 1px solid rgba(0,0,0,0.05);
}

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

.message-link-list a {
    color: #667eea;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
}

.message-link-list a:hover {
    text-decoration: underline;
}

/* Search Result Styling */
.search-suggestion {
    background: #e8f4f8;
    padding: 12px 15px;
    border-radius: 12px;
    margin-top: 10px;
    border-left: 4px solid #667eea;
}

.search-suggestion a {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #667eea;
    font-weight: 600;
}

/* Responsive */
@media (max-width: 768px) {
    .eliot-header {
        flex-direction: column;
        text-align: center;
    }
    
    .eliot-avatar {
        width: 80px;
        height: 80px;
    }
    
    .avatar-face {
        width: 65px;
        height: 65px;
    }
    
    .eye {
        width: 12px;
        height: 15px;
        top: 15px;
    }
    
    .eye.left { left: 12px; }
    .eye.right { right: 12px; }
    
    .mouth {
        width: 24px;
        height: 12px;
        bottom: 12px;
    }
    
    .quick-actions {
        justify-content: center;
    }
    
    .quick-btn {
        font-size: 0.85em;
        padding: 8px 14px;
    }
    
    .message {
        max-width: 90%;
    }
    
    .eliot-footer {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    body {
        background: #1a1a2e;
    }
    
    .chat-container {
        background: #16213e;
    }
    
    .chat-messages {
        background: #16213e;
    }
    
    .message.eliot {
        background: #1f2b47;
        color: #e0e0e0;
    }
    
    .quick-actions {
        background: #1a1a2e;
        border-color: #2a2a4a;
    }
    
    .quick-btn {
        background: #1f2b47;
        border-color: #667eea;
    }
    
    .chat-input-area {
        background: #1a1a2e;
        border-color: #2a2a4a;
    }
    
    .input-wrapper textarea {
        background: #1f2b47;
        border-color: #2a2a4a;
        color: white;
    }
    
    .eliot-footer {
        background: #16213e;
    }
    
    .feedback-modal {
        background: #16213e;
    }
    
    .feedback-modal .modal-body {
        color: #e0e0e0;
    }
}

/* ========================================================
   IMAGE LEARNING MODAL
   ======================================================== */

.image-learn-modal {
    background: white;
    border-radius: 20px;
    max-width: 800px;
    width: 95%;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.image-learn-modal .modal-header {
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.image-learn-modal .modal-header h3 {
    margin: 0;
}

.image-learn-modal .modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.modal-info {
    color: #666;
    margin-bottom: 20px;
    font-size: 14px;
}

.image-upload-area {
    border: 3px dashed #667eea;
    border-radius: 15px;
    padding: 40px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #f8f9ff;
}

.image-upload-area:hover {
    background: #e8ebff;
    border-color: #4c5ed9;
}

.image-upload-area .upload-icon {
    font-size: 48px;
    margin-bottom: 10px;
}

.image-canvas-container {
    margin-top: 20px;
    max-width: 100%;
}

.zoom-toolbar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 10px 15px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 10px 10px 0 0;
    margin-bottom: 0;
}

.zoom-btn {
    padding: 8px 14px;
    border: none;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.2s;
}

.zoom-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

.zoom-level {
    color: white;
    font-weight: bold;
    min-width: 50px;
    text-align: center;
    font-size: 14px;
}

.canvas-scroll-area {
    overflow: auto;
    max-height: 450px;
    border: 2px solid #667eea;
    border-top: none;
    border-radius: 0 0 10px 10px;
    background: #f0f0f0;
    position: relative;
}

#imageCanvas {
    cursor: crosshair;
    display: block;
    background: white;
    /* Größe wird dynamisch per JS gesetzt */
}

.canvas-toolbar {
    display: flex;
    gap: 10px;
    padding: 15px;
    background: #f5f5f5;
    border-radius: 10px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.tool-btn {
    padding: 8px 16px;
    border: 2px solid #667eea;
    background: white;
    color: #667eea;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.tool-btn:hover {
    background: #667eea;
    color: white;
}

.tool-btn.active {
    background: #667eea;
    color: white;
}

.tool-btn.danger {
    border-color: #e74c3c;
    color: #e74c3c;
}

.tool-btn.danger:hover {
    background: #e74c3c;
    color: white;
}

.marker-list {
    margin-top: 15px;
    padding: 15px;
    background: #fafafa;
    border-radius: 10px;
    min-height: 60px;
}

.marker-hint {
    color: #999;
    font-size: 13px;
    text-align: center;
    margin: 0;
}

.marker-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: white;
    border-radius: 8px;
    margin-bottom: 8px;
    border: 1px solid #eee;
}

.marker-item .marker-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.marker-item .marker-color {
    width: 20px;
    height: 20px;
    border-radius: 4px;
}

.marker-item .marker-remove {
    background: none;
    border: none;
    color: #e74c3c;
    cursor: pointer;
    font-size: 16px;
}

.learn-description {
    margin-top: 20px;
    padding: 20px;
    background: #e8f5e9;
    border-radius: 10px;
}

.learn-description label {
    display: block;
    font-weight: 600;
    color: #2e7d32;
    margin-bottom: 10px;
}

.learn-description textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid #a5d6a7;
    border-radius: 8px;
    font-family: inherit;
    font-size: 14px;
    min-height: 80px;
    resize: vertical;
}

.description-type {
    margin-top: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.description-type label {
    margin: 0;
    font-weight: 500;
    color: #333;
}

.description-type select {
    padding: 8px 12px;
    border: 2px solid #667eea;
    border-radius: 8px;
    font-size: 14px;
    background: white;
}

.learn-description button {
    margin-top: 15px;
    width: 100%;
    padding: 12px;
    font-size: 16px;
}

/* Dark Mode für Image Learn Modal */
@media (prefers-color-scheme: dark) {
    .image-learn-modal {
        background: #1a1a2e;
    }
    
    .modal-info {
        color: #aaa;
    }
    
    .image-upload-area {
        background: #1f2b47;
        border-color: #667eea;
    }
    
    .image-upload-area:hover {
        background: #2a3a5a;
    }
    
    .image-upload-area p {
        color: #e0e0e0;
    }
    
    #imageCanvas {
        border-color: #3a3a5a;
    }
    
    .canvas-toolbar {
        background: #1f2b47;
    }
    
    .marker-list {
        background: #1f2b47;
    }
    
    .marker-item {
        background: #2a3a5a;
        border-color: #3a3a5a;
    }
    
    .learn-description {
        background: #1f3d2a;
    }
    
    .learn-description label {
        color: #81c784;
    }
    
    .learn-description textarea {
        background: #1a1a2e;
        border-color: #4caf50;
        color: #e0e0e0;
    }
    
    .description-type label {
        color: #e0e0e0;
    }
    
    .description-type select {
        background: #1a1a2e;
        color: #e0e0e0;
        border-color: #667eea;
    }
}

/* ========================================================
   QUICK ACTIONS UPDATE - Bild-Lernen Button
   ======================================================== */

.quick-btn[data-action="bildlernen"] {
    background: linear-gradient(135deg, #81c784 0%, #4caf50 100%);
    color: white;
    border-color: #4caf50;
}

.quick-btn[data-action="bildlernen"]:hover {
    background: linear-gradient(135deg, #66bb6a 0%, #43a047 100%);
}

/* ========================================================
   ATTACHMENT PREVIEW - ChatGPT Style
   ======================================================== */

.attachment-preview {
    padding: 12px 20px;
    border-bottom: 1px solid #e0e0e0;
    background: #f9fafb;
}

.attachment-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: white;
    border: 1px solid #d1d5db;
    border-radius: 12px;
    transition: all 0.2s;
}

.attachment-card:hover {
    border-color: #667eea;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.1);
}

.attachment-icon {
    font-size: 24px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f0f2f5;
    border-radius: 8px;
    flex-shrink: 0;
}

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

.attachment-name {
    font-weight: 500;
    font-size: 0.95em;
    color: #1a1a2e;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.attachment-size {
    font-size: 0.85em;
    color: #6b7280;
    margin-top: 2px;
}

.attachment-remove {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: none;
    background: #f3f4f6;
    color: #6b7280;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: all 0.2s;
    flex-shrink: 0;
}

.attachment-remove:hover {
    background: #fee2e2;
    color: #dc2626;
}

