/* =====================================================
 * RLMS — COMPLIANZ MOBILE COOKIE FIX
 * ===================================================== */

@media (max-width: 767px) {

    /*
     * Banner always stays inside the real mobile viewport.
     */
    .cmplz-cookiebanner {
        box-sizing: border-box !important;

        top: auto !important;
        left: 10px !important;
        right: 10px !important;
        bottom: 10px !important;

        width: auto !important;
        max-width: none !important;

        max-height: calc(100dvh - 20px) !important;

        overflow-y: auto !important;
        overscroll-behavior: contain;

        padding: 14px !important;

        z-index: 2147483000 !important;

        border-radius: 16px !important;
    }

    /*
     * Logo should not consume a large part of the screen.
     */
    .cmplz-cookiebanner .cmplz-logo img {
        width: auto !important;
        max-width: 210px !important;
        max-height: 48px !important;
        object-fit: contain !important;
    }

    /*
     * Keep text readable but compact.
     */
    .cmplz-cookiebanner .cmplz-message {
        font-size: 16px !important;
        line-height: 1.45 !important;

        max-height: 30dvh !important;
        overflow-y: auto !important;
    }

    /*
     * Buttons remain usable and visible.
     */
    .cmplz-cookiebanner .cmplz-buttons {
        display: grid !important;
        grid-template-columns: 1fr !important;

        gap: 9px !important;

        position: sticky !important;
        bottom: 0 !important;

        z-index: 5 !important;

        margin-top: 10px !important;
        padding:
            10px
            0
            calc(8px + env(safe-area-inset-bottom))
            !important;

        background: #fff !important;
    }

    .cmplz-cookiebanner .cmplz-btn {
        width: 100% !important;
        min-height: 48px !important;

        margin: 0 !important;
        padding: 10px 14px !important;

        font-size: 16px !important;
        line-height: 1.2 !important;
    }

    /*
     * "Приемам" should be the first obvious action.
     */
    .cmplz-cookiebanner .cmplz-accept {
        order: -10 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }

    .cmplz-cookiebanner .cmplz-deny {
        order: 0 !important;
    }

    .cmplz-cookiebanner .cmplz-view-preferences {
        order: 10 !important;
    }
}


/* =====================================================
 * RLMS — COMPLIANZ MOBILE POSITION CORRECTION
 * Fix horizontal offset caused by native translateX().
 * ===================================================== */

@media (max-width: 767px) {

    .cmplz-cookiebanner {
        left: 50% !important;
        right: auto !important;

        width: calc(100vw - 20px) !important;
        max-width: calc(100vw - 20px) !important;
        min-width: 0 !important;

        margin: 0 !important;

        transform: translateX(-50%) !important;

        bottom: max(
            10px,
            env(safe-area-inset-bottom)
        ) !important;

        max-height: calc(100dvh - 20px) !important;

        overflow-x: hidden !important;
        overflow-y: auto !important;

        box-sizing: border-box !important;

        z-index: 2147483647 !important;
    }

    .cmplz-cookiebanner *,
    .cmplz-cookiebanner *::before,
    .cmplz-cookiebanner *::after {
        box-sizing: border-box;
    }

    /*
     * AI beacon must not compete with cookie consent.
     */
    body:has(.cmplz-cookiebanner)
    .rlms-amr-beacon {
        visibility: hidden !important;
        pointer-events: none !important;
    }
}
