/* ==========================================================================
   1. GLOBAL & MOBILE TARGETS (All screen resolutions up to 480px)
   ========================================================================== */

/* Target only the outer dynamic DIV wrapper block if it exists */
#apg-webchat-widget-container,
div:has(iframe[src*="apigateway.co"]) {
    position: fixed !important;
    bottom: 15px !important;
    right: 15px !important;
    width: calc(100% - 30px) !important;
    max-width: 360px !important;
    height: 140px !important;
    z-index: 2147483647 !important;
    display: block !important;
    contain: strict !important;
    top: auto !important;
    left: auto !important;

    /* Clicks pass through the invisible OUTSIDE padding area of the container */
    pointer-events: none !important;
    background: transparent !important;
    border: none !important;
}

/* Force sizing and direct CLICKABILITY on the actual interactive iframe nodes */
.apg-webchat-iframe,
iframe[src*="apigateway.co"],
iframe[id^="webchat-floating-iframe-"] {
    position: fixed !important;
    top: auto !important;
    left: auto !important;
    bottom: 15px !important;
    right: 15px !important;
    width: calc(100% - 30px) !important;
    max-width: 360px !important;
    height: 140px !important;
    border: none !important;
    margin: 0 !important;
    padding: 0 !important;
    z-index: 2147483647 !important;

    /* CRITICAL FIX: Explicitly restore click interactions directly on the iframe layer */
    pointer-events: auto !important;
}

/* ==========================================================================
   2. DESKTOP RESPONSIVE TARGETS (Screens 481px and wider)
   ========================================================================== */
@media only screen and (min-width: 481px) {
    #apg-webchat-widget-container,
    div:has(iframe[src*="apigateway.co"]) {
        bottom: 20px !important;
        right: 20px !important;
        width: 360px !important;
        height: 340px !important;
        max-width: none !important;
    }

    /* Match desktop size updates on the structural interactive iframe node */
    .apg-webchat-iframe,
    iframe[src*="apigateway.co"],
    iframe[id^="webchat-floating-iframe-"] {
        bottom: 20px !important;
        right: 20px !important;
        width: 360px !important;
        height: 340px !important;
        max-width: none !important;
    }
}