/* Floating Chat Button */
#chatFab {
    position: fixed;
    bottom: 18px;
    right: 18px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    z-index: 3000; /* High z-index to stay on top */
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.2s ease;
    border: none;
    background: linear-gradient(135deg, #0d6efd, #0a58ca);
    color: white;
    pointer-events: auto; /* Ensure clickable */
}

#chatFab:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

#chatFab:active {
    transform: scale(0.95);
}

#chatFab i {
    font-size: 1.5rem;
}

/* Offcanvas Customization */
#chatOffcanvas {
    z-index: 3050; /* Above FAB */
    width: 420px; /* Default desktop width */
    border-left: 1px solid rgba(0,0,0,0.1);
    box-shadow: -5px 0 25px rgba(0,0,0,0.1);
}

/* Offcanvas Body - Remove padding for full iframe */
#chatOffcanvas .offcanvas-body {
    padding: 0;
    overflow: hidden; /* Prevent double scrollbars */
    background-color: #f8f9fa;
}

/* Dark Mode Support */
.theme-dark #chatFab {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.theme-dark #chatOffcanvas {
    background-color: #1e1e2d;
    border-left-color: #2b2b40;
}

.theme-dark #chatOffcanvas .offcanvas-header {
    background-color: #151521;
    color: #fff;
    border-bottom: 1px solid #2b2b40;
}

.theme-dark #chatOffcanvas .btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
}

/* Mobile Adjustments */
@media (max-width: 575.98px) {
    #chatFab {
        bottom: 18px; /* Default */
        bottom: calc(18px + env(safe-area-inset-bottom)); /* Safe area */
        right: 18px;
        width: 52px;
        height: 52px;
    }
    
    #chatFab i {
        font-size: 1.25rem;
    }

    #chatOffcanvas {
        width: 100% !important; /* Fullscreen on mobile */
    }
}
