/*
 * AUTOMART MOBILE VEHICLE DETAIL V42.13
 *
 * Recovery authority for:
 * - V40 floating mobile header
 * - V42.6 66px header lock
 * - V42.6 sticky contact bar
 * - V42.3 safe-area behavior
 *
 * Mobile only.
 * Desktop/tablet untouched.
 */

@media (max-width:767px){

    /*
     * =========================================================
     * FLOATING MOBILE HEADER
     * =========================================================
     */

    html body .am-mobile-v40__header[data-am-mobile-v40-header]{
        position:fixed !important;
        top:0 !important;
        left:0 !important;
        right:0 !important;

        width:100% !important;
        height:66px !important;
        min-height:66px !important;
        max-height:66px !important;

        display:block !important;
        visibility:visible !important;
        opacity:1 !important;

        z-index:2147483000 !important;

        transform:translate3d(0,0,0) !important;
        will-change:transform !important;

        pointer-events:auto !important;
    }

    html body .am-mobile-v40__top{
        height:48px !important;
        min-height:48px !important;
        max-height:48px !important;
    }

    /*
     * Existing approved body clearance.
     */
    html body:not(.admin-page){
        --am-v426-header-height:66px;
        --am-v426-header-clearance:74px;
    }

    /*
     * Keep the mobile shell above page content.
     */
    html body .am-mobile-v40{
        position:relative !important;
        z-index:2147482999 !important;
    }

    /*
     * =========================================================
     * CANONICAL GLOBAL MOBILE BOTTOM NAV
     * =========================================================
     */

    html body #bpp-global-mobile-bottom-nav{
        position:fixed !important;
        left:0 !important;
        right:0 !important;
        bottom:0 !important;

        width:100% !important;

        z-index:2147481900 !important;

        visibility:visible !important;
        opacity:1 !important;

        transform:translate3d(0,0,0) !important;
    }

    /*
     * Legacy AutoMart mobile-bottom is not allowed to compete
     * with the canonical global navigation.
     */
    html body nav.mobile-bottom{
        display:none !important;
    }

    /*
     * =========================================================
     * V42.6 STICKY CONTACT BAR
     * =========================================================
     */

    html body .am-v426-sticky-contact{
        position:fixed !important;

        left:10px !important;
        right:10px !important;

        bottom:
            calc(
                var(--am-v426-bottom-nav-height, 62px)
                + env(safe-area-inset-bottom)
                + 8px
            ) !important;

        min-height:56px !important;
        height:auto !important;

        display:flex !important;
        align-items:stretch !important;

        gap:8px !important;

        padding:6px !important;

        box-sizing:border-box !important;

        background:rgba(255,255,255,.98) !important;

        border:1px solid #dfe8e3 !important;
        border-radius:18px !important;

        box-shadow:
            0 10px 30px rgba(15,23,42,.14),
            0 2px 8px rgba(15,23,42,.06) !important;

        z-index:2147482000 !important;

        visibility:visible !important;
        opacity:1 !important;

        transform:translate3d(0,0,0) !important;

        pointer-events:auto !important;
    }

    html body .am-v426-sticky-contact > a{
        flex:1 1 0 !important;

        min-width:0 !important;
        min-height:44px !important;

        display:flex !important;
        align-items:center !important;
        justify-content:center !important;

        gap:6px !important;

        padding:0 10px !important;

        box-sizing:border-box !important;

        border-radius:12px !important;

        font-family:
            "Inter",
            -apple-system,
            BlinkMacSystemFont,
            "Segoe UI",
            Roboto,
            Arial,
            sans-serif !important;

        font-size:13px !important;
        font-weight:700 !important;
        line-height:1 !important;

        text-decoration:none !important;

        white-space:nowrap !important;

        cursor:pointer !important;
    }

    /*
     * Call
     */
    html body .am-v426-sticky-contact > a.am-v426-call{
        background:#0b9f63 !important;
        color:#fff !important;
        border:1px solid #0b9f63 !important;
    }

    /*
     * WhatsApp
     */
    html body .am-v426-sticky-contact > a.am-v426-whatsapp{
        background:#e9f8f1 !important;
        color:#087b4d !important;
        border:1px solid #c8ebdc !important;
    }

    /*
     * Chat
     */
    html body .am-v426-sticky-contact > a.am-v426-chat{
        background:#fff !important;
        color:#18263d !important;
        border:1px solid #dce5e1 !important;
    }

    /*
     * Existing old sticky implementations are hidden.
     * V42.13 is the final recovery authority.
     */
    html body .am-v421-sticky-cta,
    html body .am-v422-sticky-cta{
        display:none !important;
    }

    /*
     * Prevent content from disappearing behind the action bar.
     */
    html body .vehicle-detail-page{
        padding-bottom:
            calc(
                78px
                + var(--am-v426-bottom-nav-height,62px)
                + env(safe-area-inset-bottom)
            ) !important;
    }
}


