/* SHT Beraterassistent 0.3.2 – alle Selektoren bleiben im Modul-Namespace. */
.sht-chat,
.sht-chat * {
    box-sizing: border-box;
}

.sht-chat {
    --sht-chat-blue: #003366;
    --sht-chat-link: #0066cc;
    --sht-chat-orange: #f7931e;
    --sht-chat-border: #d8e0e8;
    --sht-chat-muted: #5d6975;
    --sht-chat-surface: #ffffff;
    --sht-chat-soft: #f3f6f8;
    --sht-chat-danger: #a51d2d;
    --sht-chat-viewport-height: 100dvh;
    color: #263442;
    font-family: 'Segoe UI', Arial, sans-serif;
    line-height: 1.45;
}

.sht-chat button,
.sht-chat textarea,
.sht-chat a {
    font: inherit;
}

.sht-chat__trigger {
    align-items: center;
    background: var(--sht-chat-blue);
    border: 2px solid #fff;
    border-radius: 999px;
    bottom: 24px;
    box-shadow: 0 5px 18px rgba(0, 35, 70, 0.28);
    color: #fff;
    cursor: pointer;
    display: flex;
    font-weight: 700;
    gap: 9px;
    min-height: 48px;
    padding: 10px 18px;
    position: fixed;
    right: 24px;
    z-index: 8998;
}

.sht-chat__trigger::before {
    background: #1d2730;
    border-radius: 4px;
    bottom: calc(100% + 8px);
    color: #fff;
    content: attr(data-tooltip);
    font-size: 12px;
    font-weight: 500;
    opacity: 0;
    padding: 6px 9px;
    pointer-events: none;
    position: absolute;
    right: 0;
    transform: translateY(4px);
    transition: opacity .16s ease, transform .16s ease;
    white-space: nowrap;
}

.sht-chat__trigger:hover {
    background: #004b84;
}

.sht-chat__trigger:hover::before,
.sht-chat__trigger:focus-visible::before {
    opacity: 1;
    transform: translateY(0);
}

.sht-chat__trigger img {
    filter: brightness(0) invert(1);
    height: 22px;
    width: 22px;
}

.sht-chat__trigger[hidden] {
    display: none;
}

.sht-chat__panel {
    background: var(--sht-chat-surface);
    border: 1px solid #b9c7d4;
    border-radius: 12px;
    bottom: 84px;
    box-shadow: 0 14px 45px rgba(0, 31, 64, 0.25);
    display: flex;
    flex-direction: column;
    height: min(650px, calc(100dvh - 110px));
    max-height: 650px;
    max-width: calc(100vw - 32px);
    overflow: hidden;
    position: fixed;
    right: 24px;
    width: 400px;
    z-index: 8999;
}

.sht-chat__panel[hidden] {
    display: none;
}

.sht-chat__header {
    align-items: center;
    background: var(--sht-chat-blue);
    border-top: 4px solid var(--sht-chat-orange);
    color: #fff;
    display: flex;
    flex: 0 0 auto;
    gap: 10px;
    justify-content: space-between;
    min-height: 66px;
    padding: 10px 11px 10px 15px;
}

.sht-chat__heading {
    min-width: 0;
}

.sht-chat__heading h2 {
    color: #fff;
    font-size: 16px;
    font-weight: 700;
    line-height: 1.25;
    margin: 0;
    padding: 0;
}

.sht-chat__status {
    align-items: center;
    display: flex;
    font-size: 12px;
    gap: 5px;
    margin-top: 3px;
}

.sht-chat__status > span {
    background: #55c878;
    border: 1px solid rgba(255, 255, 255, .8);
    border-radius: 50%;
    display: inline-block;
    height: 8px;
    width: 8px;
}

.sht-chat__header-actions {
    align-items: center;
    display: flex;
    flex: 0 0 auto;
    gap: 4px;
}

.sht-chat__icon-button,
.sht-chat__new-button {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, .48);
    border-radius: 5px;
    color: #fff;
    cursor: pointer;
    min-height: 34px;
}

.sht-chat__icon-button:hover,
.sht-chat__new-button:hover {
    background: rgba(255, 255, 255, .14);
}

.sht-chat__icon-button {
    align-items: center;
    display: inline-flex;
    font-weight: 800;
    justify-content: center;
    width: 34px;
}

.sht-chat__icon-button svg {
    fill: none;
    height: 18px;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-width: 2;
    width: 18px;
}

.sht-chat__new-button {
    font-size: 12px;
    padding: 5px 8px;
}

.sht-chat__info {
    align-items: center;
    background: #eaf2f8;
    border-bottom: 1px solid #cbd9e5;
    color: #29445d;
    display: flex;
    flex: 0 0 auto;
    flex-wrap: wrap;
    font-size: 12px;
    gap: 4px 10px;
    padding: 9px 14px;
}

