@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700&display=swap');

/* ============================================================
   SEAMLESS FULLSCREEN UNIFIED LAYOUT (NO WHITE GAPS)
   Blends the entire page in all 4 directions with #f0f2f5.
   Completely removes theme and Elementor padding, margins,
   and white boxes. 0 outer scrollbars.
   ============================================================ */
html.aso-support-fullscreen,
body.aso-support-fullscreen,
body.page-id-98,
html:has(.aso-support-wrapper),
body:has(.aso-support-wrapper) {
    height: 100% !important;
    height: 100dvh !important;
    max-height: 100dvh !important;
    width: 100vw !important;
    max-width: 100vw !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
    position: fixed !important;
    left: 0 !important;
    top: 0 !important;
    background: #f0f2f5 !important;
    box-sizing: border-box !important;
}

/* Force all theme and Elementor wrapper hierarchy to match seamlessly */
body.aso-support-fullscreen #page,
body.aso-support-fullscreen .site,
body.aso-support-fullscreen #content,
body.aso-support-fullscreen .site-content,
body.aso-support-fullscreen .ast-container,
body.aso-support-fullscreen #primary,
body.aso-support-fullscreen main,
body.aso-support-fullscreen article,
body.aso-support-fullscreen .entry-content,
body.aso-support-fullscreen .ast-article-single,
body.aso-support-fullscreen .elementor,
body.aso-support-fullscreen .elementor-98,
body.aso-support-fullscreen .e-con,
body.aso-support-fullscreen .e-con-boxed,
body.aso-support-fullscreen .e-con-inner,
body.aso-support-fullscreen .elementor-element,
body.aso-support-fullscreen .elementor-widget,
body.aso-support-fullscreen .elementor-widget-container,
body.page-id-98 #page,
body.page-id-98 .site,
body.page-id-98 #content,
body.page-id-98 .site-content,
body.page-id-98 .ast-container,
body.page-id-98 #primary,
body.page-id-98 main,
body.page-id-98 article,
body.page-id-98 .entry-content,
body.page-id-98 .ast-article-single,
body.page-id-98 .elementor,
body.page-id-98 .elementor-98,
body.page-id-98 .e-con,
body.page-id-98 .e-con-boxed,
body.page-id-98 .e-con-inner,
body.page-id-98 .elementor-element,
body.page-id-98 .elementor-widget,
body.page-id-98 .elementor-widget-container {
    height: 100% !important;
    height: 100dvh !important;
    max-height: 100dvh !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    background: transparent !important;
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column !important;
    flex: 1 1 100% !important;
    box-sizing: border-box !important;
}

/* Hide theme header & footer on support page */
body.aso-support-fullscreen header,
body.aso-support-fullscreen footer,
body.aso-support-fullscreen #ast-desktop-header,
body.aso-support-fullscreen #ast-mobile-header,
body.aso-support-fullscreen #colophon,
body.page-id-98 header,
body.page-id-98 footer,
body.page-id-98 #ast-desktop-header,
body.page-id-98 #ast-mobile-header,
body.page-id-98 #colophon {
    display: none !important;
}

/* Main Outer Wrapper: Blends edge-to-edge into #f0f2f5 */
.aso-support-wrapper {
    background: #f0f2f5 !important;
    width: 100vw !important;
    max-width: 100vw !important;
    height: 100vh !important;
    height: 100dvh !important;
    max-height: 100dvh !important;
    padding: 16px !important;
    margin: 0 !important;
    box-sizing: border-box !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    overflow: hidden !important;
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Chatbot Card Container */
.aso-ai-chatbot-container {
    width: 100%;
    max-width: 680px;
    height: 100%;
    max-height: calc(100dvh - 32px);
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    overflow: hidden;
    background: #ffffff;
    box-shadow: 0 16px 40px rgba(0, 22, 46, 0.08);
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
}

/* Top Header */
.aso-ai-chat-header {
    flex: 0 0 auto !important;
    background: #00162e;
    color: #fff;
    padding: 18px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 4px solid #FF9900;
    position: relative;
    z-index: 2;
    box-sizing: border-box;
}

.aso-ai-header-info {
    display: flex;
    flex-direction: column;
}

.aso-ai-chat-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: #fff;
    letter-spacing: 0.3px;
}

