/* ACS Chatbot widget */
#acs-cb {
    --acs-cb-accent: #C9A245;
    --acs-cb-dark: #2B2B2E;
    --acs-cb-bg: #FFFFFF;
    --acs-cb-soft: #F5F3EE;
    --acs-cb-text: #1F1F22;
    --acs-cb-muted: #6B6B70;
    --acs-cb-border: #E7E3D9;
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 2147483000; /* above the theme's sticky header */
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Noto Sans Bengali', sans-serif;
    font-size: 14.5px;
    line-height: 1.5;
    color: var(--acs-cb-text);
}
#acs-cb *, #acs-cb *::before, #acs-cb *::after { box-sizing: border-box; }
#acs-cb [hidden] { display: none !important; }
#acs-cb button {
    font: inherit; margin: 0; text-transform: none; letter-spacing: normal;
    box-shadow: none; min-height: 0; line-height: 1;
}

/* Keep the theme's scroll-to-top button clear of the chat launcher */
.wpr-stt-btn { bottom: 96px !important; }

/* Launcher */
#acs-cb .acs-cb-launcher {
    width: 60px; height: 60px; border-radius: 50%; border: 0; padding: 0; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    background: var(--acs-cb-dark); color: var(--acs-cb-accent);
    box-shadow: 0 10px 28px rgba(20, 20, 22, .32), 0 0 0 3px rgba(201, 162, 69, .35);
    transition: transform .25s ease, box-shadow .25s ease;
}
#acs-cb .acs-cb-launcher:hover { transform: translateY(-2px) scale(1.04); box-shadow: 0 14px 32px rgba(20, 20, 22, .38), 0 0 0 4px rgba(201, 162, 69, .5); }
#acs-cb .acs-cb-launcher:focus-visible { outline: 3px solid var(--acs-cb-accent); outline-offset: 3px; }
#acs-cb .acs-cb-icon-close { display: none; }
#acs-cb.acs-cb-is-open .acs-cb-icon-open { display: none; }
#acs-cb.acs-cb-is-open .acs-cb-icon-close { display: flex; }
#acs-cb .acs-cb-icon-open, #acs-cb .acs-cb-icon-close { align-items: center; justify-content: center; display: flex; }

/* Teaser bubble */
#acs-cb .acs-cb-teaser {
    position: absolute; right: 0; bottom: 74px; width: 240px; padding: 12px 30px 12px 14px;
    background: var(--acs-cb-bg); border: 1px solid var(--acs-cb-border); border-radius: 14px 14px 4px 14px;
    box-shadow: 0 10px 30px rgba(20, 20, 22, .16); font-size: 13.5px; cursor: pointer;
    animation: acsCbIn .35s ease both;
}
#acs-cb .acs-cb-teaser-close {
    position: absolute; top: 4px; right: 6px; width: 22px; height: 22px; border: 0; background: none;
    color: var(--acs-cb-muted); font-size: 18px; cursor: pointer; padding: 0;
}

/* Panel */
#acs-cb .acs-cb-panel {
    position: absolute; right: 0; bottom: 76px;
    width: 380px; height: min(600px, calc(100vh - 130px));
    display: flex; flex-direction: column; overflow: hidden;
    background: var(--acs-cb-bg); border-radius: 18px; border: 1px solid var(--acs-cb-border);
    box-shadow: 0 24px 60px rgba(20, 20, 22, .28);
    animation: acsCbIn .28s cubic-bezier(.16, 1, .3, 1) both;
}
@keyframes acsCbIn { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }

#acs-cb .acs-cb-head {
    display: flex; align-items: center; gap: 12px; padding: 14px 14px 14px 16px;
    background: var(--acs-cb-dark); color: #fff;
}
#acs-cb .acs-cb-avatar {
    width: 40px; height: 40px; border-radius: 50%; object-fit: contain; background: #fff; padding: 3px; flex: none;
}
#acs-cb .acs-cb-avatar-fallback {
    display: flex; align-items: center; justify-content: center; background: var(--acs-cb-accent); color: var(--acs-cb-dark); font-weight: 700;
}
#acs-cb .acs-cb-title { flex: 1; min-width: 0; display: flex; flex-direction: column; }
#acs-cb .acs-cb-title strong { font-size: 15.5px; font-weight: 700; color: #fff; }
#acs-cb .acs-cb-title span { font-size: 12px; color: rgba(255, 255, 255, .72); display: flex; align-items: center; gap: 6px; }
#acs-cb .acs-cb-dot { width: 7px; height: 7px; border-radius: 50%; background: #3DDC84; display: inline-block; }
#acs-cb .acs-cb-close {
    width: 36px; height: 36px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .08);
    color: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center; padding: 0;
}
#acs-cb .acs-cb-close:hover { background: rgba(255, 255, 255, .18); }

