/* ── Chat-Widget BFR Wisskirchen ──────────────────────────────── */

/* Floating Button */
#bfr-chat-btn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #c30000;
    color: #fff;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    z-index: 9998;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, background 0.2s;
}
#bfr-chat-btn:hover {
    transform: scale(1.08);
    background: #a00;
}
#bfr-chat-btn svg {
    width: 40px;
    height: 40px;
    fill: #fff;
}

/* Chat-Fenster */
#bfr-chat-window {
    position: fixed;
    bottom: 96px;
    right: 24px;
    width: 370px;
    height: calc(95vh - 96px);
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.25);
    z-index: 9999;
    display: none;
    flex-direction: column;
    overflow: hidden;
    font-family: Arial, Helvetica, sans-serif;
}
#bfr-chat-window.open {
    display: flex;
}

/* Header */
#bfr-chat-header {
    background: #c30000;
    color: #fff;
    padding: 14px 16px;
    font-size: 15px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}
#bfr-chat-header span {
    display: flex;
    align-items: center;
    gap: 8px;
}
#bfr-chat-header span svg {
    width: 18px;
    height: 18px;
    fill: #fff;
}
#bfr-chat-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 22px;
    cursor: pointer;
    line-height: 1;
    padding: 6px 8px;
    min-width: 34px;
    min-height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
}
#bfr-chat-close:hover {
    opacity: 0.7;
}

/* Nachrichten-Bereich */
#bfr-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 200px;
    background: #f7f7f7;
}

/* Nachrichten-Blasen */
.bfr-msg {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.45;
    word-wrap: break-word;
    overflow-wrap: break-word;
}
.bfr-msg-bot {
    background: #fff;
    color: #333;
    align-self: flex-start;
    border: 1px solid #e0e0e0;
    border-bottom-left-radius: 4px;
}
.bfr-msg-bot a {
    color: #c30000;
    text-decoration: underline;
}
.bfr-msg-bot a:hover {
    color: #a00;
}
.bfr-msg-user {
    background: #c30000;
    color: #fff;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

/* Lautsprecher-Button auf Bot-Nachrichten */
.bfr-msg-speak {
    background: none;
    border: none;
    cursor: pointer;
    padding: 2px 4px;
    margin-top: 4px;
    display: inline-flex;
    align-items: center;
    opacity: 0.5;
}
.bfr-msg-speak:hover {
    opacity: 1;
}
.bfr-msg-speak svg {
    width: 16px;
    height: 16px;
    fill: #666;
}

/* Tipp-Indikator */
.bfr-typing {
    align-self: flex-start;
    display: flex;
    gap: 4px;
    padding: 10px 14px;
    background: #fff;
    border-radius: 12px;
    border: 1px solid #e0e0e0;
    border-bottom-left-radius: 4px;
}
.bfr-typing-dot {
    width: 8px;
    height: 8px;
    background: #999;
    border-radius: 50%;
    animation: bfr-bounce 1.2s infinite;
}
.bfr-typing-dot:nth-child(2) { animation-delay: 0.2s; }
.bfr-typing-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes bfr-bounce {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-6px); }
}

/* Eingabebereich */
#bfr-chat-input-area {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    border-top: 1px solid #e0e0e0;
    background: #fff;
    gap: 6px;
    flex-shrink: 0;
}
#bfr-chat-input {
    flex: 1;
    border: 1px solid #ccc;
    border-radius: 20px;
    padding: 8px 14px;
    font-size: 14px;
    outline: none;
    font-family: inherit;
    resize: none;
    min-width: 0;
}
#bfr-chat-input:focus {
    border-color: #c30000;
}

/* Sprach-Dropdown im Eingabebereich */
#bfr-chat-lang {
    width: 52px;
    height: 34px;
    border: 1px solid #ccc;
    border-radius: 6px;
    background: #fff;
    font-size: 16px;
    cursor: pointer;
    padding: 0 14px 0 2px;
    outline: none;
    flex-shrink: 0;
    color: #333;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23999'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 4px center;
    background-size: 8px;
}
#bfr-chat-lang:focus {
    border-color: #c30000;
}

/* Buttons im Eingabebereich */
#bfr-chat-input-area button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s;
    flex-shrink: 0;
}
#bfr-chat-input-area button:hover {
    background: #f0f0f0;
}
#bfr-chat-input-area button svg {
    width: 22px;
    height: 22px;
    fill: #666;
}
#bfr-chat-send svg {
    fill: #c30000;
}
#bfr-chat-mic.recording {
    background: #ffe0e0;
}
#bfr-chat-mic.recording svg {
    fill: #c30000;
}

/* Fehlermeldung */
.bfr-msg-error {
    background: #fff3f3;
    color: #c30000;
    border: 1px solid #f5c6c6;
    align-self: flex-start;
    font-size: 13px;
}

/* ── Consent-Screen ─────────────────────────────────────────── */
#bfr-chat-consent {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px 20px;
    text-align: center;
    background: #f7f7f7;
}
.bfr-consent-greeting {
    font-size: 18px;
    font-weight: bold;
    color: #333;
    margin: 0 0 16px;
}
.bfr-consent-text {
    font-size: 12px;
    color: #666;
    line-height: 1.5;
    margin: 0 0 8px;
}
.bfr-consent-text a {
    color: #c30000;
    text-decoration: underline;
}
#bfr-chat-agree {
    display: inline-block;
    margin-top: 16px;
    padding: 10px 20px;
    background: #c30000;
    color: #fff;
    border-radius: 20px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s;
}
#bfr-chat-agree:hover {
    background: #a00;
    color: #fff;
}

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 480px) {
    #bfr-chat-window {
        right: 0;
        bottom: 0;
        left: 0;
        width: 100%;
        max-height: 95vh;
        height: 95vh;
        border-radius: 12px 12px 0 0;
    }
    #bfr-chat-messages {
        max-height: none;
        flex: 1;
    }
    #bfr-chat-lang {
        width: 48px;
        height: 32px;
        font-size: 15px;
    }
    #bfr-chat-btn {
        bottom: 16px;
        right: 16px;
        width: 54px;
        height: 54px;
    }
}
