/* HM ORIGENS - CIPHER MOBILE COMPACT V5 */

@media (max-width: 600px) {

    #zion-modal-v1.zion-modal {
        --cipher-v5-safe-top: max(
            58px,
            calc(env(safe-area-inset-top, 0px) + 12px)
        );

        position: fixed !important;
        inset: auto !important;

        top: calc(
            var(--cipher-c3-top, 0px)
            + var(--cipher-v5-safe-top)
        ) !important;

        left: 50% !important;
        right: auto !important;
        bottom: auto !important;

        transform: translateX(-50%) !important;
        margin: 0 !important;

        width: min(
            420px,
            calc(
                100vw - 20px
                - env(safe-area-inset-left, 0px)
                - env(safe-area-inset-right, 0px)
            )
        ) !important;

        /* Altura acompanha o conteudo */
        height: auto !important;
        min-height: 0 !important;

        /* Cresce apenas ate o limite da tela */
        max-height: min(
            550px,
            72dvh,
            calc(
                var(--cipher-c3-height, 100dvh)
                - var(--cipher-v5-safe-top)
                - 12px
            )
        ) !important;

        overflow: hidden !important;
        border-radius: 16px;
    }

    #zion-modal-v1.zion-modal[open] {
        display: flex !important;
        flex-direction: column !important;
    }

    #zion-modal-v1 .zion-top {
        flex: 0 0 auto !important;
        min-height: 0 !important;
        padding: 11px 12px;
    }

    #zion-modal-v1 .zion-top > div {
        min-width: 0;
    }

    #zion-modal-v1 .zion-close {
        flex: 0 0 44px;
        width: 44px;
        height: 44px;
    }

    /* A conversa ocupa apenas o espaco necessario */
    #zion-modal-v1 .zion-history {
        flex: 0 1 auto !important;
        min-height: 0 !important;

        max-height: min(
            320px,
            38dvh
        ) !important;

        overflow-y: auto !important;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;

        padding: 12px 10px;
    }

    /* Envio e contatos sempre no fim do modal */
    #zion-modal-v1 .zion-form {
        flex: 0 0 auto !important;
        padding: 9px 10px;
        gap: 7px;
    }

    #zion-modal-v1 .zion-form input {
        min-width: 0;
        flex: 1 1 auto;
        min-height: 44px;
        font-size: 16px;
    }

    #zion-modal-v1 .zion-form button {
        flex: 0 0 auto;
        min-height: 44px;
        padding: 8px 12px;
    }

    #zion-modal-v1 .zion-links {
        flex: 0 0 auto !important;
        padding: 7px 10px 12px;
    }

    /* Sem perguntas prontas */
    #zion-modal-v1 .zion-shortcuts,
    #zion-modal-v1 .zion-catalog {
        display: none !important;
    }
}

/* Tablet */
@media (min-width: 601px) and (max-width: 1100px) {

    #zion-modal-v1.zion-modal {
        height: auto !important;
        min-height: 0 !important;

        max-height: min(
            600px,
            calc(100dvh - 48px)
        ) !important;
    }

    #zion-modal-v1 .zion-history {
        flex: 0 1 auto !important;
        min-height: 0 !important;

        max-height: min(
            400px,
            50dvh
        ) !important;

        overflow-y: auto !important;
    }
}
