.campsecure-chat-shell {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 380px;
    z-index: 9990;
}

.campsecure-chat-shell.minimized {
    width: 210px;
}

.chat-mobile-launcher {
    display: none;
}

.campsecure-chat {
    position: relative;
    width: 100%;
    height: 550px;
    background: #032905;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(3, 41, 5, 0.45);
    display: flex;
    flex-direction: column;
    font-family: Arial, sans-serif;
    overflow: hidden;
    transition: all 0.3s ease;
    border: 1px solid rgba(249, 115, 22, 0.25);
}

.campsecure-chat.minimized {
    height: 50px;
}

.chat-avatar-bar {
    position: absolute;
    top: -58px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0;
    background: transparent;
    border: none;
    pointer-events: none;
}

.chat-avatar-img {
    width: 100px;
    height: 100px;
    object-fit: contain;
    display: block;
    filter: drop-shadow(0 6px 18px rgba(0, 0, 0, 0.45));
}

.campsecure-chat-shell.minimized .chat-avatar-bar {
    display: none !important;
}

/* Navigation hat Vorrang – Chat ausblenden, solange Menü offen */
body.menu-open .campsecure-chat-shell {
    visibility: hidden;
    pointer-events: none;
}

.campsecure-chat .chat-header {
    background: #021a03;
    color: #f97316;
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: bold;
    flex-shrink: 0;
}

.campsecure-chat .chat-header > span {
    margin-top: 25px;
}

.campsecure-chat .chat-header .chat-toggle {
    background: rgba(249, 115, 22, 0.12);
    border: 1px solid rgba(249, 115, 22, 0.45);
    border-radius: 8px;
    color: #f97316;
    font-size: 22px;
    line-height: 1;
    min-width: 36px;
    min-height: 36px;
    cursor: pointer;
    flex-shrink: 0;
}

.campsecure-chat .chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #021a03;
    min-height: 0;
}

.chat-message {
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.chat-message .avatar {
    width: 32px;
    height: 32px;
    background: #032905;
    border: 1px solid rgba(249, 115, 22, 0.35);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: #f97316;
    font-weight: 700;
}

.chat-message.user .avatar {
    background: #f97316;
    color: #032905;
    border-color: #f97316;
}

.chat-message .content {
    background: #032905;
    padding: 10px 14px;
    border-radius: 12px;
    max-width: 78%;
    color: #f0fdf4;
    font-size: 14px;
    line-height: 1.4;
    white-space: pre-wrap;
    word-break: break-word;
    border: 1px solid rgba(249, 115, 22, 0.15);
}

.chat-message.user .content {
    background: #f97316;
    color: #032905;
    border-color: #f97316;
}

.chat-input-area {
    display: flex;
    gap: 8px;
    padding: 12px;
    background: #021a03;
    border-top: 1px solid rgba(249, 115, 22, 0.2);
    flex-shrink: 0;
}

#chat-input {
    flex: 1;
    background: #032905;
    border: 1px solid rgba(249, 115, 22, 0.3);
    border-radius: 8px;
    padding: 10px;
    color: #f0fdf4;
    font-family: inherit;
    resize: none;
}

#chat-send {
    background: #f97316;
    border: none;
    border-radius: 8px;
    padding: 0 16px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 700;
    color: #032905;
}

#chat-send:hover {
    background: #fb923c;
}

.chat-footer {
    padding: 8px 12px;
    text-align: center;
    background: #021a03;
    border-top: 1px solid rgba(249, 115, 22, 0.2);
    font-size: 11px;
    color: #a7f3d0;
    flex-shrink: 0;
}

.chat-footer a {
    color: #f97316;
}

.chat-lead-panel {
    flex-shrink: 0;
    max-height: 0;
    overflow: hidden;
    padding: 0 12px;
    background: #021a03;
    border-top: 1px solid rgba(249, 115, 22, 0.2);
    transition: max-height 0.25s ease;
}

