/* ═══════════════════════════════════════════════ */
/* Virtual Assistant Pro — Chat Widget Styles      */
/* ═══════════════════════════════════════════════ */

/* Global box-sizing for the widget */
#avpro-window,
#avpro-window *,
#avpro-window *::before,
#avpro-window *::after {
    box-sizing: border-box;
}

/* Chat window: normal mode */
.avpro-win-normal {
    display: none;
    flex-direction: column;
    position: fixed;
    bottom: 96px;
    right: 24px;
    width: 380px;
    height: 520px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.18);
    z-index: 99999;
    overflow: hidden;
    transition: all 0.3s ease;
}

/* Chat window: tall mode (full height, normal width) */
.avpro-win-tall {
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 16px;
    bottom: 16px;
    right: 24px;
    width: 380px;
    height: auto;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.22);
    z-index: 100000;
    overflow: hidden;
    transition: all 0.3s ease;
}

/* Left-positioned tall variant */
.avpro-win-tall[data-position="bottom-left"] {
    right: auto;
    left: 24px;
}

/* Chat window: expanded (fullscreen-ish) mode */
.avpro-win-expanded {
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 16px;
    left: 16px;
    right: 16px;
    bottom: 16px;
    width: auto;
    height: auto;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 48px rgba(0,0,0,0.25);
    z-index: 100000;
    overflow: hidden;
    transition: all 0.3s ease;
}

/* Left-positioned variant */
.avpro-win-normal[data-position="bottom-left"] {
    right: auto;
    left: 24px;
}

/* Messages area */
#avpro-messages {
    scrollbar-width: thin;
    scrollbar-color: #ccc transparent;
}
#avpro-messages::-webkit-scrollbar {
    width: 6px;
}
#avpro-messages::-webkit-scrollbar-track {
    background: transparent;
}
#avpro-messages::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

/* Input focus glow */
#avpro-input:focus {
    box-shadow: 0 0 0 2px rgba(33, 150, 243, 0.2);
}

/* Send button hover */
#avpro-send:hover {
    opacity: 0.85;
    transform: scale(1.05);
    transition: all 0.15s;
}

/* Bubble hover */
#avpro-bubble:hover {
    transform: scale(1.08) !important;
    transition: transform 0.15s;
}

/* Expand/close button hovers */
#avpro-expand:hover,
#avpro-close:hover,
#avpro-download:hover {
    opacity: 1 !important;
}

/* Message animations */
.avpro-msg {
    animation: avproSlideIn 0.25s ease-out;
}
@keyframes avproSlideIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Typing dots */
.avpro-dot {
    animation: avproPulse 1.2s ease-in-out infinite;
    font-size: 10px;
}
.avpro-dot:nth-child(2) { animation-delay: 0.2s; }
.avpro-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes avproPulse {
    0%, 80%, 100% { opacity: 0.3; }
    40% { opacity: 1; }
}

/* Responsive: mobile full-screen (portrait + landscape on touch devices) */
@media (max-width: 480px), (max-height: 480px) and (hover: none) {
    .avpro-win-normal,
    .avpro-win-tall,
    .avpro-win-expanded {
        bottom: 0 !important;
        top: 0 !important;
        right: 0 !important;
        left: 0 !important;
        width: 100% !important;
        height: 100% !important; /* fallback for older browsers */
        height: 100dvh !important; /* dynamic viewport height — handles address bar */
        border-radius: 0 !important;
        max-width: 100vw !important;
        box-sizing: border-box !important;
        /* Prevent iOS rubber-band scroll on the window itself */
        overscroll-behavior: contain;
    }

    /* Header: prevent overflow */
    #avpro-header {
        padding: 12px 14px !important;
    }
    #avpro-header span:first-child {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        min-width: 0;
    }

    /* Input area: prevent send button from being pushed off-screen */
    #avpro-input {
        min-width: 0 !important;
    }

    /* Footer safe area for iPhone notch/home indicator */
    #avpro-window > div:last-of-type {
        padding-bottom: env(safe-area-inset-bottom, 0px) !important;
    }

    /* Hide expand button on mobile — already fullscreen */
    #avpro-expand {
        display: none !important;
    }
}

/* Tablet expanded */
@media (min-width: 481px) and (max-width: 1024px) {
    .avpro-win-expanded {
        top: 8px;
        left: 8px;
        right: 8px;
        bottom: 8px;
    }
}
