/*
============================================================
AUTOMART VEHICLE SEARCH MOBILE V41.4

FINAL SEARCH-PAGE CLEANUP

- Real sticky header synchronization
- Right gutter for More Filters
- Refined result spacing
- More dealer-name room
- Action-button breathing room
- Bottom-nav safe area
- 12px minimum typography preserved
============================================================
*/


@media (max-width:767px) {


    /* =====================================================
       REAL V40 STICKY HEADER CLEARANCE
       ===================================================== */

    html body.site-page:not(.admin-page) {
        padding-top:
            calc(
                var(
                    --am-v414-header-height,
                    164px
                )
                + 12px
            )
            !important;
    }


    body.site-page main {
        margin-top:
            0 !important;

        padding-top:
            0 !important;
    }


    body.site-page
    .premium-listing-v14-1 {
        padding-top:
            4px !important;

        padding-bottom:
            112px !important;
    }


    body.site-page
    .market-title-row {
        margin-top:
            0 !important;

        padding-top:
            5px !important;

        margin-bottom:
            13px !important;
    }



    /* =====================================================
       V40 QUICK FILTER ROW
       ENSURE LAST CHIP CAN FULLY SCROLL INTO VIEW
       ===================================================== */

    body:not(.admin-page)
    .am-mobile-v40__filters {
        box-sizing:
            border-box !important;

        padding-right:
            18px !important;

        scroll-padding-left:
            4px;

        scroll-padding-right:
            18px;
    }


    body:not(.admin-page)
    .am-mobile-v40__filters
    > a:last-child {
        margin-right:
            12px !important;
    }



    /* =====================================================
       REMOVE ANY REMAINING LARGE LEGACY FILTER BUTTON
       ===================================================== */

    body.site-page
    button.filter-toggle,

    body.site-page
    .btn.filter-toggle,

    body.site-page
    .btn.btn-light.filter-toggle,

    body.site-page
    .am-global-mobile-toggle-v18 {
        display:
            none !important;

        visibility:
            hidden !important;

        width:
            0 !important;

        height:
            0 !important;

        min-width:
            0 !important;

        min-height:
            0 !important;

        max-width:
            0 !important;

        max-height:
            0 !important;

        margin:
            0 !important;

        padding:
            0 !important;

        border:
            0 !important;

        overflow:
            hidden !important;

        opacity:
            0 !important;

        pointer-events:
            none !important;
    }



    /* =====================================================
       SORT / VIEW CONTROLS
       ===================================================== */

    body.site-page
    .view-tools {
        margin-bottom:
            4px !important;
    }


    body.site-page
    .view-tools label {
        padding-left:
            13px !important;

        padding-right:
            11px !important;
    }



    /* =====================================================
       GRID CARDS
       ===================================================== */

    body.site-page
    .premium-search-results-v15:not(.view-mode-list-v17)
    .premium-search-grid-v15 {
        gap:
            10px !important;

        padding-bottom:
            26px !important;
    }


    body.site-page
    .premium-search-results-v15:not(.view-mode-list-v17)
    .premium-auto-card {
        border-radius:
            14px !important;
    }



    /* =====================================================
       DEALER ROW — MORE NAME SPACE
       ===================================================== */

    body.site-page
    .premium-search-results-v15:not(.view-mode-list-v17)
    .premium-dealer-row {
        grid-template-columns:
            28px
            minmax(0,1fr)
            35px !important;

        column-gap:
            4px !important;
    }


    body.site-page
    .premium-search-results-v15:not(.view-mode-list-v17)
    .premium-dealer-avatar {
        width:
            28px !important;

        height:
            28px !important;

        min-width:
            28px !important;
    }


    body.site-page
    .premium-search-results-v15:not(.view-mode-list-v17)
    .premium-dealer-row
    > div:nth-child(2) {
        min-width:
            0 !important;

        padding-right:
            1px;
    }


    body.site-page
    .premium-search-results-v15:not(.view-mode-list-v17)
    .premium-dealer-row
    > div:nth-child(2)
    strong {
        max-width:
            100% !important;

        font-size:
            12px !important;

        font-weight:
            700 !important;

        letter-spacing:
            -.005em;
    }


    body.site-page
    .premium-search-results-v15:not(.view-mode-list-v17)
    .premium-rating {
        min-width:
            35px;

        justify-self:
            end;

        text-align:
            right;
    }



    /* =====================================================
       GRID ACTION BUTTON BREATHING ROOM
       ===================================================== */

    body.site-page
    .premium-search-results-v15:not(.view-mode-list-v17)
    .premium-card-actions {
        gap:
            5px !important;

        margin-top:
            9px !important;
    }


    body.site-page
    .premium-search-results-v15:not(.view-mode-list-v17)
    .premium-card-actions a {
        min-height:
            37px !important;

        padding:
            0 7px !important;

        font-size:
            12px !important;

        line-height:
            1 !important;

        font-weight:
            700 !important;

        letter-spacing:
            -.005em;
    }



    /* =====================================================
       LIST VIEW DEALER / ACTION REFINEMENT
       ===================================================== */

    body.site-page
    .premium-search-results-v15.view-mode-list-v17
    .premium-dealer-row {
        grid-template-columns:
            27px
            minmax(0,1fr)
            36px !important;

        gap:
            4px !important;
    }


    body.site-page
    .premium-search-results-v15.view-mode-list-v17
    .premium-dealer-row
    > div:nth-child(2) {
        min-width:
            0 !important;
    }


    body.site-page
    .premium-search-results-v15.view-mode-list-v17
    .premium-rating {
        min-width:
            36px;

        justify-self:
            end;
    }


    body.site-page
    .premium-search-results-v15.view-mode-list-v17
    .premium-card-actions {
        gap:
            5px !important;

        margin-top:
            8px !important;
    }


    body.site-page
    .premium-search-results-v15.view-mode-list-v17
    .premium-card-actions a {
        min-height:
            35px !important;

        padding:
            0 6px !important;

        font-size:
            12px !important;

        font-weight:
            700 !important;
    }



    /* =====================================================
       BOTTOM NAVIGATION CLEARANCE
       ===================================================== */

    body.site-page
    .premium-search-results-v15 {
        padding-bottom:
            34px !important;
    }


    body.site-page
    .premium-search-grid-v15 {
        margin-bottom:
            18px !important;
    }


    body.site-page {
        scroll-padding-bottom:
            96px !important;
    }

}



