/* LiveChat Position Fix - Prevents Full-Page Overlay */
/* Created: December 14, 2025 */
/* Purpose: Fix Odoo LiveChat widget from covering entire page */

/* Target all LiveChat container elements */
.o_livechat_root,
.o-livechat-root,
.o_livechat_button,
.o_livechat_chatwindow,
[class*="livechat"],
[id*="livechat"],
[class*="o_livechat"],
[id*="o_livechat"] {
    /* Force corner positioning instead of full-page overlay */
    z-index: 999 !important; /* Below modals (1001) and modal backdrop (1000) */
    max-width: 400px !important; /* Prevent full-width */
    max-height: 600px !important; /* Prevent full-height */
    width: auto !important; /* Override any 100% width */
    height: auto !important; /* Override any 100% height */

    /* Position in bottom-right corner */
    position: fixed !important;
    bottom: 20px !important;
    right: 20px !important;
    left: auto !important; /* Override any left: 0 positioning */
    top: auto !important; /* Override any top: 0 positioning */
}

/* Prevent full-page overlay pseudo-elements */
.o_livechat_root::before,
.o_livechat_root::after,
.o-livechat-root::before,
.o-livechat-root::after {
    content: none !important; /* Remove any overlay backgrounds */
    display: none !important;
}

/* Ensure chat button is visible but not blocking */
.o_livechat_button,
.o-livechat-button,
[class*="livechat-button"],
[class*="livechat_button"] {
    z-index: 999 !important;
    position: fixed !important;
    bottom: 20px !important;
    right: 20px !important;
    max-width: 80px !important; /* Small button */
    max-height: 80px !important;
}

/* Chat window when opened */
.o_livechat_chatwindow,
[class*="livechat-window"],
[class*="livechat_window"] {
    position: fixed !important;
    bottom: 80px !important; /* Above button */
    right: 20px !important;
    max-width: 400px !important;
    max-height: 600px !important;
    width: 350px !important;
    height: 500px !important;
    left: auto !important;
    top: auto !important;
}

/* Prevent backdrop/overlay */
.o_livechat_backdrop,
[class*="livechat-backdrop"],
[class*="livechat_backdrop"] {
    display: none !important; /* No full-page darkening */
    opacity: 0 !important;
}

/* Mobile responsive adjustments */
@media (max-width: 768px) {
    .o_livechat_root,
    .o-livechat-root,
    .o_livechat_chatwindow,
    [class*="livechat-window"] {
        max-width: calc(100vw - 40px) !important; /* Full width minus padding */
        right: 10px !important;
        bottom: 10px !important;
    }

    .o_livechat_button,
    [class*="livechat-button"] {
        right: 10px !important;
        bottom: 10px !important;
    }
}

/* Ensure chat doesn't interfere with site navigation */
.o_livechat_root,
.o-livechat-root {
    pointer-events: auto !important; /* Allow clicking */
}

/* But don't block clicks on page content */
body > *:not([class*="livechat"]):not([id*="livechat"]) {
    position: relative;
    z-index: 1; /* Ensure page content is below chat but accessible */
}
