.nexora-chat-widget {
    position: fixed;
    right: clamp(14px, 2vw, 28px);
    bottom: clamp(14px, 2.2vh, 28px);
    z-index: 999998;
    width: 0;
    height: 0;
    isolation: isolate;
    color: var(--nexora-headerTextColor, #172033);
    font-family: var(--nexora-font-family, Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif);
    line-height: 1.45;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

.nexora-chat-widget *,
.nexora-chat-widget *::before,
.nexora-chat-widget *::after {
    box-sizing: border-box;
}

.nexora-chat-widget button,
.nexora-chat-widget input {
    font-family: inherit;
}

.nexora-chatbot-window {
    position: absolute;
    right: 0;
    bottom: 78px;
    display: flex;
    width: min(400px, calc(100vw - 28px));
    height: min(740px, calc(100vh - 112px));
    height: min(740px, calc(100dvh - 112px));
    min-height: min(480px, calc(100dvh - 112px));
    max-height: calc(100dvh - 112px);
    flex-direction: column;
    overflow: hidden;
    border: 1px solid rgba(100, 116, 139, .18);
    border-radius: 26px;
    background: var(--nexora-chatBgColor, #fff);
    box-shadow: 0 26px 72px rgba(15, 23, 42, .20), 0 4px 14px rgba(15, 23, 42, .08);
    transform-origin: bottom right;
}

.nexora-chatbot-window[hidden],
.nexora-chatbot-launcher[hidden] {
    display: none !important;
}

.nexora-chat-open .nexora-chatbot-window:not([hidden]) {
    animation: nexora-chat-window-in 190ms cubic-bezier(.23, 1, .32, 1) both;
}

@keyframes nexora-chat-window-in {
    from { opacity: 0; transform: translateY(8px) scale(.985); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (max-width: 560px) {
    .nexora-chat-widget {
        right: 14px;
        bottom: 14px;
    }

    .nexora-chatbot-window {
        bottom: 72px;
        width: min(400px, calc(100vw - 28px));
        height: min(680px, calc(100vh - 100px));
        height: min(680px, calc(100dvh - 100px));
        min-height: min(420px, calc(100dvh - 100px));
        max-height: calc(100dvh - 100px);
        border-radius: 24px;
    }

    .nexora-chat-widget.nexora-mobile-open {
        inset: 0;
        right: auto;
        bottom: auto;
        width: 100vw;
        height: 100vh;
        height: 100dvh;
        background: rgba(15, 23, 42, .16);
    }

    .nexora-chat-widget.nexora-mobile-open .nexora-chatbot-window {
        position: absolute;
        inset: 0;
        right: auto;
        bottom: auto;
        width: 100%;
        height: 100%;
        min-height: 100%;
        max-height: none;
        border: 0;
        border-radius: 0;
        box-shadow: none;
        transform-origin: center;
    }

    .nexora-chat-widget.nexora-mobile-open .nexora-chatbot-header {
        min-height: calc(72px + env(safe-area-inset-top, 0px));
        padding-top: max(12px, env(safe-area-inset-top, 0px));
    }

    .nexora-chat-widget.nexora-mobile-open .nexora-chatbot-messages {
        min-height: 0;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
    }

    .nexora-chat-widget.nexora-mobile-open .nexora-chatbot-form {
        padding-bottom: max(12px, env(safe-area-inset-bottom, 0px));
    }

    .nexora-chat-widget.nexora-mobile-open .nexora-chatbot-footer {
        padding-bottom: max(10px, env(safe-area-inset-bottom, 0px));
    }
}

@media (prefers-reduced-motion: reduce) {
    .nexora-chat-open .nexora-chatbot-window:not([hidden]) {
        animation: none;
    }
}
