/* "Find Your Tires" vehicle modal (#vehicleEntryModal: footer.php, template-parts/visualizer.php) on phones.
   Desktop untouched: everything is inside the 767px breakpoint, and the phone-only markup
   (.bwo-vw-m, .bwo-vw-m-lead) carries the hidden attribute until these rules show it.
   Loaded after dev-extra.css; the ID scope beats mobile.css / style.css / responsive.css. */

@media (max-width: 767px) {

    /* ---------- Sheet: full height, top-rounded, header + tabs fixed, tab content scrolls ---------- */

    #vehicleEntryModal.customModal.modal-overlay {
        padding: 0;
        background: rgba(31, 32, 35, .32);
    }
    #vehicleEntryModal.customModal .modal-box {
        position: absolute;
        top: auto;
        right: 0;
        /* One steady height for every tab and step (sizing to the content made it jump while picking a size). */
        height: min(88%, calc(100% - max(12px, env(safe-area-inset-top, 0px))));
        bottom: 0;
        left: 0;
        display: flex;
        flex-direction: column;
        max-width: none;
        margin: 0;
        border-radius: 20px 20px 0 0;
        background: #fff;
        font-family: Outfit, system-ui, sans-serif;
        color: #1f2023;
    }

    #vehicleEntryModal.customModal .modal-header {
        flex: none;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        padding: 18px 20px 6px;
        border: 0;
        background: #fff;
        color: #1f2023;
    }
    #vehicleEntryModal.customModal .modal-header h3 {
        margin: 0;
        font-family: inherit;
        font-size: 18px;
        font-weight: 500;
        color: #1f2023;
    }
    /* Tire / wheel icon and the subheading, as on desktop. */
    #vehicleEntryModal.customModal .modal-header > div:not(.tire-box) { flex: 1; min-width: 0; }
    #vehicleEntryModal.customModal .modal-header .tire-box {
        position: static;
        flex: none;
        display: grid;
        place-items: center;
        width: 40px;
        height: 40px;
        border-radius: 10px;
        background: #f4f4f5;
    }
    #vehicleEntryModal.customModal .modal-header .tire-box :is(svg, img) { width: 24px; height: 24px; }
    #vehicleEntryModal.customModal .modal-header .js-entry-modal-subtext {
        display: block;
        margin: 2px 0 0;
        font-size: 13px;
        line-height: 1.35;
        color: #6b6e76;
    }
    #vehicleEntryModal.customModal .modal-header .close-btn {
        position: static;
        flex: none;
        display: grid;
        place-items: center;
        width: 32px;
        height: 32px;
        border-radius: 50%;
        background: #f4f4f5;
        color: #4b4e55;
        font-size: 22px;
        line-height: 1;
    }

    /* Tabs as a segmented control (the Verify Fitment flow still hides them with an inline display:none). */
    #vehicleEntryModal .entry-modal-tabs {
        flex: none;
        display: grid;
        grid-auto-flow: column;
        grid-auto-columns: minmax(0, 1fr);
        gap: 0;
        width: auto;
        margin: 8px 20px 0;
        padding: 3px;
        border: 0;
        border-radius: 10px;
        background: #f4f4f5;
    }
    #vehicleEntryModal .entry-modal-tabs .entry-modal-tab {
        display: flex;
        align-items: center;
        justify-content: center;
        height: 34px;
        padding: 0 8px;
        border: 0;
        border-radius: 8px;
        background: transparent;
        box-shadow: none;
        color: #6b6e76;
        font: 400 14px Outfit, system-ui, sans-serif;
    }
    #vehicleEntryModal .entry-modal-tabs .entry-modal-tab:hover { background: transparent; }
    #vehicleEntryModal .entry-modal-tabs .entry-modal-tab.active {
        background: #fff;
        box-shadow: 0 1px 2px rgba(0, 0, 0, .08);
        color: #1f2023;
        font-weight: 500;
    }
    #vehicleEntryModal .entry-modal-tabs .entry-modal-tab span { display: none; }

    #vehicleEntryModal.customModal .modal-body {
        flex: 1 1 auto;
        min-height: 0;
        overflow-y: auto;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
        padding: 16px 20px 0;
    }

    /* ---------- By Vehicle: card, "I drive a" fields, ZIP, garage, then the sticky button ---------- */

    #vehicleEntryModal.customModal .modal-body:not([data-tab-pane="tiresize"]) {
        display: flex;
        flex-direction: column;
    }
    /* Garage (or the sign-up note) moves below the fields, as in the design. */
    #vehicleEntryModal .modal-body > * { order: 6; flex-shrink: 0; } /* the body scrolls; nothing gets squeezed */
    #vehicleEntryModal .modal-body > .bwo-vw-m { order: 0; }
    #vehicleEntryModal .modal-body > .divider ~ * { order: 2; }
    #vehicleEntryModal .modal-body > .divider { order: 5; }
    #vehicleEntryModal .modal-body > .cta-btn { order: 9; }
    /* Garage first, then OR, then the vehicle card and fields: the saved vehicles when signed in, the
       "Save your vehicle in My Garage" note when signed out. */
    #vehicleEntryModal .modal-body:has(> .garage-vehicle-swiper-wrap, > .vehicle-box-text) > * { order: 0; }
    #vehicleEntryModal .modal-body:has(> .garage-vehicle-swiper-wrap, > .vehicle-box-text) > .divider { order: 1; }
    #vehicleEntryModal .modal-body:has(> .garage-vehicle-swiper-wrap, > .vehicle-box-text) > .bwo-vw-m { order: 2; }
    #vehicleEntryModal .modal-body:has(> .garage-vehicle-swiper-wrap, > .vehicle-box-text) > .divider ~ * { order: 3; }
    #vehicleEntryModal .modal-body:has(> .garage-vehicle-swiper-wrap, > .vehicle-box-text) > .cta-btn { order: 9; }
    #vehicleEntryModal .modal-body:has(> .garage-vehicle-swiper-wrap) > h6:first-of-type,
    #vehicleEntryModal .modal-body > .vehicle-box-text { margin-top: 0 !important; }
    #vehicleEntryModal .modal-body:has(.garage-vehicle-swiper-wrap) .garage-vehicle-swiper .swiper-wrapper { max-height: 224px; } /* about 3 rows, so the fields stay in reach */
    /* "No saved vehicles yet. Pick one below": stays above the fields, so no garage line either. */
    #vehicleEntryModal .modal-body > p { order: 1; }
    #vehicleEntryModal .modal-body > p ~ .divider { display: none; }

    /* "Your vehicle": one compact row -- small photo left; label, progress and name right. */
    #vehicleEntryModal .modal-body > .bwo-vw-m {
        display: grid !important;
        grid-template-columns: 84px minmax(0, 1fr);
        grid-template-areas: "car top" "car name";
        align-items: center;
        column-gap: 12px;
        row-gap: 2px;
        margin: 0;
        padding: 10px 14px;
        border-radius: 14px;
        background: #f6f6f7;
    }
    #vehicleEntryModal .bwo-vw-m__top { grid-area: top; }
    #vehicleEntryModal .bwo-vw-m__car,
    #vehicleEntryModal .bwo-vw-m__photo { grid-area: car; }
    #vehicleEntryModal .bwo-vw-m__name { grid-area: name; }
    #vehicleEntryModal .bwo-vw-m__top {
        display: flex;
        align-items: center;
        justify-content: space-between;
        font-size: 12px;
        color: #6b6e76;
    }
    #vehicleEntryModal .bwo-vw-m__progress { display: flex; gap: 4px; }
    #vehicleEntryModal .bwo-vw-m__progress i {
        width: 18px;
        height: 3px;
        border-radius: 2px;
        background: #e2e2e5;
    }
    #vehicleEntryModal .bwo-vw-m__progress i.is-on { background: #c81414; }
    #vehicleEntryModal .bwo-vw-m__car {
        align-self: center;
        width: 84px;
        height: auto;
    }
    #vehicleEntryModal .bwo-vw-m__photo {
        align-self: center;
        width: 100%;
        max-width: 84px;
        height: 52px;
        object-fit: contain;
    }
    #vehicleEntryModal .bwo-vw-m.has-photo .bwo-vw-m__car { display: none; }
    #vehicleEntryModal .bwo-vw-m__name {
        margin: 0;
        font-size: 15px;
        font-weight: 500;
        line-height: 1.3;
        text-align: left;
        color: #1f2023;
    }
    #vehicleEntryModal .bwo-vw-m__name .is-missing { color: #9a9da4; font-weight: 400; }
    /* "2010 Buick · model · trim": a dot on either side of each part still to pick. */
    #vehicleEntryModal .bwo-vw-m__name .is-missing:not(:first-child)::before,
    #vehicleEntryModal .bwo-vw-m__name .is-missing + span::before { content: "\00B7\00A0"; color: #9a9da4; font-weight: 400; }

    #vehicleEntryModal .modal-body > h6,
    #vehicleEntryModal .modal-body > p {
        margin: 0 0 8px;
        font-family: inherit;
        font-size: 13px;
        font-weight: 400;
        line-height: 1.4;
        color: #6b6e76;
    }
    #vehicleEntryModal .modal-body > .divider ~ h6 { margin: 20px 0 10px; }

    #vehicleEntryModal .modal-body .filters {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        align-items: center;
        gap: 8px;
        width: 100%;
        font-size: 16px;
        color: #4b4e55;
    }
    #vehicleEntryModal .filters .bwo-vw-m-lead { display: none !important; }
    #vehicleEntryModal .filters .vehicle-fields-loader { grid-column: 1 / -1; }
    #vehicleEntryModal .filters .vehicle-fields-loader { border-radius: 10px; }

    /* Fields as chips: grey when filled, red outline on the one to fill next, dashed while it has nothing to choose. */
    #vehicleEntryModal .modal-body .filters select {
        width: 100%;
        min-width: 0;
        height: 40px;
        margin: 0;
        padding: 0 30px 0 12px;
        border: 1px solid #e2e2e5;
        border-radius: 8px;
        background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='13' height='13' viewBox='0 0 24 24' fill='none' stroke='%234B4E55' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 10px center / 13px;
        box-shadow: none;
        font: 400 15px/32px Outfit, system-ui, sans-serif;
        color: #6b6e76;
        -webkit-appearance: none;
        appearance: none;
    }
    #vehicleEntryModal .modal-body .filters select.bwo-vw-done {
        background-color: #f6f6f7;
        color: #1f2023;
        font-weight: 500;
    }
    #vehicleEntryModal .modal-body .filters select.bwo-vw-next {
        border-color: #c81414;
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='13' height='13' viewBox='0 0 24 24' fill='none' stroke='%23C81414' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
        color: #c81414;
        font-weight: 500;
    }
    #vehicleEntryModal .modal-body .filters select.bwo-vw-waiting,
    #vehicleEntryModal .modal-body .filters select:disabled {
        border-style: dashed;
        border-color: #d4d5d9;
        background-color: #fff;
        background-image: none;
        padding-right: 12px;
        color: #9a9da4;
        font-weight: 400;
    }

    /* ZIP: slim full-width row between hairlines; Google Places still attaches to #zipcode. */
    #vehicleEntryModal .modal-body .filters #zipcode {
        grid-column: 1 / -1;
        width: 100%;
        height: 46px;
        margin: 12px 0 0;
        padding: 0 4px 0 30px;
        border: 0;
        border-top: 1px solid #efeff1;
        border-bottom: 1px solid #efeff1;
        border-radius: 0;
        background: transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%236B6E76' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 21s-7-6.2-7-11a7 7 0 0114 0c0 4.8-7 11-7 11z'/%3E%3Ccircle cx='12' cy='10' r='2.5'/%3E%3C/svg%3E") no-repeat 4px center / 18px;
        box-shadow: none;
        font: 400 16px Outfit, system-ui, sans-serif; /* 16px+ stops iOS zooming in on focus */
        color: #1f2023;
    }
    #vehicleEntryModal .modal-body .filters #zipcode.bwo-vw-next { border-bottom-color: #c81414; }
    #vehicleEntryModal .modal-body .filters #zipcode:focus { outline: 0 !important; box-shadow: none !important; border-bottom-color: #c81414; }
    #vehicleEntryModal .modal-body .filters { margin-bottom: 16px; }
    #vehicleEntryModal .modal-body .filters #zipcode::placeholder { color: #9a9da4; }

    #vehicleEntryModal .modal-body > #vehicle-entry-error { margin: 10px 0 0; font-size: 13px; color: #c81414; }
    #vehicleEntryModal .modal-body > #vehicle-model-empty-msg { margin: 10px 0 0; }

    /* "OR" divider between the fields and the garage, as on desktop. */
    #vehicleEntryModal .modal-body > .divider { margin: 22px 0 14px; }
    #vehicleEntryModal .modal-body > .divider::before { border-top: 1px dashed #d4d5d9; }
    #vehicleEntryModal .modal-body > .divider span {
        width: 30px;
        height: 30px;
        border-color: #e2e2e5;
        font: 500 12px Outfit, system-ui, sans-serif;
        color: #4b4e55;
        box-shadow: none;
    }
    #vehicleEntryModal .modal-body > .divider ~ h6 { margin-top: 16px; } /* "Find Tires for Your Vehicle" under the card */

    /* Garage: the Swiper stays, its cards become small image + name chips. */
    #vehicleEntryModal .garage-vehicle-swiper-wrap { margin: 0 0 4px; padding: 0; }
    #vehicleEntryModal .garage-vehicle-swiper-wrap .swp-btn { display: none; }
    /* Saved vehicles: 2-column list in a short scrolling box (a garage can hold 30-40 cars), with a
       search box above it from 7 cars (vehicle-entry-modal.js). Swiper's dragging is off on phones. */
    #vehicleEntryModal .garage-vehicle-swiper .swiper-wrapper {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
        max-height: 296px; /* about 4 rows */
        overflow-y: auto;
        overscroll-behavior: contain;
        transform: none !important;
    }
    #vehicleEntryModal .garage-vehicle-swiper .swiper-slide { width: auto !important; margin: 0 !important; }
    #vehicleEntryModal .garage-vehicle-swiper .swiper-slide[hidden] { display: none !important; }
    #vehicleEntryModal input.bwo-garage-search {
        width: 100% !important;
        height: 48px !important;
        margin: 0 0 10px !important;
        padding: 0 14px 0 40px !important;
        border: 1px solid #e2e2e5 !important;
        border-radius: 12px !important;
        outline: 0 !important;
        display: block !important;
        -webkit-appearance: none !important; /* the native search look ignores height */
        appearance: none !important;
        background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%236B6E76' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-4-4'/%3E%3C/svg%3E") no-repeat 14px center / 18px !important;
        font: 400 16px Outfit, system-ui, sans-serif; /* 16px+ stops iOS zooming in */
        color: #1f2023;
    }
    #vehicleEntryModal input.bwo-garage-search:focus { border-color: #c81414 !important; box-shadow: none !important; }
    #vehicleEntryModal .bwo-garage-empty { margin: 4px 0 0; font-size: 13px; color: #6b6e76; }
    #vehicleEntryModal .garage-vehicle-card {
        flex-direction: row;
        align-items: center;
        gap: 8px;
        height: 68px;
        padding: 8px 10px;
        border: 1px solid #e2e2e5;
        border-radius: 12px;
        background: #fff;
        font: 400 13px Outfit, system-ui, sans-serif;
        color: #1f2023;
        text-align: left;
    }
    #vehicleEntryModal .garage-vehicle-card.selected { border-color: #c81414; color: #c81414; }
    /* Real photo of each saved vehicle (bwo_get_vehicle_model_image), small on the left. */
    #vehicleEntryModal .garage-vehicle-card .vehicle-card-img {
        flex: none;
        display: flex;
        align-items: center;
        width: 60px;
        height: 40px;
    }
    #vehicleEntryModal .garage-vehicle-card .vehicle-card-img img { width: 100%; height: 100%; object-fit: contain; }
    /* Name on up to two lines. */
    #vehicleEntryModal .garage-vehicle-card span {
        display: -webkit-box;
        min-width: 0;
        overflow: hidden;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
        line-height: 1.3;
        white-space: normal;
    }

    /* Signed out: the "save your vehicle" note as a soft panel, without its picture. */
    #vehicleEntryModal .modal-body > .vehicle-box-text {
        margin: 16px 0 0;
        padding: 14px 16px;
        border-radius: 12px;
        background: #f6f6f7;
    }
    #vehicleEntryModal .vehicle-box-text > div { width: 100%; padding: 0; }
    /* The garage picture (as on desktop) as a short banner on top of the note. */
    #vehicleEntryModal .modal-body > .vehicle-box-text { display: flex; flex-direction: column; gap: 12px; }
    #vehicleEntryModal .vehicle-box-text > div:last-child { order: -1; display: block; }
    #vehicleEntryModal .vehicle-box-text > div:last-child img {
        display: block;
        width: 100%;
        height: 120px;
        border-radius: 10px;
        object-fit: cover;
    }
    #vehicleEntryModal .vehicle-box-text h6 { margin: 0 0 4px; font-size: 15px; font-weight: 500; color: #1f2023; }
    #vehicleEntryModal .vehicle-box-text p,
    #vehicleEntryModal .vehicle-box-text ul { font-size: 13px; color: #6b6e76; }
    #vehicleEntryModal .vehicle-box-text ul { margin-top: 10px; padding: 10px 0 0 18px; border-top-color: #e2e2e5; }

    /* Continue: full-width, stays at the bottom while the tab scrolls. */
    #vehicleEntryModal .modal-body > .cta-btn {
        position: sticky;
        bottom: 0;
        z-index: 3;
        margin: auto -20px 0;
        padding: 14px 20px calc(22px + env(safe-area-inset-bottom, 0px));
        border: 0;
        background: #fff;
    }
    #vehicleEntryModal #btn-check-vehicle {
        height: 48px;
        padding: 0 16px;
        border: 0 !important;
        border-radius: 12px;
        background: #c81414 !important;
        color: #fff !important;
        font: 500 16px Outfit, system-ui, sans-serif;
        opacity: 1;
    }
    #vehicleEntryModal #btn-check-vehicle:hover:not(:disabled) { background: #a01010 !important; }
    #vehicleEntryModal #btn-check-vehicle:disabled,
    #vehicleEntryModal #btn-check-vehicle:disabled:hover {
        background: #efeff1 !important;
        color: #9a9da4 !important;
        opacity: 1;
    }

    /* ---------- By Tire Size (TireSearch renders into #brand-tire-wizard-container) ---------- */

    #vehicleEntryModal .modal-body[data-tab-pane="tiresize"] { padding-bottom: 22px; }
    #vehicleEntryModal #brand-tire-wizard-container .visual-tire-detail {
        padding: 0;
        border-radius: 0;
        background: transparent;
        box-shadow: none;
    }
    /* Size readout first (soft panel), then the step label. */
    #vehicleEntryModal #brand-tire-wizard-container .tire-header {
        display: flex;
        flex-direction: column-reverse;
        align-items: stretch;
        gap: 16px;
        margin: 0 0 8px;
        padding: 0;
    }
    #vehicleEntryModal #brand-tire-wizard-container .tire-header h5 {
        margin: 0;
        font-family: inherit;
        font-size: 13px;
        font-weight: 400;
        color: #6b6e76;
    }
    #vehicleEntryModal #brand-tire-wizard-container .tire-dimensions {
        display: flex;
        align-items: baseline;
        justify-content: center;
        gap: 6px;
        padding: 16px;
        border-radius: 16px;
        background: #f6f6f7;
        box-shadow: none;
        font: 500 22px Outfit, system-ui, sans-serif;
        color: #b9bbc1;
    }
    #vehicleEntryModal #brand-tire-wizard-container .tire-dimensions .dim-selected { color: #1f2023; font-size: 28px; }
    #vehicleEntryModal #brand-tire-wizard-container .tire-dimensions .dim-placeholder { color: #9a9da4; font-size: 16px; font-weight: 400; }

    #vehicleEntryModal #brand-tire-wizard-container .tire-wizard .options-grid {
        grid-template-columns: repeat(5, minmax(0, 1fr));
        gap: 6px;
        max-height: none;
        overflow: visible;
        padding: 0;
    }
    #vehicleEntryModal #brand-tire-wizard-container button.tire-size-card {
        height: 36px;
        min-height: 0;
        padding: 0 2px;
        border: 1px solid #e2e2e5;
        border-radius: 8px;
        background: #fff;
        box-shadow: none;
        transform: none;
        font: 400 15px Outfit, system-ui, sans-serif;
        color: #1f2023;
    }
    #vehicleEntryModal #brand-tire-wizard-container button.tire-size-card.selected {
        border-color: #c81414;
        color: #c81414;
        font-weight: 500;
    }
    #vehicleEntryModal #brand-tire-wizard-container .tire-wizard hr { margin: 16px 0 !important; border-top-color: #efeff1 !important; opacity: 1; }
    #vehicleEntryModal #brand-tire-wizard-container .tire-footer {
        flex-direction: column;
        gap: 10px;
        margin: 16px 0 0;
        padding: 0;
        background: transparent;
    }
    #vehicleEntryModal #brand-tire-wizard-container .tire-footer span { align-items: flex-start; font-size: 13px; line-height: 1.4; color: #6b6e76; }
    #vehicleEntryModal #brand-tire-wizard-container .tire-footer ul { gap: 12px; }
    #vehicleEntryModal #brand-tire-wizard-container .tire-footer ul li { font-size: 13px; color: #1f2023; }
    #vehicleEntryModal #brand-tire-wizard-container .circle-count { background: #c81414; }

    /* Size summary step: flat card, same red 48px button. */
    #vehicleEntryModal #tire-wizard-summary-step .visual-tire-detail {
        padding: 16px !important;
        border: 1px solid #efeff1;
        border-radius: 16px !important;
        box-shadow: none !important;
    }
    #vehicleEntryModal #btn-find-matching-tires {
        height: 48px;
        padding: 0 16px !important;
        border: 0 !important;
        border-radius: 12px !important;
        background: #c81414 !important;
        box-shadow: none !important;
        font-size: 16px !important;
    }
}
