/* Allgemeine Stile */
html body {
    font-family: Arial, sans-serif;
    background-color: #102E44;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100dvh;
    overflow: hidden;
    touch-action: manipulation; /* Bessere Touch-Erkennung */
}

/* Header */
header {
    width: 100%;
    background-color: #102E44;
    color: white;
    text-align: center;
    padding: 1rem 0;
    font-size: 1.5rem;
    font-weight: bold;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10;
    
}

.Logo {
    width: 200px;
}

/* Haupt-Container für den gesamten Chat */
.chat-wrapper {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: calc(100dvh - 70px); /* Berechnet Höhe ohne Header */;
    position: relative;
    overflow: hidden; /* Kein Scrollen des Wrappers */
}

/* Scrollbarer Chatbereich */
.container {
    width: 90%;
    max-width: 700px;
    gap: 20px;
    margin-top: 80px; /* Platz für Header */
    height: calc(100vh - 160px); /* Platz für Header & Eingabefeld */
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    padding: 10px;
    box-sizing: border-box;
    position: relative; /* Wichtig für statischen Verlauf */
    scrollbar-width: none; /* Versteckt Scrollbar in Firefox */
}

/* Scrollbar für Chrome, Edge & Safari ausblenden */
.container::-webkit-scrollbar {
    display: none;
}

/* STATISCHER unterer Scroll-Übergang */
.scroll-fade {
    position: absolute;
    bottom: 83px; /* Statisch ganz unten */
    left: 0;
    width: 100%;
    height: 20px; /* Höhe des Effekts */
    background: linear-gradient(to bottom, rgba(16, 46, 68, 0) 0%, rgba(16, 46, 68, 1) 100%);
    pointer-events: none; /* Kein Einfluss auf Klicken oder Scrollen */
    z-index: 2; /* Höher als der Scrollbereich */
}


/* Fix für Safari: Scrollbare Bereiche nicht über Body scrollen */
.container:focus-within {
    scroll-behavior: smooth;
}

/* Erste Nachricht mit Abstand zum Header */
.container .msg:first-child {
    margin-top: 40px; /* 40px Abstand zur ersten Nachricht */
}

/* Eingabefeld */
#chatField {
    flex: 1;
    background: transparent !important; /* Sicherstellen, dass kein Hintergrund erscheint */
    border: none;
    color: white;
    font-size: 16px;
    outline: none;
    padding: 10px;
    caret-color: white; /* Cursor bleibt weiß */
}

/* Entfernt die weiße Hinterlegung beim Einfügen von Text */
#chatField:focus, #chatField:active {
    background: transparent !important;
}

/* Sicherstellen, dass das Platzhalter-Styling erhalten bleibt */
#chatField::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

/* Chat Nachrichten */
.msg {
    background-color: white;
    padding: 10px 15px;
    border-radius: 10px;
    box-shadow: 0px 2px 4px rgba(0, 0, 0, 0.1);
    max-width: 80%;
    word-wrap: break-word;
}

/* Benutzer- und Bot-Nachrichten */
.user-msg {
    align-self: flex-end;
    background-color: #ffffff;
    color: #102E44;
    border: 1px solid #949494; /* Leichte Umrandung */
    padding: 15px;
}

.bot-msg {
    align-self: flex-start;
    background-color: #ffffff00;
    color: #ffffff;
    box-shadow: none;
}


/* Eingabefeld-Container */
.input-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: fixed;
    bottom: 20px;
    width: 90%;
    max-width: 700px;
    background: #2b4357; /* Transparenter Hintergrund */
    border: 1px solid #536777;
    border-radius: 25px;
    padding: 10px;
    backdrop-filter: blur(10px); /* Weicher Hintergrundeffekt */
    transition: 0.3s;
    z-index: 3;
}

/* Eingabefeld */
input {
    flex: 1;
    background: transparent; /* Kein weißer Hintergrund */
    border: none;
    font-size: 16px;
    color: white; /* Textfarbe bleibt weiß */
    outline: none;
    padding: 10px;
    caret-color: #102E44; /* Cursor bleibt weiß */
}

