/* Chat Button */
#scoutly-chatbot-chatButton {
    position: fixed !important;
    bottom: 20px !important;
    right: 20px !important;
    width: 92px !important;
    height: 92px !important;
    background: #fafafa;
    border-radius: 50%;
    box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: opacity 0.3s ease-in-out;
    opacity: 0;
    z-index: 1300;
}

/* Chat Window Base */
#scoutly-chatbot-chatWindow {
    position: fixed;
    bottom: 80px;
    right: 20px;
    width: 480px;
    height: 480px;
    background: white;
    border-radius: 16px;
    border: 1px solid #ccc;
    box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.2);
    z-index: 1500;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(20px);
    transform-origin: bottom right;
    transition:
        opacity 0.3s ease,
        transform 0.3s ease,
        width 0.35s ease,
        height 0.35s ease,
        bottom 0.35s ease,
        right 0.35s ease;
}

/* Active and Hidden States */
#scoutly-chatbot-chatWindow.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
}

#scoutly-chatbot-chatWindow.hidden {
    display: none;
}

/* Chat Window Header */
#scoutly-chatbot-chatWindow .scoutly-window-header {
    position: relative;
    min-height: 40px;
    background-color: #003f87;
    padding: 8px 12px;
    color: #fff;
    font-weight: bold;
    letter-spacing: 0.6px;
    line-height: 1.5em;
}

/* Header Icons */
#scoutly-chatbot-chatWindow #scoutly-chatbot-resizeChat,
#scoutly-chatbot-chatWindow #scoutly-chatbot-closeChat {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
}

#scoutly-chatbot-chatWindow #scoutly-chatbot-resizeChat {
    right: 40px;
}

#scoutly-chatbot-chatWindow #scoutly-chatbot-closeChat {
    right: 10px;
}

#scoutly-chatbot-chatWindow #scoutly-chatbot-resizeIcon {
    width: 18px;
    height: 18px;
}

#scoutly-chatbot-chatWindow #scoutly-chatbot-closeChat img {
    width: 22px;
    height: 22px;
}

/* Iframe */
#scoutly-chatbot-chatWindow iframe {
    width: 100%;
    height: 100%;
    border: none;
}

/* Expanded Desktop Mode */
#scoutly-chatbot-chatWindow.expanded-desktop {
    width: 95vw !important;
    height: 80vh !important;
    box-shadow: 0px 8px 24px rgba(0, 0, 0, 0.3);
}

/* Fullscreen Mobile via JS */
#scoutly-chatbot-chatWindow.fullscreen-mobile {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 90vh;
    max-width: 100vw;
    max-height: 100vh;
    border-radius: 0;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    overflow: hidden;
    touch-action: none;
    transform: translateZ(0);
    /* iOS GPU fix */
}

/* body tag class */
.body-active-chat-mobile {
    overflow: hidden;
    touch-action: none;
    /* Prevents scroll on touch devices */
    overscroll-behavior: contain;
    -webkit-text-size-adjust: 100%;
    -webkit-user-select: none;
}

/* Failsafe for small screens */
@media (max-width: 1024px) {

    #scoutly-chatbot-chatWindow {
        max-width: 90vw;
        width: 90vw;
    }

    @media (orientation: landscape) {
        /* Landscape modifier*/
        #scoutly-chatbot-chatWindow {
            max-width: 90vw;
            width: 85vw;
            height: 85vh;
            top: 5vh;
        }  
    }
}