/* ============================================================
   Wordshop AI ChatBot — Alpine.js widget styles
   Self-contained. Class names are prefixed `wdsp-cb*` so they
   won't collide with host-page styles. All colours come from
   CSS variables set on .wdsp-cb (driven by the API theme).
   ============================================================ */

[x-cloak] {
    display: none !important;
}

.wdsp-cb {
    /* Brand (orange defaults to match the design) */
    --wdsp-chat-primary: #e8740c;
    --wdsp-chat-primary-hover: #cf6309;
    --wdsp-chat-primary-contrast: #ffffff;

    /* Surfaces */
    --wdsp-chat-bg: #ffffff;
    --wdsp-chat-bg-secondary: #f7f8fa;

    /* Text */
    --wdsp-chat-text: #1f2430;
    --wdsp-chat-text-secondary: #5b6170;
    --wdsp-chat-border: #e6e8ee;

    /* Bubbles */
    --wdsp-chat-user-bubble: #f7dcc4;
    --wdsp-chat-user-text: #1f2430;
    --wdsp-chat-bot-bubble: #f1f2f4;
    --wdsp-chat-bot-text: #1f2430;

    /* Intro gradient */
    --wdsp-chat-intro-from: #fde4cf;
    --wdsp-chat-intro-to: #ffffff;

    /* Teaser */
    --wdsp-chat-teaser-bg: #14182b;
    --wdsp-chat-teaser-text: #ffffff;

    /* Misc */
    --wdsp-chat-shadow: 0 24px 60px -18px rgba(17, 24, 39, 0.35);
    --wdsp-chat-radius: 1rem;
    --wdsp-chat-button-size: 60px;

    position: fixed;
    bottom: 1.25rem;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 1rem;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
    color: var(--wdsp-chat-text);
}

.wdsp-cb *,
.wdsp-cb *::before,
.wdsp-cb *::after {
    box-sizing: border-box;
}

/*
 * Defensive resets — this widget is embedded into host sites whose global
 * styles (e.g. `input, textarea, button { display:block; width:100%;
 * margin-bottom:1rem }`) would otherwise leak in and break the layout
 * (stacked input + button, stray gaps in the case form, etc.). We neutralise
 * those here so the widget renders consistently anywhere.
 */
.wdsp-cb form,
.wdsp-cb input,
.wdsp-cb textarea,
.wdsp-cb button,
.wdsp-cb select {
    margin: 0;
    font-family: inherit;
    font-size: inherit;
    line-height: inherit;
    letter-spacing: normal;
    text-transform: none;
    box-shadow: none;
    min-width: 0;
}

.wdsp-cb form {
    width: auto;
}

.wdsp-cb button {
    font-family: inherit;
    cursor: pointer;
    width: auto;
    text-align: center;
    /* Neutralise host button skins (gradients, blue tints, transforms). */
    background-image: none;
    text-decoration: none;
    -webkit-appearance: none;
    appearance: none;
}

/*
 * Circular buttons MUST stay perfectly round. Some host sites force
 * `button { width:100% }`, padding, or `align-items:stretch` on the flex
 * parent, which squashes these into eggs. We pin the geometry with
 * !important so no host rule can deform them.
 */
.wdsp-cb .wdsp-cb-send,
.wdsp-cb .wdsp-cb-cta-circle,
.wdsp-cb .wdsp-cb-iconbtn,
.wdsp-cb .wdsp-cb-launcher {
    flex: 0 0 auto !important;
    align-self: center !important;
    padding: 0 !important;
    aspect-ratio: 1 / 1;
}

.wdsp-cb .wdsp-cb-send {
    width: 44px !important;
    height: 44px !important;
    min-width: 44px !important;
    max-width: 44px !important;
    min-height: 44px !important;
    max-height: 44px !important;
}

.wdsp-cb .wdsp-cb-cta-circle {
    width: 40px !important;
    height: 40px !important;
    min-width: 40px !important;
    max-width: 40px !important;
    min-height: 40px !important;
    max-height: 40px !important;
}

.wdsp-cb .wdsp-cb-iconbtn {
    width: 40px !important;
    height: 40px !important;
    min-width: 40px !important;
    max-width: 40px !important;
    min-height: 40px !important;
    max-height: 40px !important;
}

