/**
 * Showroom listing page styles (plan §1, §2). Card, CTA-button, title-banner,
 * breadcrumb, and modal styles live in vehicle-shared.css since the card
 * partial and modal are reused on the vehicle detail page too.
 *
 * Every colour/font value below is a var(--...) reference into the custom
 * properties printed by inc/theme-config.php — no hex code, rgb() value, or
 * font-family string appears anywhere in this file. To rebrand, edit
 * inc/theme-config.php only.
 */

/* ---------------------------------------------------------------------
 * Results header (count + desktop sort)
 * ------------------------------------------------------------------- */

.vehicle-results-header {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 1.5rem 0 1rem;
}

@media (min-width: 480px) {
    .vehicle-results-header {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }
}

.vehicle-results-count {
    margin: 0;
    font-size: var(--text-base);
}

.vehicle-results-sort-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.vehicle-results-sort-label {
    color: var(--color-black);
    font-size: var(--text-sm);
    font-weight: 500;
}

.vehicle-results-sort {
    font-family: var(--font-family-base);
    font-size: var(--text-sm);
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--color-black);
    border-radius: var(--radius-input);
    background: var(--color-white);
    color: var(--color-black);
}

/* ---------------------------------------------------------------------
 * Card grid + empty/loading states (§1.2, §1.5)
 * ------------------------------------------------------------------- */

.vehicle-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-grid-gap-lg);
    transition: opacity 0.15s ease;
}

@media (min-width: 640px) {
    .vehicle-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .vehicle-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.vehicle-grid.is-loading {
    opacity: 0.5;
    pointer-events: none;
}

.vehicle-grid-empty {
    text-align: center;
    padding: 3rem 0;
    font-size: var(--text-lg);
}

.vehicle-grid-sentinel {
    height: 1px;
}

.vehicle-grid-spinner {
    width: 2rem;
    height: 2rem;
    margin: 1.5rem auto;
    border: 3px solid var(--color-grey-off);
    border-top-color: var(--color-accent);
    border-radius: var(--radius-full);
    animation: vehicle-spin 0.7s linear infinite;
}

@keyframes vehicle-spin {
    to {
        transform: rotate(360deg);
    }
}

/* ---------------------------------------------------------------------
 * Two-column layout: filter sidebar + main content
 *
 * Deliberate deviation from plan §2.8's sticky top bar, per explicit
 * direction — the filter is a sidebar card beside the grid on desktop
 * instead of a bar that sticks to the top of the viewport on scroll.
 * ------------------------------------------------------------------- */

.vehicle-layout {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    padding-top: 1.5rem;
    padding-bottom: 3rem;
    align-items: flex-start;
}

@media (min-width: 1024px) {
    .vehicle-layout {
        flex-direction: row;
        gap: 2rem;
    }
}

.vehicle-main {
    flex: 1;
    min-width: 0;
    width: 100%;
}

/* ---------------------------------------------------------------------
 * Filter sidebar (§2)
 * ------------------------------------------------------------------- */

.filter-sidebar {
    width: 100%;
}

@media (min-width: 1024px) {
    .filter-sidebar {
        width: 17rem;
        flex-shrink: 0;
        /* Deliberately not position: sticky — that collided with the site's
           own sticky header in a way that proved too fragile to fix blind
           on this specific site. Scrolls normally with the page instead. */
    }
}

.filter-sidebar__toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    background: var(--color-white);
    color: var(--color-accent);
    border: 1px solid var(--color-accent);
    border-radius: var(--radius-md);
    padding: 0.75rem;
    font-family: var(--font-family-base);
    font-weight: 500;
    cursor: pointer;
}

@media (min-width: 1024px) {
    .filter-sidebar__toggle {
        display: none;
    }
}

.filter-sidebar__badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.25rem;
    height: 1.25rem;
    padding: 0 0.35rem;
    border-radius: var(--radius-full);
    background: var(--color-accent);
    color: var(--color-white);
    font-size: var(--text-xs);
}

