/* chat.css */
#lac_chat { 
    /* WICHTIG: Hier werden die Variablen aus dem Admin-Bereich genutzt */
    background: var(--lac-bg-color, #FFFFFF);
    border: 1px solid #ccc; 
    padding: 10px; 
    width: 300px; 
    max-width: 100%; 
    font-family: sans-serif; 
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    border-radius: 8px;
}

#lac_input {
    width: 100%;
    height: 50px;
    margin-bottom: 5px;
    padding:5px;
    background: var(--lac-input-bg-color, #8c00ffff);
}

#lac_output { 
    height: 200px; 
    overflow-y: auto; 
    /*border: 1px solid #ddd;*/
    padding: 5px; 
    margin-bottom: 5px; 
    background: var(--lac-output-bg-color, #000000ff);

}

/* Variablen für die Textfarben */
.lac_user { color: var(--lac-user-color, blue); margin-bottom: 5px; }
.lac_ai { color: var(--lac-ai-color, green); margin-bottom: 5px; }

#lac_send { display: block; width: 100%; padding:5px; }
.lac_spinner { color: orange; font-style: italic; margin-bottom: 5px; }

.lac_metrics {
    font-size: 0.75em;
    color: #666;
    margin-bottom: 5px;
    padding: 2px 5px;
    background: #eef;
    border-radius: 3px;
    text-align: right;
}
#lac_version {
    font-size: 0.7em;
    color: #999;
    text-align: right;
    margin-top: 5px;
}

/* --- Floating Widget Modus --- */
.floating_right {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    border-radius: 8px;
    max-height: calc(100vh - 40px);
}

.floating_right #lac_chat {
    width: 320px;
    max-width: 100%;
    border: none;
    padding: 0;
    border-radius: 8px;
    overflow: hidden;
}

/* Sichert, dass Padding und Border zur Breite gehören, NICHT hinzugefügt werden. */
@media screen and (max-width: 600px) {
    .floating_right, 
    .floating_right #lac_chat, 
    .floating_right #lac_chat * {
    box-sizing: border-box !important;
    }
}

/* Flexbox für das Chat-Fenster: 
   Sorgt dafür, dass Header, Output und Input vertikal angeordnet sind */
@media screen and (max-width: 600px) {
   .floating_right #lac_chat {
    display: flex !important;
    flex-direction: column !important;
    height: 100% !important; /* Wichtig: Füllt den Container */
    }
}

/* Das Output-Fenster (der Chat-Verlauf) MUSS den freien Platz einnehmen */
@media screen and (max-width: 600px) {
    .floating_right #lac_output {
    flex-grow: 1 !important;        /* Wächst und nimmt den gesamten verfügbaren Raum ein */
    height: auto !important;        /* Überschreibt die starre 200px Höhe aus der Basis-CSS */
    max-height: none !important;    /* Keine maximale Höhe */
    }
}

@media screen and (max-width: 600px) {
    
    .floating_right {
        width: 80vw !important;
        max-width: 80vw !important;
        left: 10vw !important;
        right: 10vw!important;
        bottom: 80px !important;
        /* Höhe fixieren (wichtig, um den Leerraum unten zu vermeiden) */
        height: auto !important; 
        border-radius: 10px !important;
        box-shadow: 0 4px 12px rgba(0,0,0,0.15) !important;
    }

    /* 2. Innerer Chat-Container */
    .floating_right #lac_chat {
        /* Übernimmt die volle Größe des Elternelements */
        width: 100% !important;
        height: 100% !important;
        border: none !important;
        padding: 10px !important; /* Hier kannst du den Innenabstand festlegen */
        border-radius: 0 !important;
        
        /* Stellt sicher, dass das 400px Limit im Basis-CSS nicht greift */
        max-width: 100% !important; 
    }
    
    /* 3. Eingabefelder: Für Touch-Bedienung optimieren */
    #lac_input {
        min-height: 50px;
        font-size: 16px !important; /* WICHTIG: Verhindert automatisches Zoom-In auf iPhones */
    }
}