/* Floating AI support widget — Probash Hub green/gold theme */
.support-widget {
    position: fixed;
    bottom: 0;
    right: 0;
    z-index: 1050;
    pointer-events: none;
    font-family: var(--pb-font, 'Hind Siliguri', 'Noto Sans Bengali', sans-serif);
}

.support-widget * {
    box-sizing: border-box;
}

.support-widget-fab,
.support-widget-whatsapp-fab,
.support-widget-panel {
    pointer-events: auto;
}

.support-widget-fab-stack {
    position: fixed;
    bottom: max(1.25rem, env(safe-area-inset-bottom, 0px));
    right: max(1.25rem, env(safe-area-inset-right, 0px));
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: .65rem;
    z-index: 1052;
    pointer-events: none;
}

.support-widget-fab-stack > * {
    pointer-events: auto;
}

.support-widget-fab {
    position: relative;
    bottom: auto;
    right: auto;
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    padding: .85rem 1.15rem;
    border: none;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--pb-green, #006a4e) 0%, var(--pb-green-dark, #004d38) 100%);
    color: #fff;
    font-size: .92rem;
    font-weight: 600;
    box-shadow: 0 6px 24px rgba(0, 106, 78, .35);
    cursor: pointer;
    transition: transform .2s ease, box-shadow .2s ease;
    isolation: isolate;
}

.support-widget-whatsapp-fab {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    padding: .75rem 1rem;
    border-radius: 999px;
    background: #25d366;
    color: #fff;
    font-size: .88rem;
    font-weight: 600;
    text-decoration: none;
    box-shadow: 0 6px 20px rgba(37, 211, 102, .4);
    transition: transform .2s ease, box-shadow .2s ease, filter .15s ease;
    line-height: 1;
}

.support-widget-whatsapp-fab i {
    font-size: 1.25rem;
}

.support-widget-whatsapp-fab:hover {
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 10px 28px rgba(37, 211, 102, .48);
    filter: brightness(1.05);
}

.support-widget-whatsapp-fab:focus-visible {
    outline: 3px solid #128c7e;
    outline-offset: 3px;
}

.support-widget.is-open .support-widget-whatsapp-fab {
    opacity: .92;
}

.support-widget-fab-pulse {
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: inherit;
    z-index: -1;
    opacity: .55;
    animation: swFabPulse 2.4s ease-out infinite;
    pointer-events: none;
}

.support-widget.is-open .support-widget-fab-pulse {
    display: none;
}

.support-widget-fab:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 32px rgba(0, 106, 78, .42);
}

