:root {
    --faq-braun: #4A413A;
    --faq-orange: #EF7900;
    --faq-gruen: #9AB938;
    --faq-blau: #5A87A6;
    --faq-bg: #f6f7f9;
    --faq-text: #1f1f1f;
    --faq-muted: #666;
    --faq-border: #ddd;
    --faq-white: #fff;
}

/* Launcher unten rechts */
#faq-chat-launcher {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 99998;
    width: 82px;
    height: 82px;
    border-radius: 50%;
    border: 4px solid var(--faq-orange);
    background: #fff;
    cursor: pointer;
    box-shadow: 0 10px 25px rgba(0,0,0,.25);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    overflow: hidden;
}

#faq-chat-launcher:hover {
    transform: scale(1.04);
}

#faq-chat-launcher img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Chatfenster */
#faq-chat-window {
    position: fixed;
    right: 24px;
    bottom: 116px;
    z-index: 99999;
    width: 410px;
    max-width: calc(100vw - 32px);
    height: 610px;
    max-height: calc(100vh - 145px);
    background: var(--faq-white);
    border-radius: 18px;
    box-shadow: 0 18px 45px rgba(0,0,0,.28);
    overflow: hidden;
    display: none;
    flex-direction: column;
    font-family: Arial, sans-serif;
    color: var(--faq-text);
}

#faq-chat-window.faq-open {
    display: flex;
}

/* Header */
.faq-chat-header {
    background: var(--faq-braun);
    color: #fff;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-shrink: 0;
}

.faq-header-brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.faq-header-brand img {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    border: 2px solid #fff;
    background: #fff;
    object-fit: cover;
    flex-shrink: 0;
}

.faq-chat-title {
    font-weight: bold;
    font-size: 17px;
}

.faq-chat-subtitle {
    font-size: 12px;
    opacity: .85;
    margin-top: 2px;
}

#faq-chat-close {
    border: 0;
    background: transparent;
    color: #fff;
    font-size: 26px;
    cursor: pointer;
    line-height: 1;
}

/* Body */
.faq-chat-body {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    background: var(--faq-bg);
}

.faq-message {
    margin-bottom: 12px;
    display: flex;
}

.faq-message.bot {
    justify-content: flex-start;
}

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

.faq-bubble {
    max-width: 86%;
    padding: 11px 13px;
    border-radius: 15px;
    font-size: 14px;
    line-height: 1.45;
    white-space: normal;
}

.faq-message.bot .faq-bubble {
    background: #fff;
    border: 1px solid var(--faq-border);
    border-bottom-left-radius: 4px;
}

.faq-message.user .faq-bubble {
    background: var(--faq-blau);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.faq-answer-text {
    white-space: normal;
}

/* Quellen */
.faq-sources {
    margin-top: 14px;
    padding-top: 10px;
    border-top: 1px solid #e4e4e4;
    font-size: 13px;
    color: var(--faq-muted);
}

.faq-sources strong {
    display: block;
    margin-bottom: 8px;
    color: var(--faq-muted);
}

.faq-source-item {
    margin-bottom: 8px;
}

.faq-sources a {
    color: var(--faq-blau);
    text-decoration: none;
    font-weight: bold;
    display: inline;
}

.faq-sources a:hover {
    text-decoration: underline;
}

.faq-sources span {
    display: block;
    margin-top: 2px;
    color: var(--faq-muted);
    font-size: 12px;
}

/* Teilen / Kopieren */
#faq-chat-window .faq-share-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-top: 13px;
    padding-top: 11px;
    border-top: 1px solid #e7e7e7;
}

#faq-chat-window .faq-share-actions button {
    appearance: none;
    -webkit-appearance: none;
    border: 0;
    border-radius: 999px;
    padding: 7px 11px;
    font-family: Arial, sans-serif;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    color: #4A413A;
    background: #f2f3f4;
    box-shadow: none;
    transition: background .15s ease, transform .15s ease;
}

#faq-chat-window .faq-share-actions button:hover {
    background: #e7e8ea;
    transform: translateY(-1px);
}

#faq-chat-window .faq-share-actions button:active {
    transform: translateY(0);
}

#faq-chat-window .faq-share-copy {
    background: rgba(154,185,56,.18) !important;
    color: #3f5314 !important;
}

#faq-chat-window .faq-share-whatsapp {
    background: rgba(37,211,102,.18) !important;
    color: #146c35 !important;
}

#faq-chat-window .faq-share-mail {
    background: rgba(90,135,166,.18) !important;
    color: #365d78 !important;
}

#faq-chat-window .faq-share-native {
    background: rgba(239,121,0,.16) !important;
    color: #9a4d00 !important;
}

/* Footer */
.faq-chat-footer {
    border-top: 1px solid var(--faq-border);
    background: #fff;
    padding: 12px;
    flex-shrink: 0;
}

.faq-study-select {
    margin-bottom: 8px;
}

.faq-study-select select {
    width: 100%;
    border: 1px solid var(--faq-border);
    border-radius: 10px;
    padding: 9px;
    font-size: 13px;
    background: #fff;
}

.faq-input-row {
    display: flex;
    gap: 8px;
}

#faq-chat-input {
    flex: 1;
    min-height: 44px;
    max-height: 100px;
    resize: none;
    border: 1px solid var(--faq-border);
    border-radius: 12px;
    padding: 10px;
    font-size: 14px;
    font-family: Arial, sans-serif;
}

#faq-chat-send {
    width: 46px;
    border: 0;
    border-radius: 12px;
    background: var(--faq-orange);
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    font-weight: bold;
    flex-shrink: 0;
}

#faq-chat-send:disabled {
    opacity: .55;
    cursor: not-allowed;
}

.faq-privacy {
    margin-top: 8px;
    font-size: 11px;
    color: var(--faq-muted);
    line-height: 1.35;
}

/* Tippen-Animation */
.faq-typing {
    display: inline-flex;
    gap: 4px;
    align-items: center;
}

.faq-dot {
    width: 6px;
    height: 6px;
    background: #999;
    border-radius: 50%;
    animation: faqTyping 1s infinite ease-in-out;
}

.faq-dot:nth-child(2) {
    animation-delay: .15s;
}

.faq-dot:nth-child(3) {
    animation-delay: .3s;
}
#faq-chat-window .faq-answer-link {
    display: inline-block;
    margin: 6px 6px 6px 0;
    padding: 7px 11px;
    border-radius: 999px;
    background: rgba(90,135,166,.14);
    color: #365d78;
    font-size: 13px;
    font-weight: bold;
    text-decoration: none;
    word-break: normal;
}

#faq-chat-window .faq-answer-link:hover {
    background: rgba(90,135,166,.24);
    text-decoration: none;
}

@keyframes faqTyping {
    0%, 80%, 100% {
        opacity: .3;
        transform: translateY(0);
    }
    40% {
        opacity: 1;
        transform: translateY(-3px);
    }
}

/* Mobile */
@media (max-width: 600px) {
    #faq-chat-launcher {
        right: 16px;
        bottom: 16px;
        width: 76px;
        height: 76px;
    }

    #faq-chat-window {
        right: 12px;
        left: 12px;
        bottom: 98px;
        width: auto;
        height: calc(100vh - 120px);
        max-height: none;
    }

    #faq-chat-window .faq-share-actions {
        gap: 6px;
    }

    #faq-chat-window .faq-share-actions button {
        font-size: 12px;
        padding: 7px 10px;
    }
}