/**
 * Unified Floating Action Dock & Anti-Collision System
 * Coordinates Native AI Chatbot, WhatsApp, Direct Call, and Tawk.to
 */

.__floating-action-dock {
    position: fixed;
    z-index: 1040;
    display: flex;
    flex-direction: column-reverse;
    align-items: center;
    gap: 12px;
    margin: 0;
    padding: 0;
    list-style: none;
    pointer-events: auto;
    transition: bottom 0.3s cubic-bezier(0.16, 1, 0.3, 1), left 0.3s ease, right 0.3s ease;
}

/* Default Right Position */
.__floating-action-dock.dock-pos-right {
    right: 20px;
    bottom: 24px;
    left: auto;
}

/* Optional Left Position */
.__floating-action-dock.dock-pos-left {
    left: 20px;
    bottom: 24px;
    right: auto;
}

/* Anti-Collision: Elevated directly above Tawk.to when anchored bottom-right */
.__floating-action-dock.dock-pos-right.has-tawkto {
    bottom: 95px !important;
}

/* Mobile Screen & Mobile Bottom Navigation Bar Support */
@media (max-width: 767.98px) {
    .__floating-action-dock.dock-pos-right {
        right: 14px;
        bottom: 24px;
    }
    .__floating-action-dock.dock-pos-left {
        left: 14px;
        bottom: 24px;
    }
    .__floating-action-dock.has-mobile-nav {
        bottom: 80px !important;
    }
    .__floating-action-dock.has-mobile-nav.has-tawkto.dock-pos-right {
        bottom: 145px !important;
    }
}

/* Dock Item Wrapping */
.dock-item {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Hover Tooltips */
.dock-tooltip {
    position: absolute;
    top: 50%;
    transform: translateY(-50%) scale(0.92);
    background: rgba(15, 23, 42, 0.92);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    color: #ffffff;
    font-size: 12px;
    font-weight: 600;
    padding: 5px 11px;
    border-radius: 6px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
    z-index: 1050;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.dock-pos-right .dock-tooltip {
    right: calc(100% + 12px);
}

.dock-pos-left .dock-tooltip {
    left: calc(100% + 12px);
}

.dock-item:hover .dock-tooltip {
    opacity: 1;
    transform: translateY(-50%) scale(1);
}

/* Button Base Styles */
.dock-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: none;
    outline: none;
    cursor: pointer;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.16);
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s ease;
    user-select: none;
    text-decoration: none !important;
    color: #ffffff !important;
    padding: 0;
}

.dock-btn:hover {
    transform: scale(1.09);
    box-shadow: 0 10px 26px rgba(0, 0, 0, 0.24);
}

.dock-btn:active {
    transform: scale(0.94);
}

/* 1. Native AI Chatbot Button */
.dock-btn-ai {
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, #4F46E5 0%, #7C3AED 100%);
    position: relative;
}

.dock-btn-ai svg {
    width: 28px;
    height: 28px;
    stroke: #ffffff;
    transition: transform 0.2s ease;
}

.dock-icon-close {
    display: none;
}

.dock-btn-ai.is-active .dock-icon-bot {
    display: none;
}

.dock-btn-ai.is-active .dock-icon-close {
    display: block;
}

/* Pulse animation on AI bot */
.dock-pulse-ring {
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 2px solid rgba(124, 58, 237, 0.5);
    animation: dockAiPulse 2.4s infinite cubic-bezier(0.4, 0, 0.6, 1);
    pointer-events: none;
}

@keyframes dockAiPulse {
    0% { transform: scale(0.96); opacity: 0.9; }
    50% { transform: scale(1.22); opacity: 0; }
    100% { transform: scale(0.96); opacity: 0; }
}

/* 2. WhatsApp Button */
.dock-btn-wa {
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, #25D366, #128C7E);
    position: relative;
}

.dock-btn-wa svg {
    width: 28px;
    height: 28px;
    fill: #ffffff;
    transition: transform 0.2s ease;
}

.dock-btn-wa .dock-pulse-ring {
    border-color: rgba(37, 211, 102, 0.5);
}

/* 3. Direct Phone Call Button */
.dock-btn-call {
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, #0284C7, #0369A1);
    position: relative;
}

.dock-btn-call svg {
    width: 26px;
    height: 26px;
    stroke: #ffffff;
    transition: transform 0.2s ease;
}

.dock-btn-call .dock-pulse-ring {
    border-color: rgba(2, 132, 199, 0.5);
}

/* ─── Embedded Native AI Chatbot Window (Safe Positioning Guarantee) ─── */
#softsasi-window {
    position: fixed !important;
    z-index: 100000 !important;
    width: 380px !important;
    height: 580px !important;
    max-width: calc(100vw - 32px) !important;
    max-height: calc(100vh - 100px) !important;
    background: #ffffff !important;
    border-radius: 16px !important;
    box-shadow: 0 20px 30px -10px rgba(0, 0, 0, 0.25) !important;
    border: 1px solid #E2E8F0 !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.25s !important;
    transform: translateY(20px) scale(0.96) !important;
}

#softsasi-window.softsasi-open {
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
    transform: translateY(0) scale(1) !important;
}

#softsasi-window.softsasi-pos-bottom-right,
#softsasi-window:not(.softsasi-pos-bottom-left) {
    right: 24px !important;
    bottom: 94px !important;
    left: auto !important;
    top: auto !important;
}

#softsasi-window.softsasi-pos-bottom-left {
    left: 24px !important;
    bottom: 94px !important;
    right: auto !important;
    top: auto !important;
}

@media (max-width: 480px) {
    #softsasi-window {
        width: calc(100vw - 20px) !important;
        height: calc(100vh - 110px) !important;
        right: 10px !important;
        bottom: 85px !important;
    }
}
