/* static/css/mobile-chat-widget.css */
@import url('./colors.css');

/* ==========================================================================
   Mobile: Full-screen toggle between Bob chat and tab content.
   Default = chat view. Chevron toggles between the two.
   ========================================================================== */

@media (max-width: 576px) {

    /* ---- Chat container: full height by default ---- */
    .chat-container {
        display: flex !important;
        flex-direction: column;
        width: 100%;
        min-width: 0;
        max-width: none;
        flex: 1 1 auto;
        min-height: 0;
        border-radius: 0;
        box-shadow: none;
        background: var(--bs-white);
    }

    .chat-container .chat-messages {
        flex: 1 1 auto;
        overflow-y: auto;
        padding: 12px;
        font-size: 14px;
        scroll-behavior: smooth;
    }

    .chat-container .chat-disclaimer {
        padding: 4px 12px;
        font-size: 11px;
    }

    .chat-container .message {
        margin-bottom: 8px;
    }

    /* Avatars are retired app-wide; only the user turn keeps bubble padding. */
    .chat-container .message.ai-message {
        padding-left: 0;
    }

    .chat-container .message-content {
        font-size: 13px;
    }

    .chat-container .message.user-message .message-content {
        padding: 8px 12px;
    }

    /* ---- Tab container: hidden by default ---- */
    .main-container:not(.mobile-tab-view) .tab-container {
        display: none !important;
    }

    /* ---- When tab view is active ---- */
    .main-container.mobile-tab-view .chat-container {
        display: none !important;
    }

    .main-container.mobile-tab-view .tab-container {
        display: flex !important;
        flex-direction: column;
        flex: 1 1 auto;
        min-height: 0;
    }

    /* ---- Chevron toggle button ---- */
    .mobile-view-toggle {
        position: fixed;
        left: 50%;
        transform: translateX(-50%);
        width: 48px;
        height: 28px;
        display: flex;
        align-items: center;
        justify-content: center;
        background: white;
        border: 1px solid var(--bs-gray-300);
        border-radius: 14px;
        color: var(--bs-gray-500);
        font-size: 14px;
        cursor: pointer;
        z-index: 1010;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
        -webkit-tap-highlight-color: transparent;
        touch-action: manipulation;
        transition: opacity 0.2s ease;
    }

    .mobile-view-toggle:active {
        opacity: 0.6;
    }

    /* Chevron at bottom — chat is showing, tap to see tabs */
    .mobile-view-toggle.toggle-bottom {
        bottom: calc(62px + env(safe-area-inset-bottom));
        top: auto;
    }

    /* Chevron at top — tab is showing, tap to see chat */
    .mobile-view-toggle.toggle-top {
        top: 58px;
        bottom: auto;
    }

    /* ---- Kill any leftover floating widget elements ---- */
    .floating-chat-widget,
    .floating-chat-expanded {
        display: none !important;
    }

    /* Hide header's inline Test Lab — the fixed top-right one is kept */
    header .app-debug-corner {
        display: none;
    }
}

/* Desktop — hide all mobile-only elements */
@media (min-width: 577px) {
    .floating-chat-widget,
    .floating-chat-expanded,
    .mobile-view-toggle {
        display: none;
    }
}