.sht-chat__info[hidden] {
    display: none;
}

.sht-chat__info strong {
    color: var(--sht-chat-blue);
}

.sht-chat__info a {
    color: var(--sht-chat-link);
    margin-left: auto;
}

.sht-chat__messages {
    background: #f7f9fb;
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    gap: 12px;
    min-height: 120px;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 16px 14px;
    scrollbar-color: #aebdca transparent;
}

.sht-chat__message {
    display: flex;
    flex-direction: column;
    max-width: 88%;
}

.sht-chat__message--assistant {
    align-self: flex-start;
}

.sht-chat__message--user {
    align-self: flex-end;
}

.sht-chat__bubble {
    background: #fff;
    border: 1px solid var(--sht-chat-border);
    border-radius: 4px 12px 12px 12px;
    box-shadow: 0 1px 3px rgba(0, 31, 64, .06);
    overflow-wrap: anywhere;
    padding: 10px 12px;
    white-space: pre-wrap;
}

.sht-chat__message--user .sht-chat__bubble {
    background: var(--sht-chat-blue);
    border-color: var(--sht-chat-blue);
    border-radius: 12px 4px 12px 12px;
    color: #fff;
}

.sht-chat__bubble p {
    margin: 0 0 8px;
}

.sht-chat__bubble p:last-child {
    margin-bottom: 0;
}

.sht-chat__bubble ul,
.sht-chat__bubble ol {
    margin: 5px 0 8px;
    padding-left: 21px;
}

.sht-chat__bubble li + li {
    margin-top: 3px;
}

.sht-chat__suggestions {
    display: flex;
    flex-direction: column;
    gap: 7px;
    margin-top: 9px;
}

.sht-chat__suggestion {
    background: #fff;
    border: 1px solid var(--sht-chat-link);
    border-radius: 6px;
    color: var(--sht-chat-blue);
    cursor: pointer;
    font-weight: 600;
    padding: 8px 10px;
    text-align: left;
}

.sht-chat__suggestion:hover {
    background: #eaf2f8;
}

.sht-chat__sources {
    border-top: 1px solid #e2e7ec;
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin-top: 10px;
    padding-top: 8px;
}

.sht-chat__sources strong {
    color: var(--sht-chat-muted);
    font-size: 11px;
    text-transform: uppercase;
}

.sht-chat__source {
    color: var(--sht-chat-link);
    font-size: 13px;
    text-decoration: underline;
}

.sht-chat__notice,
.sht-chat__question,
.sht-chat__error {
    border-radius: 7px;
    font-size: 13px;
    margin-top: 9px;
    padding: 9px 10px;
}

.sht-chat__notice {
    background: #eaf2f8;
    border-left: 4px solid var(--sht-chat-blue);
}

.sht-chat__notice--warning {
    background: #fff5e8;
    border-left-color: var(--sht-chat-orange);
}

.sht-chat__question {
    background: #f2f6f9;
    border: 1px solid #cbd9e5;
    color: #243d53;
    font-weight: 600;
}

.sht-chat__error {
    background: #fff0f1;
    border: 1px solid #e5aab1;
    color: #751521;
}

.sht-chat__retry {
    background: #fff;
    border: 1px solid currentColor;
    border-radius: 5px;
    color: var(--sht-chat-danger);
    cursor: pointer;
    display: block;
    font-weight: 700;
    margin-top: 7px;
    padding: 6px 9px;
}

.sht-chat__product {
    background: #fff;
    border: 1px solid #c9d5df;
    border-radius: 8px;
    display: grid;
    gap: 8px 10px;
    grid-template-columns: 72px 1fr;
    margin-top: 10px;
    overflow: hidden;
    padding: 10px;
}

.sht-chat__product-image {
    align-items: center;
    background: #f4f6f8;
    border-radius: 5px;
    display: flex;
    height: 72px;
    justify-content: center;
    overflow: hidden;
    width: 72px;
}

.sht-chat__product-image img {
    height: 100%;
    object-fit: contain;
    width: 100%;
}

.sht-chat__product-main {
    min-width: 0;
}

.sht-chat__product h3 {
    color: var(--sht-chat-blue);
    font-size: 14px;
    line-height: 1.3;
    margin: 0 0 3px;
}

.sht-chat__product-sku,
.sht-chat__product-availability,
.sht-chat__product-label {
    color: var(--sht-chat-muted);
    display: block;
    font-size: 11px;
}

.sht-chat__product-price {
    color: #24303b;
    display: block;
    font-size: 15px;
    font-weight: 700;
    margin-top: 4px;
}

.sht-chat__product-reason,
.sht-chat__product-link {
    grid-column: 1 / -1;
}

.sht-chat__product-reason {
    font-size: 12px;
    margin: 0;
}

.sht-chat__product-link {
    color: var(--sht-chat-link);
    font-size: 13px;
    font-weight: 700;
}