.wdsp-cb .wdsp-cb-launcher {
    width: var(--wdsp-chat-button-size) !important;
    height: var(--wdsp-chat-button-size) !important;
    min-width: var(--wdsp-chat-button-size) !important;
    max-width: var(--wdsp-chat-button-size) !important;
    min-height: var(--wdsp-chat-button-size) !important;
    max-height: var(--wdsp-chat-button-size) !important;
    /*
     * The launcher lives in the column (not a row), so it must hug the RIGHT
     * edge. The shared rule above sets `align-self: center` (correct for the
     * in-row send/header buttons) which would otherwise centre the launcher
     * under the open window — keep it pinned to the right.
     */
    align-self: flex-end !important;
}

/* ---- Window ---- */
.wdsp-cb-window {
    position: relative;
    width: 390px;
    max-width: calc(100vw - 2rem);
    height: 640px;
    max-height: calc(100vh - 120px);
    background-color: var(--wdsp-chat-bg);
    border: 1px solid var(--wdsp-chat-border);
    border-radius: var(--wdsp-chat-radius);
    box-shadow: var(--wdsp-chat-shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform-origin: bottom right;
}

/* ---- Spring show/hide animation (slides in from the right) ---- */
.wdsp-cb-enter {
    transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1),
    opacity 0.28s ease-out;
    transition-delay: 0.06s;
    will-change: transform, opacity;
}

.wdsp-cb-enter-start {
    opacity: 0;
    transform: translateX(48px) scale(0.94);
}

.wdsp-cb-enter-end {
    opacity: 1;
    transform: translateX(0) scale(1);
}

.wdsp-cb-leave {
    transition: transform 0.22s ease-in, opacity 0.2s ease-in;
    will-change: transform, opacity;
}

.wdsp-cb-leave-start {
    opacity: 1;
    transform: translateX(0) scale(1);
}

.wdsp-cb-leave-end {
    opacity: 0;
    transform: translateX(48px) scale(0.96);
}

@media (prefers-reduced-motion: reduce) {
    .wdsp-cb-enter,
    .wdsp-cb-leave {
        transition-duration: 0.01ms;
        transition-delay: 0ms;
    }
}

/* ---- Resize handle (top-left corner) ---- */
/* Higher specificity than `.wdsp-cb button` so the resize cursor wins. */
.wdsp-cb .wdsp-cb-resize {
    position: absolute;
    top: 0;
    left: 0;
    width: 28px !important;
    height: 28px !important;
    min-width: 28px !important;
    max-width: 28px !important;
    min-height: 28px !important;
    max-height: 28px !important;
    z-index: 40;
    cursor: nwse-resize;
    background: transparent !important;
    border: none;
    padding: 0 !important;
    touch-action: none;
}

/* While dragging, force the resize cursor everywhere so it never flickers. */
.wdsp-cb-resizing,
.wdsp-cb-resizing * {
    cursor: nwse-resize !important;
}

.wdsp-cb-resize::before {
    content: "";
    position: absolute;
    top: 7px;
    left: 7px;
    width: 9px;
    height: 9px;
    border-top: 2px solid var(--wdsp-chat-text-secondary);
    border-left: 2px solid var(--wdsp-chat-text-secondary);
    border-top-left-radius: 3px;
    opacity: 0.4;
    transition: opacity 0.15s ease;
}

.wdsp-cb-resize:hover::before {
    opacity: 0.85;
}

/* ---- Avatar circles ---- */
.wdsp-cb-avatar {
    border-radius: 50%;
    background-color: var(--wdsp-chat-primary) !important;
    color: var(--wdsp-chat-primary-contrast) !important;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
}

.wdsp-cb-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.wdsp-cb-avatar svg {
    width: 55%;
    height: 55%;
}

/* ============ Intro screen ============ */
.wdsp-cb-intro {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    background: linear-gradient(
            180deg,
            var(--wdsp-chat-intro-from) 0%,
            var(--wdsp-chat-intro-to) 42%
    );
}

