.bpochat {
    --bpochat-main: #2269B2;
    --bpochat-main-soft: #3A7FC4;
    --bpochat-accent: #2269B2;
    --bpochat-accent-dark: #1A5590;
    --bpochat-text: #1F2933;
    --bpochat-muted: #6B7280;
    --bpochat-line: #DDDDDD;
    --bpochat-bg: #F9F9F9;
    --bpochat-launcher-right: 16px;
    --bpochat-launcher-bottom: 20px;
    --bpochat-launcher-size: 64px;
    font-family: "Segoe UI", "Roboto", "Arial", sans-serif;
    font-size: 14px;
    line-height: 1.55;
    color: var(--bpochat-text);
}

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

.bpochat [hidden] {
    display: none !important;
}

.bpochat img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.bpochatLauncher {
    position: fixed;
    right: var(--bpochat-launcher-right);
    bottom: var(--bpochat-launcher-bottom);
    z-index: 10000;
    width: var(--bpochat-launcher-size);
    height: var(--bpochat-launcher-size);
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: var(--bpochat-main);
    overflow: visible;
    cursor: pointer;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
    animation: bpochatFloat 3s ease-in-out infinite;
}

.bpochatLauncher img {
    border-radius: 50%;
    transition: transform .3s ease;
}

.bpochatLauncher::before {
    content: "";
    position: absolute;
    inset: -3px;
    border-radius: 50%;
    animation: bpochatRing 2.4s ease-out infinite;
    pointer-events: none;
}

.bpochatLauncher::after {
    content: "";
    position: absolute;
    right: 2px;
    bottom: 2px;
    width: 14px;
    height: 14px;
    border: 2px solid #FFFFFF;
    border-radius: 50%;
    background: #22C55E;
}

.bpochatLauncher:hover {
    animation-play-state: paused;
}

.bpochatLauncher:hover img {
    transform: scale(1.08) rotate(5deg);
}

.bpochat.is-open .bpochatLauncher {
    animation: none;
}

/* Gentle float up and down */
@keyframes bpochatFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}

.bpochat.is-open .bpochatLauncher::before {
    animation: none;
}

@keyframes bpochatRing {
    0% { box-shadow: 0 0 0 0 rgba(34, 105, 178, 0.45); }
    100% { box-shadow: 0 0 0 16px rgba(34, 105, 178, 0); }
}

.bpochatTeaser {
    position: fixed;
    right: calc(var(--bpochat-launcher-right) + var(--bpochat-launcher-size) + 14px);
    bottom: calc(var(--bpochat-launcher-bottom) + var(--bpochat-launcher-size) / 2);
    z-index: 10000;
    display: flex;
    align-items: center;
    gap: 6px;
    width: max-content;
    max-width: calc(100vw - var(--bpochat-launcher-right) - var(--bpochat-launcher-size) - 30px);
    padding: 12px 20px;
    white-space: nowrap;
    border: 1px solid var(--bpochat-line);
    border-radius: 26px;
    background: #FFFFFF;
    box-shadow: 0 8px 26px rgba(10, 26, 62, 0.16);
    transform: translateY(50%);
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity .8s ease, visibility 0s linear .8s;
    animation: bpochatBob 2.6s ease-in-out infinite;
}

.bpochatTeaser.is-show {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transition: opacity .8s ease, visibility 0s;
}

.bpochatTeaser::after {
    content: "";
    position: absolute;
    top: 50%;
    right: -6px;
    width: 12px;
    height: 12px;
    border-top: 1px solid var(--bpochat-line);
    border-right: 1px solid var(--bpochat-line);
    background: #FFFFFF;
    transform: translateY(-50%) rotate(45deg);
}

.bpochatTeaser:hover {
    animation-play-state: paused;
}

.bpochatTeaser p {
    margin: 0;
    font-size: 15px;
    line-height: 1.45;
}

@keyframes bpochatBob {
    0%, 100% { transform: translateY(50%); }
    50% { transform: translateY(calc(50% - 7px)); }
}

.bpochatPanel {
    position: fixed;
    right: var(--bpochat-launcher-right);
    bottom: calc(var(--bpochat-launcher-bottom) + var(--bpochat-launcher-size) + 14px);
    z-index: 10001;
    display: flex;
    flex-direction: column;
    width: 380px;
    /* Grows with the conversation, stops 16px below the site's fixed header (--bpochat-top-gap, set by JS) */
    height: auto;
    max-height: calc(100vh - var(--bpochat-top-gap, 100px) - 16px - var(--bpochat-launcher-bottom) - var(--bpochat-launcher-size) - 14px);
    border-radius: 20px;
    background: var(--bpochat-bg);
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    transform-origin: bottom right;
    animation: bpochatIn .25s ease;
}

