/* Pooja Chatbot — floating launcher + responsive chat panel.
   Desktop: docked ~380px window anchored bottom-right.
   Phone:   full-screen floating sheet. */

.pooja-chat {
    --pc-brand: #b8336a;
    --pc-brand-dark: #8f2552;
    --pc-bot-bg: #f3f0f5;
    --pc-bot-text: #2a2330;
    --pc-user-bg: #b8336a;
    --pc-user-text: #ffffff;
    --pc-panel-bg: #ffffff;
    --pc-radius: 18px;
    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: 99990;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 15px;
    line-height: 1.5;
}

/* ---------- Launcher button ---------- */
.pooja-chat__launcher {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: none;
    cursor: pointer;
    background: var(--pc-brand);
    color: #fff;
    padding: 13px 18px;
    border-radius: 999px;
    box-shadow: 0 8px 24px rgba(184, 51, 106, 0.38);
    transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}
.pooja-chat__launcher:hover { background: var(--pc-brand-dark); transform: translateY(-2px); }
.pooja-chat__launcher:focus-visible { outline: 3px solid rgba(184,51,106,.4); outline-offset: 2px; }
.pooja-chat__launcher-icon { flex: 0 0 auto; }
.pooja-chat__launcher-label { font-weight: 600; letter-spacing: .2px; }

.pooja-chat.is-open .pooja-chat__launcher { display: none; }

/* ---------- Panel ---------- */
.pooja-chat__panel {
    position: absolute;
    right: 0;
    bottom: 0;
    width: 380px;
    max-width: calc(100vw - 32px);
    height: 560px;
    max-height: calc(100vh - 110px);
    background: var(--pc-panel-bg);
    border-radius: var(--pc-radius);
    box-shadow: 0 20px 60px rgba(0,0,0,.25);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: pc-pop .18s ease-out;
}
@keyframes pc-pop { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }

.pooja-chat__header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    background: linear-gradient(135deg, var(--pc-brand), var(--pc-brand-dark));
    color: #fff;
}
.pooja-chat__avatar {
    width: 38px; height: 38px; border-radius: 50%;
    background: rgba(255,255,255,.2);
    display: flex; align-items: center; justify-content: center;
    font-size: 20px; flex: 0 0 auto;
}
.pooja-chat__titles { display: flex; flex-direction: column; line-height: 1.25; flex: 1 1 auto; min-width: 0; }
.pooja-chat__title { font-size: 15px; }
.pooja-chat__subtitle { font-size: 12px; opacity: .85; }
.pooja-chat__close {
    background: transparent; border: none; color: #fff; font-size: 26px;
    line-height: 1; cursor: pointer; padding: 0 4px; opacity: .9;
}
.pooja-chat__close:hover { opacity: 1; }

.pooja-chat__messages {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 16px;
    background: #faf8fb;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.pooja-chat__msg {
    max-width: 82%;
    padding: 10px 14px;
    border-radius: 16px;
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow-wrap: anywhere;
    animation: pc-fade .15s ease-out;
}
@keyframes pc-fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.pooja-chat__msg a { color: inherit; text-decoration: underline; }
.pooja-chat__msg--bot {
    align-self: flex-start;
    background: var(--pc-bot-bg);
    color: var(--pc-bot-text);
    border-bottom-left-radius: 5px;
}
.pooja-chat__msg--user {
    align-self: flex-end;
    background: var(--pc-user-bg);
    color: var(--pc-user-text);
    border-bottom-right-radius: 5px;
}
.pooja-chat__msg--user a { color: #fff; }

/* Quick-reply language chips */
.pooja-chat__chips { display: flex; flex-wrap: wrap; gap: 8px; align-self: flex-start; max-width: 100%; }
.pooja-chat__chip {
    border: 1px solid var(--pc-brand);
    color: var(--pc-brand);
    background: #fff;
    border-radius: 999px;
    padding: 7px 14px;
    font-size: 14px;
    cursor: pointer;
    transition: background .12s ease, color .12s ease;
}
.pooja-chat__chip:hover { background: var(--pc-brand); color: #fff; }

/* Typing indicator */
.pooja-chat__typing { align-self: flex-start; display: inline-flex; gap: 4px; padding: 12px 14px; background: var(--pc-bot-bg); border-radius: 16px; border-bottom-left-radius: 5px; }
.pooja-chat__typing span { width: 7px; height: 7px; border-radius: 50%; background: #b9aec2; animation: pc-bounce 1.2s infinite ease-in-out; }
.pooja-chat__typing span:nth-child(2) { animation-delay: .15s; }
.pooja-chat__typing span:nth-child(3) { animation-delay: .3s; }
@keyframes pc-bounce { 0%, 60%, 100% { transform: translateY(0); opacity: .5; } 30% { transform: translateY(-5px); opacity: 1; } }

.pooja-chat__form { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-top: 1px solid #eee; background: #fff; }
.pooja-chat__input {
    flex: 1 1 auto;
    border: 1px solid #ddd;
    border-radius: 999px;
    padding: 11px 16px;
    font-size: 15px;
    outline: none;
    background: #fff;
    color: #222;
}
.pooja-chat__input:focus { border-color: var(--pc-brand); box-shadow: 0 0 0 3px rgba(184,51,106,.12); }
.pooja-chat__send {
    flex: 0 0 auto;
    width: 42px; height: 42px;
    border: none; border-radius: 50%;
    background: var(--pc-brand); color: #fff;
    display: inline-flex; align-items: center; justify-content: center;
    cursor: pointer; transition: background .12s ease;
}
.pooja-chat__send:hover { background: var(--pc-brand-dark); }
.pooja-chat__send:disabled { background: #d8c7d1; cursor: default; }

.pooja-chat__footnote { text-align: center; font-size: 11px; color: #9a93a0; padding: 0 12px 10px; background: #fff; }

.pooja-chat.is-ended .pooja-chat__form { display: none; }

/* ---------- Phone: full-screen floating sheet ---------- */
@media (max-width: 600px) {
    .pooja-chat { right: 16px; bottom: 16px; }
    .pooja-chat__panel {
        position: fixed;
        right: 0; left: 0; top: 0; bottom: 0;
        width: 100vw;
        max-width: 100vw;
        height: 100%;
        height: 100dvh;
        max-height: none;
        border-radius: 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    .pooja-chat__panel, .pooja-chat__msg, .pooja-chat__typing span { animation: none; }
    .pooja-chat__launcher { transition: none; }
}
