/**
 * Digitons Development — Floating Widgets: Call CTA, WhatsApp CTA & DigiSaathi AI
 * Premium, lightweight, accessible, zero layout shift.
 */

/* ==========================================================================
   0. Floating Call Us CTA
   ========================================================================== */
.floating-call-btn {
    position: fixed;
    right: 24px;
    bottom: 154px;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0057fc 0%, #003bb5 100%);
    color: #FFFFFF !important;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none !important;
    box-shadow: 0 4px 18px rgba(0, 87, 252, 0.38), 0 2px 6px rgba(0, 0, 0, 0.08);
    z-index: 9988;
    cursor: pointer;
    transition: transform 0.24s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.24s ease, opacity 0.2s ease;
    outline: none;
    border: none;
    -webkit-tap-highlight-color: transparent;
}

.floating-call-btn svg {
    width: 24px;
    height: 24px;
    stroke: #FFFFFF;
    transition: transform 0.2s ease;
    display: block;
}

.floating-call-btn:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 8px 24px rgba(0, 87, 252, 0.52), 0 4px 10px rgba(0, 0, 0, 0.12);
    color: #FFFFFF !important;
}

.floating-call-btn:hover svg {
    transform: rotate(12deg) scale(1.08);
}

.floating-call-btn:active {
    transform: translateY(0) scale(0.96);
}

/* Tooltip on hover (desktop only) */
.floating-call-tooltip {
    position: absolute;
    right: 64px;
    top: 50%;
    transform: translateY(-50%) translateX(6px);
    background: #0f172a;
    color: #ffffff;
    font-family: "Poppins", -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 12.5px;
    font-weight: 500;
    line-height: 1;
    padding: 8px 12px;
    border-radius: 8px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.2);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.floating-call-tooltip::after {
    content: "";
    position: absolute;
    right: -5px;
    top: 50%;
    transform: translateY(-50%);
    border-width: 5px 0 5px 5px;
    border-style: solid;
    border-color: transparent transparent transparent #0f172a;
}

.floating-call-btn:hover .floating-call-tooltip,
.floating-call-btn:focus-visible .floating-call-tooltip {
    opacity: 1;
    transform: translateY(-50%) translateX(0);
}

/* ==========================================================================
   1. Floating WhatsApp CTA
   ========================================================================== */
.floating-whatsapp-btn {
    position: fixed;
    right: 24px;
    bottom: 92px;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
    color: #FFFFFF !important;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none !important;
    box-shadow: 0 4px 18px rgba(37, 211, 102, 0.38), 0 2px 6px rgba(0, 0, 0, 0.08);
    z-index: 9989;
    cursor: pointer;
    transition: transform 0.24s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.24s ease, opacity 0.2s ease;
    outline: none;
    border: none;
    -webkit-tap-highlight-color: transparent;
}

.floating-whatsapp-btn svg {
    width: 28px;
    height: 28px;
    fill: #FFFFFF;
    transition: transform 0.2s ease;
    display: block;
}

.floating-whatsapp-btn:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 8px 24px rgba(37, 211, 102, 0.5), 0 4px 10px rgba(0, 0, 0, 0.12);
    color: #FFFFFF !important;
}

.floating-whatsapp-btn:hover svg {
    transform: scale(1.06);
}

.floating-whatsapp-btn:active {
    transform: translateY(0) scale(0.96);
}

/* Tooltip on hover (desktop only) */
.floating-whatsapp-tooltip {
    position: absolute;
    right: 64px;
    top: 50%;
    transform: translateY(-50%) translateX(6px);
    background: #0f172a;
    color: #ffffff;
    font-family: "Poppins", -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 12.5px;
    font-weight: 500;
    line-height: 1;
    padding: 8px 12px;
    border-radius: 8px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.2);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.floating-whatsapp-tooltip::after {
    content: "";
    position: absolute;
    right: -5px;
    top: 50%;
    transform: translateY(-50%);
    border-width: 5px 0 5px 5px;
    border-style: solid;
    border-color: transparent transparent transparent #0f172a;
}

.floating-whatsapp-btn:hover .floating-whatsapp-tooltip,
.floating-whatsapp-btn:focus-visible .floating-whatsapp-tooltip {
    opacity: 1;
    transform: translateY(-50%) translateX(0);
}


/* ==========================================================================
   2. DigiSaathi AI Floating Launcher
   ========================================================================== */
