/* Shared customer mobile improvements: iOS Safari, iPadOS, Android browsers. */
@media (max-width: 1024px) and (pointer: coarse), (max-width: 820px) {
    body:not(.admin-body) input[type="text"],
    body:not(.admin-body) input[type="email"],
    body:not(.admin-body) input[type="password"],
    body:not(.admin-body) input[type="number"],
    body:not(.admin-body) input[type="tel"],
    body:not(.admin-body) input[type="search"],
    body:not(.admin-body) input[type="url"],
    body:not(.admin-body) textarea,
    body:not(.admin-body) select {
        font-size: 16px; /* Prevent iOS Safari's automatic input zoom. */
    }

    body:not(.admin-body).customer-keyboard-active {
        padding-bottom: var(--customer-keyboard-space, 0px);
    }
    body:not(.admin-body).customer-keyboard-active .inquiry-widget:not(.is-open) {
        visibility: hidden;
        pointer-events: none;
    }

    body:not(.admin-body) .adis-toast,
    body:not(.admin-body) .adis-live-notification,
    body:not(.admin-body) .notification-modal-trigger {
        touch-action: pan-y;
        -webkit-tap-highlight-color: transparent;
    }
    body:not(.admin-body) .adis-toast.show {
        transform: translateX(var(--customer-swipe-x, 0px)) scale(1);
    }
    body:not(.admin-body) .adis-live-notification.show {
        transform: translate(calc(-50% + var(--customer-swipe-x, 0px)), 0) scale(1);
    }
    body:not(.admin-body) .notification-modal-trigger {
        transform: translateX(var(--customer-swipe-x, 0px));
    }
    body:not(.admin-body) .customer-swipe-dragging {
        transition: none !important;
    }
    body:not(.admin-body) .customer-swipe-away {
        transition: transform .23s ease, opacity .23s ease !important;
        pointer-events: none;
    }
    body:not(.admin-body) .customer-swipe-card-dismissed {
        display: none !important;
    }

    /* Respect iPhone safe areas and prevent notification banners overflowing. */
    body:not(.admin-body) .adis-toast {
        top: max(12px, env(safe-area-inset-top));
        right: max(12px, env(safe-area-inset-right));
        max-width: calc(100vw - 24px);
        overflow-wrap: anywhere;
    }
    body:not(.admin-body) .adis-live-notification {
        width: min(420px, calc(100vw - 24px));
        top: calc(70px + env(safe-area-inset-top));
        overflow-wrap: anywhere;
    }

    body:not(.admin-body) .notification-list {
        min-width: 0;
        max-width: 100%;
    }
    body:not(.admin-body) .notification-modal-trigger {
        max-width: 100%;
        min-width: 0;
    }
    body:not(.admin-body) .notification-copy,
    body:not(.admin-body) .notification-title-wrap {
        min-width: 0;
        overflow-wrap: anywhere;
    }
}

.customer-swipe-info {
    margin: 12px 0;
    color: #aab3c5;
    font-size: .82rem;
    line-height: 1.5;
}

/* Customer chat fits the visual viewport, including the on-screen keyboard. */
@media (max-width: 820px), (max-width: 1100px) and (pointer: coarse) {
    body:not(.admin-body) .inquiry-widget.is-open {
        position: fixed !important;
        inset: auto !important;
        top: var(--inquiry-viewport-top, 0px) !important;
        left: var(--inquiry-viewport-left, 0px) !important;
        width: var(--inquiry-visible-width, 100vw) !important;
        height: var(--inquiry-visible-height, 100dvh) !important;
        max-width: none !important;
        z-index: 3200 !important;
        display: block;
        box-sizing: border-box;
        padding: 6px max(6px, env(safe-area-inset-right)) 6px max(6px, env(safe-area-inset-left));
        pointer-events: none;
    }
    body:not(.admin-body) .inquiry-widget.is-open .inquiry-panel {
        position: relative;
        inset: auto;
        display: flex;
        flex-direction: column;
        width: 100%;
        height: 100%;
        max-height: none;
        min-height: 0;
        margin: 0;
        box-sizing: border-box;
        overflow: hidden;
        border-radius: 16px;
        animation: none;
        transform: none;
        pointer-events: auto;
    }
    body:not(.admin-body) .inquiry-widget.is-open [data-inquiry-launcher] { display: none; }
    body:not(.admin-body) .inquiry-widget.is-open .inquiry-panel-head {
        flex: 0 0 auto;
        padding: 9px 12px;
        gap: 8px;
    }
    body:not(.admin-body) .inquiry-widget.is-open .inquiry-panel-brand img {
        width: 30px; height: 30px;
    }
    body:not(.admin-body) .inquiry-widget.is-open .inquiry-thread,
    body:not(.admin-body) .inquiry-widget.is-open .inquiry-guest {
        flex: 1 1 0;
        min-height: 0;
        overflow-y: auto;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
    }
    body:not(.admin-body) .inquiry-widget.is-open .inquiry-composer {
        flex: 0 0 auto;
        min-width: 0;
        margin: 0;
        padding: 8px 10px max(8px, env(safe-area-inset-bottom));
        background: #101722;
    }
    body:not(.admin-body) .inquiry-widget.is-open .inquiry-composer textarea {
        display: block;
        box-sizing: border-box;
        width: 100%;
        height: 48px;
        min-height: 48px;
        max-height: 48px;
        resize: none;
        font-size: 16px;
        line-height: 1.35;
        overflow-y: auto;
    }
    body:not(.admin-body) .inquiry-widget.is-open .inquiry-composer-actions {
        margin-top: 5px;
    }
    body:not(.admin-body) .inquiry-widget.is-open .inquiry-composer-status {
        min-width: 0;
        max-height: 32px;
        overflow-y: auto;
        overflow-wrap: anywhere;
    }
    body:not(.admin-body) .inquiry-widget.is-open .inquiry-send-btn {
        flex: 0 0 auto;
        min-height: 40px;
    }
    body:not(.admin-body) .inquiry-widget.is-compact .inquiry-panel-head { padding: 4px 10px; }
    body:not(.admin-body) .inquiry-widget.is-compact .inquiry-panel-brand small { display: none; }
    body:not(.admin-body) .inquiry-widget.is-compact .inquiry-thread { padding: 4px 10px; }
    body:not(.admin-body) .inquiry-widget.is-compact .inquiry-composer {
        padding: 4px 8px;
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 6px;
        align-items: end;
    }
    body:not(.admin-body) .inquiry-widget.is-compact .inquiry-composer-actions { margin: 0; }
    body:not(.admin-body) .inquiry-widget.is-compact .inquiry-composer-status:empty { display: none; }
    body:not(.admin-body) .inquiry-widget.is-compact .inquiry-composer-status {
        position: absolute; bottom: 56px; left: 12px; right: 12px;
        background: #101722;
    }
}

