/* ═══════════════════════════════════════════════════════
   SVaaN Chatbot — Radixweb-inspired guided flow widget
   Uses CSS custom property --ac for the brand accent color
═══════════════════════════════════════════════════════ */

/* ── CSS Reset (scoped) ──────────────────────────────── */
.svaan-cb *,
.svaan-cb *::before,
.svaan-cb *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', Roboto, sans-serif;
}

/* ── Positioning wrapper ─────────────────────────────── */
.svaan-cb {
    position: fixed;
    z-index: 2147483647;
    /* max z-index, above Elementor */
    bottom: 24px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 12px;
}

.svaan-cb--right {
    right: 24px;
}

.svaan-cb--left {
    left: 24px;
    align-items: flex-start;
}

/* ═══════════════════════════════════════════════════════
   LAUNCHER BUTTON
═══════════════════════════════════════════════════════ */
.svaan-cb__btn {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--ac, #0a5cf5);
    border: none;
    border-radius: 50px;
    padding: 11px 20px 11px 12px;
    cursor: pointer;
    color: #fff;
    box-shadow: 0 6px 28px color-mix(in srgb, var(--ac, #0a5cf5) 45%, transparent);
    transition: transform .2s ease, box-shadow .2s ease;
    position: relative;
    line-height: 1;
    outline: none;
}

.svaan-cb__btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 36px color-mix(in srgb, var(--ac, #0a5cf5) 55%, transparent);
}

.svaan-cb__btn:focus-visible {
    outline: 3px solid white;
    outline-offset: 2px;
}

/* Icon circle */
.svaan-cb__btn-icon {
    width: 38px;
    height: 38px;
    background: rgba(255, 255, 255, .18);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: transform .2s;
}

.svaan-cb__btn-icon--close {
    display: none;
}

.svaan-cb__btn-icon svg {
    width: 22px;
    height: 22px;
}

/* Button text label */
.svaan-cb__btn-label {
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    letter-spacing: -.01em;
}

/* Unread notification dot */
.svaan-cb__dot {
    position: absolute;
    top: 3px;
    right: 3px;
    width: 12px;
    height: 12px;
    background: #ff3b3b;
    border: 2.5px solid #fff;
    border-radius: 50%;
    animation: sv-pulse 2.2s infinite;
}

.svaan-cb__dot.is-hidden {
    display: none;
}

@keyframes sv-pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.5);
        opacity: .7;
    }
}

/* ═══════════════════════════════════════════════════════
   CHAT WINDOW
═══════════════════════════════════════════════════════ */
.svaan-cb__win {
    width: 385px;
    max-width: calc(100vw - 32px);
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .18), 0 2px 8px rgba(0, 0, 0, .06);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    max-height: 78vh;

    /* Hidden by default */
    opacity: 0;
    transform: translateY(14px) scale(.96);
    pointer-events: none;
    transition: opacity .24s ease, transform .24s ease;
    transform-origin: bottom right;
}

.svaan-cb--left .svaan-cb__win {
    transform-origin: bottom left;
}

.svaan-cb__win.is-open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: all;
}

/* ── Header ──────────────────────────────────────────── */
.svaan-cb__head {
    background: var(--ac, #0a5cf5);
    padding: 15px 17px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.svaan-cb__head-left {
    display: flex;
    align-items: center;
    gap: 11px;
}

.svaan-cb__avatar {
    width: 42px;
    height: 42px;
    flex-shrink: 0;
}

.svaan-cb__avatar svg {
    width: 42px;
    height: 42px;
}

.svaan-cb__head-name {
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: -.01em;
}

.svaan-cb__head-status {
    color: rgba(255, 255, 255, .82);
    font-size: 11px;
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: 2px;
}

.svaan-cb__live-dot {
    width: 7px;
    height: 7px;
    background: #4dffb4;
    border-radius: 50%;
    display: inline-block;
}

.svaan-cb__head-close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .15);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .15s;
    flex-shrink: 0;
}

.svaan-cb__head-close:hover {
    background: rgba(255, 255, 255, .28);
}

.svaan-cb__head-close:focus-visible {
    outline: 2px solid rgba(255, 255, 255, .7);
}

