.m8-chatbot,
.m8-chatbot * {
    box-sizing: border-box;
}

.m8-chatbot {
    position: fixed;
    z-index: 2147482000;
    color: var(--m8-chatbot-text);
    font-family: inherit;
    line-height: 1.45;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: opacity .22s ease, transform .22s ease, visibility .22s ease;
    animation: m8-chatbot-fallback-show 0s linear var(--m8-chatbot-delay, 0s) forwards;
}

@keyframes m8-chatbot-fallback-show {
    to {
        opacity: 1;
        visibility: visible;
    }
}

.m8-chatbot.is-visible {
    animation: none;
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.m8-chatbot--bottom_right {
    right: var(--m8-chatbot-offset-x);
    bottom: var(--m8-chatbot-offset-y);
}

.m8-chatbot--bottom_left {
    left: var(--m8-chatbot-offset-x);
    bottom: var(--m8-chatbot-offset-y);
}

.m8-chatbot--middle_right {
    right: var(--m8-chatbot-offset-x);
    top: 50%;
    transform: translateY(calc(-50% + 10px));
}

.m8-chatbot--middle_right.is-visible {
    transform: translateY(-50%);
}

.m8-chatbot--middle_left {
    left: var(--m8-chatbot-offset-x);
    top: 50%;
    transform: translateY(calc(-50% + 10px));
}

.m8-chatbot--middle_left.is-visible {
    transform: translateY(-50%);
}

.m8-chatbot__trigger {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-width: var(--m8-chatbot-trigger-size);
    height: var(--m8-chatbot-trigger-size);
    padding: 0 18px;
    border: 0;
    border-radius: calc(var(--m8-chatbot-trigger-size) / 2);
    background: var(--m8-chatbot-primary);
    color: var(--m8-chatbot-header-text);
    box-shadow: 0 12px 35px rgba(0, 0, 0, .22);
    cursor: pointer;
    font: inherit;
    font-weight: 700;
}

.m8-chatbot__trigger:hover,
.m8-chatbot__trigger:focus-visible {
    filter: brightness(1.08);
}

.m8-chatbot__trigger-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.m8-chatbot__trigger-label {
    white-space: nowrap;
}

.m8-chatbot.is-open .m8-chatbot__trigger {
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
}

.m8-chatbot__panel {
    position: absolute;
    display: flex;
    flex-direction: column;
    width: min(var(--m8-chatbot-width), calc(100vw - 24px));
    height: min(var(--m8-chatbot-height), calc(100vh - 24px));
    overflow: hidden;
    border: 1px solid rgba(15, 23, 42, .12);
    border-radius: 18px;
    background: var(--m8-chatbot-panel);
    box-shadow: 0 24px 70px rgba(15, 23, 42, .28);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(12px) scale(.985);
    transform-origin: bottom right;
    transition: opacity .2s ease, transform .2s ease, visibility .2s ease;
}

.m8-chatbot--bottom_right .m8-chatbot__panel,
.m8-chatbot--bottom_left .m8-chatbot__panel {
    bottom: 0;
}

.m8-chatbot--bottom_right .m8-chatbot__panel,
.m8-chatbot--middle_right .m8-chatbot__panel {
    right: 0;
}

.m8-chatbot--bottom_left .m8-chatbot__panel,
.m8-chatbot--middle_left .m8-chatbot__panel {
    left: 0;
    transform-origin: bottom left;
}

.m8-chatbot--middle_right .m8-chatbot__panel,
.m8-chatbot--middle_left .m8-chatbot__panel {
    top: 50%;
    transform: translateY(-47%) scale(.985);
}

.m8-chatbot.is-open .m8-chatbot__panel {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0) scale(1);
}

.m8-chatbot--middle_right.is-open .m8-chatbot__panel,
.m8-chatbot--middle_left.is-open .m8-chatbot__panel {
    transform: translateY(-50%) scale(1);
}

.m8-chatbot__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 14px 14px 16px;
    background: var(--m8-chatbot-primary);
    color: var(--m8-chatbot-header-text);
}

.m8-chatbot__identity {
    display: flex;
    align-items: center;
    min-width: 0;
    gap: 10px;
}

.m8-chatbot__identity > span:last-child {
    display: flex;
    min-width: 0;
    flex-direction: column;
}

.m8-chatbot__identity strong,
.m8-chatbot__identity small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.m8-chatbot__identity strong {
    font-size: 15px;
}

.m8-chatbot__identity small {
    opacity: .78;
    font-size: 11px;
}

.m8-chatbot__avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .16);
}

.m8-chatbot__header-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

.m8-chatbot__header-actions button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: inherit;
    cursor: pointer;
    font: inherit;
    font-size: 24px;
    line-height: 1;
}

.m8-chatbot__header-actions button:hover,
.m8-chatbot__header-actions button:focus-visible {
    background: rgba(255, 255, 255, .14);
}

.m8-chatbot__messages {
    flex: 1 1 auto;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    padding: 18px 16px;
    background:
        linear-gradient(rgba(255,255,255,.78), rgba(255,255,255,.78)),
        var(--m8-chatbot-panel);
    overscroll-behavior: contain;
}

.m8-chatbot__message {
    display: flex;
    margin: 0 0 12px;
}

.m8-chatbot__message--user {
    justify-content: flex-end;
}

.m8-chatbot__bubble {
    max-width: 86%;
    padding: 11px 13px;
    border-radius: 16px 16px 16px 5px;
    background: #eef2f7;
    color: #1f2937;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .06);
    overflow-wrap: anywhere;
}

.m8-chatbot__message--user .m8-chatbot__bubble {
    border-radius: 16px 16px 5px 16px;
    background: var(--m8-chatbot-primary);
    color: var(--m8-chatbot-header-text);
}