.support-widget-fab:focus-visible {
    outline: 3px solid var(--pb-gold, #e8a317);
    outline-offset: 3px;
}

.support-widget-fab-icon--close {
    display: none;
}

.support-widget.is-open .support-widget-fab-icon--open {
    display: none;
}

.support-widget.is-open .support-widget-fab-icon--close {
    display: inline;
}

.support-widget.is-open .support-widget-fab-label {
    display: none !important;
}

.support-widget-panel {
    position: fixed;
    bottom: 0;
    right: 0;
    width: min(100%, 400px);
    height: min(85vh, 620px);
    max-height: min(85vh, 620px);
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -8px 40px rgba(0, 0, 0, .16);
    transform: translateY(110%);
    opacity: 0;
    visibility: hidden;
    transition: transform .35s cubic-bezier(.32, .72, 0, 1), opacity .25s ease, visibility .25s ease;
    z-index: 1051;
    overflow: hidden;
    border: 1px solid rgba(0, 106, 78, .08);
}

.support-widget.is-open .support-widget-panel {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
}

.support-widget-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    padding: 1rem 1rem .85rem;
    background: linear-gradient(135deg, var(--pb-green, #006a4e) 0%, var(--pb-green-dark, #004d38) 100%);
    color: #fff;
    flex-shrink: 0;
}

.support-widget-header-info {
    display: flex;
    align-items: center;
    gap: .75rem;
    min-width: 0;
}

.support-widget-header-icon {
    position: relative;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .18);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.support-widget-online-dot {
    position: absolute;
    right: 1px;
    bottom: 1px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #3ddc97;
    border: 2px solid var(--pb-green-dark, #004d38);
}

.support-widget-header-text {
    min-width: 0;
}

.support-widget-header-top {
    display: flex;
    align-items: center;
    gap: .45rem;
    flex-wrap: wrap;
}

.support-widget-stage,
.support-widget-online-badge {
    display: inline-block;
    font-size: .65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .03em;
    padding: .15rem .45rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, .2);
    color: #fff;
    line-height: 1.3;
}

.support-widget-online-badge {
    background: rgba(61, 220, 151, .28);
}

.support-widget-stage--explorer { background: rgba(255, 255, 255, .22); }
.support-widget-stage--preparing { background: rgba(244, 160, 36, .35); }
.support-widget-stage--active { background: rgba(100, 200, 255, .3); }
.support-widget-stage--ready { background: rgba(120, 255, 180, .28); }

.support-widget-title {
    font-size: 1.05rem;
    font-weight: 700;
    margin: 0;
    line-height: 1.25;
    font-family: var(--pb-font-display, 'Outfit', 'Hind Siliguri', sans-serif);
}

.support-widget-subtitle {
    font-size: .78rem;
    opacity: .88;
    margin-top: .15rem;
}

.support-widget-header-actions {
    display: flex;
    align-items: center;
    gap: .35rem;
    flex-shrink: 0;
}

.support-widget-close,
.support-widget-expand {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, .15);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: background .15s ease;
    text-decoration: none;
    font-size: .9rem;
}

.support-widget-close:hover,
.support-widget-expand:hover {
    background: rgba(255, 255, 255, .28);
    color: #fff;
}

.support-widget-close:focus-visible,
.support-widget-expand:focus-visible {
    outline: 2px solid var(--pb-gold, #e8a317);
    outline-offset: 2px;
}

.support-widget-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    background:
        radial-gradient(ellipse at top right, rgba(232, 163, 23, .06), transparent 45%),
        var(--pb-light, #f3f7f5);
    scroll-behavior: smooth;
    min-height: 180px;
    -webkit-overflow-scrolling: touch;
}

.support-widget-welcome {
    text-align: center;
    padding: 1.25rem .5rem .5rem;
    color: #556;
    font-size: .9rem;
}

.support-widget-welcome-text {
    margin-bottom: .5rem;
    line-height: 1.55;
    color: #334;
}

.support-widget-welcome-eyebrow {
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--pb-green, #006a4e);
    opacity: .9;
}

.support-widget-welcome-meta {
    font-size: .8rem;
    color: var(--pb-green, #006a4e);
    margin-bottom: .75rem !important;
}

.support-widget-chips {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
    justify-content: center;
    margin-top: .75rem;
    padding: 0 .25rem;
}

.support-widget-chip {
    border: 1px solid rgba(0, 106, 78, .2);
    background: #fff;
    color: var(--pb-green-dark, #004d38);
    font-size: .76rem;
    font-weight: 500;
    padding: .4rem .7rem;
    border-radius: 999px;
    cursor: pointer;
    transition: background .15s ease, border-color .15s ease, transform .1s ease;
    font-family: inherit;
    line-height: 1.3;
}

.support-widget-chip:hover:not(:disabled) {
    background: rgba(0, 106, 78, .08);
    border-color: var(--pb-green, #006a4e);
}

.support-widget-chip:active:not(:disabled) {
    transform: scale(.97);
}

.support-widget-chip:disabled {
    opacity: .5;
    cursor: not-allowed;
}

.support-widget-chip:focus-visible {
    outline: 2px solid var(--pb-green, #006a4e);
    outline-offset: 2px;
}

/* Guest CTA shell */
.support-widget-guest-cta-text {
    font-size: .85rem;
    color: #556;
    margin: .75rem 0 .9rem;
    line-height: 1.5;
}

.support-widget-guest-actions {
    display: flex;
    flex-direction: column;
    gap: .5rem;
    padding: 0 .75rem;
    margin-bottom: .85rem;
}

.support-widget-guest-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    padding: .65rem 1rem;
    border-radius: 12px;
    font-weight: 600;
    font-size: .9rem;
    text-decoration: none;
    transition: filter .15s ease, transform .1s ease;
    font-family: inherit;
}

.support-widget-guest-btn--primary {
    background: linear-gradient(135deg, var(--pb-green, #006a4e), var(--pb-green-dark, #004d38));
    color: #fff;
}

.support-widget-guest-btn--gold {
    background: linear-gradient(135deg, var(--pb-gold, #e8a317), var(--pb-gold-hover, #d4920f));
    color: #1a1a2e;
}

.support-widget-guest-btn:hover {
    filter: brightness(1.05);
    color: inherit;
    transform: translateY(-1px);
}

.support-widget-guest-faq {
    display: inline-block;
    font-size: .8rem;
    color: var(--pb-green, #006a4e);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.support-widget-guest-faq:hover {
    color: var(--pb-green-dark, #004d38);
}

.support-widget-composer--guest {
    background: #fafcfb;
    border-top: 1px solid rgba(0, 106, 78, .08);
    padding: .85rem 1rem calc(.9rem + env(safe-area-inset-bottom, 0));
}

.support-widget-guest-locked {
    font-size: .8rem;
    color: #778;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
}

.support-widget-agent-name {
    font-size: .72rem;
    font-weight: 700;
    color: var(--pb-green, #006a4e);
    margin-bottom: .25rem;
    opacity: .85;
}

.support-widget-msg-text {
    line-height: 1.55;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.support-widget-msg-text .ai-md-p {
    display: block;
    margin: 0 0 .45rem;
}

.support-widget-msg-text .ai-md-p:last-child {
    margin-bottom: 0;
}

.support-widget-msg-text .ai-md-heading {
    display: block;
    font-weight: 700;
    color: var(--pb-green-dark, #004d38);
    margin: .2rem 0 .4rem;
}

.support-widget-msg-text .ai-md-list {
    display: block;
    margin: .35rem 0 .55rem;
    padding-left: 1.25rem;
    list-style-position: outside;
}

.support-widget-msg-text .ai-md-list li {
    margin-bottom: .35rem;
    padding-left: .15rem;
    line-height: 1.5;
}

.support-widget-msg-text .ai-md-list li:last-child {
    margin-bottom: 0;
}

.support-widget-msg-text br.ai-md-break {
    display: block;
    content: '';
    margin-top: .35rem;
}

.support-widget-msg-text strong {
    font-weight: 700;
    color: var(--pb-green-dark, #004d38);
}

.support-widget-msg--assistant .support-widget-bubble a {
    color: var(--pb-green, #006a4e);
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.support-widget-time {
    font-size: .65rem;
    opacity: .55;
    margin-top: .35rem;
    text-align: right;
}

.support-widget-msg--assistant .support-widget-time {
    text-align: left;
}

.support-widget-welcome-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto .75rem;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(0, 106, 78, .12), rgba(232, 163, 23, .14));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.45rem;
    color: var(--pb-green, #006a4e);
    box-shadow: inset 0 0 0 1px rgba(0, 106, 78, .08);
}

.support-widget-msg {
    display: flex;
    align-items: flex-end;
    gap: .55rem;
    margin-bottom: .85rem;
    animation: swMsgIn .25s ease;
}

@keyframes swMsgIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes swFabPulse {
    0% { transform: scale(1); opacity: .5; }
    70% { transform: scale(1.35); opacity: 0; }
    100% { transform: scale(1.35); opacity: 0; }
}

.support-widget-msg--user {
    justify-content: flex-end;
}

.support-widget-msg--assistant {
    justify-content: flex-start;
}

.support-widget-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .78rem;
    font-weight: 700;
    flex-shrink: 0;
}

.support-widget-avatar--user {
    background: linear-gradient(135deg, var(--pb-green, #006a4e), var(--pb-green-dark, #004d38));
    color: #fff;
}

.support-widget-avatar--assistant {
    background: #e8f5f0;
    color: var(--pb-green, #006a4e);
    border: 1px solid rgba(0, 106, 78, .12);
}

.support-widget-bubble {
    max-width: 82%;
    padding: .65rem .9rem;
    border-radius: 14px;
    font-size: .88rem;
    line-height: 1.5;
    word-break: break-word;
}

.support-widget-msg--user .support-widget-bubble {
    background: linear-gradient(135deg, var(--pb-green, #006a4e), #00875f);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.support-widget-msg--assistant .support-widget-bubble {
    background: #fff;
    border: 1px solid rgba(0, 106, 78, .1);
    color: #2a2a2a;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .04);
}

.support-widget-bubble img {
    display: block;
    max-width: 100%;
    max-height: 160px;
    border-radius: 8px;
    margin-bottom: .4rem;
}

.support-widget-bubble a {
    color: inherit;
    text-decoration: underline;
}

.support-widget-typing .support-widget-bubble {
    display: flex;
    align-items: center;
    gap: .3rem;
    min-width: 48px;
    padding: .75rem .9rem;
}

.support-widget-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--pb-green, #006a4e);
    opacity: .45;
    animation: swTyping 1.2s infinite ease-in-out;
}

.support-widget-dot:nth-child(2) { animation-delay: .15s; }
.support-widget-dot:nth-child(3) { animation-delay: .3s; }

@keyframes swTyping {
    0%, 80%, 100% { transform: translateY(0); opacity: .35; }
    40% { transform: translateY(-3px); opacity: 1; }
}

.support-widget-composer {
    border-top: 1px solid rgba(0, 106, 78, .08);
    padding: .65rem .75rem calc(.55rem + env(safe-area-inset-bottom, 0));
    background: #fff;
    flex-shrink: 0;
}

.support-widget-footer-meta {
    display: flex;
    justify-content: flex-end;
    margin-top: .4rem;
    padding: 0 .15rem;
}

.support-widget-full-link {
    font-size: .72rem;
    color: var(--pb-green, #006a4e);
    text-decoration: none;
    opacity: .75;
}

.support-widget-full-link:hover {
    opacity: 1;
    text-decoration: underline;
}

.support-widget-image-preview {
    position: relative;
    margin-bottom: .5rem;
    display: inline-block;
}

.support-widget-image-preview img {
    max-height: 72px;
    max-width: 120px;
    border-radius: 8px;
    border: 2px solid var(--pb-gold, #e8a317);
    object-fit: cover;
}

.support-widget-image-remove {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 22px;
    height: 22px;
    border: none;
    border-radius: 50%;
    background: #dc3545;
    color: #fff;
    font-size: .75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
}

.support-widget-input-row {
    display: flex;
    align-items: flex-end;
    gap: .45rem;
}

.support-widget-upload-btn,
.support-widget-send {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    cursor: pointer;
    transition: background .15s ease, opacity .15s ease, filter .15s ease;
}

.support-widget-upload-btn {
    background: rgba(0, 106, 78, .08);
    color: var(--pb-green, #006a4e);
}

.support-widget-upload-btn:hover:not(:disabled) {
    background: rgba(0, 106, 78, .15);
}

.support-widget-send {
    background: linear-gradient(135deg, var(--pb-gold, #e8a317), #e09000);
    color: #1a1a2e;
}

.support-widget-send:hover:not(:disabled) {
    filter: brightness(1.05);
}

.support-widget-send:disabled,
.support-widget-upload-btn:disabled {
    opacity: .55;
    cursor: not-allowed;
}

.support-widget-send.is-loading i {
    animation: swSpin .8s linear infinite;
}

.support-widget-send:focus-visible,
.support-widget-upload-btn:focus-visible {
    outline: 2px solid var(--pb-green, #006a4e);
    outline-offset: 2px;
}

@keyframes swSpin {
    to { transform: rotate(360deg); }
}

.support-widget-input {
    flex: 1;
    border: 1px solid rgba(0, 106, 78, .18);
    border-radius: 20px;
    padding: .55rem .9rem;
    font-size: .88rem;
    resize: none;
    max-height: 100px;
    line-height: 1.4;
    font-family: inherit;
    background: #fff;
}

.support-widget-input:focus {
    outline: none;
    border-color: var(--pb-green, #006a4e);
    box-shadow: 0 0 0 3px rgba(0, 106, 78, .12);
}

@media (min-width: 480px) {
    .support-widget-panel {
        bottom: 5.5rem;
        right: max(1.25rem, env(safe-area-inset-right, 0px));
        border-radius: 20px;
        height: min(70vh, 560px);
        max-height: min(70vh, 560px);
        width: 380px;
        transform: translateY(20px) scale(.96);
    }

    .support-widget.is-open .support-widget-panel {
        transform: translateY(0) scale(1);
    }

    .support-widget-fab-stack {
        bottom: max(1.5rem, env(safe-area-inset-bottom, 0px));
        right: max(1.5rem, env(safe-area-inset-right, 0px));
    }

    .support-widget--has-whatsapp .support-widget-panel {
        bottom: 9.5rem;
    }

    .support-widget-guest-actions {
        flex-direction: row;
        justify-content: center;
    }

    .support-widget-guest-btn {
        flex: 1;
    }
}

@media (max-width: 479px) {
    .support-widget-panel {
        width: 100%;
        max-width: 100%;
        left: 0;
        right: 0;
    }

    .support-widget.is-open .support-widget-fab-stack {
        bottom: calc(min(85vh, 620px) + .35rem);
        right: 1rem;
    }

    .support-widget.is-open .support-widget-fab {
        padding: .75rem;
        width: 48px;
        height: 48px;
        justify-content: center;
    }

    .support-widget.is-open .support-widget-whatsapp-fab {
        padding: .75rem;
        width: 48px;
        height: 48px;
        justify-content: center;
    }

    .support-widget.is-open .support-widget-whatsapp-label {
        display: none !important;
    }
}

@media (prefers-reduced-motion: reduce) {
    .support-widget-fab,
    .support-widget-whatsapp-fab,
    .support-widget-panel,
    .support-widget-chip,
    .support-widget-guest-btn,
    .support-widget-msg {
        transition: none !important;
        animation: none !important;
    }

    .support-widget-fab-pulse,
    .support-widget-dot,
    .support-widget-send.is-loading i {
        animation: none !important;
    }

    .support-widget-messages {
        scroll-behavior: auto;
    }
}