.aso-ai-chat-header p {
    margin: 4px 0 0 0;
    font-size: 12px;
    color: #a0aec0;
}

.aso-ai-status {
    font-size: 11px;
    font-weight: 600;
    background: rgba(20, 168, 0, 0.15);
    color: #14A800;
    padding: 5px 12px;
    border-radius: 20px;
    border: 1px solid rgba(20, 168, 0, 0.3);
    display: flex;
    align-items: center;
    gap: 6px;
}

.aso-ai-status::before {
    content: '';
    display: block;
    width: 7px;
    height: 7px;
    background: #14A800;
    border-radius: 50%;
    box-shadow: 0 0 8px rgba(20, 168, 0, 0.8);
    animation: pulse-green 2s infinite;
}

/* Chat Messages: Takes available height and scrolls internally */
.aso-ai-chat-messages {
    flex: 1 1 0% !important;
    min-height: 0 !important;
    height: auto !important;
    overflow-y: auto !important;
    padding: 20px 24px;
    background: #fafbfc;
    scroll-behavior: smooth;
    display: flex;
    flex-direction: column;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    box-sizing: border-box;
}

.aso-ai-chat-messages::-webkit-scrollbar {
    width: 6px;
}
.aso-ai-chat-messages::-webkit-scrollbar-track {
    background: transparent;
}
.aso-ai-chat-messages::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}

.aso-message {
    margin-bottom: 14px;
    padding: 12px 16px;
    border-radius: 18px;
    max-width: 85%;
    font-size: 14.5px;
    line-height: 1.5;
    word-wrap: break-word;
    animation: slideUp 0.25s ease-out forwards;
    opacity: 0;
    transform: translateY(8px);
}

.bot-message {
    background: #ffffff;
    color: #00162e;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 3px 8px rgba(0,0,0,0.03);
}

.user-message {
    background: #00162e;
    color: #ffffff;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
    box-shadow: 0 3px 8px rgba(0, 22, 46, 0.18);
}

/* Bottom Input Area: Clean breathing space, never clipped */
.aso-ai-chat-input-area {
    flex: 0 0 auto !important;
    display: flex !important;
    padding: 14px 20px 18px 20px !important;
    padding-bottom: max(18px, env(safe-area-inset-bottom, 18px)) !important;
    background: #f0f2f5 !important;
    align-items: center !important;
    gap: 10px !important;
    border-top: 1px solid #e2e8f0 !important;
    box-sizing: border-box !important;
}

.aso-ai-chat-input-area input {
    flex: 1;
    height: 46px;
    padding: 12px 18px;
    border: 1px solid #e2e8f0;
    border-radius: 24px;
    outline: none;
    font-size: 14.5px;
    font-family: inherit;
    transition: all 0.2s ease;
    background: #ffffff;
    color: #111b21;
    box-shadow: 0 1px 2px rgba(0,0,0,0.06);
    box-sizing: border-box;
    margin: 0;
}

.aso-ai-chat-input-area input:focus {
    background: #ffffff;
    border-color: #cbd5e1;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.aso-ai-chat-input-area button {
    background-color: #14A800;
    background-image: url('data:image/svg+xml;utf8,<svg viewBox="0 0 24 24" fill="%23ffffff" xmlns="http://www.w3.org/2000/svg"><path d="M2.01 21L23 12 2.01 3 2 10l15 2-15 2z"/></svg>');
    background-repeat: no-repeat;
    background-position: center 12px;
    background-size: 19px;
    color: transparent;
    border: none !important;
    width: 46px !important;
    height: 46px !important;
    min-width: 46px !important;
    min-height: 46px !important;
    max-width: 46px !important;
    max-height: 46px !important;
    padding: 0 !important;
    margin: 0 !important;
    box-sizing: border-box !important;
    border-radius: 50% !important;
    aspect-ratio: 1 / 1 !important;
    flex: 0 0 46px !important;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 6px rgba(20, 168, 0, 0.4);
    display: block !important;
}

