:root {
    --legans-chatbot-blue: #042862;
    --legans-chatbot-blue-dark: #021a40;
    --legans-chatbot-ink: #182033;
    --legans-chatbot-muted: #687384;
    --legans-chatbot-cream: #f6f8fc;
    --legans-chatbot-border: #dce4ef;
    --legans-chatbot-white: #fff;
}

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

.legans-chatbot {
    position: fixed;
    right: auto;
    bottom: 80px;
    left: calc(80% + 7px);
    width: 56px;
    height: 56px;
    z-index: 10050;
    color: var(--legans-chatbot-ink);
    font-family: "Poppins", Arial, sans-serif;
    font-size: 14px;
    line-height: 1.45;
}

.legans-chatbot__launcher {
    position: absolute;
    right: 0;
    bottom: 0;
    width: 56px;
    height: 56px;
    padding: 3px;
    overflow: hidden;
    border: 4px solid var(--legans-chatbot-blue);
    border-radius: 50%;
    background: var(--legans-chatbot-white);
    color: var(--legans-chatbot-white);
    box-shadow: 0 10px 24px rgba(4, 40, 98, .28);
    cursor: pointer;
    transition: transform .2s ease, background .2s ease;
}

.legans-chatbot__launcher:hover,
.legans-chatbot__launcher:focus-visible {
    background: var(--legans-chatbot-white);
    transform: translateY(-2px);
    outline: 3px solid rgba(4, 40, 98, .2);
    outline-offset: 3px;
}

.legans-chatbot__launcher-icon {
    display: grid;
    width: 100%;
    height: 100%;
    overflow: hidden;
    place-items: center;
    border-radius: 50%;
    background: var(--legans-chatbot-white);
}

.legans-chatbot__launcher-icon img {
    width: 92%;
    height: 92%;
    object-fit: contain;
}

.legans-chatbot__launcher-close {
    display: none;
    font-size: 34px;
    font-weight: 300;
    line-height: 1;
}

.legans-chatbot--open .legans-chatbot__launcher-icon {
    display: none;
}

.legans-chatbot--open .legans-chatbot__launcher {
    border-color: var(--legans-chatbot-blue);
    background: var(--legans-chatbot-blue);
}

.legans-chatbot--open .legans-chatbot__launcher-close {
    display: inline;
}

.legans-chatbot__window {
    position: absolute;
    right: 0;
    bottom: 70px;
    display: flex;
    width: min(340px, calc(100vw - 40px));
    height: min(520px, calc(100vh - 110px));
    min-height: 440px;
    overflow: hidden;
    flex-direction: column;
    border: 1px solid var(--legans-chatbot-border);
    border-radius: 14px;
    background: var(--legans-chatbot-white);
    box-shadow: 0 16px 42px rgba(35, 29, 23, .22);
    opacity: 0;
    pointer-events: none;
    transform: translateY(18px) scale(.98);
    transform-origin: right bottom;
    transition: opacity .22s ease, transform .22s ease;
}

.legans-chatbot--open .legans-chatbot__window {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0) scale(1);
}

.legans-chatbot__header {
    display: flex;
    min-height: 58px;
    padding: 9px 11px;
    align-items: center;
    gap: 9px;
    background: var(--legans-chatbot-blue);
    color: var(--legans-chatbot-white);
}

.legans-chatbot__avatar {
    width: 34px;
    height: 34px;
    overflow: hidden;
    flex: 0 0 34px;
    border: 2px solid rgba(255, 255, 255, .78);
    border-radius: 50%;
    background: var(--legans-chatbot-white);
}

.legans-chatbot__avatar img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.legans-chatbot__identity {
    min-width: 0;
    flex: 1;
}

.legans-chatbot__identity h2,
.legans-chatbot__identity p {
    margin: 0;
    color: inherit;
}

.legans-chatbot__identity h2 {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .01em;
}

.legans-chatbot__identity p {
    display: flex;
    margin-top: 1px;
    align-items: center;
    gap: 6px;
    font-size: 9px;
    opacity: .82;
}

.legans-chatbot__status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #62c684;
    box-shadow: 0 0 0 3px rgba(98, 198, 132, .15);
}

.legans-chatbot__minimize {
    display: grid;
    width: 30px;
    height: 30px;
    padding: 0;
    place-items: center;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, .09);
    color: var(--legans-chatbot-white);
    cursor: pointer;
    font-size: 20px;
}