@media (max-width:380px) {

    html body.site-page:not(.admin-page) {
        padding-top:
            calc(
                var(
                    --am-v414-header-height,
                    160px
                )
                + 10px
            )
            !important;
    }


    body.site-page
    .premium-search-results-v15:not(.view-mode-list-v17)
    .premium-card-actions a {
        padding-left:
            5px !important;

        padding-right:
            5px !important;
    }

}


/* AUTOMART V41.5 QUICK FILTER POLISH START */

@media (max-width:767px) {

    /*
     * Keep the existing horizontal behaviour but make the
     * complete More Filters chip easier to expose.
     */

    body:not(.admin-page)
    .am-mobile-v40__filters {
        gap:
            6px !important;

        padding-right:
            30px !important;

        scroll-padding-right:
            30px !important;
    }


    body:not(.admin-page)
    .am-mobile-v40__filters > a {
        min-height:
            36px !important;

        padding-left:
            9px !important;

        padding-right:
            9px !important;
    }


    body:not(.admin-page)
    .am-mobile-v40__filters
    > a:last-child {
        margin-right:
            22px !important;
    }


    /*
     * Slightly compact filter labels without violating the
     * approved 12px minimum type rule.
     */

    body:not(.admin-page)
    .am-mobile-v40__filters
    > a span {
        font-size:
            12px !important;

        line-height:
            1 !important;
    }

}

/* AUTOMART V41.5 QUICK FILTER POLISH END */