.m8-chatbot__bubble > :first-child {
    margin-top: 0;
}

.m8-chatbot__bubble > :last-child {
    margin-bottom: 0;
}

.m8-chatbot__bubble p {
    margin: 0 0 8px;
}

.m8-chatbot__bubble ul,
.m8-chatbot__bubble ol {
    margin: 8px 0 8px 18px;
    padding: 0;
}

.m8-chatbot__topics,
.m8-chatbot__suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 4px 0 14px;
}

.m8-chatbot__topic,
.m8-chatbot__suggestion {
    padding: 8px 11px;
    border: 1px solid color-mix(in srgb, var(--m8-chatbot-primary) 32%, #d5dbe4);
    border-radius: 999px;
    background: var(--m8-chatbot-panel);
    color: var(--m8-chatbot-text);
    cursor: pointer;
    font: inherit;
    font-size: 13px;
    line-height: 1.25;
}

.m8-chatbot__topic:hover,
.m8-chatbot__topic:focus-visible,
.m8-chatbot__suggestion:hover,
.m8-chatbot__suggestion:focus-visible,
.m8-chatbot__topic.is-active {
    border-color: var(--m8-chatbot-primary);
    background: var(--m8-chatbot-primary);
    color: var(--m8-chatbot-header-text);
}

.m8-chatbot__sources {
    display: grid;
    gap: 8px;
    margin: 0 0 14px;
}

.m8-chatbot__source {
    display: block;
    padding: 10px 11px;
    border: 1px solid rgba(15, 23, 42, .11);
    border-radius: 11px;
    background: rgba(255, 255, 255, .88);
    color: #1f2937;
    text-decoration: none;
    transition: border-color .15s ease, transform .15s ease;
}

.m8-chatbot__source:hover,
.m8-chatbot__source:focus-visible {
    border-color: var(--m8-chatbot-primary);
    transform: translateY(-1px);
}

.m8-chatbot__source strong,
.m8-chatbot__source span {
    display: block;
}

.m8-chatbot__source strong {
    margin-bottom: 3px;
    font-size: 13px;
}

.m8-chatbot__source span {
    color: #667085;
    font-size: 11px;
    line-height: 1.4;
}

.m8-chatbot__typing .m8-chatbot__bubble {
    display: inline-flex;
    align-items: center;
    min-width: 52px;
    gap: 4px;
}

.m8-chatbot__typing i {
    display: block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #8792a2;
    animation: m8-chatbot-bounce 1s infinite ease-in-out;
}

.m8-chatbot__typing i:nth-child(2) {
    animation-delay: .15s;
}

.m8-chatbot__typing i:nth-child(3) {
    animation-delay: .3s;
}

@keyframes m8-chatbot-bounce {
    0%, 60%, 100% { transform: translateY(0); opacity: .55; }
    30% { transform: translateY(-4px); opacity: 1; }
}

.m8-chatbot__form {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
    padding: 11px;
    border-top: 1px solid rgba(15, 23, 42, .1);
    background: var(--m8-chatbot-panel);
}

.m8-chatbot__input {
    flex: 1 1 auto;
    min-width: 0;
    height: 44px;
    padding: 0 13px;
    border: 1px solid #d5dbe4;
    border-radius: 12px;
    background: #fff;
    color: #1f2937;
    font: inherit;
    outline: none;
}

.m8-chatbot__input:focus {
    border-color: var(--m8-chatbot-primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--m8-chatbot-primary) 16%, transparent);
}

.m8-chatbot__send {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 44px;
    height: 44px;
    padding: 0;
    border: 0;
    border-radius: 12px;
    background: var(--m8-chatbot-primary);
    color: var(--m8-chatbot-header-text);
    cursor: pointer;
}

.m8-chatbot__send:disabled,
.m8-chatbot__input:disabled {
    cursor: wait;
    opacity: .65;
}

.m8-chatbot__sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

@media (max-width: 640px) {
    .m8-chatbot {
        right: 12px !important;
        bottom: 12px !important;
        left: 12px !important;
        top: auto !important;
        transform: translateY(10px) !important;
    }

    .m8-chatbot.is-visible {
        transform: translateY(0) !important;
    }

    .m8-chatbot__panel {
        position: fixed;
        right: 8px !important;
        bottom: 8px !important;
        left: 8px !important;
        top: 8px !important;
        width: auto;
        height: auto;
        max-height: none;
        border-radius: 16px;
        transform: translateY(12px) scale(.985) !important;
    }

    .m8-chatbot.is-open .m8-chatbot__panel {
        transform: translateY(0) scale(1) !important;
    }

    .m8-chatbot__trigger {
        margin-left: auto;
    }
}

@media (prefers-reduced-motion: reduce) {
    .m8-chatbot,
    .m8-chatbot__panel,
    .m8-chatbot__source {
        transition: none;
    }

    .m8-chatbot__typing i {
        animation: none;
    }
}

/* Dynamische Themenvorschläge nach einer Nutzereingabe. */
.m8-chatbot__suggestions-wrap {
    margin: 2px 0 14px;
}

.m8-chatbot__suggestions-label {
    display: block;
    margin: 0 0 7px;
    color: color-mix(in srgb, var(--m8-chatbot-text) 72%, transparent);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .02em;
}

.m8-chatbot__suggestions-wrap .m8-chatbot__suggestions {
    margin: 0;
}

.m8-chatbot__suggestion.is-active {
    border-color: var(--m8-chatbot-primary);
    background: var(--m8-chatbot-primary);
    color: var(--m8-chatbot-header-text);
}
