/* =====================================================================
   KI-Chat: Knopf unten rechts und kleines Chatfenster
   ===================================================================== */
.kc-knopf {
    position: fixed;
    right: 22px;
    bottom: 26px;
    z-index: 9000;
    width: 62px;
    height: 62px;
    border-radius: 50%;
    border: 0;
    background: var(--primary-color, #00a3e0);
    color: #fff;
    font-size: 26px;
    cursor: pointer;
    box-shadow: 0 6px 18px rgba(0, 0, 0, .25);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform .2s, background-color .2s;
}
.kc-knopf:hover { background: #008cc2; transform: scale(1.06); }
.kc-knopf:focus-visible { outline: 3px solid #ffc107; outline-offset: 3px; }
.kc-knopf .kc-auf, .kc-knopf .kc-zu { display: flex; align-items: center; justify-content: center; line-height: 0; }
.kc-knopf .kc-zu { display: none; }
.kc-offen .kc-knopf .kc-auf { display: none; }
.kc-offen .kc-knopf .kc-zu { display: flex; }
.kc-senden { display: flex; align-items: center; justify-content: center; padding: 0; }

/* Wackeln, um den Blick zu lenken */
@keyframes kc-wackeln {
    0%, 100% { transform: rotate(0); }
    15% { transform: rotate(-14deg) scale(1.08); }
    30% { transform: rotate(12deg) scale(1.08); }
    45% { transform: rotate(-9deg) scale(1.05); }
    60% { transform: rotate(6deg); }
    75% { transform: rotate(-3deg); }
}
.kc-knopf.kc-wackeln { animation: kc-wackeln .9s ease-in-out; }
@media (prefers-reduced-motion: reduce) { .kc-knopf.kc-wackeln { animation: none; } }

/* Kleine Sprechblase neben dem Knopf */
.kc-hinweis {
    position: fixed;
    right: 96px;
    bottom: 38px;
    z-index: 9000;
    background: #fff;
    color: #333;
    padding: 10px 14px;
    border-radius: 12px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, .18);
    font-size: 14px;
    font-weight: 600;
    max-width: 220px;
    cursor: pointer;
    opacity: 0;
    transform: translateX(10px);
    pointer-events: none;
    transition: opacity .3s, transform .3s;
}
.kc-hinweis::after {
    content: "";
    position: absolute;
    right: -7px;
    bottom: 14px;
    border: 7px solid transparent;
    border-right: 0;
    border-left-color: #fff;
}
.kc-hinweis.kc-sichtbar { opacity: 1; transform: none; pointer-events: auto; }
.kc-offen .kc-hinweis { display: none; }

/* Chatfenster */
.kc-fenster {
    position: fixed;
    right: 22px;
    bottom: 100px;
    z-index: 9001;
    width: 370px;
    height: min(560px, calc(100vh - 130px));
    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;
    color: #333;
}
.kc-offen .kc-fenster { display: flex; animation: kc-auf .2s ease-out; }
@keyframes kc-auf { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

.kc-kopf {
    background: var(--primary-color, #00a3e0);
    color: #fff;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}
.kc-kopf-symbol {
    width: 38px; height: 38px; border-radius: 50%;
    background: rgba(255, 255, 255, .2);
    display: flex; align-items: center; justify-content: center; font-size: 18px; flex-shrink: 0;
}
.kc-kopf-text { flex: 1; min-width: 0; line-height: 1.25; }
.kc-kopf-text strong { display: block; font-size: 16px; }
.kc-kopf-text span { font-size: 12.5px; opacity: .9; }
.kc-schliessen {
    background: transparent; border: 0; color: #fff; font-size: 22px; cursor: pointer;
    width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0;
}
.kc-schliessen:hover { background: rgba(255, 255, 255, .2); }

.kc-nachrichten {
    flex: 1;
    overflow-y: auto;
    padding: 16px 14px;
    background: #f5f7f9;
    display: flex;
    flex-direction: column;
    gap: 10px;
    overscroll-behavior: contain;
}
.kc-blase {
    max-width: 85%;
    padding: 10px 13px;
    border-radius: 14px;
    font-size: 14.5px;
    line-height: 1.45;
    word-wrap: break-word;
    overflow-wrap: anywhere;
}
.kc-blase.kc-ki { background: #fff; border: 1px solid #e3e7eb; border-bottom-left-radius: 4px; align-self: flex-start; }
.kc-blase.kc-ich { background: var(--primary-color, #00a3e0); color: #fff; border-bottom-right-radius: 4px; align-self: flex-end; }
.kc-blase.kc-fehler { background: #fdecea; border: 1px solid #f5c6cb; color: #721c24; align-self: flex-start; }
.kc-blase a { color: inherit; text-decoration: underline; }

.kc-tippt { display: inline-flex; gap: 4px; padding: 14px 16px; }
.kc-tippt i {
    width: 7px; height: 7px; border-radius: 50%; background: #9aa5b1; display: block;
    animation: kc-punkt 1.2s infinite ease-in-out;
}
.kc-tippt i:nth-child(2) { animation-delay: .15s; }
.kc-tippt i:nth-child(3) { animation-delay: .3s; }
@keyframes kc-punkt { 0%, 80%, 100% { opacity: .3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-4px); } }

.kc-eingabe {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 10px 12px;
    border-top: 1px solid #e3e7eb;
    background: #fff;
    flex-shrink: 0;
}
.kc-eingabe textarea {
    flex: 1;
    resize: none;
    border: 1px solid #d5dbe1;
    border-radius: 18px;
    padding: 9px 14px;
    font-family: inherit;
    font-size: 15px;
    line-height: 1.35;
    max-height: 110px;
    min-height: 40px;
    outline: none;
    background: #fff;
    margin: 0;
}
.kc-eingabe textarea:focus { border-color: var(--primary-color, #00a3e0); }
.kc-senden {
    width: 40px; height: 40px; border-radius: 50%; border: 0; flex-shrink: 0;
    background: var(--primary-color, #00a3e0); color: #fff; font-size: 16px; cursor: pointer;
}
.kc-senden:disabled { background: #b8c4ce; cursor: default; }

.kc-hinweistext {
    font-size: 11px;
    color: #8a949e;
    padding: 0 14px 9px;
    background: #fff;
    line-height: 1.35;
    flex-shrink: 0;
}
.kc-hinweistext a { color: #8a949e; }

/* Handy: Knopf ueber der Bewertungsleiste, Fenster bildschirmfuellend */
@media (max-width: 600px) {
    .kc-knopf { right: 16px; bottom: 92px; width: 58px; height: 58px; font-size: 24px; }
    .kc-hinweis { right: 84px; bottom: 102px; }
    .kc-fenster {
        right: 0; bottom: 0; left: 0; top: 0;
        width: 100%; height: 100%;
        height: 100dvh;
        border-radius: 0;
    }
    .kc-offen .kc-knopf { display: none; }
    .kc-eingabe textarea { font-size: 16px; } /* verhindert Zoom auf dem iPhone */
}