.sht-chat__action {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-top: 10px;
}

.sht-chat__action a {
    background: var(--sht-chat-blue);
    border-radius: 5px;
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    padding: 8px 10px;
    text-decoration: none;
}

.sht-chat__action a + a {
    background: #fff;
    border: 1px solid var(--sht-chat-blue);
    color: var(--sht-chat-blue);
}

.sht-chat__activity {
    align-items: center;
    background: #f7f9fb;
    color: var(--sht-chat-muted);
    display: flex;
    flex: 0 0 auto;
    font-size: 12px;
    gap: 8px;
    padding: 5px 15px;
}

.sht-chat__activity[hidden] {
    display: none;
}

.sht-chat__typing {
    display: inline-flex;
    gap: 3px;
}

.sht-chat__typing i {
    animation: sht-chat-bounce 1.1s infinite ease-in-out;
    background: var(--sht-chat-blue);
    border-radius: 50%;
    height: 5px;
    width: 5px;
}

.sht-chat__typing i:nth-child(2) { animation-delay: .14s; }
.sht-chat__typing i:nth-child(3) { animation-delay: .28s; }

.sht-chat__composer {
    background: #fff;
    border-top: 1px solid var(--sht-chat-border);
    flex: 0 0 auto;
    padding: 10px 12px 8px;
}

.sht-chat__composer textarea {
    background: #fff;
    border: 1px solid #9eacb8;
    border-radius: 6px;
    color: #263442;
    display: block;
    max-height: 112px;
    min-height: 48px;
    padding: 8px 9px;
    resize: vertical;
    width: 100%;
}

.sht-chat__composer-row {
    align-items: center;
    display: flex;
    gap: 8px;
    justify-content: space-between;
    margin-top: 7px;
}

.sht-chat__composer-row > span {
    color: var(--sht-chat-muted);
    font-size: 10px;
    line-height: 1.25;
}

.sht-chat__send,
.sht-chat__stop {
    border: 0;
    border-radius: 5px;
    color: #fff;
    cursor: pointer;
    flex: 0 0 auto;
    font-weight: 700;
    min-width: 76px;
    padding: 8px 13px;
}

.sht-chat__send {
    background: var(--sht-chat-blue);
}

.sht-chat__send:hover {
    background: #004b84;
}

.sht-chat__send:disabled {
    background: #8794a0;
    cursor: not-allowed;
}

.sht-chat__stop {
    background: #9c2633;
}

.sht-chat__stop[hidden] {
    display: none;
}

.sht-chat__disclaimer {
    background: #f1f3f5;
    border-top: 1px solid #dce2e7;
    color: #515d67;
    flex: 0 0 auto;
    font-size: 10px;
    line-height: 1.3;
    margin: 0;
    padding: 6px 12px;
}

.sht-chat button:focus-visible,
.sht-chat textarea:focus-visible,
.sht-chat a:focus-visible {
    outline: 3px solid #ffb04c;
    outline-offset: 2px;
}

.sht-chat__sr-only {
    clip: rect(0, 0, 0, 0) !important;
    clip-path: inset(50%) !important;
    height: 1px !important;
    overflow: hidden !important;
    position: absolute !important;
    white-space: nowrap !important;
    width: 1px !important;
}

@keyframes sht-chat-bounce {
    0%, 70%, 100% { opacity: .35; transform: translateY(0); }
    35% { opacity: 1; transform: translateY(-3px); }
}

@media (max-width: 600px) {
    body.sht-chat-open {
        overflow: hidden;
    }

    .sht-chat__trigger {
        bottom: 56px;
        right: 12px;
    }

    .sht-chat__panel {
        border: 0;
        border-radius: 0;
        bottom: auto;
        height: var(--sht-chat-viewport-height);
        inset: 0;
        max-height: none;
        max-width: none;
        right: auto;
        width: 100%;
    }

    .sht-chat__header {
        min-height: 60px;
        padding-left: 12px;
    }

    .sht-chat__heading h2 {
        font-size: 15px;
    }

    .sht-chat__new-button {
        max-width: 75px;
        padding: 4px 6px;
    }

    .sht-chat__messages {
        padding: 12px 10px;
    }

    .sht-chat__message {
        max-width: 92%;
    }

    .sht-chat__composer {
        padding-bottom: max(8px, env(safe-area-inset-bottom));
    }

    .sht-chat__composer textarea {
        font-size: 16px; /* verhindert iOS-Autozoom */
        resize: none;
    }
}

@media (max-width: 370px) {
    .sht-chat__new-button {
        font-size: 0;
        width: 34px;
    }

    .sht-chat__new-button::after {
        content: '+';
        font-size: 20px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .sht-chat *,
    .sht-chat *::before,
    .sht-chat *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
        transition-duration: .01ms !important;
    }
}
