* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
    margin: 0;
    overflow: hidden;
}

body {
    font-family: 'PT Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    color: #1a1a1a;
    background: #ffffff;
}

#chat-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    height: 100dvh; /* overrides on browsers supporting dvh */
    max-width: 900px;
    margin: 0 auto;
}

#chat-messages {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
/* First message should stick to the input area*/
#chat-messages > .message:first-child {
    margin-top: auto;
}

/* Nachrichten-Bubbles ohne Ränder */
.message {
    max-width: 90%;
    padding: 12px 16px;
    border-radius: 12px;
    word-wrap: break-word;
    overflow-wrap: break-word;
    border: none;
    position: relative;
}

/* Assistant message — mobile default */
.message-assistant {
    align-self: flex-start;
    background: #B2DCC4;
    border: none;
    padding-left: 16px; /* normal bubble padding */
}

/* Disable icon by default */
.message-assistant::before {
    content: none;
}

/* Nutzer-Box (#3CB4E4) */
.message-user {
    align-self: flex-end;
    background: #3CB4E4;
    color: #ffffff;
    border: none;
}

.message-label {
    font-size: 12px;
    font-weight: 700;
    color: #6b7280;
    margin-bottom: 4px;
    text-transform: uppercase;
}

/* Markdown content inside messages */
.message-content p { margin: 0.5em 0; }

.message-content p:first-child { margin-top: 0; }

.message-content p:last-child { margin-bottom: 0; }

.message-content ul, .message-content ol {
    margin: 0.5em 0;
    padding-left: 1.5em;
}

/* Link-Farben */
.message-assistant .message-content a { color: #1d4ed8; font-weight: 700; }
.message-user .message-content a { color: #ffffff; text-decoration: underline; }

/* Quellenbereich */
.message-sources {
    margin-top: 10px;
    padding-top: 8px;
    border: none;
}

.message-sources summary {
    cursor: pointer;
    font-size: 13px;
    font-weight: 700;
    user-select: none;
}

/* Eingabebereich */
#chat-input-area {
    --input-gap: 10px;
    display: flex;
    gap: var(--input-gap);
    padding: 16px;
    background: #f9fafb;
    align-items: flex-end;
    border: none;
}

#chat-input {
    flex: 1;
    resize: none;
    padding: 12px;
    border-radius: 8px;
    font-family: 'PT Sans', sans-serif;
    font-size: 16px;
    outline: none;
    border: none;
    background: #ffffff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

#chat-input:focus {
    box-shadow: 0 0 0 3px rgba(60, 180, 228, 0.3);
}

/* Buttons */
#chat-buttons {
    display: flex;
    flex-direction: column;
    gap: var(--input-gap);
}

#chat-buttons button {
    width: 42px;
    height: 42px;
    border-radius: 8px;
    background: #ffffff;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    border: none;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

#send-btn:hover:not(:disabled) {
    background: #3CB4E4;
    color: white;
}

#retry-btn:hover:not(:disabled) {
    background: #B2DCC4;
}

@media (min-width: 700px) {
    .message {
        max-width: 80%;
    }

    .message-assistant {
        padding-left: 44px; /* space for icon */
    }

    .message-assistant::before {
        content: "";
        position: absolute; /*original by martin*/
        left: 12px;
        top: 12px;
        width: 22px;
        height: 22px;
        background-image: url("/static/icon.svg");
        background-repeat: no-repeat;
        background-size: contain;
    }
}