/* AUTOMART VEHICLE SEARCH MOBILE V41.6 START */

/*
============================================================
AUTOMART VEHICLE SEARCH MOBILE V41.6

FINAL VISUAL POLISH ONLY

- Full Brand New condition label
- Better Sort-by vertical alignment
- More bottom clearance above fixed navigation
- Existing Grid/List architecture preserved
- Existing 12px minimum typography preserved
============================================================
*/

@media (max-width:767px) {


    /* =====================================================
       SORT CONTROL — BALANCED VERTICAL ALIGNMENT
       ===================================================== */

    body.site-page
    .view-tools label {
        display:grid !important;

        grid-template-rows:
            auto
            auto !important;

        align-content:center !important;

        justify-content:stretch !important;

        gap:2px !important;

        height:50px !important;
        min-height:50px !important;

        padding:
            5px 13px
            6px !important;

        line-height:1.1 !important;
    }


    body.site-page
    .view-tools label select {
        height:auto !important;

        min-height:0 !important;

        margin:0 !important;

        padding:0 !important;

        line-height:1.15 !important;

        align-self:center !important;
    }


    /*
     * Match icon buttons to the polished sort control.
     */

    body.site-page
    .view-tools .view-btn,

    body.site-page
    .am-v411-filter-button {
        height:50px !important;
        min-height:50px !important;
    }



    /* =====================================================
       LIST VIEW — CONDITION GETS ITS OWN ROW
       ===================================================== */

    body.site-page
    .premium-search-results-v15.view-mode-list-v17
    .premium-title-row {
        display:grid !important;

        grid-template-columns:
            minmax(0,1fr)
            !important;

        gap:6px !important;

        align-items:start !important;
    }


    body.site-page
    .premium-search-results-v15.view-mode-list-v17
    .premium-condition {
        width:max-content !important;

        max-width:none !important;

        justify-self:start !important;

        margin:0 !important;

        padding:
            5px 8px !important;

        overflow:visible !important;

        text-overflow:clip !important;

        white-space:nowrap !important;

        font-size:12px !important;

        line-height:1 !important;

        font-weight:700 !important;
    }


    /*
     * Keep title and subtitle readable now that condition
     * no longer occupies their horizontal space.
     */

    body.site-page
    .premium-search-results-v15.view-mode-list-v17
    .premium-title-copy {
        width:100% !important;

        min-width:0 !important;
    }


    body.site-page
    .premium-search-results-v15.view-mode-list-v17
    .premium-title-copy h3 {
        width:100% !important;

        max-width:100% !important;

        padding-right:0 !important;
    }


    body.site-page
    .premium-search-results-v15.view-mode-list-v17
    .premium-title-copy p {
        width:100% !important;

        max-width:100% !important;
    }



    /* =====================================================
       LIST CARD HEIGHT — SMALL COMPENSATION FOR CONDITION ROW
       ===================================================== */

    body.site-page
    .premium-search-results-v15.view-mode-list-v17
    .premium-auto-card,

    body.site-page
    .premium-search-results-v15.view-mode-list-v17
    .vehicle-card {
        min-height:210px !important;
    }


    body.site-page
    .premium-search-results-v15.view-mode-list-v17
    .premium-auto-media,

    body.site-page
    .premium-search-results-v15.view-mode-list-v17
    .premium-auto-media img,

    body.site-page
    .premium-search-results-v15.view-mode-list-v17
    .premium-auto-body {
        min-height:210px !important;
    }



    /* =====================================================
       GRID CONDITION
       ENSURE FULL LABEL THERE TOO
       ===================================================== */

    body.site-page
    .premium-search-results-v15:not(.view-mode-list-v17)
    .premium-condition {
        width:max-content !important;

        max-width:none !important;

        overflow:visible !important;

        text-overflow:clip !important;

        white-space:nowrap !important;

        font-size:12px !important;
    }



    /* =====================================================
       ACTION BUTTON FINAL POLISH
       ===================================================== */

    body.site-page
    .premium-card-actions {
        gap:6px !important;
    }


    body.site-page
    .premium-card-actions a {
        min-width:0 !important;

        padding-left:7px !important;
        padding-right:7px !important;

        font-size:12px !important;

        font-weight:700 !important;

        letter-spacing:-.005em !important;
    }



    /* =====================================================
       BOTTOM-NAV SAFE CLEARANCE
       ===================================================== */

    body.site-page
    .premium-listing-v14-1 {
        padding-bottom:
            calc(
                150px
                + env(safe-area-inset-bottom)
            )
            !important;
    }


    body.site-page
    .premium-search-results-v15 {
        padding-bottom:44px !important;
    }


    body.site-page
    .premium-search-grid-v15 {
        padding-bottom:36px !important;

        margin-bottom:28px !important;
    }


    body.site-page {
        scroll-padding-bottom:
            calc(
                110px
                + env(safe-area-inset-bottom)
            )
            !important;
    }

}


