/* ================================================
   MCF Chatbot Widget — "KI-Berater"
   DSGVO-konform mit Consent-Overlay
   ================================================ */

/* ── Toggle-Button (fixed, unten rechts — vorerst deaktiviert) ── */
.cb-toggle-btn {
    background: var(--mcf-blue, #0092C7) !important;
    position: relative;
}
.cb-toggle-btn:hover {
    background: var(--mcf-blue-hover, #007AA8) !important;
}
.cb-toggle-btn .cb-badge {
    position: absolute;
    top: -2px; right: -2px;
    width: 14px; height: 14px;
    background: #4CAF50;
    border-radius: 50%;
    border: 2px solid #fff;
}

/* ── Preisbox-Button ── */
.cta-chat {
    background: var(--mcf-blue, #0092C7) !important;
    color: #fff !important;
    border: none !important;
    margin-top: 4px;
}
.cta-chat:hover {
    filter: brightness(.88) !important;
}

/* ── Chat Panel ── */
.cb-panel {
    display: none;
    position: fixed;
    bottom: 100px;
    right: 30px;
    width: 400px;
    height: 560px;
    background: var(--mcf-white, #fff);
    border-radius: 20px;
    box-shadow: 0 28px 80px rgba(0,0,0,.25);
    z-index: 9998;
    flex-direction: column;
    overflow: hidden;
    animation: cbFadeIn .25s ease;
}
.cb-panel.is-open {
    display: flex;
}

@keyframes cbFadeIn {
    from { opacity: 0; transform: scale(.96) translateY(10px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

/* ── Header ── */
.cb-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    background: var(--mcf-blue, #0092C7);
    color: #fff;
    flex-shrink: 0;
}
.cb-avatar {
    width: 38px; height: 38px;
    background: rgba(255,255,255,.2);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}
.cb-header-info { flex: 1; }
.cb-header-title {
    font-size: 15px; font-weight: 800;
    line-height: 1.2;
}
.cb-header-sub {
    font-size: 11px; opacity: .8;
    font-weight: 500;
}
.cb-close {
    width: 32px; height: 32px;
    background: rgba(255,255,255,.15);
    border: none; border-radius: 50%;
    color: #fff; font-size: 16px;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background .2s;
    flex-shrink: 0;
}
.cb-close:hover { background: rgba(255,255,255,.3); }

/* ── DSGVO Consent Overlay ── */
.cb-consent {
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 70px;
    left: 0; right: 0; bottom: 0;
    background: var(--mcf-white, #fff);
    z-index: 10;
    padding: 24px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}
.cb-consent-inner {
    text-align: center;
    max-width: 320px;
}
.cb-consent-icon {
    font-size: 36px;
    color: var(--mcf-blue, #0092C7);
    margin-bottom: 16px;
}
.cb-consent-title {
    font-size: 17px;
    font-weight: 800;
    color: var(--mcf-black, #1A1A1A);
    margin-bottom: 14px;
}
.cb-consent p {
    font-size: 12px;
    line-height: 1.6;
    color: #555;
    margin: 0 0 10px;
    text-align: left;
}
.cb-consent a {
    color: var(--mcf-blue, #0092C7);
    text-decoration: underline;
}
.cb-consent-buttons {
    margin-top: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.cb-consent-accept {
    padding: 12px 20px;
    background: var(--mcf-blue, #0092C7);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-family: 'Mulish', sans-serif;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all .2s;
}
.cb-consent-accept:hover {
    background: var(--mcf-blue-hover, #007AA8);
}
.cb-consent-decline {
    padding: 10px 20px;
    background: transparent;
    color: #888;
    border: 1.5px solid #ddd;
    border-radius: 10px;
    font-family: 'Mulish', sans-serif;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all .2s;
}
.cb-consent-decline:hover {
    border-color: #999;
    color: #555;
}

/* ── Messages Area ── */
.cb-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    -webkit-overflow-scrolling: touch;
}

/* Message Bubbles */
.cb-msg {
    max-width: 85%;
    padding: 12px 16px;
    font-size: 14px;
    line-height: 1.5;
    font-weight: 500;
    word-wrap: break-word;
}
.cb-msg-bot {
    align-self: flex-start;
    background: var(--mcf-gray-light, #F5F5F5);
    color: var(--mcf-black, #1A1A1A);
    border-radius: 16px 16px 16px 4px;
}
.cb-msg-user {
    align-self: flex-end;
    background: var(--mcf-blue, #0092C7);
    color: #fff;
    border-radius: 16px 16px 4px 16px;
}

/* Markdown-like formatting in bot messages */
.cb-msg-bot strong { font-weight: 800; }
.cb-msg-bot a {
    color: var(--mcf-blue, #0092C7);
    text-decoration: underline;
}

/* ── Quick Actions ── */
.cb-quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 0 16px 8px;
}
.cb-quick-btn {
    padding: 8px 14px;
    border: 1.5px solid var(--mcf-gray-mid, #E0E0E0);
    border-radius: 20px;
    background: var(--mcf-white, #fff);
    font-family: 'Mulish', sans-serif;
    font-size: 12px;
    font-weight: 700;
    color: var(--mcf-black, #1A1A1A);
    cursor: pointer;
    transition: all .2s;
    white-space: nowrap;
}
.cb-quick-btn:hover {
    border-color: var(--mcf-blue, #0092C7);
    color: var(--mcf-blue, #0092C7);
    background: var(--mcf-blue-light, #E6F4FA);
}

/* ── Typing Indicator ── */
.cb-typing {
    align-self: flex-start;
    display: none;
    align-items: center;
    gap: 4px;
    padding: 12px 20px;
    background: var(--mcf-gray-light, #F5F5F5);
    border-radius: 16px 16px 16px 4px;
}
.cb-typing.is-visible { display: flex; }
.cb-dot {
    width: 7px; height: 7px;
    background: #aaa;
    border-radius: 50%;
    animation: cbBounce 1.2s infinite ease-in-out;
}
.cb-dot:nth-child(2) { animation-delay: .15s; }
.cb-dot:nth-child(3) { animation-delay: .3s; }

@keyframes cbBounce {
    0%, 60%, 100% { transform: translateY(0); opacity: .4; }
    30% { transform: translateY(-6px); opacity: 1; }
}

/* ── Input Area ── */
.cb-input-area {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid var(--mcf-gray-mid, #E0E0E0);
    flex-shrink: 0;
    background: var(--mcf-white, #fff);
}
.cb-input {
    flex: 1;
    border: 1.5px solid var(--mcf-gray-mid, #E0E0E0);
    border-radius: 22px;
    padding: 10px 16px;
    font-family: 'Mulish', sans-serif;
    font-size: 14px;
    font-weight: 500;
    color: var(--mcf-black, #1A1A1A);
    outline: none;
    transition: border-color .2s;
    min-width: 0;
}
.cb-input:focus { border-color: var(--mcf-blue, #0092C7); }
.cb-input::placeholder { color: #aaa; }

.cb-send {
    width: 42px; height: 42px;
    border-radius: 50%;
    background: var(--mcf-blue, #0092C7);
    color: #fff;
    border: none;
    font-size: 16px;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    transition: all .2s;
}
.cb-send:hover { background: var(--mcf-blue-hover, #007AA8); transform: scale(1.05); }
.cb-send:disabled { opacity: .5; cursor: not-allowed; transform: none; }

/* ── Responsive ── */
@media (max-width: 600px) {
    .cb-panel {
        inset: 0;
        width: 100%;
        height: 100%;
        border-radius: 0;
        bottom: 0;
        right: 0;
    }
    .cb-consent {
        top: 70px;
    }
}