.wdsp-cb-intro-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 1.5rem 1.5rem 0;
    flex-shrink: 0;
}

.wdsp-cb-intro-top .wdsp-cb-avatar {
    width: 56px;
    height: 56px;
}

.wdsp-cb-iconbtn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background-color: transparent !important;
    color: var(--wdsp-chat-text) !important;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.15s ease;
}

.wdsp-cb-iconbtn:hover,
.wdsp-cb-iconbtn:focus {
    background-color: rgba(17, 24, 39, 0.06) !important;
    color: var(--wdsp-chat-text) !important;
}

.wdsp-cb-iconbtn svg {
    width: 20px;
    height: 20px;
}

.wdsp-cb-intro-body {
    padding: 1.25rem 1.5rem 0.5rem;
    display: flex;
    flex-direction: column;
}

.wdsp-cb-intro-heading {
    margin: 0;
    font-size: 1.75rem;
    line-height: 1.2;
    font-weight: 800;
    letter-spacing: -0.01em;
    text-wrap: balance;
    text-align: center;
}

.wdsp-cb-intro-sub {
    margin: 1rem 0 1.5rem;
    font-size: 0.95rem;
    line-height: 1.55;
    color: var(--wdsp-chat-text-secondary);
    text-align: center;
}

/* CTA card */
.wdsp-cb-cta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    width: 100%;
    padding: 1rem 1rem 1rem 1.25rem;
    background-color: var(--wdsp-chat-bg);
    border: 1px solid var(--wdsp-chat-border);
    border-radius: 0.875rem;
    font-size: 1rem;
    font-weight: 600;
    color: var(--wdsp-chat-text);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.wdsp-cb-cta:hover,
.wdsp-cb-cta:focus {
    border-color: var(--wdsp-chat-primary) !important;
    color: var(--wdsp-chat-text) !important;
    box-shadow: 0 4px 14px -6px rgba(232, 116, 12, 0.4);
}

.wdsp-cb-cta-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: var(--wdsp-chat-primary) !important;
    color: var(--wdsp-chat-primary-contrast) !important;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.wdsp-cb-cta-circle svg {
    width: 18px;
    height: 18px;
}

/* Links card */
.wdsp-cb-links {
    margin-top: 1.25rem;
    padding: 1.25rem;
    background-color: var(--wdsp-chat-bg);
    border: 1px solid var(--wdsp-chat-border);
    border-radius: 0.875rem;
}

.wdsp-cb-links-heading {
    margin: 0 0 0.5rem;
    font-size: 1rem;
    font-weight: 700;
}

.wdsp-cb-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.875rem 0;
    border-top: 1px solid var(--wdsp-chat-border);
    color: var(--wdsp-chat-text);
    text-decoration: none;
    font-size: 0.95rem;
}

.wdsp-cb-link:first-child {
    border-top: none;
}

.wdsp-cb-link:hover {
    color: var(--wdsp-chat-primary);
}

.wdsp-cb-link-icon {
    color: var(--wdsp-chat-primary);
    display: flex;
    flex-shrink: 0;
}

.wdsp-cb-link-icon svg {
    width: 20px;
    height: 20px;
}

/* Footer */
.wdsp-cb-footer {
    margin-top: auto;
    padding: 1rem 1.5rem 1.25rem;
    text-align: center;
    border-top: 1px solid var(--wdsp-chat-border);
    background-color: var(--wdsp-chat-bg);
    flex-shrink: 0;
}

.wdsp-cb-powered {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--wdsp-chat-text);
}

.wdsp-cb-powered a {
    color: var(--wdsp-chat-text);
    font-weight: 700;
    text-decoration: none;
}

.wdsp-cb-disclaimer {
    margin: 0.625rem 0 0;
    font-size: 0.7rem;
    line-height: 1.5;
    color: var(--wdsp-chat-text-secondary);
}

/* ============ Conversation ============ */
.wdsp-cb-chat {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.wdsp-cb-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--wdsp-chat-border);
    background-color: var(--wdsp-chat-bg);
    flex-shrink: 0;
}

.wdsp-cb-header-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.wdsp-cb-header-left .wdsp-cb-avatar {
    width: 44px;
    height: 44px;
}