/* Narrow phones */

@media (max-width:380px) {

    body.site-page
    .premium-card-actions a {
        padding-left:5px !important;
        padding-right:5px !important;
    }


    body.site-page
    .premium-search-results-v15.view-mode-list-v17
    .premium-condition {
        padding-left:6px !important;
        padding-right:6px !important;
    }

}

/* AUTOMART VEHICLE SEARCH MOBILE V41.6 END */


/* AUTOMART VEHICLE SEARCH MOBILE V41.7 START */

/*
============================================================
AUTOMART VEHICLE SEARCH MOBILE V41.7

SAFE-AREA FREEZE

ONLY:
- Dealer verification tick spacing
- Final search-result safe area above fixed bottom navigation

NO:
- Typography changes
- Card dimension changes
- Header changes
- Grid/List logic changes
============================================================
*/

@media (max-width:767px) {


    /* =====================================================
       DEALER VERIFIED TICK SPACING
       ===================================================== */

    body.site-page
    .premium-dealer-row
    .dealer-tick {
        display:inline-flex !important;

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

        margin-left:5px !important;

        vertical-align:middle;

        flex:0 0 auto;
    }


    body.site-page
    .premium-dealer-row
    strong {
        display:inline-flex !important;

        align-items:center;

        max-width:100%;

        min-width:0;
    }



    /* =====================================================
       SEARCH RESULTS SAFE AREA
       ===================================================== */

    body.site-page
    .premium-search-results-v15 {
        padding-bottom:
            calc(
                120px
                + env(safe-area-inset-bottom)
            )
            !important;
    }


    body.site-page
    .premium-search-grid-v15 {
        padding-bottom:
            calc(
                95px
                + env(safe-area-inset-bottom)
            )
            !important;

        margin-bottom:
            35px !important;
    }



    /* =====================================================
       LIST MODE — FINAL CARD
       ===================================================== */

    body.site-page
    .premium-search-results-v15.view-mode-list-v17
    .premium-auto-card:last-child {
        margin-bottom:
            calc(
                115px
                + env(safe-area-inset-bottom)
            )
            !important;
    }



    /* =====================================================
       GRID MODE — FINAL ROW
       Give both final cards equal bottom breathing room.
       ===================================================== */

    body.site-page
    .premium-search-results-v15:not(.view-mode-list-v17)
    .premium-auto-card:nth-last-child(-n+2) {
        margin-bottom:
            calc(
                115px
                + env(safe-area-inset-bottom)
            )
            !important;
    }



    /* =====================================================
       FIXED BOTTOM NAV SCROLL CLEARANCE
       ===================================================== */

    html body.site-page {
        scroll-padding-bottom:
            calc(
                125px
                + env(safe-area-inset-bottom)
            )
            !important;
    }

}


/* Narrow phones */

@media (max-width:380px) {

    body.site-page
    .premium-dealer-row
    .dealer-tick {
        margin-left:4px !important;
    }

}

/* AUTOMART VEHICLE SEARCH MOBILE V41.7 END */

