/* Mobile-only shell corrections for the Apollo booking assistant.
   This file changes layout only; no chat or API behaviour is affected. */
@media (max-width:480px){
    .ap-window,
    .ap-window.expanded{
        top:auto !important;
        right:8px !important;
        bottom:calc(70px + env(safe-area-inset-bottom)) !important;
        left:8px !important;
        width:auto !important;
        height:min(650px, calc(100dvh - 86px - env(safe-area-inset-bottom))) !important;
        max-height:calc(100dvh - 86px - env(safe-area-inset-bottom)) !important;
        border-radius:18px !important;
    }

    .ap-window .ap-header{
        padding-top:max(12px, env(safe-area-inset-top));
    }

    .ap-window .ap-body{
        min-height:0;
        overscroll-behavior:contain;
        -webkit-overflow-scrolling:touch;
    }

    .ap-window #apExpand{display:none}

    /* Do not show two blue chat controls while the panel is already open. */
    body:has(.ap-window.open) .ap-launcher{
        opacity:0;
        pointer-events:none;
        transform:scale(.82);
    }

    /* The typing controls are intentionally hidden on the service menu. Do
       not leave a large empty footer in that state. */
    .ap-window .ap-footer:has(.ap-input-wrap[style*="display: none"]){
        padding:8px 14px 10px;
    }
    .ap-window .ap-footer:has(.ap-input-wrap[style*="display: none"]) .ap-powered{
        margin-top:0;
    }
}

@media (max-width:480px) and (max-height:620px){
    .ap-window,
    .ap-window.expanded{
        height:calc(100dvh - 80px - env(safe-area-inset-bottom)) !important;
        max-height:calc(100dvh - 80px - env(safe-area-inset-bottom)) !important;
    }
    .ap-window .ap-header{padding:10px 12px}
    .ap-window .ap-status{padding-top:5px;padding-bottom:5px}
}

/* Fallback for older mobile browsers without dynamic viewport units. */
@supports not (height:100dvh){
    @media (max-width:480px){
        .ap-window,
        .ap-window.expanded{
            height:min(650px, calc(100vh - 86px - env(safe-area-inset-bottom))) !important;
            max-height:calc(100vh - 86px - env(safe-area-inset-bottom)) !important;
        }
    }
}
