/* HKM Website-Chatbot Widget — Markenrot #9E0B0F, Creme #F2EDE4 */

#hkm-chat-launcher {
    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: 9998;
    width: 58px;
    height: 58px;
    border-radius: 50%;
    border: none;
    background: #9E0B0F;
    color: #fff;
    cursor: pointer;
    box-shadow: 0 6px 18px rgba(0, 0, 0, .25);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform .15s ease;
}
#hkm-chat-launcher:hover { transform: scale(1.07); }
#hkm-chat-launcher svg { width: 28px; height: 28px; }

#hkm-chat-panel {
    position: fixed;
    right: 22px;
    bottom: 92px;
    z-index: 9999;
    /* Groesser (Flemming 07.10.2026): das Uebergabeformular passte nicht ins
       Fenster. Breite 420, Hoehe nach Bildschirm, aber nie ueber den Rand. */
    width: 420px;
    max-width: calc(100vw - 24px);
    height: min(720px, calc(100vh - 120px));
    max-height: calc(100vh - 120px);
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, .28);
    display: none;
    flex-direction: column;
    overflow: hidden;
    font-family: inherit;
}
#hkm-chat-panel.hkm-open { display: flex; }

.hkm-chat-head {
    background: #9E0B0F;
    color: #fff;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.hkm-chat-head-title { font-weight: 600; font-size: 15px; line-height: 1.2; }
.hkm-chat-head-sub { font-size: 11px; opacity: .85; margin-top: 2px; }
.hkm-chat-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    padding: 2px 6px;
}