@keyframes bpochatIn {
    from { opacity: 0; transform: translateY(10px) scale(.97); }
    to { opacity: 1; transform: none; }
}

.bpochatHead {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 15px 14px 15px 18px;
    border-bottom: 0;
    background: var(--bpochat-main);
    color: #FFFFFF;
}

.bpochatTitle {
    flex: 1;
    margin: 0;
    color: #FFFFFF;
    font-size: 17px;
    font-weight: 700;
}

.bpochatClose {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: #FFFFFF;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
}

.bpochatClose:hover {
    background: rgba(255, 255, 255, .15);
    opacity: 1;
}

.bpochatBody {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 18px 16px;
    background: var(--bpochat-bg);
    overflow-y: auto;
    overscroll-behavior: contain;
}

.bpochatRow {
    display: flex;
    gap: 10px;
}

.bpochatRow--user {
    flex-direction: row-reverse;
}

.bpochatRow--user .bpochatStack {
    align-items: flex-end;
}

.bpochatAvatar.bpochatAvatar--user {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    border-color: #FFFFFF;
    background: var(--bpochat-main);
    color: #FFFFFF;
}

.bpochatAvatar--user svg {
    width: 36px;
    height: 36px;
    margin-bottom: -5px;
}

.bpochatAvatar {
    flex: 0 0 40px;
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 50%;
    background: var(--bpochat-main);
    overflow: hidden;
}

.bpochatStack {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    min-width: 0;
    max-width: calc(100% - 50px);
}

.bpochatSender {
    margin: 2px 0 -2px;
    color: #333333;
    font-size: 13px;
    font-weight: 500;
}

.bpochatBubble {
    max-width: 100%;
    padding: 10px 14px;
    border-radius: 15px;
    font-size: 15px;
    line-height: 1.45;
    word-wrap: break-word;
}

.bpochatRow--bot .bpochatBubble {
    border: 0;
    background: var(--bpochat-main);
    color: #FFFFFF;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.bpochatRow--bot .bpochatBubble a {
    color: #FFFFFF;
}

.bpochatRow--user .bpochatBubble {
    max-width: 100%;
    border-radius: 15px 15px 3px 15px;
    background: #FFFFFF;
    color: #000000;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.08);
}

.bpochatBubble p,
.bpochatBubble ul,
.bpochatBubble ol {
    margin: 0 0 6px;
}

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

.bpochatBubble ul,
.bpochatBubble ol {
    padding-left: 18px;
}

.bpochatBubble ul {
    list-style: disc;
}

.bpochatBubble ol {
    list-style: decimal;
}

.bpochatBubble a {
    color: inherit;
    font-weight: 600;
    text-decoration: underline;
}

.bpochatRow--bot .bpochatBubble strong {
    color: #FFFFFF;
}

.bpochatRow--bot .bpochatBubble.is-error {
    background: #FFFFFF;
    border: 1px solid #F3C9C9;
    color: var(--bpochat-text);
}

.bpochatRow--bot .bpochatBubble.is-error strong {
    color: inherit;
}

.bpochatDots {
    display: inline-flex;
    gap: 4px;
    padding: 5px 0;
}

.bpochatDots i {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--bpochat-muted);
    animation: bpochatDot 1.2s infinite ease-in-out;
}

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

@keyframes bpochatDot {
    0%, 80%, 100% { opacity: .35; transform: translateY(0); }
    40% { opacity: 1; transform: translateY(-3px); }
}

.bpochatForm {
    padding: 10px;
    background: var(--bpochat-bg);
}

.bpochatField {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 6px 6px 6px 16px;
    border: 1px solid var(--bpochat-line);
    border-radius: 999px;
    background: #F5F5F5;
}

.bpochatField:focus-within {
    border-color: var(--bpochat-accent);
    background: #FFFFFF;
}

.bpochatInput {
    flex: 1;
    min-height: 40px;
    max-height: 110px;
    padding: 9px 0;
    border: 0;
    background: transparent;
    font: inherit;
    font-size: 15px;
    color: inherit;
    resize: none;
    outline: none;
}

.bpochatInput::placeholder {
    color: #8A939E;
}

.bpochatSend {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 42px;
    height: 42px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: var(--bpochat-main);
    color: #FFFFFF;
    cursor: pointer;
}

.bpochatSend:hover {
    background: var(--bpochat-accent-dark);
}

.bpochatSend:disabled {
    opacity: .5;
    cursor: default;
}