.legans-chatbot__minimize:hover,
.legans-chatbot__minimize:focus-visible {
    background: rgba(255, 255, 255, .18);
    outline: 2px solid rgba(255, 255, 255, .45);
}

.legans-chatbot__messages {
    flex: 1;
    padding: 14px 12px 10px;
    overflow-x: hidden;
    overflow-y: auto;
    background:
        radial-gradient(circle at top right, rgba(4, 40, 98, .08), transparent 34%),
        #fbfcfe;
    overscroll-behavior: contain;
}

.legans-chatbot__message {
    display: flex;
    margin-bottom: 10px;
}

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

.legans-chatbot__bubble {
    max-width: 86%;
    padding: 9px 11px;
    border-radius: 5px 12px 12px 12px;
    background: var(--legans-chatbot-white);
    box-shadow: 0 3px 12px rgba(41, 34, 28, .07);
    color: #3f3933;
}

.legans-chatbot__message--user .legans-chatbot__bubble {
    border-radius: 12px 12px 5px 12px;
    background: var(--legans-chatbot-blue);
    color: var(--legans-chatbot-white);
}

.legans-chatbot__bubble p {
    margin: 0;
    color: inherit;
    font-size: 11px;
    white-space: pre-line;
}

.legans-chatbot__bubble--image {
    padding: 6px 6px 8px;
    text-align: right;
}

.legans-chatbot__bubble-image {
    display: block;
    width: auto;
    max-width: 170px;
    max-height: 170px;
    border-radius: 8px;
    object-fit: cover;
    margin: 0 0 5px auto;
    border: 1px solid rgba(255, 255, 255, .24);
    box-shadow: 0 3px 10px rgba(4, 40, 98, .2);
}

.legans-chatbot__bubble-caption {
    margin: 0;
    padding: 0 3px;
    color: inherit;
    font-size: 10.5px;
    line-height: 1.35;
    opacity: .92;
}

.legans-chatbot__quick-actions,
.legans-chatbot__response-options {
    display: grid;
    margin: 4px 0 12px;
    grid-template-columns: 1fr;
    gap: 7px;
}

.legans-chatbot__quick-actions button,
.legans-chatbot__response-options button {
    width: 100%;
    min-height: 34px;
    padding: 7px 12px;
    border: 1px solid var(--legans-chatbot-border);
    border-radius: 18px;
    background: var(--legans-chatbot-cream);
    color: #51483f;
    cursor: pointer;
    font: inherit;
    font-size: 10px;
    transition: border-color .18s ease, background .18s ease;
}

.legans-chatbot__quick-actions button:hover,
.legans-chatbot__quick-actions button:focus-visible,
.legans-chatbot__response-options button:hover,
.legans-chatbot__response-options button:focus-visible {
    border-color: rgba(4, 40, 98, .34);
    background: #edf2f9;
    outline: none;
}

.legans-chatbot__typing {
    display: flex;
    width: 54px;
    padding: 13px 14px;
    gap: 4px;
}

.legans-chatbot__typing span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #9d9287;
    animation: legans-chatbot-typing 1.1s infinite ease-in-out;
}

.legans-chatbot__typing span:nth-child(2) { animation-delay: .14s; }
.legans-chatbot__typing span:nth-child(3) { animation-delay: .28s; }

@keyframes legans-chatbot-typing {
    0%, 60%, 100% { transform: translateY(0); opacity: .45; }
    30% { transform: translateY(-4px); opacity: 1; }
}

.legans-chatbot__products {
    display: grid;
    margin: 2px 0 14px;
    gap: 10px;
}

.legans-chatbot__product {
    display: grid;
    min-height: 104px;
    padding: 9px;
    grid-template-columns: 78px minmax(0, 1fr);
    gap: 10px;
    border: 1px solid var(--legans-chatbot-border);
    border-radius: 14px;
    background: var(--legans-chatbot-white);
    box-shadow: 0 4px 14px rgba(41, 34, 28, .06);
}

.legans-chatbot__product-image {
    width: 78px;
    height: 78px;
    border-radius: 10px;
    background: var(--legans-chatbot-cream);
    object-fit: cover;
}

.legans-chatbot__product-content {
    display: flex;
    min-width: 0;
    flex-direction: column;
    align-items: flex-start;
}