.filter-sidebar__badge[hidden],
.filter-sidebar__clear[hidden] {
    display: none;
}

.filter-sidebar__panel {
    display: none;
    background: var(--color-black);
    color: var(--color-white);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    margin-top: 0.75rem;
}

.filter-sidebar__panel.is-open {
    display: block;
}

@media (min-width: 1024px) {
    .filter-sidebar__panel {
        display: block;
        margin-top: 0;
    }
}

.filter-sidebar__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

.filter-sidebar__title {
    margin: 0;
    font-size: var(--text-lg);
    color: var(--color-white);
}

.filter-sidebar__clear {
    background: none;
    border: none;
    color: var(--color-white);
    text-decoration: underline;
    cursor: pointer;
    font-size: var(--text-sm);
}

.filter-sidebar__facets {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.filter-sidebar__apply {
    font-family: var(--font-family-base);
    font-size: var(--text-sm);
    padding: 0.6rem 1rem;
    border-radius: var(--radius-input);
    border: 1px solid var(--color-accent);
    background: var(--color-accent);
    color: var(--color-white);
    margin-top: 1rem;
    width: 100%;
    cursor: pointer;
}

/* Each facet is its own white boxed dropdown sitting inside the dark
   sidebar card — a rounded white box with a dropdown-style chevron that
   expands into a white checkbox list, rather than blending into the dark
   sidebar background. */
.filter-facet {
    background: var(--color-white);
    border-radius: var(--radius-input);
    overflow: hidden;
}

.filter-facet__summary {
    list-style: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--color-black);
}

.filter-facet__summary::-webkit-details-marker {
    display: none;
}

/* Dropdown arrow: a CSS chevron, pointing down at rest, flipped to point up
   while the facet is expanded. */
.filter-facet__summary::after {
    content: '';
    flex-shrink: 0;
    width: 0.45rem;
    height: 0.45rem;
    border-right: 2px solid var(--color-black);
    border-bottom: 2px solid var(--color-black);
    transform: rotate(45deg);
    transition: transform 0.2s ease;
}

.filter-facet[open] > .filter-facet__summary::after {
    transform: rotate(-135deg);
}

.filter-facet__panel {
    padding: 0 1rem 1rem;
    max-height: 16rem;
    overflow-y: auto;
    background: var(--color-white);
}

.facet-tree__label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0;
    font-size: var(--text-sm);
    color: var(--color-black);
    cursor: pointer;
}

.facet-tree__count {
    color: color-mix(in srgb, var(--color-black) 40%, transparent);
    font-size: var(--text-xs);
}

/* Make/Model/Variant tree: no indentation — each level's checkbox sits at
   the same left edge as its parent. A small dropdown arrow (not a boxed
   dropdown) sits at the end of its row; clicking it reveals that make's
   models (or that model's variants) as a plain, unindented block below —
   label always comes before its toggle/content in the markup, so nothing
   reorders or jumps when expanded. Controlled by assets/js/vehicle-filter.js
   toggling [hidden]; with no JS, nothing here is hidden to begin with, so
   every make/model/variant is simply always visible (degrades to "shows
   everything" rather than "hides something the visitor can't reach"). */
.facet-tree__row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.4rem;
}

.facet-tree__row .facet-tree__label {
    flex: 1;
    min-width: 0;
}

.facet-tree__nested-toggle {
    flex-shrink: 0;
    display: block;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem 0.2rem;
}

.facet-tree__nested-toggle::after {
    content: '';
    display: block;
    width: 0.4rem;
    height: 0.4rem;
    border-right: 2px solid var(--color-black);
    border-bottom: 2px solid var(--color-black);
    transform: rotate(45deg);
    transition: transform 0.2s ease;
}

.facet-tree__nested-toggle[aria-expanded="true"]::after {
    transform: rotate(-135deg);
}

.facet-tree__nested-content {
    padding-top: 0.15rem;
}

.facet-tree__nested-content[hidden] {
    display: none;
}
