﻿/* ========================================================================== */
/* 4Offerten KI-Assistent                                                     */
/* Modernes Chatfenster für Desktop und mobile Geräte                         */
/* ========================================================================== */


/* -------------------------------------------------------------------------- */
/* Hauptcontainer des KI-Assistenten                                          */
/* -------------------------------------------------------------------------- */

.ai-chat {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 9999;
    font-family: inherit;
}


/* -------------------------------------------------------------------------- */
/* Runde Schaltfläche zum Öffnen des Chats                                    */
/* -------------------------------------------------------------------------- */

.ai-chat-toggle {
    min-height: 62px;
    padding: 0;
    border: 0;
    background: transparent;
    color: #ffffff;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    margin-left: auto;
    filter: drop-shadow(0 8px 18px rgba(0, 0, 0, 0.20));
    transition: transform 0.2s ease, filter 0.2s ease;
}

.ai-chat-toggle-text {
    min-height: 58px;
    padding: 8px 27px 8px 18px;
    margin-right: -17px;
    border-radius: 18px 0 0 18px;
    background: linear-gradient(135deg, #0b7285, #008080);
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    line-height: 1.15;
    white-space: nowrap;
}

.ai-chat-toggle-text strong {
    font-size: 16px;
    font-weight: 700;
}

.ai-chat-toggle-text > span {
    margin-top: 3px;
    font-size: 13px;
    font-weight: 500;
    opacity: 0.95;
}

.ai-chat-toggle-icon {
    position: relative;
    z-index: 1;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0b7285, #008080);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 25px;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.18);
}

.ai-chat-toggle:hover {
    transform: translateY(-2px);
    filter: drop-shadow(0 10px 22px rgba(0, 0, 0, 0.26));
}

.ai-chat-toggle:focus-visible {
    outline: 3px solid rgba(0, 128, 128, 0.25);
    outline-offset: 4px;
}


/* -------------------------------------------------------------------------- */
/* Chatfenster                                                                */
/* -------------------------------------------------------------------------- */

.ai-chat-panel {
    /* Grössere Desktop-Abmessungen für eine ruhigere und besser lesbare Unterhaltung. */
    width: 460px;
    height: 650px;
    max-height: calc(100vh - 120px);
    margin-bottom: 14px;
    background: #ffffff;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.22);
    border: 1px solid rgba(0, 0, 0, 0.08);
}

    .ai-chat-panel:not([hidden]) {
        display: flex;
        flex-direction: column;
    }


/* -------------------------------------------------------------------------- */
/* Kopfbereich des Chatfensters                                               */
/* -------------------------------------------------------------------------- */

.ai-chat-header {
    min-height: 82px;
    padding: 12px 16px;
    background: linear-gradient(135deg, #0b7285, #008080);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.ai-chat-header-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

/* Das transparente AI-Logo wird direkt auf dem Header angezeigt. */
.ai-chat-header-logo-wrap {
    width: 145px;
    min-width: 145px;
    height: 48px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: flex-start;
}

.ai-chat-header-logo {
    display: block;
    max-width: 100%;
    max-height: 45px;
    width: auto;
    height: auto;
}

.ai-chat-header-text {
    display: flex;
    flex-direction: column;
    line-height: 1.25;
}

    .ai-chat-header-text strong {
        font-size: 19px;
        font-weight: 700;
    }

        .ai-chat-header-text strong::after {
            content: "Online";
            display: block;
            margin-top: 4px;
            font-size: 13px;
            font-weight: 400;
            opacity: 0.85;
        }


/* -------------------------------------------------------------------------- */
/* Aktionen im Kopfbereich: neue Unterhaltung und Chat schliessen              */
/* -------------------------------------------------------------------------- */

.ai-chat-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.ai-chat-reset {
    min-height: 38px;
    padding: 0 11px;
    border: 0;
    border-radius: 19px;
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    transition: background-color 0.2s ease, opacity 0.2s ease;
}

.ai-chat-reset:hover {
    background: rgba(255, 255, 255, 0.22);
}

.ai-chat-reset:disabled {
    cursor: wait;
    opacity: 0.55;
}

/* -------------------------------------------------------------------------- */
/* Schaltfläche zum Schliessen des Chatfensters                               */
/* -------------------------------------------------------------------------- */

.ai-chat-close {
    width: 38px;
    height: 38px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: background-color 0.2s ease;
}

    .ai-chat-close:hover {
        background: rgba(255, 255, 255, 0.22);
    }


/* -------------------------------------------------------------------------- */
/* Nachrichtenbereich                                                         */
/* -------------------------------------------------------------------------- */

.ai-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 22px 18px;
    background: #f7f9fa;
    scroll-behavior: smooth;
}


/* -------------------------------------------------------------------------- */
/* Allgemeine Darstellung einer Chatnachricht                                 */
/* Diese Klassen werden später über JavaScript erzeugt.                       */
/* -------------------------------------------------------------------------- */

.ai-chat-message {
    display: flex;
    width: 100%;
    margin-bottom: 14px;
}

.ai-chat-message-user {
    justify-content: flex-end;
}

.ai-chat-message-assistant {
    justify-content: flex-start;
}

.ai-chat-message-bubble {
    max-width: 86%;
    padding: 13px 16px;
    border-radius: 16px;
    /* 17 Pixel sind auf Desktop deutlich angenehmer, besonders für ältere Besucher. */
    font-size: 17px;
    line-height: 1.55;
    word-break: break-word;
}


/* -------------------------------------------------------------------------- */
/* Nachricht des Besuchers                                                    */
/* -------------------------------------------------------------------------- */

.ai-chat-message-user .ai-chat-message-bubble {
    background: #008080;
    color: #ffffff;
    border-bottom-right-radius: 5px;
}


/* -------------------------------------------------------------------------- */
/* Nachricht des KI-Assistenten                                               */
/* -------------------------------------------------------------------------- */

.ai-chat-message-assistant .ai-chat-message-bubble {
    background: #ffffff;
    color: #333333;
    border: 1px solid #e6eaed;
    border-bottom-left-radius: 5px;
    box-shadow: 0 2px 7px rgba(0, 0, 0, 0.05);
}


/* -------------------------------------------------------------------------- */
/* Anzeige während der KI-Assistent eine Antwort erstellt                     */
/* -------------------------------------------------------------------------- */

.ai-chat-typing {
    padding: 7px 18px;
    background: #f7f9fa;
    color: #7a7a7a;
    font-size: 16px;
    font-style: italic;
    flex-shrink: 0;
}


/* -------------------------------------------------------------------------- */
/* Eingabebereich am unteren Rand des Chatfensters                            */
/* -------------------------------------------------------------------------- */

.ai-chat-form {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px;
    background: #ffffff;
    border-top: 1px solid #e8ecef;
    flex-shrink: 0;
}

.ai-chat-input {
    flex: 1;
    min-width: 0;
    height: 50px;
    padding: 0 17px;
    border: 1px solid #dce1e4;
    border-radius: 22px;
    background: #f8f9fa;
    color: #333333;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

    .ai-chat-input:focus {
        border-color: #008080;
        box-shadow: 0 0 0 3px rgba(0, 128, 128, 0.10);
        background: #ffffff;
    }

    .ai-chat-input::placeholder {
        color: #999999;
    }


/* -------------------------------------------------------------------------- */
/* Schaltfläche zum Senden einer Nachricht                                    */
/* -------------------------------------------------------------------------- */

.ai-chat-send {
    width: 50px;
    height: 50px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: #008080;
    color: #ffffff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

    .ai-chat-send:hover {
        transform: scale(1.05);
    }

    .ai-chat-send:disabled {
        cursor: not-allowed;
        opacity: 0.55;
        transform: none;
    }


/* -------------------------------------------------------------------------- */
/* Darstellung des Eingabefeldes während auf eine Antwort gewartet wird       */
/* -------------------------------------------------------------------------- */

.ai-chat-input:disabled {
    cursor: wait;
    opacity: 0.75;
}



/* -------------------------------------------------------------------------- */
/* Schaltfläche zum Wechsel in das vorbereitete Anfrageformular               */
/* -------------------------------------------------------------------------- */

.ai-chat-form-action {
    display: flex;
    justify-content: flex-start;
    margin: 2px 0 18px 0;
}

.ai-chat-form-button {
    min-height: 46px;
    padding: 10px 18px;
    border-radius: 14px;
    font-size: 16px;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.10);
}

/* -------------------------------------------------------------------------- */
/* Anpassung für Smartphones und kleine Bildschirme                           */
/* -------------------------------------------------------------------------- */

@media (max-width: 576px) {

    .ai-chat {
        right: 14px;
        bottom: 14px;
    }

    .ai-chat-panel {
        position: fixed;
        left: 10px;
        right: 10px;
        bottom: 86px;
        width: auto;
        height: min(600px, calc(100vh - 110px));
        max-height: none;
        margin: 0;
        border-radius: 16px;
    }


    .ai-chat-header {
        min-height: 76px;
    }

    .ai-chat-header-logo-wrap {
        width: 120px;
        min-width: 120px;
        height: 42px;
    }

    .ai-chat-header-logo {
        max-height: 36px;
    }

    /* Auf kleinen Bildschirmen bleibt für den Neustart nur das eindeutige Symbol sichtbar. */
    .ai-chat-reset {
        width: 38px;
        padding: 0;
    }

    .ai-chat-reset span {
        display: none;
    }


    .ai-chat-message-bubble {
        max-width: 90%;
        font-size: 16px;
    }

    .ai-chat-input {
        font-size: 16px;
    }

    .ai-chat-toggle {
        min-height: 58px;
    }

    .ai-chat-toggle-text {
        min-height: 52px;
        padding: 7px 24px 7px 14px;
        margin-right: -15px;
        border-radius: 16px 0 0 16px;
    }

    .ai-chat-toggle-text strong {
        font-size: 14px;
    }

    .ai-chat-toggle-text > span {
        font-size: 12px;
    }

    .ai-chat-toggle-icon {
        width: 58px;
        height: 58px;
        font-size: 23px;
    }
}