.wdsp-cb-header-actions {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

/* Messages */
.wdsp-cb-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    background-color: var(--wdsp-chat-bg);
}

.wdsp-cb-welcome {
    text-align: center;
    padding: 0.5rem 0.25rem 0.75rem;
}

.wdsp-cb-welcome h4 {
    margin: 0 0 0.5rem;
    font-size: 1.25rem;
    font-weight: 700;
}

.wdsp-cb-welcome p {
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.55;
    color: var(--wdsp-chat-text-secondary);
}

.wdsp-cb-suggestions {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.75rem;
}

.wdsp-cb-suggestion {
    max-width: 85%;
    padding: 0.875rem 1.125rem;
    background-color: var(--wdsp-chat-bg) !important;
    border: 1px solid var(--wdsp-chat-border);
    border-radius: 0.875rem;
    font-size: 0.9rem;
    line-height: 1.45;
    color: var(--wdsp-chat-text) !important;
    text-align: left;
    transition: border-color 0.15s ease;
}

.wdsp-cb-suggestion:hover,
.wdsp-cb-suggestion:focus {
    border-color: var(--wdsp-chat-primary) !important;
    background-color: var(--wdsp-chat-bg) !important;
    color: var(--wdsp-chat-text) !important;
}

/* Message rows + bubbles */
.wdsp-cb-row {
    display: flex;
    flex-direction: column;
}

.wdsp-cb-row.user {
    align-items: flex-end;
}

.wdsp-cb-row.bot {
    align-items: flex-start;
}

.wdsp-cb-bubble {
    max-width: 88%;
    padding: 0.875rem 1.125rem;
    border-radius: 0.875rem;
    font-size: 0.9rem;
    line-height: 1.55;
    word-break: break-word;
}

.wdsp-cb-bubble.user {
    background-color: var(--wdsp-chat-user-bubble);
    color: var(--wdsp-chat-user-text);
    border-bottom-right-radius: 0.25rem;
}

.wdsp-cb-bubble.bot {
    background-color: var(--wdsp-chat-bot-bubble);
    color: var(--wdsp-chat-bot-text);
    border-bottom-left-radius: 0.25rem;
}

.wdsp-cb-time {
    margin-top: 0.25rem;
    font-size: 0.7rem;
    color: var(--wdsp-chat-text-secondary);
}

.wdsp-cb-typing {
    font-size: 0.8rem;
    font-style: italic;
    color: var(--wdsp-chat-text-secondary);
}

/* ---- Markdown inside bot bubbles ---- */
.wdsp-cb-md > *:first-child {
    margin-top: 0;
}

.wdsp-cb-md > *:last-child {
    margin-bottom: 0;
}

.wdsp-cb-md p {
    margin: 0 0 0.75rem;
}

.wdsp-cb-md strong {
    font-weight: 700;
}

.wdsp-cb-md h1,
.wdsp-cb-md h2,
.wdsp-cb-md h3,
.wdsp-cb-md h4 {
    margin: 0 0 0.5rem;
    font-size: 0.95rem;
    font-weight: 700;
}

.wdsp-cb-md a {
    color: var(--wdsp-chat-primary);
    text-decoration: underline;
}

/* Bullets drawn with ::before so host-page resets can't strip them */
.wdsp-cb-md ul,
.wdsp-cb-md ol {
    margin: 0 0 0.75rem;
    padding: 0;
    list-style: none !important;
}

.wdsp-cb-md ol {
    counter-reset: wdsp-cb-counter;
}

.wdsp-cb-md li {
    position: relative;
    margin: 0 0 0.4rem;
    padding-left: 1.4rem;
    list-style: none !important;
}

.wdsp-cb-md ul > li::before {
    content: "•";
    position: absolute;
    left: 0.3rem;
    top: 0;
    color: var(--wdsp-chat-primary);
    font-weight: 700;
}

.wdsp-cb-md ol > li {
    counter-increment: wdsp-cb-counter;
}

.wdsp-cb-md ol > li::before {
    content: counter(wdsp-cb-counter) ".";
    position: absolute;
    left: 0;
    top: 0;
    color: var(--wdsp-chat-primary);
    font-weight: 600;
}