.digisaathi-launcher {
    position: fixed;
    right: 24px;
    bottom: 24px;
    width: 58px;
    height: 58px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ac218a 0%, #6c5ce7 100%);
    color: #ffffff !important;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    box-shadow: 0 6px 22px rgba(172, 33, 138, 0.42), 0 2px 8px rgba(108, 92, 231, 0.2);
    z-index: 9990;
    cursor: pointer;
    transition: transform 0.24s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.24s ease;
    outline: none;
    -webkit-tap-highlight-color: transparent;
}

.digisaathi-launcher:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 10px 28px rgba(172, 33, 138, 0.55), 0 4px 12px rgba(108, 92, 231, 0.3);
}

.digisaathi-launcher:active {
    transform: translateY(0) scale(0.96);
}

.digisaathi-launcher-icon-open,
.digisaathi-launcher-icon-close {
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.22s ease, opacity 0.22s ease;
}

.digisaathi-launcher-icon-open {
    opacity: 1;
    transform: scale(1) rotate(0deg);
}

.digisaathi-launcher-icon-close {
    opacity: 0;
    transform: scale(0.5) rotate(-90deg);
}

.digisaathi-wrapper.is-open .digisaathi-launcher-icon-open {
    opacity: 0;
    transform: scale(0.5) rotate(90deg);
}

.digisaathi-wrapper.is-open .digisaathi-launcher-icon-close {
    opacity: 1;
    transform: scale(1) rotate(0deg);
}

/* Pulsing Badge Indicator */
.digisaathi-launcher-badge {
    position: absolute;
    top: 0px;
    right: 0px;
    width: 14px;
    height: 14px;
    background: #10b981;
    border: 2.5px solid #ffffff;
    border-radius: 50%;
}

.digisaathi-launcher-tooltip {
    position: absolute;
    right: 70px;
    top: 50%;
    transform: translateY(-50%) translateX(6px);
    background: #0f172a;
    color: #ffffff;
    font-family: "Poppins", -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 12.5px;
    font-weight: 500;
    line-height: 1;
    padding: 8px 12px;
    border-radius: 8px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.2);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.digisaathi-launcher-tooltip::after {
    content: "";
    position: absolute;
    right: -5px;
    top: 50%;
    transform: translateY(-50%);
    border-width: 5px 0 5px 5px;
    border-style: solid;
    border-color: transparent transparent transparent #0f172a;
}

.digisaathi-launcher:hover .digisaathi-launcher-tooltip,
.digisaathi-launcher:focus-visible .digisaathi-launcher-tooltip {
    opacity: 1;
    transform: translateY(-50%) translateX(0);
}

.digisaathi-wrapper.is-open .digisaathi-launcher-tooltip {
    display: none;
}


/* ==========================================================================
   3. DigiSaathi AI Chat Window
   ========================================================================== */
.digisaathi-window {
    position: fixed;
    right: 24px;
    bottom: 94px;
    width: 388px;
    max-width: calc(100vw - 32px);
    height: 560px;
    max-height: calc(100vh - 120px);
    background: #ffffff;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(15, 23, 42, 0.18), 0 0 0 1px rgba(226, 232, 240, 0.85);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 9995;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(18px) scale(0.96);
    transform-origin: bottom right;
    transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.24s ease, visibility 0.24s;
    font-family: "Poppins", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.digisaathi-wrapper.is-open .digisaathi-window {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0) scale(1);
}

