/* DigiMartrix Chatbot Styles */

/* CTA Popup Animation */
.chatbot-cta {
    animation: fadeIn 0.5s ease-out forwards;
}

/* Quick Replies */
.quick-reply-container {
    display: flex;
    gap: 8px;
    margin-top: 8px;
    flex-wrap: wrap;
}

.quick-reply-chip {
    background: linear-gradient(135deg, rgba(249, 115, 22, 0.2), rgba(249, 115, 22, 0.1));
    border: 2px solid #f97316;
    color: #f97316;
    padding: 10px 18px;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(249, 115, 22, 0.2);
}

.quick-reply-chip:hover {
    background: linear-gradient(135deg, #f97316, #ea580c);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(249, 115, 22, 0.4);
}

/* Typing Indicator Animation */
.typing-indicator span {
    display: inline-block;
    width: 6px;
    height: 6px;
    background-color: #ccc;
    border-radius: 50%;
    margin: 0 2px;
    animation: bounce 1.4s infinite ease-in-out both;
}

.typing-indicator span:nth-child(1) {
    animation-delay: -0.32s;
}

.typing-indicator span:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes bounce {

    0%,
    80%,
    100% {
        transform: scale(0);
    }

    40% {
        transform: scale(1);
    }
}

/* Hide expand button on desktop - not needed */
.expand-btn {
    display: none !important;
}

/* ==========================================
   MOBILE FULLSCREEN CHATBOT (< 768px)
   ========================================== */
@media (max-width: 767px) {

    /* Hide the CTA popup on mobile */
    #chatbotCTA {
        display: none !important;
    }

    /* Make chatbot button bigger on mobile for better visibility */
    #chatbotButton {
        width: 100px !important;
        height: 100px !important;
        right: 12px !important;
        bottom: 12px !important;
    }

    /* Fullscreen chat window on mobile - AUTOMATIC */
    #chat-window:not(.hidden) {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: 100vw !important;
        height: 100vh !important;
        height: 100dvh !important;
        /* Dynamic viewport height for mobile */
        max-width: 100vw !important;
        max-height: 100vh !important;
        max-height: 100dvh !important;
        margin: 0 !important;
        border-radius: 0 !important;
        z-index: 10000 !important;
        transform: none !important;
        opacity: 1 !important;
        display: flex !important;
        flex-direction: column !important;
        overflow: hidden !important;
        overscroll-behavior: contain !important;
        /* Prevent pull-to-refresh/body scroll */
    }

    /* Fix the container positioning on mobile */
    #chatbot-container {
        position: fixed !important;
        bottom: 0 !important;
        right: 0 !important;
        z-index: 9999 !important;
    }

    /* When chat is open, container should be fullscreen */
    #chatbot-container:has(#chat-window:not(.hidden)) {
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: 100vw !important;
        height: 100vh !important;
        height: 100dvh !important;
    }

    /* Mobile header styling - centered */
    #chat-window .bg-slate-900:first-child {
        padding: 16px !important;
        border-bottom: 1px solid #334155 !important;
        justify-content: center !important;
        position: relative !important;
        flex-shrink: 0 !important;
    }

    /* Center the header content */
    #chat-window .bg-slate-900:first-child>div:first-child {
        justify-content: center !important;
        flex: 1;
    }

    /* Position close button absolutely on the right */
    #closeChat {
        position: absolute !important;
        right: 16px !important;
        top: 50% !important;
        transform: translateY(-50%) !important;
    }

    /* Mobile input area container - Target by border-t class */
    #chat-window .border-t.border-slate-700 {
        padding: 16px !important;
        padding-bottom: 60px !important;
        /* Large padding for Safari bottom bar */
        padding-bottom: max(60px, calc(env(safe-area-inset-bottom) + 16px)) !important;
        flex-shrink: 0 !important;
        position: relative !important;
        z-index: 100 !important;
        background: #0f172a !important;
    }

    /* Messages area - flex grow to fill space */
    #chat-messages {
        padding: 16px !important;
        flex: 1 1 auto !important;
        overflow-y: auto !important;
        min-height: 0 !important;
        max-height: none !important;
        -webkit-overflow-scrolling: touch !important;
        /* Smooth scroll on iOS */
    }

    /* Make sure input and button are visible */
    #chatInput {
        font-size: 16px !important;
        /* Prevent iOS zoom */
        appearance: none !important;
        -webkit-appearance: none !important;
    }

    #sendMessage {
        min-width: 44px !important;
        min-height: 44px !important;
    }
}

/* ==========================================
   TABLET STYLES (768px - 1024px)
   ========================================== */
@media (min-width: 768px) and (max-width: 1024px) {

    /* Larger chatbot on tablet */
    #chat-window:not(.hidden) {
        width: 450px !important;
        height: 550px !important;
    }
}