.wdsp-cb-md code {
    background-color: rgba(0, 0, 0, 0.06);
    padding: 0.1rem 0.3rem;
    border-radius: 4px;
    font-size: 0.85em;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.wdsp-cb-md pre {
    margin: 0 0 0.75rem;
    padding: 0.75rem 0.875rem;
    background-color: rgba(0, 0, 0, 0.06);
    border: 1px solid var(--wdsp-chat-border);
    border-radius: 8px;
    overflow-x: auto;
}

.wdsp-cb-md pre code {
    background: none;
    padding: 0;
    font-size: 0.8rem;
    line-height: 1.5;
    white-space: pre;
}

/* Input */
.wdsp-cb-input {
    display: flex;
    align-items: flex-end;
    gap: 0.625rem;
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--wdsp-chat-border);
    background-color: var(--wdsp-chat-bg);
    flex-shrink: 0;
}

.wdsp-cb-textarea {
    flex: 1;
    min-height: 44px;
    max-height: 7rem;
    resize: none;
    border: 1px solid var(--wdsp-chat-border);
    border-radius: 0.75rem;
    padding: 0.7rem 1rem;
    font-size: 0.9rem;
    line-height: 1.4;
    color: var(--wdsp-chat-text);
    background-color: var(--wdsp-chat-bg);
    outline: none;
    transition: border-color 0.15s ease;
}

.wdsp-cb-textarea::placeholder {
    color: var(--wdsp-chat-text-secondary);
}

.wdsp-cb-textarea:focus {
    border-color: var(--wdsp-chat-primary);
}

.wdsp-cb-send {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background-color: var(--wdsp-chat-primary) !important;
    color: var(--wdsp-chat-primary-contrast) !important;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: filter 0.15s ease, opacity 0.15s ease;
}

.wdsp-cb-send:hover,
.wdsp-cb-send:focus,
.wdsp-cb-send:active {
    background-color: var(--wdsp-chat-primary-hover) !important;
    color: var(--wdsp-chat-primary-contrast) !important;
    filter: brightness(0.92);
}

.wdsp-cb-send:disabled {
    opacity: 0.55;
    cursor: default;
}

.wdsp-cb-send svg {
    width: 20px;
    height: 20px;
}

/* ---- Overlay panels (settings / case) ---- */
.wdsp-cb-overlay {
    position: absolute;
    inset: 0;
    z-index: 20;
    display: flex;
    flex-direction: column;
    padding: 1.25rem;
    background-color: var(--wdsp-chat-bg);
}

.wdsp-cb-overlay-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
}

.wdsp-cb-overlay-head h4 {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
}

.wdsp-cb-section-title {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--wdsp-chat-text-secondary);
    margin-bottom: 0.75rem;
}

.wdsp-cb-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0;
    font-size: 0.9rem;
}

.wdsp-cb-field {
    width: 100%;
    border: 1px solid var(--wdsp-chat-border);
    border-radius: 0.5rem;
    padding: 0.625rem 0.875rem;
    font-size: 0.9rem;
    color: var(--wdsp-chat-text);
    background-color: var(--wdsp-chat-bg);
    outline: none;
}

.wdsp-cb-field:focus {
    border-color: var(--wdsp-chat-primary);
}

.wdsp-cb-primary-btn {
    border: none;
    border-radius: 0.5rem;
    padding: 0.7rem 1rem;
    font-size: 0.9rem;
    font-weight: 600;
    background-color: var(--wdsp-chat-primary);
    color: var(--wdsp-chat-primary-contrast);
}

.wdsp-cb-primary-btn:disabled {
    opacity: 0.55;
}

/* Toggle switch */
.wdsp-cb-toggle {
    position: relative;
    width: 42px;
    height: 24px;
    flex-shrink: 0;
}

.wdsp-cb-toggle input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.wdsp-cb-toggle-slider {
    position: absolute;
    inset: 0;
    border-radius: 999px;
    background-color: var(--wdsp-chat-border);
    transition: background-color 0.2s ease;
}

.wdsp-cb-toggle-slider::before {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background-color: #ffffff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    transition: transform 0.2s ease;
}