.aso-ai-chat-input-area button:hover {
    transform: translateY(-1px) scale(1.02);
    box-shadow: 0 4px 8px rgba(20, 168, 0, 0.5);
    background-color: #118f00;
}

.aso-ai-chat-input-area button:active {
    transform: translateY(0) scale(0.98);
}

/* Clear Chat / New Chat Button */
.aso-ai-clear-chat-btn {
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: #e2e8f0;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.2s ease;
}
.aso-ai-clear-chat-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    color: #fff;
}

/* Error message styling */
.aso-message[style*="color: red"],
.aso-message[style*="color:#e53e3e"] {
    background: #fef2f2 !important;
    color: #dc2626 !important;
    border: 1px solid #fecaca !important;
}

/* Animations */
@keyframes slideUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse-green {
    0% { box-shadow: 0 0 0 0 rgba(20, 168, 0, 0.7); }
    70% { box-shadow: 0 0 0 6px rgba(20, 168, 0, 0); }
    100% { box-shadow: 0 0 0 0 rgba(20, 168, 0, 0); }
}

/* Typing Indicator */
.typing-indicator {
    display: flex !important;
    align-items: center;
    gap: 5px;
    padding: 14px 18px !important;
    width: fit-content;
}

.typing-indicator .dot {
    width: 6px;
    height: 6px;
    background-color: #8c9bb0;
    border-radius: 50%;
    animation: typingBounce 1.4s infinite ease-in-out both;
}

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

@keyframes typingBounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* Markdown Styling */
.markdown-body {
    line-height: 1.5;
}
.markdown-body p { margin: 0 0 8px 0; }
.markdown-body p:last-child { margin: 0; }
.markdown-body ul, .markdown-body ol { margin: 0 0 10px 0; padding-left: 20px; }
.markdown-body li { margin-bottom: 4px; }
.markdown-body strong { font-weight: 600; color: #000; }
.markdown-body em { font-style: italic; }
.markdown-body a { color: #14A800; text-decoration: underline; }

/* ============================================================
   MOBILE RESPONSIVENESS (<= 768px)
   Full-screen edge-to-edge native app feel.
   Input send area has generous bottom clearance and is NEVER cut off.
   ============================================================ */
@media (max-width: 768px) {
    .aso-support-wrapper {
        padding: 0 !important;
        margin: 0 !important;
        border-radius: 0 !important;
        height: 100% !important;
        height: 100dvh !important;
        max-height: 100dvh !important;
        width: 100vw !important;
    }

    .aso-ai-chatbot-container {
        max-width: 100% !important;
        width: 100% !important;
        height: 100% !important;
        height: 100dvh !important;
        max-height: 100dvh !important;
        border-radius: 0 !important;
        box-shadow: none !important;
        border: none !important;
    }

    .aso-ai-chat-header {
        padding: 12px 14px !important;
        border-radius: 0 !important;
    }

    .aso-ai-chat-header h3 {
        font-size: 16px !important;
    }

    .aso-ai-chat-messages {
        padding: 14px 12px !important;
        flex: 1 1 0% !important;
        min-height: 0 !important;
    }

    .aso-message {
        font-size: 14px !important;
        padding: 10px 14px !important;
        margin-bottom: 12px !important;
    }

    /* Fixed bottom input area with 22px+ safe clearance so it is NEVER cut off */
    .aso-ai-chat-input-area {
        padding: 12px 14px 22px 14px !important;
        padding-bottom: max(22px, env(safe-area-inset-bottom, 22px)) !important;
        background: #f0f2f5 !important;
        border-radius: 0 !important;
        box-sizing: border-box !important;
    }

    .aso-ai-chat-input-area input {
        height: 44px !important;
        padding: 10px 16px !important;
        font-size: 14px !important;
        box-sizing: border-box !important;
        margin: 0 !important;
    }

    .aso-ai-chat-input-area button {
        width: 44px !important;
        height: 44px !important;
        min-width: 44px !important;
        min-height: 44px !important;
        flex: 0 0 44px !important;
        background-position: center 11px !important;
        background-size: 18px !important;
        box-sizing: border-box !important;
        margin: 0 !important;
    }
}