.chat-lead-panel:not([hidden]) {
    max-height: 340px;
    overflow-y: auto;
    padding: 12px;
}

.lead-panel-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 10px;
}

.lead-panel-head .lead-offer-intro {
    margin: 0;
    flex: 1;
}

.lead-panel-close {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border: 1px solid rgba(249, 115, 22, 0.45);
    border-radius: 8px;
    background: transparent;
    color: #f97316;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
}

.lead-panel-close:hover {
    background: rgba(249, 115, 22, 0.15);
}

.lead-form-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.lead-dismiss-btn {
    background: transparent !important;
    color: #a7f3d0 !important;
    border: 1px solid rgba(167, 243, 208, 0.35) !important;
    font-weight: 600 !important;
}

.lead-dismiss-btn:hover {
    background: rgba(167, 243, 208, 0.1) !important;
    color: #f0fdf4 !important;
}

.campsecure-chat.has-lead-panel .chat-messages {
    flex: 1;
    min-height: 120px;
}

.chat-lead-panel .lead-offer-intro {
    font-weight: 600;
    color: #f97316;
    margin: 0 0 10px;
    font-size: 13px;
    line-height: 1.35;
}

.lead-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.lead-form input,
.lead-form select {
    padding: 8px;
    border-radius: 6px;
    border: 1px solid rgba(249, 115, 22, 0.3);
    background: #021a03;
    color: #f0fdf4;
}

.lead-form button {
    background: #f97316;
    color: #032905;
    border: none;
    padding: 10px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
}

.lead-form button:hover {
    background: #fb923c;
}

.lead-form .dsgvo-hinweis {
    font-size: 10px;
    color: #86efac;
    text-align: center;
    line-height: 1.35;
}

/* Mobil: Launcher-Button, Chat nur nach Tipp – nicht Vollbild */
@media (max-width: 768px) {
    .chat-mobile-launcher {
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 8px 14px 8px 8px;
        border: 1px solid rgba(249, 115, 22, 0.45);
        border-radius: 999px;
        background: #032905;
        color: #f97316;
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
        cursor: pointer;
        font-weight: 700;
        font-size: 14px;
        font-family: Arial, sans-serif;
    }

    .chat-launcher-avatar {
        width: 56px;
        height: 56px;
        border-radius: 50%;
        object-fit: cover;
        flex-shrink: 0;
        filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.35));
    }

    .chat-launcher-label {
        padding-right: 4px;
        white-space: nowrap;
    }

    .campsecure-chat-shell.is-mobile {
        width: auto;
        left: auto;
        right: 12px;
        bottom: 12px;
    }

    .campsecure-chat-shell.is-mobile:not(.mobile-open) .campsecure-chat {
        display: none;
    }

    .campsecure-chat-shell.is-mobile:not(.mobile-open) .chat-avatar-bar {
        display: none !important;
    }

    .campsecure-chat-shell.is-mobile:not(.mobile-open) .chat-mobile-launcher {
        display: flex;
    }

    .campsecure-chat-shell.is-mobile.mobile-open {
        width: calc(100% - 16px);
        left: 8px;
        right: 8px;
        bottom: 8px;
    }

    .campsecure-chat-shell.is-mobile.mobile-open .chat-mobile-launcher {
        display: none;
    }

    .campsecure-chat-shell.is-mobile.mobile-open .campsecure-chat {
        display: flex;
        height: min(62vh, 520px);
        max-height: min(62vh, 520px);
    }

    .campsecure-chat-shell.is-mobile.mobile-open .chat-header > span {
        margin-top: 0;
    }

    .campsecure-chat-shell.is-mobile.mobile-open .chat-avatar-bar {
        display: none !important;
    }

    .campsecure-chat-shell.is-mobile .chat-header .chat-toggle {
        font-size: 22px;
        line-height: 1;
        min-width: 36px;
        min-height: 36px;
    }
}

@media (min-width: 769px) {
    .chat-mobile-launcher {
        display: none !important;
    }
}