.legans-chatbot__product h3 {
    margin: 1px 0 2px;
    color: var(--legans-chatbot-ink);
    font-size: 11px;
    font-weight: 600;
    line-height: 1.3;
}

.legans-chatbot__product-category,
.legans-chatbot__product-stock {
    margin: 0;
    color: var(--legans-chatbot-muted);
    font-size: 11px;
    line-height: 1.35;
}

.legans-chatbot__product-price {
    margin: 4px 0 5px;
    color: var(--legans-chatbot-ink);
    font-size: 14px;
    font-weight: 700;
}

.legans-chatbot__product-link {
    margin-top: auto;
    padding: 0;
    border: 0;
    border-bottom: 1px solid currentColor;
    background: transparent;
    color: var(--legans-chatbot-blue);
    cursor: pointer;
    font: inherit;
    font-size: 11px;
    font-weight: 600;
}

.legans-chatbot__composer {
    display: flex;
    min-height: 58px;
    padding: 7px 8px 7px 12px;
    align-items: flex-end;
    gap: 9px;
    border-top: 1px solid var(--legans-chatbot-border);
    background: var(--legans-chatbot-white);
}

.legans-chatbot__composer textarea {
    width: 100%;
    max-height: 82px;
    min-height: 40px;
    padding: 10px 2px;
    resize: none;
    border: 0;
    background: transparent;
    color: var(--legans-chatbot-ink);
    font: inherit;
    font-size: 10px;
    line-height: 20px;
    outline: none;
}

.legans-chatbot__composer textarea::placeholder {
    color: #9a9289;
}

.legans-chatbot__image-input {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
}

.legans-chatbot__image-button {
    display: grid;
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    padding: 0;
    place-items: center;
    border: 1px solid var(--legans-chatbot-border);
    border-radius: 50%;
    background: var(--legans-chatbot-cream);
    color: var(--legans-chatbot-blue);
    cursor: pointer;
    transition: background .18s ease, transform .18s ease;
}

.legans-chatbot__image-button:hover,
.legans-chatbot__image-button:focus-visible {
    background: #edf2f9;
    transform: translateY(-1px);
    outline: 3px solid rgba(4, 40, 98, .16);
}

.legans-chatbot__image-button:disabled {
    cursor: wait;
    opacity: .55;
    transform: none;
}

.legans-chatbot__send {
    display: grid;
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    padding: 0;
    place-items: center;
    border: 0;
    border-radius: 50%;
    background: var(--legans-chatbot-blue);
    color: var(--legans-chatbot-white);
    cursor: pointer;
    transition: background .18s ease, transform .18s ease;
}

.legans-chatbot__send:hover,
.legans-chatbot__send:focus-visible {
    background: var(--legans-chatbot-blue-dark);
    transform: translateY(-1px);
    outline: 3px solid rgba(4, 40, 98, .2);
}

.legans-chatbot__send:disabled {
    cursor: wait;
    opacity: .55;
    transform: none;
}

.legans-chatbot__send svg,
.legans-chatbot__image-button svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

@media (max-width: 575.98px) {
    .legans-chatbot {
        right: auto;
        bottom: 80px;
        left: calc(80% + 6px);
        width: 58px;
        height: 58px;
    }

    .legans-chatbot__launcher {
        width: 58px;
        height: 58px;
    }

    .legans-chatbot__window {
        position: fixed;
        inset: 3vh 3vw;
        width: 94vw;
        height: 94dvh;
        min-height: 0;
        border-radius: 18px;
        transform-origin: right bottom;
    }

    .legans-chatbot--open .legans-chatbot__launcher {
        display: none;
    }

    .legans-chatbot__header {
        min-height: 72px;
        padding-top: max(13px, env(safe-area-inset-top));
    }

    .legans-chatbot__messages {
        padding-right: 13px;
        padding-left: 13px;
    }

    .legans-chatbot__composer {
        padding-bottom: max(10px, env(safe-area-inset-bottom));
    }
}

@media (prefers-reduced-motion: reduce) {
    .legans-chatbot__window,
    .legans-chatbot__launcher,
    .legans-chatbot__image-button,
    .legans-chatbot__send {
        transition: none;
    }

    .legans-chatbot__typing span {
        animation: none;
    }
}