@media (max-width: 768px) {
    .bpochat {
        --bpochat-launcher-right: 12px;
        --bpochat-launcher-bottom: 16px;
        --bpochat-launcher-size: 54px;
    }

    .bpochatTeaser {
        white-space: normal;
    }

    .bpochatTeaser p {
        font-size: 14px;
    }

    .bpochatPanel {
        inset: 0;
        width: 100%;
        height: 100%;
        height: 100dvh;
        max-height: none;
        border-radius: 0;
    }

    .bpochatInput {
        font-size: 16px;
    }

    .bpochat.is-open .bpochatLauncher,
    .bpochat.is-open .bpochatTeaser {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .bpochatPanel,
    .bpochatTeaser,
    .bpochatLauncher,
    .bpochatLauncher::before,
    .bpochatDots i {
        animation: none;
    }
}



/* Contact form inside the conversation */
.bpochatRow--bot .bpochatBubble.bpochatLead {
    border: 1px solid var(--bpochat-line);
    background: #FFFFFF;
    color: var(--bpochat-text);
}

.bpochatRow--bot .bpochatBubble.bpochatLead strong {
    color: inherit;
}

.bpochatLead {
    display: grid;
    gap: 10px;
    width: 100%;
    max-width: 290px;
}

.bpochatLeadIntro {
    margin: 0;
}

.bpochatLeadField label {
    display: block;
    margin: 0 0 4px;
    color: var(--bpochat-muted);
    font-size: 12px;
    font-weight: 600;
}

.bpochatLeadField label span {
    color: #d63638;
}

.bpochatLead input,
.bpochatLead select,
.bpochatLead textarea {
    box-sizing: border-box;
    width: 100%;
    margin: 0;
    padding: 8px 10px;
    border: 1px solid var(--bpochat-line);
    border-radius: 10px;
    background: #FFFFFF;
    color: var(--bpochat-text);
    font: inherit;
    font-size: 14px;
    line-height: 1.4;
}

.bpochatLead input:focus,
.bpochatLead select:focus,
.bpochatLead textarea:focus {
    border-color: var(--bpochat-accent);
    outline: none;
}

.bpochatLead textarea {
    resize: vertical;
}

.bpochatLead input:disabled,
.bpochatLead select:disabled,
.bpochatLead textarea:disabled {
    background: var(--bpochat-bg);
}

.bpochatLeadError {
    margin: 4px 0 0;
    color: #d63638;
    font-size: 12px;
}

.bpochatLeadError[hidden] {
    display: none;
}

.bpochatLead .bpochatLeadTrap {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    opacity: 0;
}

.bpochatLeadSend {
    padding: 10px 14px;
    border: 0;
    border-radius: 999px;
    background: var(--bpochat-main);
    color: #FFFFFF;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.bpochatLeadSend:hover {
    background: var(--bpochat-accent-dark);
}

.bpochatLeadSend:disabled {
    cursor: default;
    opacity: .7;
}

.bpochatLead.is-sent .bpochatLeadSend {
    background: #00a32a;
    color: #FFFFFF;
    opacity: 1;
}

/* Confirm step: the fields make way for a summary of what will be sent */
.bpochatLead.is-review > .bpochatLeadIntro,
.bpochatLead.is-review > .bpochatLeadField,
.bpochatLead.is-review > .bpochatLeadSend,
.bpochatLead.is-review > .bpochatLeadError {
    display: none;
}

.bpochatLeadReview[hidden] {
    display: none;
}

.bpochatLeadReview dl {
    display: grid;
    gap: 2px 0;
    margin: 8px 0 12px;
    padding: 10px 12px;
    border-radius: 10px;
    background: var(--bpochat-bg);
}

.bpochatLeadReview dt {
    color: var(--bpochat-muted);
    font-size: 12px;
}

.bpochatLeadReview dd {
    margin: 0 0 6px;
    color: var(--bpochat-text);
    font-weight: 600;
    overflow-wrap: anywhere;
}

.bpochatLeadActions {
    display: flex;
    gap: 8px;
}

.bpochatLeadActions button {
    flex: 1;
}

.bpochatLeadEdit {
    padding: 10px 14px;
    border: 1px solid var(--bpochat-line);
    border-radius: 999px;
    background: #FFFFFF;
    color: var(--bpochat-text);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

.bpochatLeadEdit:hover {
    border-color: var(--bpochat-accent);
}

.bpochatLead.is-sent .bpochatLeadEdit {
    display: none;
}

/* Blue bot bubbles: keep links readable on white bubbles, dots readable on blue */
.bpochatRow--bot .bpochatBubble.is-error a,
.bpochatRow--bot .bpochatBubble.bpochatLead a {
    color: var(--bpochat-main);
}

.bpochatRow--bot .bpochatBubble .bpochatDots i {
    background: #FFFFFF;
}
