.elementor-widget-at_vehicles_finder {
    align-self: flex-start;
    /* Explicit width so the inline-size container does not collapse to its
       padding when placed in a shrink-to-fit (flex-column) Elementor container. */
    width: 100%;
}

.elementor-widget-at_vehicles_finder > .elementor-widget-container {
    width: 100%;
}

.at-vehicles-finder {
    background: #f5f5f5;
    border-radius: 8px;
    padding: 20px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow-wrap: anywhere;
    /* Stack by widget width, not viewport — fixes narrow Elementor columns on desktop */
    container-type: inline-size;
    container-name: at-vehicles-finder;
}

.at-vehicles-finder *,
.at-vehicles-finder *::before,
.at-vehicles-finder *::after {
    box-sizing: border-box;
}

.at-vehicles-finder__form {
    min-width: 0;
}

.at-vehicles-finder__title {
    font-weight: 700;
    margin-bottom: 12px;
    text-transform: uppercase;
}

.at-vehicles-finder__controls {
    --atf-gap: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: var(--atf-gap);
    align-items: flex-end;
    min-width: 0;
}

.at-vehicles-finder__control {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: flex-end;
    min-width: 0;
}

.at-vehicles-finder__field {
    display: flex;
    flex-direction: column;
    flex: 1 1 200px;
    min-width: 200px;
    gap: 6px;
}

.at-vehicles-finder__field span {
    font-size: 13px;
    font-weight: 600;
}

/* Animated collapse/expand of the Series field when no series is available. */
.at-vehicles-finder__field--series {
    overflow: hidden;
    transition:
        flex 0.35s ease,
        min-width 0.35s ease,
        max-width 0.35s ease,
        margin 0.35s ease,
        opacity 0.25s ease;
}

.at-vehicles-finder__field--series.is-collapsed {
    flex: 0 0 0 !important;
    min-width: 0 !important;
    max-width: 0 !important;
    /* Absorb the duplicate flex gap left behind by the hidden field. */
    margin-right: calc(-1 * var(--atf-gap)) !important;
    opacity: 0;
    pointer-events: none;
    /* At width 0 the label would wrap char-by-char (overflow-wrap: anywhere)
       and balloon the row height; keep it on one clipped line instead. */
    white-space: nowrap;
}

.at-vehicles-finder__field--series.is-collapsed span,
.at-vehicles-finder__field--series.is-collapsed .at-vehicles-select {
    white-space: nowrap;
    overflow-wrap: normal;
    word-break: keep-all;
}

@media (prefers-reduced-motion: reduce) {
    .at-vehicles-finder__field--series {
        transition: none;
    }
}

.at-vehicles-select {
    height: 44px;
    padding: 0 12px;
    border: 1px solid #d5d5d5;
    border-radius: 4px;
    background: #fff;
    width: 100%;
    max-width: 100%;
    min-width: 0;
}

.at-vehicles-finder__submit {
    height: 44px;
    min-width: 200px;
    flex: 1 1 200px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    margin-top: auto;
    border: 0;
    border-radius: 4px;
    padding: 0 18px;
    cursor: pointer;
    background: #111;
    color: #fff;
    font-weight: 600;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    white-space: normal;
    text-align: center;
}

.at-vehicles-finder__make-list-wrap {
    margin-top: 16px;
}

.at-vehicles-finder__make-list-title {
    font-weight: 600;
    margin-bottom: 8px;
}

.at-vehicles-finder__make-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 8px 14px;
    min-width: 0;
}

.at-vehicles-finder__make-list a {
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 999px;
    background: #fff;
    border: 1px solid #e5e5e5;
    transition: all 0.2s ease;
    max-width: 100%;
    white-space: normal;
    overflow-wrap: anywhere;
}

/* Narrow column / sidebar: same as tablet row rhythm, based on finder box width */
@container at-vehicles-finder (max-width: 1024px) {
    .at-vehicles-finder__controls,
    .at-vehicles-finder__control {
        --atf-gap: 8px;
        gap: var(--atf-gap);
    }

    .at-vehicles-finder__field,
    .at-vehicles-finder__submit {
        flex: 1 1 calc(50% - 8px);
        min-width: 0 !important;
    }
}

/* Mobile viewport OR narrow widget — beats Elementor {{WRAPPER}} field flex rules */
@container at-vehicles-finder (max-width: 767px) {
    .at-vehicles-finder__title {
        margin-bottom: 10px;
        line-height: 1.3;
    }

    .at-vehicles-finder__controls,
    .at-vehicles-finder__control {
        --atf-gap: 10px;
        flex-direction: column !important;
        align-items: stretch !important;
        gap: var(--atf-gap);
    }

    .at-vehicles-finder__field,
    .at-vehicles-finder__submit {
        flex: 1 1 100% !important;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
    }

    /* Stacked layout: collapse vertically instead of horizontally. */
    .at-vehicles-finder__field--series.is-collapsed {
        max-width: 100% !important;
        margin-right: 0 !important;
        margin-bottom: calc(-1 * var(--atf-gap)) !important;
    }

    .at-vehicles-finder__make-list-wrap {
        display: none;
    }
}

@container at-vehicles-finder (max-width: 480px) {
    .at-vehicles-finder__field span {
        font-size: 12px;
    }

    .at-vehicles-select,
    .at-vehicles-finder__submit {
        height: 42px;
    }

    .at-vehicles-finder__make-list {
        gap: 6px 8px;
    }

    .at-vehicles-finder__make-list a {
        padding: 3px 8px;
        font-size: 12px;
    }
}

@media (max-width: 1024px) {
    .at-vehicles-finder {
        padding: 16px;
    }

    .at-vehicles-finder__controls,
    .at-vehicles-finder__control {
        --atf-gap: 8px;
        gap: var(--atf-gap);
    }

    .at-vehicles-finder__field,
    .at-vehicles-finder__submit {
        flex: 1 1 calc(50% - 8px);
        min-width: 0;
    }
}

@media (max-width: 767px) {
    .at-vehicles-finder {
        padding: 14px;
        border-radius: 6px;
    }

    .at-vehicles-finder__title {
        margin-bottom: 10px;
        line-height: 1.3;
    }

    .at-vehicles-finder__controls,
    .at-vehicles-finder__control {
        --atf-gap: 10px;
        flex-direction: column !important;
        align-items: stretch !important;
        gap: var(--atf-gap);
    }

    .at-vehicles-finder__field,
    .at-vehicles-finder__submit {
        flex: 1 1 100% !important;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
    }

    /* Stacked layout: collapse vertically instead of horizontally. */
    .at-vehicles-finder__field--series.is-collapsed {
        max-width: 100% !important;
        margin-right: 0 !important;
        margin-bottom: calc(-1 * var(--atf-gap)) !important;
    }

    .at-vehicles-finder__make-list-wrap {
        display: none;
    }
}

@media (max-width: 480px) {
    .at-vehicles-finder {
        padding: 12px;
    }

    .at-vehicles-finder__field span {
        font-size: 12px;
    }

    .at-vehicles-select,
    .at-vehicles-finder__submit {
        height: 42px;
    }

    .at-vehicles-finder__make-list {
        gap: 6px 8px;
    }

    .at-vehicles-finder__make-list a {
        padding: 3px 8px;
        font-size: 12px;
    }
}
