.juschat {
    position: fixed;
    right: 16px;
    bottom: 16px;
    z-index: 10050;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    pointer-events: none;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 15px;
    line-height: 1.45;
    color: #111827;
}

.juschat-launcher,
.juschat-send,
.juschat-close {
    font: inherit;
    cursor: pointer;
}

.juschat-launcher {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
    max-width: 280px;
    pointer-events: auto;
    border: 0;
    border-radius: 999px;
    padding: 12px 18px;
    background: #0345bf;
    color: #fff;
    box-shadow: 0 8px 24px rgba(3, 69, 191, 0.28);
    animation: juschat-pulse 2.4s ease-in-out infinite;
}

.juschat.is-seen .juschat-launcher,
.juschat.is-open .juschat-launcher {
    animation: none;
}

.juschat.is-nudging .juschat-launcher {
    animation: juschat-nudge 0.65s ease;
}

.juschat-launcher:hover,
.juschat-launcher:focus-visible {
    background: #044cd0;
}

.juschat-teaser {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    max-width: 260px;
    margin: 0 0 10px;
    padding: 12px 14px;
    border-radius: 16px;
    background: #fff;
    color: #111827;
    box-shadow: 0 10px 28px rgba(17, 24, 39, 0.16);
    pointer-events: auto;
}

.juschat-teaser p {
    margin: 0;
}

.juschat-teaser-close {
    flex: none;
    border: 0;
    padding: 0;
    background: transparent;
    color: #6b7280;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
}

.juschat-teaser[hidden],
.juschat.is-open .juschat-teaser {
    display: none;
}

.juschat-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 0 14px 12px;
}

.juschat-suggestions[hidden] {
    display: none;
}

.juschat-suggestion {
    border: 1px solid #d5deea;
    border-radius: 999px;
    padding: 8px 12px;
    background: #fff;
    color: #0345bf;
    font: inherit;
    cursor: pointer;
}

.juschat-suggestion:hover,
.juschat-suggestion:focus-visible {
    border-color: #0345bf;
    background: #eff6ff;
}

.juschat-icon {
    width: 20px;
    height: 20px;
    flex: none;
}

.juschat-panel {
    position: absolute;
    right: 0;
    bottom: calc(100% + 12px);
    display: flex;
    flex-direction: column;
    width: min(360px, calc(100vw - 32px));
    height: min(520px, calc(100vh - 96px));
    overflow: hidden;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 16px 40px rgba(17, 24, 39, 0.2);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(16px) scale(0.96);
    transform-origin: bottom right;
    transition: opacity 0.35s ease, transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1), visibility 0.4s;
}

.juschat.is-open .juschat-panel {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: none;
}

.juschat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    background: #2b2b7b;
    color: #fff;
}

.juschat-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    font-size: 15px;
    font-weight: 700;
}

.juschat-close {
    border: 0;
    background: transparent;
    color: #fff;
    font-size: 24px;
    line-height: 1;
}

.juschat-log {
    flex: 1;
    overflow: auto;
    padding: 14px;
    background: #f8fafc;
}

.juschat-message {
    margin: 0 0 10px;
    max-width: 90%;
    padding: 8px 10px;
    border-radius: 12px;
    white-space: pre-wrap;
    animation: juschat-message-in 0.28s ease;
}

.juschat-message-assistant {
    background: #fff;
    border: 1px solid #e5e7eb;
}

.juschat-message.is-typing::after {
    content: "";
    display: inline-block;
    width: 2px;
    height: 0.95em;
    margin-left: 1px;
    background: #0345bf;
    vertical-align: text-bottom;
    animation: juschat-caret 0.9s steps(1) infinite;
}

.juschat-message-user {
    margin-left: auto;
    background: #dbeafe;
}

.juschat-message a {
    color: #0345bf;
    font-weight: 700;
}

.juschat-note,
.juschat-links {
    margin: 0;
    padding: 0 14px 8px;
    color: #4b5563;
    font-size: 12px;
}

.juschat-links a {
    color: #0345bf;
}

.juschat-form {
    display: flex;
    gap: 8px;
    padding: 0 14px 14px;
}

.juschat-input {
    flex: 1;
    min-width: 0;
    resize: none;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    padding: 8px 10px;
    font: inherit;
}

.juschat-send {
    border: 0;
    border-radius: 10px;
    padding: 8px 12px;
    background: #0345bf;
    color: #fff;
}

.juschat-send:disabled {
    opacity: 0.6;
    cursor: default;
}

@media (min-width: 992px) {
    .juschat {
        bottom: 48px;
    }

    .juschat-panel {
        height: min(520px, calc(100vh - 140px));
    }
}

@keyframes juschat-pulse {
    0%,
    100% {
        transform: translateY(0);
        box-shadow: 0 8px 24px rgba(3, 69, 191, 0.28);
    }

    50% {
        transform: translateY(-5px);
        box-shadow: 0 16px 32px rgba(3, 69, 191, 0.42);
    }
}

@keyframes juschat-nudge {
    0%,
    100% {
        transform: translateY(0) scale(1);
    }

    35% {
        transform: translateY(-10px) scale(1.05);
    }

    70% {
        transform: translateY(0) scale(1);
    }
}

@keyframes juschat-caret {
    0%,
    45% {
        opacity: 1;
    }

    50%,
    100% {
        opacity: 0;
    }
}

@keyframes juschat-message-in {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .juschat-launcher,
    .juschat-panel,
    .juschat-message,
    .juschat-message.is-typing::after {
        animation: none;
        transition: none;
    }
}
