/* FAQ-Chatbot – unten rechts */
.ab-chat {
    --ab-chat-z: 1200;
    position: fixed;
    right: 1rem;
    bottom: 1rem;
    z-index: var(--ab-chat-z);
    font-family: var(--font-body, system-ui, sans-serif);
    color: var(--color-foreground, #1a1a1a);
}

.ab-chat__toggle {
    width: 3.5rem;
    height: 3.5rem;
    border: 0;
    border-radius: 999px;
    background: var(--color-forest, hsl(152, 45%, 28%));
    color: #fff;
    box-shadow: 0 10px 28px hsla(152, 45%, 20%, 0.35);
    cursor: pointer;
    display: grid;
    place-items: center;
    transition: transform 0.18s ease, background 0.18s ease;
}

.ab-chat__toggle:hover,
.ab-chat__toggle:focus-visible {
    background: var(--color-forest-dark, hsl(152, 48%, 20%));
    transform: translateY(-2px);
    outline: none;
}

.ab-chat__toggle:focus-visible {
    box-shadow: 0 0 0 3px #fff, 0 0 0 6px var(--color-accent, hsl(35, 60%, 55%));
}

.ab-chat__toggle-icon {
    width: 1.45rem;
    height: 1.45rem;
    display: block;
}

.ab-chat.is-open .ab-chat__toggle {
    display: none;
}

.ab-chat__panel {
    width: min(22.5rem, calc(100vw - 1.5rem));
    height: min(32rem, calc(100vh - 5.5rem));
    background: #fff;
    border: 1px solid var(--color-border, hsl(40, 15%, 85%));
    border-radius: 1rem;
    box-shadow: 0 18px 50px hsla(152, 30%, 15%, 0.22);
    display: none;
    flex-direction: column;
    overflow: hidden;
}

.ab-chat.is-open .ab-chat__panel {
    display: flex;
}

.ab-chat__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.9rem 1rem;
    background: linear-gradient(145deg, var(--color-forest, hsl(152, 45%, 28%)), var(--color-forest-mid, hsl(148, 30%, 42%)));
    color: #fff;
}

.ab-chat__head-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.25;
}

.ab-chat__head-sub {
    margin: 0.2rem 0 0;
    font-size: 0.8rem;
    opacity: 0.92;
    line-height: 1.35;
}

.ab-chat__close {
    border: 0;
    background: transparent;
    color: #fff;
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
    padding: 0.15rem 0.35rem;
    border-radius: 0.35rem;
}

.ab-chat__close:hover,
.ab-chat__close:focus-visible {
    background: hsla(0, 0%, 100%, 0.15);
    outline: none;
}

.ab-chat__log {
    flex: 1;
    overflow-y: auto;
    padding: 0.85rem 0.9rem;
    background: var(--color-bg, hsl(40, 20%, 97%));
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.ab-chat__row {
    display: flex;
}

.ab-chat__row--user {
    justify-content: flex-end;
}

.ab-chat__row--bot {
    justify-content: flex-start;
}

.ab-chat__bubble {
    max-width: 92%;
    padding: 0.65rem 0.8rem;
    border-radius: 0.85rem;
    font-size: 0.9rem;
    line-height: 1.45;
    white-space: normal;
}

.ab-chat__bubble a {
    color: inherit;
    text-decoration: underline;
    word-break: break-word;
}

.ab-chat__bubble--bot {
    background: #fff;
    border: 1px solid var(--color-border, hsl(40, 15%, 85%));
    color: var(--color-foreground, #1a1a1a);
    border-bottom-left-radius: 0.25rem;
}

.ab-chat__bubble--user {
    background: var(--color-forest, hsl(152, 45%, 28%));
    color: #fff;
    border-bottom-right-radius: 0.25rem;
}

.ab-chat__chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    padding: 0 0.85rem 0.65rem;
    background: var(--color-bg, hsl(40, 20%, 97%));
}

.ab-chat__chip {
    border: 1px solid var(--color-border, hsl(40, 15%, 85%));
    background: #fff;
    color: var(--color-forest-dark, hsl(152, 48%, 20%));
    border-radius: 999px;
    padding: 0.35rem 0.7rem;
    font-size: 0.75rem;
    cursor: pointer;
    line-height: 1.2;
}

.ab-chat__chip:hover,
.ab-chat__chip:focus-visible {
    border-color: var(--color-forest-mid, hsl(148, 30%, 42%));
    background: var(--color-sand, hsl(40, 30%, 90%));
    outline: none;
}

.ab-chat__form {
    display: flex;
    gap: 0.45rem;
    padding: 0.7rem 0.8rem;
    border-top: 1px solid var(--color-border, hsl(40, 15%, 85%));
    background: #fff;
}

.ab-chat__input {
    flex: 1;
    min-width: 0;
    border: 1px solid var(--color-border, hsl(40, 15%, 85%));
    border-radius: 0.65rem;
    padding: 0.55rem 0.7rem;
    font: inherit;
    font-size: 0.9rem;
    background: #fff;
}

.ab-chat__input:focus {
    outline: 2px solid hsla(152, 45%, 28%, 0.35);
    border-color: var(--color-forest-mid, hsl(148, 30%, 42%));
}

.ab-chat__send {
    border: 0;
    border-radius: 0.65rem;
    padding: 0.55rem 0.85rem;
    background: var(--color-accent, hsl(35, 60%, 55%));
    color: #1a1a1a;
    font-weight: 700;
    font-size: 0.85rem;
    cursor: pointer;
}

.ab-chat__send:hover,
.ab-chat__send:focus-visible {
    background: var(--color-accent-hover, hsl(35, 62%, 48%));
    outline: none;
}

.ab-chat.is-busy .ab-chat__send {
    opacity: 0.7;
    pointer-events: none;
}

.ab-chat__status {
    min-height: 1rem;
    margin: 0;
    padding: 0 0.9rem 0.45rem;
    font-size: 0.75rem;
    color: var(--color-stone, #666);
    background: #fff;
}

.ab-chat__hp {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

@media (max-width: 480px) {
    .ab-chat {
        right: 0.65rem;
        bottom: 0.65rem;
    }

    .ab-chat__panel {
        width: min(100vw - 1.1rem, 22.5rem);
        height: min(78vh, 32rem);
    }
}

/* Über Cookie-Banner heben, wenn beide sichtbar */
.cookie-banner:not([hidden]) ~ .ab-chat,
body:has(.cookie-banner:not([hidden])) .ab-chat {
    bottom: 5.5rem;
}
