/* Search history has two different jobs: revisit a vehicle or repeat a query.
   Keep those actions visually distinct while preserving shared search behavior. */
.stock-search-dropdown:has(.stock-search-recent-menu) {
    left: 50%;
    right: auto;
    width: min(620px, calc(100vw - 32px));
    max-height: min(620px, calc(100vh - 96px));
    padding: 0;
    overflow-x: hidden;
    overflow-y: auto;
    transform: translateX(-50%);
}

.stock-search-recent-menu {
    display: flex;
    flex-direction: column;
    background: var(--surface);
}

.stock-search-recent-section {
    min-width: 0;
    padding: 14px;
}

.stock-search-recent-searches-section {
    border-top: 1px solid var(--border);
    background: var(--surface-muted, #f7f8fa);
}

.stock-search-recent-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 0 0 10px;
}

.stock-search-recent-heading h3 {
    margin: 0;
    color: var(--text);
    font-size: 13px;
    font-weight: 750;
    letter-spacing: -0.01em;
    line-height: 1.2;
    text-transform: none;
}

.stock-search-recent-heading > span {
    color: var(--muted);
    font-size: 11px;
    font-weight: 600;
    line-height: 1.2;
}

.stock-search-recent-vehicles {
    display: flex;
    gap: 10px;
    min-width: 0;
    overflow-x: auto;
    padding: 1px 1px 7px;
    scroll-snap-type: x proximity;
    scrollbar-color: rgba(102, 112, 133, 0.35) transparent;
    scrollbar-width: thin;
}

.stock-search-recent-vehicle-card {
    flex: 0 0 260px;
    width: 260px;
    min-width: 260px;
    scroll-snap-align: start;
}

.stock-search-recent-searches {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.stock-search-recent-search {
    display: grid;
    grid-template-columns: 32px minmax(0, 1fr) 18px;
    gap: 10px;
    align-items: center;
    min-height: 48px;
    padding: 6px 8px;
    border-radius: var(--radius-sm);
    color: var(--text);
    cursor: pointer;
    transition: background var(--duration-fast) var(--ease-snappy);
}

.stock-search-recent-search:hover,
.stock-search-recent-search:focus-visible {
    background: var(--surface);
    outline: none;
}

.stock-search-recent-search-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: var(--surface);
    color: var(--muted);
}

.stock-search-recent-search-icon svg,
.stock-search-recent-search-arrow {
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.stock-search-recent-search-icon svg {
    width: 17px;
    height: 17px;
}

.stock-search-recent-search-main {
    display: flex;
    flex-direction: column;
    min-width: 0;
    gap: 1px;
}

.stock-search-recent-search-title,
.stock-search-recent-search-meta {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.stock-search-recent-search-title {
    color: var(--text);
    font-size: 13px;
    font-weight: 650;
    line-height: 1.25;
}

.stock-search-recent-search-meta {
    color: var(--muted);
    font-size: 10px;
    font-weight: 500;
    line-height: 1.2;
}

.stock-search-recent-search-arrow {
    width: 17px;
    height: 17px;
    color: var(--muted);
}

@media (max-width: 900px) {
    .stock-search-dropdown:has(.stock-search-recent-menu) {
        left: 0;
        right: 0;
        width: 100%;
        max-height: min(68vh, 560px);
        transform: none;
    }

    .stock-search-recent-section {
        padding: 12px;
    }

    .stock-search-recent-vehicle-card {
        flex-basis: 100%;
        width: 100%;
        min-width: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    .stock-search-recent-vehicle-card {
        transition: none;
    }

    .stock-search-recent-vehicle-card:hover {
        transform: none;
    }
}
