/* Mobile Search Fix (Screens under 992px) */
@media (max-width: 991px) {
    /* 1. Ensure the search button doesn't float or overlap */
    .mt-car-search .col-md-2 {
        margin-top: 10px !important;
        width: 100% !important;
        float: none !important;
        clear: both !important;
        display: block !important;
    }

    /* 2. Force the button to be full width on mobile for better UX */
    .mt-car-search .mt-submit-form {
        width: 100% !important;
        height: 50px !important;
        line-height: 50px !important;
        text-align: center !important;
    }

    /* 3. Fix the "Car Model" and other fields stacking */
    .mt-car-search .mt-form-field-group {
        margin-bottom: 15px !important;
        width: 100% !important;
    }
}

/* Fix WooCommerce Ordering Dropdown on Mobile */
@media (max-width: 991px) {
    /* 1. Ensure the form container doesn't allow overflow */
    .woocommerce-ordering {
        float: none !important;
        width: 100% !important;
        margin-bottom: 20px !important;
        position: relative;
    }

    /* 2. Fix the NiceSelect wrapper */
    .woocommerce-ordering .nice-select {
        width: 100% !important; /* Make it full width so it's easier to tap */
        float: none !important;
    }

    /* 3. THE FIX: Fix the actual dropdown list */
    .woocommerce-ordering .nice-select .list {
        width: 100% !important;
        left: 0 !important;
        right: 0 !important;
        box-shadow: 0 4px 15px rgba(0,0,0,0.15);
        position: absolute;
        /* Ensure it stays on top of product images */
        z-index: 9999; 
    }
    
    /* 4. Optional: Prevent text from being cut off inside options */
    .woocommerce-ordering .nice-select .option {
        white-space: normal !important;
        line-height: 1.4;
        padding-top: 10px;
        padding-bottom: 10px;
    }
}


/* Ensure recovery filter button is visible on mobile */
.ecars-mobile-filter-recovery {
    display: none;
}

@media (max-width: 991px) {
    .ecars-mobile-filter-recovery {
        display: block !important;
        text-align: center;
        padding: 20px 0;
    }
    
    /* Ensure the button doesn't inherit 'hide' styles from the empty container */
    .ecars-mobile-filter-recovery .autobid-shop-filters-button {
        display: inline-block !important;
        visibility: visible !important;
    }
}


/* FIX HOME ENTRY IN MAIN MENY SHOWING AN "EXPAND" PROPERTY ON MOBILE */
/* 1. Hide the expand arrow for the Home menu item specifically */
#menu-item-8234 .expand {
    display: none !important;
}

/* 2. Remove the extra padding usually reserved for the arrow */
#menu-item-8234 a {
    padding-right: 15px !important;
}

/* FIX EXPAND BUTTONS SOMETIMES NOT SHOWING ON MOBILE */
/* Fix Expand Icon for Shop/Child Pages */
.expand,
.action-expand {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    vertical-align: middle;
    text-decoration: none !important;
}

/* Force the theme's expected icon settings */
.action-expand::after {
    /* If the theme uses ::after, we lock it here */
    font-family: "Font Awesome 5 Free" !important;
    font-weight: 900 !important;
    font-style: normal;
    font-variant: normal;
    text-rendering: auto;
    -webkit-font-smoothing: antialiased;
    visibility: visible !important;
    display: inline-block !important;
    content: "\f078" !important; /* Default theme chevron-down */
}



@media (max-width: 991px) {
    /* 1. The Main Container */
    .product.row {
        display: flex !important;
        flex-direction: column !important;
    }

    /* 2. Unwrap the columns and wrappers */
    /* This makes the children of these divs direct flex items of .product.row */
    .tabs-related,
    .sidebar-product,
    .sidebar-product-wrapper,
    .woocommerce-tabs {
        display: contents !important;
    }

    /* 3. ORDER ASSIGNMENTS */

    /* A. Quick Info (Already inside Summary, which is usually Order 0 or 1) */
    .thumbnails-summary { order: 1 !important; }

    /* B. Car Specs (Was in Left Col) */
    .main-specs { order: 2 !important; }

    /* C. Additional Options (Was in Left Col Tabs) */

    #tab-description { 
        order: 3 !important; 
    }

    /* D. Car Costs (Was in Right Col) */
    #ecars-financial-summary { order: 4 !important; }

    /* E. VIN Checker (Was in Right Col) */
    #movable-history-box { 
        order: 5 !important; 
        margin-bottom: 20px !important;
    }

    /* F. Auction History (Was in Left Col Tabs) */
    #tab-simle_auction_history { 
        order: 6 !important; 
        display: block !important; 
    }

    /* G. Expiring Soon (Was in Right Col) */
    .woocommerce_expiring { 
        order: 7 !important; 
        margin-top: 30px !important;
    }

    /* 4. CLEANUP */
    /* Hide the tab buttons (Auction History / Equipment) since we just stacked the content */
    ul.tabs.wc-tabs {
        display: none !important;
    }
}