.hkm-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 14px;
    background: #F2EDE4;
}
.hkm-msg {
    max-width: 85%;
    margin-bottom: 10px;
    padding: 9px 12px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.45;
    white-space: pre-wrap;
    word-wrap: break-word;
}
.hkm-msg a { color: #9E0B0F; text-decoration: underline; }
.hkm-msg-bot {
    background: #fff;
    color: #2b2b2b;
    border-bottom-left-radius: 4px;
    margin-right: auto;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .08);
}
.hkm-msg-user {
    background: #9E0B0F;
    color: #fff;
    border-bottom-right-radius: 4px;
    margin-left: auto;
}
.hkm-msg-typing { color: #8a8a8a; font-style: italic; }

/* Daumen-Feedback unter KI-Antworten */
.hkm-rating { margin-top: 6px; display: flex; gap: 6px; }
.hkm-rating button {
    background: none;
    border: 1px solid #e0d6c6;
    border-radius: 12px;
    padding: 1px 8px;
    font-size: 13px;
    cursor: pointer;
    opacity: .7;
}
.hkm-rating button:hover { opacity: 1; border-color: #9E0B0F; }
.hkm-rated { font-size: 11px; color: #8a8a8a; }

.hkm-chat-inputrow {
    display: flex;
    gap: 8px;
    padding: 10px 12px;
    border-top: 1px solid #e5ddd0;
    background: #fff;
}
.hkm-chat-inputrow textarea {
    flex: 1;
    resize: none;
    border: 1px solid #d8cfc0;
    border-radius: 10px;
    padding: 8px 10px;
    font-size: 14px;
    font-family: inherit;
    height: 42px;
    outline: none;
}
.hkm-chat-inputrow textarea:focus { border-color: #9E0B0F; }
.hkm-chat-send {
    background: #9E0B0F;
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 0 14px;
    cursor: pointer;
    font-size: 14px;
}
.hkm-chat-send:disabled { opacity: .5; cursor: default; }

.hkm-chat-foot {
    text-align: center;
    font-size: 11px;
    color: #8a8a8a;
    padding: 4px 10px 8px;
    background: #fff;
}
.hkm-chat-foot button {
    background: none;
    border: none;
    color: #9E0B0F;
    text-decoration: underline;
    cursor: pointer;
    font-size: 11px;
    padding: 0;
}

/* Stufe 1: Themen-Buttons (Schnellantworten ohne KI) */
.hkm-quickreplies {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 4px 0 10px;
}
.hkm-quickreplies button {
    background: #fff;
    border: 1px solid #9E0B0F;
    color: #9E0B0F;
    border-radius: 16px;
    padding: 6px 12px;
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
    transition: background .12s ease, color .12s ease;
}
.hkm-quickreplies button:hover {
    background: #9E0B0F;
    color: #fff;
}

/* Eingeklappte Themen nach der ersten Interaktion */
.hkm-topics-toggle {
    display: block;
    margin: 2px 0 10px;
    background: none;
    border: 1px dashed #c9beac;
    color: #8a7c68;
    border-radius: 14px;
    padding: 4px 12px;
    font-size: 12px;
    font-family: inherit;
    cursor: pointer;
}
.hkm-topics-toggle:hover { border-color: #9E0B0F; color: #9E0B0F; }

/* Übergabe-Formular im Chat */
.hkm-handoff {
    background: #fff;
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 10px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .08);
}
.hkm-handoff label { font-size: 12px; color: #555; display: block; margin: 6px 0 2px; }
.hkm-handoff .hkm-h-zeile { display: flex; gap: 8px; }
.hkm-handoff .hkm-h-zeile > div { flex: 1 1 0; min-width: 0; }
.hkm-handoff input,
.hkm-handoff textarea {
    width: 100%;
    border: 1px solid #d8cfc0;
    border-radius: 8px;
    padding: 7px 9px;
    font-size: 14px;
    font-family: inherit;
    box-sizing: border-box;
}
.hkm-handoff textarea { height: 56px; resize: none; }
.hkm-handoff .hkm-hp { display: none; }
.hkm-handoff-send {
    margin-top: 10px;
    width: 100%;
    background: #9E0B0F;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 9px;
    cursor: pointer;
    font-size: 14px;
}
.hkm-handoff-send:disabled { opacity: .5; }
.hkm-handoff-error { color: #9E0B0F; font-size: 12px; margin-top: 6px; }

/* Abo-Bestätigungskarte: zeigt den serverseitig validierten Änderungs-
   vorschlag; erst "Bestätigen" führt die Änderung aus */
.hkm-abocard {
    background: #fff;
    border: 1.5px solid #9E0B0F;
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 10px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .08);
}
.hkm-abocard-title { font-weight: 600; font-size: 14px; color: #9E0B0F; }
.hkm-abocard-sub { font-size: 12px; color: #8a7c68; margin: 2px 0 8px; }
.hkm-abocard-line {
    font-size: 13px;
    color: #2b2b2b;
    padding: 4px 0;
    border-top: 1px solid #f0e9dd;
}
.hkm-abocard-hint { font-size: 11.5px; color: #8a7c68; margin-top: 8px; }
.hkm-abocard-actions { display: flex; gap: 8px; margin-top: 10px; }
.hkm-abocard-ok {
    flex: 1;
    background: #9E0B0F;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 9px;
    cursor: pointer;
    font-size: 14px;
    font-family: inherit;
}
.hkm-abocard-ok:disabled { opacity: .5; cursor: default; }
.hkm-abocard-no {
    background: none;
    border: 1px solid #d8cfc0;
    color: #555;
    border-radius: 8px;
    padding: 9px 14px;
    cursor: pointer;
    font-size: 14px;
    font-family: inherit;
}
.hkm-abocard-no:hover { border-color: #9E0B0F; color: #9E0B0F; }
.hkm-abocard-no:disabled { opacity: .5; cursor: default; }

@media (max-width: 480px) {
    #hkm-chat-panel {
        right: 12px;
        left: 12px;
        width: auto;
        bottom: 84px;
        height: 78vh;
    }
    #hkm-chat-launcher { right: 14px; bottom: 14px; }
}

/* Live-Chat light: Antworten echter Mitarbeiter heben sich vom Bot ab,
   der Launcher pulsiert, wenn bei geschlossenem Fenster etwas ankam. */
.hkm-msg-staff { border-left: 3px solid #9E0B0F; background: #fff7f0; }
#hkm-chat-launcher.hkm-launcher-new { animation: hkm-pulse 1.2s ease-in-out infinite; }
@keyframes hkm-pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(158, 11, 15, .45); } 50% { box-shadow: 0 0 0 10px rgba(158, 11, 15, 0); } }
.hkm-msg-system { background: transparent; border: 0; color: #8a8a8a; font-size: 12px; text-align: center; max-width: 100%; box-shadow: none; }
.hkm-live-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: #3ddc84; margin-right: 6px; vertical-align: middle;
    box-shadow: 0 0 0 3px rgba(61, 220, 132, .3); animation: hkm-live 2s ease-in-out infinite; }
@keyframes hkm-live { 0%, 100% { box-shadow: 0 0 0 3px rgba(61, 220, 132, .3); } 50% { box-shadow: 0 0 0 6px rgba(61, 220, 132, 0); } }