/* Chat Header */
.digisaathi-header {
    background: linear-gradient(135deg, #ac218a 0%, #6c5ce7 100%);
    padding: 16px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(172, 33, 138, 0.2);
    position: relative;
    z-index: 2;
}

.digisaathi-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.digisaathi-avatar-wrap {
    position: relative;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.digisaathi-avatar-icon {
    width: 22px;
    height: 22px;
    stroke: #ffffff;
}

.digisaathi-avatar-dot {
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #10b981;
    border: 2px solid #ffffff;
}

.digisaathi-header-text h3 {
    margin: 0;
    font-size: 15.5px;
    font-weight: 600;
    color: #ffffff;
    line-height: 1.2;
    letter-spacing: -0.2px;
}

.digisaathi-header-subtitle {
    margin: 2px 0 0 0;
    font-size: 11.5px;
    color: rgba(255, 255, 255, 0.88);
    font-weight: 400;
    line-height: 1.2;
}

.digisaathi-header-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.digisaathi-header-btn {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    border-radius: 8px;
    color: #ffffff;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s ease;
    padding: 0;
}

.digisaathi-header-btn:hover {
    background: rgba(255, 255, 255, 0.28);
}

/* Chat Messages Container */
.digisaathi-messages {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    background: #f8fafc;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

.digisaathi-messages::-webkit-scrollbar {
    width: 5px;
}

.digisaathi-messages::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}

/* Chat Bubble Layout */
.digisaathi-msg {
    display: flex;
    gap: 10px;
    max-width: 90%;
    animation: digiMsgIn 0.24s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes digiMsgIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.digisaathi-msg-bot {
    align-self: flex-start;
}

.digisaathi-msg-user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.digisaathi-msg-avatar {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: linear-gradient(135deg, #ac218a 0%, #6c5ce7 100%);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 4px;
}

.digisaathi-msg-avatar svg {
    width: 16px;
    height: 16px;
}

.digisaathi-bubble {
    padding: 12px 14px;
    border-radius: 16px;
    font-size: 13.5px;
    line-height: 1.55;
    word-break: break-word;
}

.digisaathi-msg-bot .digisaathi-bubble {
    background: #ffffff;
    color: #1e293b;
    border: 1px solid #e2e8f0;
    border-top-left-radius: 4px;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
}

.digisaathi-msg-user .digisaathi-bubble {
    background: #ac218a;
    color: #ffffff;
    border-top-right-radius: 4px;
    box-shadow: 0 2px 8px rgba(172, 33, 138, 0.25);
}

.digisaathi-bubble p {
    margin: 0 0 8px 0;
}

.digisaathi-bubble p:last-child {
    margin-bottom: 0;
}

.digisaathi-bubble strong {
    font-weight: 600;
}

.digisaathi-bubble ul {
    margin: 6px 0 8px 0;
    padding-left: 18px;
    list-style: disc;
}

.digisaathi-bubble li {
    margin-bottom: 4px;
}

/* Action Button Container inside Message */
.digisaathi-bubble-actions {
    margin-top: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.digisaathi-action-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 50px;
    text-decoration: none !important;
    transition: all 0.2s ease;
    cursor: pointer;
}

.digisaathi-action-primary {
    background: #ac218a;
    color: #ffffff !important;
    box-shadow: 0 2px 6px rgba(172, 33, 138, 0.2);
}

.digisaathi-action-primary:hover {
    background: #951b77;
    transform: translateY(-1px);
}

.digisaathi-action-whatsapp {
    background: #25D366;
    color: #ffffff !important;
    box-shadow: 0 2px 6px rgba(37, 211, 102, 0.25);
}

.digisaathi-action-whatsapp:hover {
    background: #1eb956;
    transform: translateY(-1px);
}

.digisaathi-action-secondary {
    background: #f1f5f9;
    color: #1e293b !important;
    border: 1px solid #cbd5e1;
}

.digisaathi-action-secondary:hover {
    background: #e2e8f0;
    color: #0f172a !important;
}

/* Quick Action Chips Wrapper & Scroll Navigation */
.digisaathi-chips-wrapper {
    position: relative;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    padding: 10px 32px;
    display: flex;
    align-items: center;
    flex-shrink: 0 !important; /* CRITICAL: Never squish on flex overflow */
    box-sizing: border-box;
    width: 100%;
}

.digisaathi-chips-scroll-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    color: #475569;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.12);
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    padding: 0;
}

.digisaathi-chips-scroll-btn:hover {
    background: #ac218a;
    color: #ffffff;
    border-color: #ac218a;
    transform: translateY(-50%) scale(1.08);
    box-shadow: 0 3px 8px rgba(172, 33, 138, 0.25);
}

.digisaathi-chips-scroll-btn:active {
    transform: translateY(-50%) scale(0.95);
}

.digisaathi-chips-prev {
    left: 5px;
}

.digisaathi-chips-next {
    right: 5px;
}

.digisaathi-chips-bar {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 8px;
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    cursor: grab;
    user-select: none;
    -webkit-user-select: none;
    padding: 2px 6px;
    box-sizing: border-box;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
}

.digisaathi-chips-bar.is-dragging {
    cursor: grabbing;
    scroll-behavior: auto;
}

.digisaathi-chips-bar::-webkit-scrollbar {
    height: 3px;
}

.digisaathi-chips-bar::-webkit-scrollbar-track {
    background: transparent;
}

.digisaathi-chips-bar::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}

.digisaathi-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 13px;
    border-radius: 50px;
    font-size: 12px;
    font-weight: 500;
    font-family: inherit;
    line-height: 1.2;
    color: #334155;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    cursor: pointer;
    flex-shrink: 0 !important;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05);
    white-space: nowrap;
    box-sizing: border-box;
}