.svaan-cb__head-close svg {
    width: 16px;
    height: 16px;
}

/* ── Progress bar ────────────────────────────────────── */
.svaan-cb__prog {
    height: 3px;
    background: rgba(0, 0, 0, .06);
    flex-shrink: 0;
}

.svaan-cb__prog-bar {
    height: 100%;
    background: var(--ac, #0a5cf5);
    width: 8%;
    transition: width .45s ease;
}

/* ── Message scroll body ─────────────────────────────── */
.svaan-cb__body {
    flex: 1;
    overflow-y: auto;
    padding: 18px 15px 10px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: #f4f7fe;
    scroll-behavior: smooth;
    overscroll-behavior: contain;
}

.svaan-cb__body::-webkit-scrollbar {
    width: 4px;
}

.svaan-cb__body::-webkit-scrollbar-thumb {
    background: #d0d9f0;
    border-radius: 4px;
}

/* ── Bot message bubble ──────────────────────────────── */
.svaan-cb__msg {
    display: flex;
    flex-direction: column;
    gap: 2px;
    animation: sv-in .22s ease both;
}

@keyframes sv-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.svaan-cb__msg-txt {
    display: inline-block;
    background: #fff;
    border: 1px solid #e4ecf9;
    border-radius: 4px 16px 16px 16px;
    padding: 11px 15px;
    font-size: 13.5px;
    line-height: 1.65;
    color: #2d3748;
    box-shadow: 0 1px 5px rgba(0, 0, 0, .05);
    white-space: pre-wrap;
    word-break: break-word;
    max-width: 88%;
}

/* Bold & links inside answers */
.svaan-cb__msg-txt strong {
    font-weight: 700;
    color: #1a202c;
}

.svaan-cb__msg-txt a {
    color: var(--ac, #0a5cf5);
}

/* User bubble */
.svaan-cb__msg--user .svaan-cb__msg-txt {
    background: var(--ac, #0a5cf5);
    color: #fff;
    border-color: transparent;
    border-radius: 16px 4px 16px 16px;
    align-self: flex-end;
    margin-left: auto;
}

/* ── Option buttons ──────────────────────────────────── */
.svaan-cb__opts {
    display: flex;
    flex-direction: column;
    gap: 7px;
    margin-top: 6px;
    animation: sv-in .25s .08s ease both;
}

.svaan-cb__opt {
    background: #fff;
    border: 1.5px solid #dce6f8;
    border-radius: 10px;
    padding: 10px 14px 10px 15px;
    font-size: 13px;
    font-weight: 500;
    color: #374151;
    cursor: pointer;
    text-align: left;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    transition: border-color .14s, background .14s, color .14s, transform .12s;
    line-height: 1.4;
}

/* Arrow indicator */
.svaan-cb__opt::after {
    content: '›';
    font-size: 20px;
    color: var(--ac, #0a5cf5);
    opacity: .5;
    flex-shrink: 0;
    transition: opacity .14s, transform .14s;
}

.svaan-cb__opt:hover {
    border-color: var(--ac, #0a5cf5);
    background: #f0f5ff;
    color: var(--ac, #0a5cf5);
    transform: translateX(4px);
}

.svaan-cb__opt:hover::after {
    opacity: 1;
    transform: translateX(3px);
}

.svaan-cb__opt.is-picked {
    background: var(--ac, #0a5cf5);
    border-color: var(--ac, #0a5cf5);
    color: #fff;
    cursor: default;
    transform: none;
}

.svaan-cb__opt.is-picked::after {
    color: rgba(255, 255, 255, .7);
    opacity: 1;
}

.svaan-cb__opt:disabled {
    opacity: .55;
    cursor: not-allowed;
    transform: none;
}

.svaan-cb__opt:focus-visible {
    outline: 2px solid var(--ac, #0a5cf5);
    outline-offset: 1px;
}

/* ── Typing indicator ────────────────────────────────── */
.svaan-cb__typing {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 12px 15px;
    background: #fff;
    border: 1px solid #e4ecf9;
    border-radius: 4px 16px 16px 16px;
    width: fit-content;
    box-shadow: 0 1px 5px rgba(0, 0, 0, .05);
}

.svaan-cb__typing span {
    display: inline-block;
    width: 7px;
    height: 7px;
    background: #b8c9e8;
    border-radius: 50%;
    animation: sv-bounce 1.3s infinite;
}

.svaan-cb__typing span:nth-child(2) {
    animation-delay: .18s;
}

.svaan-cb__typing span:nth-child(3) {
    animation-delay: .36s;
}

@keyframes sv-bounce {

    0%,
    80%,
    100% {
        transform: translateY(0);
    }

    40% {
        transform: translateY(-8px);
    }
}

/* ── Contact form area ───────────────────────────────── */
.svaan-cb__form {
    padding: 14px 15px;
    background: #fff;
    border-top: 1px solid #ebf0fa;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
    animation: sv-in .2s ease both;
}

.svaan-cb__field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.svaan-cb__lbl {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: #6b7a99;
}

.svaan-cb__lbl .req {
    color: #e53e3e;
    margin-left: 1px;
}

.svaan-cb__inp,
.svaan-cb__ta {
    width: 100%;
    border: 1.5px solid #dce6f8;
    border-radius: 8px;
    padding: 9px 12px;
    font-size: 13.5px;
    color: #2d3748;
    background: #f7f9fe;
    outline: none;
    transition: border-color .15s, background .15s, box-shadow .15s;
}

.svaan-cb__inp:focus,
.svaan-cb__ta:focus {
    border-color: var(--ac, #0a5cf5);
    background: #fff;
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--ac, #0a5cf5) 15%, transparent);
}

.svaan-cb__ta {
    resize: none;
    height: 74px;
    line-height: 1.5;
}

/* Validation error state */
.svaan-cb__field.has-err .svaan-cb__inp,
.svaan-cb__field.has-err .svaan-cb__ta {
    border-color: #e53e3e;
    background: #fff5f5;
}

.svaan-cb__err {
    font-size: 11px;
    color: #e53e3e;
    display: none;
}

.svaan-cb__field.has-err .svaan-cb__err {
    display: block;
}

.svaan-cb__submit {
    width: 100%;
    padding: 12px;
    background: var(--ac, #0a5cf5);
    color: #fff;
    border: none;
    border-radius: 9px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: opacity .15s, transform .15s;
    letter-spacing: -.01em;
    margin-top: 2px;
}

.svaan-cb__submit:hover:not(:disabled) {
    opacity: .88;
    transform: translateY(-1px);
}

.svaan-cb__submit:active {
    transform: translateY(0);
}

.svaan-cb__submit:disabled {
    opacity: .5;
    cursor: not-allowed;
    transform: none;
}

.svaan-cb__submit:focus-visible {
    outline: 3px solid rgba(255, 255, 255, .6);
}

/* End / thank you state */
.svaan-cb__end-icon {
    font-size: 42px;
    text-align: center;
    margin: 4px 0 8px;
}

/* ── Powered-by footer ───────────────────────────────── */
.svaan-cb__credit {
    text-align: center;
    font-size: 10px;
    color: #b0bcd8;
    padding: 5px;
    background: #fff;
    border-top: 1px solid #f0f3fb;
    flex-shrink: 0;
}

.svaan-cb__credit a {
    color: var(--ac, #0a5cf5);
    text-decoration: none;
    font-weight: 600;
}

/* ═══════════════════════════════════════════════════════
   MOBILE
═══════════════════════════════════════════════════════ */
@media (max-width: 480px) {
    .svaan-cb {
        bottom: 14px;
    }

    .svaan-cb--right {
        right: 14px;
    }

    .svaan-cb--left {
        left: 14px;
    }

    .svaan-cb__win {
        width: calc(100vw - 28px);
        max-height: 72vh;
        border-radius: 16px;
    }

    /* Collapse label on mobile — show icon-only pill */
    .svaan-cb__btn-label {
        display: none;
    }

    .svaan-cb__btn {
        width: 58px;
        height: 58px;
        padding: 0;
        border-radius: 50%;
        justify-content: center;
    }

    .svaan-cb__btn-icon {
        width: 40px;
        height: 40px;
        background: transparent;
    }

    .svaan-cb__btn-icon svg {
        width: 26px;
        height: 26px;
    }
}