/* Platzhalter-Styling */
input::placeholder {
    color: #aaaaaa;
    opacity: 0.8;
}

/* Verhindert weißes Hintergrund-Highlight auf Mobilgeräten */
input:focus {
    background: transparent;
    color: #000000;
}

/* Eingabefeld */
#chatField {
    flex: 1;
    background: transparent;
    border: none;
    color: white;
    font-size: 16px;
    outline: none;
    padding: 10px;
}

/* Eingabefeld Platzhalter */
#chatField::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

/* Plus-Icon für Bilder-Upload */
.plus-button, .mic-button, .send-button {
    background: transparent;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 10px;
    transition: 0.3s;
}

/* Hover-Effekt */
.plus-button:hover, .mic-button:hover, .send-button:hover {
    color: #00a7ef;
}




/* Stil für mobile Geräte: Eingabefeld als fixen Footer */
@media (max-width: 768px) {


    .input-container {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100vw; /* Volle Breite */
        height: 90px;
        border-radius: 30px 30px 0 0;
        background: #2b4357; /* Transparenter Hintergrund */
        border: 1px solid #536777;
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 10px 15px;
        box-shadow: 0px -2px 10px rgba(0, 0, 0, 0.2);
        z-index: 3;
        box-sizing: border-box; /* Sicherstellen, dass nichts über den Rand hinausgeht */
    }

    

    #chatField {
        flex: 1;
        height: 40px;
        padding: 10px;
        font-size: 18px;
        border-radius: 20px;
        color: white;
        border: none;
    }

    .mic-button, .send-button {
        font-size: 24px;
        padding: 5px;
    }

    /* STATISCHER unterer Scroll-Übergang */
.scroll-fade {
    position: absolute;
    bottom: 89px; /* Statisch ganz unten */
    left: 0;
    width: 100%;
    height: 20px; /* Höhe des Effekts */
    background: linear-gradient(to bottom, rgba(16, 46, 68, 0) 0%, rgba(16, 46, 68, 1) 100%);
    pointer-events: none; /* Kein Einfluss auf Klicken oder Scrollen */
    z-index: 2; /* Höher als der Scrollbereich */
}

/* Scrollbarer Chatbereich */
.container {
    width: 90%;
    max-width: 700px;
    gap: 20px;
    margin-top: 80px; /* Platz für Header */
    height: calc(100vh - 170px); /* Platz für Header & Eingabefeld */
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    padding: 10px;
    box-sizing: border-box;
    position: relative; /* Wichtig für statischen Verlauf */
    scrollbar-width: none; /* Versteckt Scrollbar in Firefox */
}
}

/* Amazon Link Styling */
.amazon-link {
    display: block;
    color: #ff9900;
    text-decoration: none;
    font-weight: bold;
    margin-top: 5px;
}

.amazon-link:hover {
    text-decoration: underline;
}

.amazon-product {
    display: flex;
    align-items: center;
    padding: 10px;
    border-radius: 10px;
    margin: 10px 0;
}

.amazon-img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 5px;
    margin-right: 10px;
}

.amazon-link {
    text-decoration: none;
    color: #007bff;
    font-weight: bold;
}

.amazon-link:hover {
    text-decoration: underline;
}

/* Safari iOS Fix: Verhindert Springen und Scrollen der Seite */
@supports (-webkit-touch-callout: none) {
    @media (max-width: 768px) {
        .chat-wrapper {
            height: calc(100dvh - env(safe-area-inset-bottom) - 70px);
        }
        .container {
            height: calc(100dvh - env(safe-area-inset-bottom) - 140px);
            overflow-y: scroll;
            -webkit-overflow-scrolling: touch;
        }
        /* Body fixieren, um Scrollen der Seite zu verhindern */
        body {
            position: fixed;
            width: 100%;
            height: 100dvh;
        }
    }
}

/* Entfernt Scrollbar für Chrome, Edge & Safari */
.container::-webkit-scrollbar {
    display: none;
}