.digisaathi-chip svg {
    color: #ac218a;
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.digisaathi-chip:hover {
    color: #ac218a;
    border-color: #ac218a;
    background: #fdf2f8;
    box-shadow: 0 2px 8px rgba(172, 33, 138, 0.16);
    transform: translateY(-1px);
}

.digisaathi-chip:hover svg {
    transform: scale(1.1);
}

.digisaathi-chip:active {
    transform: translateY(0);
}

/* Chat Input Bar */
.digisaathi-input-wrap {
    padding: 10px 14px 12px;
    background: #ffffff;
    border-top: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex-shrink: 0 !important;
}

.digisaathi-input-row {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 24px;
    padding: 4px 6px 4px 14px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.digisaathi-input-row:focus-within {
    border-color: #ac218a;
    box-shadow: 0 0 0 3px rgba(172, 33, 138, 0.12);
    background: #ffffff;
}

.digisaathi-input {
    flex: 1 1 auto;
    border: none;
    background: transparent;
    font-size: 13.5px;
    font-family: inherit;
    color: #1e293b;
    outline: none;
    padding: 6px 0;
}

.digisaathi-input::placeholder {
    color: #94a3b8;
}

.digisaathi-send-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #ac218a;
    color: #ffffff;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
    flex-shrink: 0;
    padding: 0;
}

.digisaathi-send-btn:hover {
    background: #951b77;
    transform: scale(1.05);
}

.digisaathi-send-btn:disabled {
    background: #cbd5e1;
    cursor: not-allowed;
    transform: none;
}

.digisaathi-disclaimer {
    font-size: 10.5px;
    color: #94a3b8;
    text-align: center;
    margin: 0;
    line-height: 1.3;
}

/* Typing Indicator */
.digisaathi-typing {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 10px 14px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    border-top-left-radius: 4px;
    width: fit-content;
}

.digisaathi-typing-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #94a3b8;
    animation: digiTyping 1.4s infinite ease-in-out both;
}

.digisaathi-typing-dot:nth-child(1) { animation-delay: -0.32s; }
.digisaathi-typing-dot:nth-child(2) { animation-delay: -0.16s; }
.digisaathi-typing-dot:nth-child(3) { animation-delay: 0s; }

@keyframes digiTyping {
    0%, 80%, 100% {
        transform: scale(0.6);
        opacity: 0.4;
    }
    40% {
        transform: scale(1);
        opacity: 1;
        background: #ac218a;
    }
}


/* ==========================================================================
   4. Mobile Responsiveness (<640px)
   ========================================================================== */
@media (max-width: 640px) {
    .floating-call-btn {
        right: 18px;
        bottom: 134px;
        width: 46px;
        height: 46px;
    }

    .floating-call-btn svg {
        width: 21px;
        height: 21px;
    }

    .floating-call-tooltip {
        display: none !important;
    }

    .floating-whatsapp-btn {
        right: 18px;
        bottom: 78px;
        width: 48px;
        height: 48px;
    }

    .floating-whatsapp-btn svg {
        width: 25px;
        height: 25px;
    }

    .floating-whatsapp-tooltip,
    .digisaathi-launcher-tooltip {
        display: none !important;
    }

    .digisaathi-launcher {
        right: 18px;
        bottom: 18px;
        width: 52px;
        height: 52px;
    }

    .digisaathi-launcher svg {
        width: 24px;
        height: 24px;
    }

    .digisaathi-window {
        right: 0 !important;
        left: 0 !important;
        bottom: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        height: 85vh !important;
        max-height: 85vh !important;
        border-radius: 20px 20px 0 0 !important;
        box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.2) !important;
        transform: translateY(100%) !important;
    }

    .digisaathi-wrapper.is-open .digisaathi-window {
        transform: translateY(0) !important;
    }

    .digisaathi-header {
        padding: 14px 16px;
        border-radius: 20px 20px 0 0;
    }

    .digisaathi-messages {
        padding: 14px;
    }

    .digisaathi-bubble {
        font-size: 13px;
    }
}