/* Messages */
#acs-cb .acs-cb-log {
    flex: 1; overflow-y: auto; padding: 16px 14px 8px; background: var(--acs-cb-soft);
    display: flex; flex-direction: column; gap: 10px; overscroll-behavior: contain;
}
#acs-cb .acs-cb-msg {
    max-width: 86%; padding: 10px 13px; border-radius: 16px; word-wrap: break-word; overflow-wrap: anywhere;
    animation: acsCbIn .22s ease both;
}
#acs-cb .acs-cb-msg p { margin: 0 0 6px; }
#acs-cb .acs-cb-msg p:last-child { margin-bottom: 0; }
#acs-cb .acs-cb-msg ul { margin: 4px 0 6px; padding-left: 18px; }
#acs-cb .acs-cb-msg li { margin: 2px 0; }
#acs-cb .acs-cb-bot {
    align-self: flex-start; background: var(--acs-cb-bg); border: 1px solid var(--acs-cb-border);
    border-bottom-left-radius: 4px;
}
#acs-cb .acs-cb-bot a { color: #8A6A1F; text-decoration: underline; text-underline-offset: 2px; }
#acs-cb .acs-cb-user {
    align-self: flex-end; background: var(--acs-cb-dark); color: #fff; border-bottom-right-radius: 4px; white-space: pre-wrap;
}
#acs-cb .acs-cb-error { border-color: #F0C9C9; background: #FFF7F7; }

#acs-cb .acs-cb-typing { display: flex; gap: 4px; padding: 13px 14px; }
#acs-cb .acs-cb-typing span {
    width: 7px; height: 7px; border-radius: 50%; background: var(--acs-cb-muted); opacity: .4;
    animation: acsCbDot 1.2s infinite ease-in-out;
}
#acs-cb .acs-cb-typing span:nth-child(2) { animation-delay: .15s; }
#acs-cb .acs-cb-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes acsCbDot { 0%, 80%, 100% { opacity: .3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

/* Suggestion chips */
#acs-cb .acs-cb-chips {
    display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 14px 4px; background: var(--acs-cb-soft);
}
#acs-cb .acs-cb-chip {
    border: 1px solid var(--acs-cb-accent); background: #fff; color: var(--acs-cb-dark);
    border-radius: 999px; padding: 7px 12px; font-size: 13px; cursor: pointer; line-height: 1.2;
    transition: background .2s ease, color .2s ease;
}
#acs-cb .acs-cb-chip:hover { background: var(--acs-cb-accent); color: var(--acs-cb-dark); }

/* Input */
#acs-cb .acs-cb-form {
    display: flex; align-items: flex-end; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--acs-cb-border); background: #fff;
}
#acs-cb .acs-cb-hp { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; opacity: 0; }
#acs-cb .acs-cb-form textarea {
    flex: 1; resize: none; border: 1px solid var(--acs-cb-border); border-radius: 12px; padding: 10px 12px;
    font: inherit; color: var(--acs-cb-text); background: #fff; max-height: 120px; min-height: 42px; line-height: 1.4;
    outline: none; box-shadow: none; margin: 0;
}
#acs-cb .acs-cb-form textarea:focus { border-color: var(--acs-cb-accent); box-shadow: 0 0 0 3px rgba(201, 162, 69, .18); }
#acs-cb .acs-cb-send {
    width: 42px; height: 42px; flex: none; border: 0; border-radius: 12px; cursor: pointer; padding: 0;
    background: var(--acs-cb-accent); color: var(--acs-cb-dark); display: flex; align-items: center; justify-content: center;
    transition: filter .2s ease;
}
#acs-cb .acs-cb-send:hover { filter: brightness(1.06); }
#acs-cb .acs-cb-send:disabled { opacity: .5; cursor: default; }
#acs-cb .acs-cb-foot {
    padding: 0 12px 10px; background: #fff; font-size: 11.5px; color: var(--acs-cb-muted); text-align: center;
}
#acs-cb .acs-cb-foot a { color: var(--acs-cb-muted); text-decoration: underline; }

/* Phones: full screen chat */
@media (max-width: 520px) {
    #acs-cb { right: 16px; bottom: 16px; }
    .wpr-stt-btn { bottom: 86px !important; }
    #acs-cb .acs-cb-launcher { width: 56px; height: 56px; }
    #acs-cb .acs-cb-panel {
        position: fixed; inset: 0; width: 100%; height: 100%; height: 100dvh; border-radius: 0; border: 0;
    }
    #acs-cb.acs-cb-is-open .acs-cb-launcher { display: none; }
    #acs-cb .acs-cb-form textarea { font-size: 16px; } /* stops iOS zooming in */
}

@media (prefers-reduced-motion: reduce) {
    #acs-cb *, #acs-cb *::before, #acs-cb *::after { animation: none !important; transition: none !important; }
}