@media (min-width:768px){

    .am-v426-sticky-contact{
        display:none !important;
    }

}

/* ============================================================
   AUTOMART V42.14
   SOURCE-ALIGNED MOBILE FLOATING HEADER + CONTACT BAR
   ============================================================ */

@media (max-width: 767px){

    /*
     * MOBILE FLOATING HEADER
     */

    html body .am-v214-mobile-floating-header{
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;

        width: 100% !important;
        max-width: none !important;

        z-index: 2147483000 !important;

        transform: translateZ(0) !important;
        -webkit-transform: translateZ(0) !important;

        will-change: transform !important;
    }

    html body.am-v214-header-active{
        padding-top: 66px !important;
    }

    /*
     * MOBILE STICKY CONTACT
     *
     * Sits above the existing global mobile bottom menu.
     */

    html body .am-v214-sticky-contact{
        position: fixed !important;

        left: 12px !important;
        right: 12px !important;

        bottom:
            calc(
                64px +
                env(safe-area-inset-bottom, 0px) +
                10px
            ) !important;

        min-height: 58px !important;

        display: flex !important;
        align-items: stretch !important;

        gap: 8px !important;

        padding: 7px !important;

        background:
            rgba(255,255,255,.97) !important;

        border:
            1px solid #dfe7e3 !important;

        border-radius:
            18px !important;

        box-shadow:
            0 12px 34px rgba(15,23,42,.16),
            0 2px 8px rgba(15,23,42,.08) !important;

        backdrop-filter:
            blur(18px) !important;

        -webkit-backdrop-filter:
            blur(18px) !important;

        z-index:
            2147482000 !important;

        transform:
            translateZ(0) !important;

        -webkit-transform:
            translateZ(0) !important;
    }

    html body
    .am-v214-sticky-contact
    .am-v214-contact-btn{

        flex: 1 1 0 !important;

        min-width: 0 !important;

        min-height: 44px !important;

        display: flex !important;

        align-items: center !important;
        justify-content: center !important;

        gap: 6px !important;

        padding:
            0 8px !important;

        border-radius:
            13px !important;

        border:
            1px solid transparent !important;

        text-decoration:
            none !important;

        font-family:
            inherit !important;

        font-size:
            13px !important;

        font-weight:
            700 !important;

        line-height:
            1 !important;

        white-space:
            nowrap !important;
    }

    html body
    .am-v214-contact-icon{

        display:
            inline-flex !important;

        align-items:
            center !important;

        justify-content:
            center !important;

        width:
            22px !important;

        height:
            22px !important;

        font-size:
            17px !important;

        line-height:
            1 !important;
    }

    html body
    .am-v214-contact-call{

        color:
            #087f52 !important;

        background:
            #ecfaf4 !important;

        border-color:
            #ccebdd !important;
    }

    html body
    .am-v214-contact-whatsapp{

        color:
            #087f52 !important;

        background:
            #e9f9f1 !important;

        border-color:
            #c9eadb !important;
    }

    html body
    .am-v214-contact-chat{

        color:
            #142033 !important;

        background:
            #f4f6f8 !important;

        border-color:
            #e1e6eb !important;
    }

    /*
     * Prevent the page's final content from disappearing
     * underneath the sticky contact bar.
     */

    html body.am-v214-contact-active{
        padding-bottom:
            calc(
                145px +
                env(safe-area-inset-bottom, 0px)
            ) !important;
    }

    /*
     * Keep the existing V43.8 floating desktop contact
     * from competing with the new mobile contact bar.
     */

    html body
    .am-v438-floating-contact{
        display: none !important;
    }

}

/* Desktop remains unchanged. */
@media (min-width: 768px){

    html body .am-v214-sticky-contact{
        display: none !important;
    }

}