.wdsp-cb-toggle input:checked + .wdsp-cb-toggle-slider {
    background-color: var(--wdsp-chat-primary);
}

.wdsp-cb-toggle input:checked + .wdsp-cb-toggle-slider::before {
    transform: translateX(18px);
}

/* ============ Teaser ============ */
.wdsp-cb-teaser {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    width: max-content;
    min-width: 230px;
    max-width: 300px;
    padding: 1rem 1.125rem;
    background-color: var(--wdsp-chat-teaser-bg);
    color: var(--wdsp-chat-teaser-text);
    border-radius: 0.875rem;
    box-shadow: var(--wdsp-chat-shadow);
    /*
     * Same spring slide-in as the launcher, but with a longer delay so the two
     * are staggered (the launcher pops in first, then the teaser follows).
     */
    transform-origin: bottom right;
    animation: wdsp-cb-launcher-in 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) 0.45s
    backwards;
}

@media (prefers-reduced-motion: reduce) {
    .wdsp-cb-teaser {
        animation: none;
    }
}

.wdsp-cb-teaser .wdsp-cb-avatar {
    width: 40px;
    height: 40px;
}

.wdsp-cb-teaser-title {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1.3;
}

.wdsp-cb-teaser-sub {
    margin: 0.15rem 0 0;
    font-size: 0.8rem;
    line-height: 1.35;
    opacity: 0.85;
}

.wdsp-cb-teaser-close {
    margin-left: auto;
    align-self: flex-start;
    background: none;
    border: none;
    color: var(--wdsp-chat-teaser-text);
    opacity: 0.7;
    display: flex;
}

.wdsp-cb-teaser-close:hover {
    opacity: 1;
}

.wdsp-cb-teaser-close svg {
    width: 16px;
    height: 16px;
}

/* ============ Launcher ============ */
.wdsp-cb-launcher {
    width: var(--wdsp-chat-button-size);
    height: var(--wdsp-chat-button-size);
    border-radius: 50%;
    border: none;
    background-color: var(--wdsp-chat-primary) !important;
    color: var(--wdsp-chat-primary-contrast) !important;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--wdsp-chat-shadow);
    overflow: hidden;
    position: relative;
    transition: transform 0.15s ease, filter 0.15s ease;
    /*
     * Spring entrance on first load: slides in from the right with a little
     * overshoot. `backwards` keeps the off-screen start applied during the
     * delay (no flash) and reverts to the normal style afterwards so the hover
     * transform keeps working.
     */
    animation: wdsp-cb-launcher-in 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) 0.15s
    backwards;
}

@keyframes wdsp-cb-launcher-in {
    0% {
        opacity: 0;
        transform: translateX(90px) scale(0.8);
    }
    60% {
        opacity: 1;
        transform: translateX(-8px) scale(1.04);
    }
    100% {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

@media (prefers-reduced-motion: reduce) {
    .wdsp-cb-launcher {
        animation: none;
    }
}

.wdsp-cb-launcher:hover,
.wdsp-cb-launcher:focus,
.wdsp-cb-launcher:active {
    background-color: var(--wdsp-chat-primary-hover) !important;
    color: var(--wdsp-chat-primary-contrast) !important;
    transform: translateY(-1px);
    filter: brightness(0.92);
}

.wdsp-cb-launcher svg {
    width: 26px;
    height: 26px;
}

.wdsp-cb-launcher img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.wdsp-cb-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    border-radius: 999px;
    background-color: #e11d48;
    color: #ffffff;
    font-size: 0.7rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Scrollbars */
.wdsp-cb-messages::-webkit-scrollbar,
.wdsp-cb-intro::-webkit-scrollbar {
    width: 6px;
}

.wdsp-cb-messages::-webkit-scrollbar-thumb,
.wdsp-cb-intro::-webkit-scrollbar-thumb {
    background-color: var(--wdsp-chat-border);
    border-radius: 3px;
}

/* Full-screen on small devices */
@media (max-width: 440px) {
    .wdsp-cb-window {
        width: calc(100vw - 2rem);
        height: calc(100vh - 110px);
    }

    .wdsp-cb-resize {
        display: none;
    }
}
