.af-cars {
    --af-accent: #6d28d9;
    --af-text: #1f2937;
    --af-muted: #9ca3af;
    --af-border: #e5e7eb;
    --af-bg: #ffffff;
    --af-field: #f3f4f6;
    font-family: inherit;
    color: var(--af-text);
    width: 100%;
    max-width: 1340px;
    margin-left: auto;
    margin-right: auto;
    box-sizing: border-box;
}

.af-cars *,
.af-cars *::before,
.af-cars *::after {
    box-sizing: border-box;
}

.af-cars .screen-reader-text {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ===== Search bar ===== */
.af-cars .af-search {
    display: flex;
    flex-direction: column;
    width: 100%;
    margin: 0 0 28px;
    padding: 0;
    background: #fff;
    border: 1px solid var(--af-border);
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
    overflow: visible;
    position: relative;
    z-index: 5;
}

.af-cars .af-search__bar {
    display: flex;
    align-items: stretch;
    width: 100%;
    min-height: 60px;
}

.af-cars .af-search__query {
    flex: 1.4 1 180px;
    min-width: 0;
    display: flex;
    border-radius: 12px 0 0 12px;
    overflow: hidden;
}

.af-cars .af-search__query input {
    width: 100%;
    height: 60px;
    margin: 0;
    padding: 0 18px;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    outline: none;
    font-size: 15px;
    color: var(--af-text);
}

.af-cars .af-search__query input::placeholder {
    color: var(--af-muted);
}

.af-cars .af-search__filters {
    display: flex;
    flex: 2 1 360px;
    min-width: 0;
    align-items: stretch;
}

.af-cars .af-search__advanced-toggle {
    flex: 0 0 auto;
    min-width: 104px;
    height: 60px;
    margin: 0;
    padding: 0 14px;
    border: 0;
    border-left: 1px solid #e5e7eb;
    border-radius: 0 !important;
    background: #fff !important;
    background-color: #fff !important;
    color: #6b7280 !important;
    -webkit-text-fill-color: #6b7280 !important;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: none !important;
    outline: none;
}

.af-cars .af-search__advanced-toggle svg {
    width: 16px;
    height: 16px;
    flex: 0 0 auto;
    color: inherit;
    fill: currentColor;
}

.af-cars .af-search__advanced-toggle:hover,
.af-cars .af-search__advanced-toggle:focus,
.af-cars .af-search__advanced-toggle:active,
.af-cars .af-search.is-advanced-open .af-search__advanced-toggle {
    background: #fff !important;
    background-color: #fff !important;
    color: var(--af-accent) !important;
    -webkit-text-fill-color: var(--af-accent) !important;
    box-shadow: none !important;
}

.af-cars .af-search__advanced[hidden] {
    display: none !important;
}

.af-cars .af-search__advanced {
    display: grid;
    gap: 20px;
    padding: 18px 16px 20px;
    border-top: 1px solid #e5e7eb;
    background: #fff;
    border-radius: 0 0 12px 12px;
    overflow: visible;
    position: relative;
    z-index: 20;
}

.af-cars .af-search__advanced-row {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    overflow: visible;
    position: relative;
    z-index: 30;
}

.af-cars .af-search__advanced-row .af-search__select {
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    background: #fff;
    overflow: visible;
    border-left: 1px solid #e5e7eb;
    position: relative;
    z-index: 1;
}

.af-cars .af-search__advanced-row .af-search__select.is-open {
    z-index: 80;
}

.af-cars .af-search__advanced-row .af-search__select .af-search__trigger,
.af-cars .af-search__advanced-row .af-search__native {
    height: 48px;
    line-height: 48px !important;
}

.af-cars .af-search__advanced-row .af-search__menu {
    z-index: 90;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
}

.af-cars .af-search__ranges {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 18px;
    position: relative;
    z-index: 1;
}

.af-cars .af-search__range {
    display: grid;
    gap: 12px;
    padding: 12px 14px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
}

.af-cars .af-search__range-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 8px;
    font-size: 13px;
    color: #6b7280;
}

.af-cars .af-search__range-head strong {
    color: #111827;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.af-cars .af-search__range-inputs {
    position: relative;
    height: 24px;
    display: flex;
    align-items: center;
}

.af-cars .af-search__range-track {
    position: absolute;
    left: 0;
    right: 0;
    height: 4px;
    border-radius: 999px;
    background: #e5e7eb;
    pointer-events: none;
}

.af-cars .af-search__range-fill {
    position: absolute;
    top: 0;
    bottom: 0;
    border-radius: 999px;
    background: #ea580c;
}

.af-cars .af-search__range-inputs input[type="range"] {
    position: absolute;
    left: 0;
    right: 0;
    width: 100%;
    margin: 0;
    appearance: none;
    background: transparent;
    height: 24px;
    pointer-events: none;
}

.af-cars .af-search__range-inputs input[type="range"]::-webkit-slider-runnable-track {
    height: 4px;
    background: transparent;
    border: none;
}

.af-cars .af-search__range-inputs input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid #ea580c;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.18);
    pointer-events: auto;
    cursor: pointer;
    margin-top: -7px;
    position: relative;
    z-index: 2;
}

.af-cars .af-search__range-inputs input[type="range"]::-moz-range-track {
    height: 4px;
    background: transparent;
    border: none;
}

.af-cars .af-search__range-inputs input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid #ea580c;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.18);
    pointer-events: auto;
    cursor: pointer;
}

.af-cars .af-search__select {
    position: relative;
    flex: 1 1 0;
    min-width: 0;
    margin: 0;
    display: flex;
    align-items: stretch;
    border-left: 1px solid #e5e7eb;
    overflow: visible;
}

/* Kill ThemeREX / Fontello caret wrappers completely inside our form */
.af-cars .af-search .select_container,
.af-cars .af-search .select2,
.af-cars .af-search .select2-container {
    display: contents !important;
}

.af-cars .af-search .select_container::before,
.af-cars .af-search .select_container::after,
.af-cars .af-search__select::before,
.af-cars .af-search__select::after,
.af-cars .af-search__trigger::before,
.af-cars .af-search__trigger::after,
.af-cars .af-search i,
.af-cars .af-search [class*="icon-"]:not(.af-search__caret-icon) {
    content: none !important;
    display: none !important;
    background: none !important;
    width: 0 !important;
    height: 0 !important;
    font-size: 0 !important;
    visibility: hidden !important;
}

.af-cars .af-search__native,
.af-cars .af-search__native--hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
    opacity: 0 !important;
    pointer-events: none !important;
    appearance: none !important;
    -webkit-appearance: none !important;
    background: none !important;
    z-index: -1 !important;
}

.af-cars .af-search__trigger {
    width: 100%;
    height: 60px;
    margin: 0;
    padding: 0 36px 0 14px !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    color: #6b7280 !important;
    -webkit-text-fill-color: #6b7280 !important;
    font-size: 14px !important;
    font-weight: 400 !important;
    line-height: 60px !important;
    text-align: left !important;
    cursor: pointer;
    outline: none;
    position: relative;
    z-index: 2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.af-cars .af-search__caret {
    position: absolute;
    top: 50%;
    right: 14px;
    width: 10px;
    height: 6px;
    margin-top: -3px;
    color: #9ca3af;
    pointer-events: none;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
}

.af-cars .af-search__caret-icon {
    display: block !important;
    width: 10px;
    height: 6px;
}

.af-cars .af-search__menu {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: -1px;
    right: -1px;
    z-index: 50;
    margin: 0;
    padding: 6px 0;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.12);
    max-height: 260px;
    overflow: auto;
}

.af-cars .af-search__select.is-open {
    z-index: 60;
}

.af-cars .af-search__select.is-open .af-search__menu {
    display: block;
}

.af-cars .af-search__option {
    display: block;
    width: 100%;
    margin: 0;
    padding: 10px 14px;
    border: 0;
    background: transparent;
    color: #374151;
    font-size: 14px;
    font-weight: 400;
    text-align: left;
    cursor: pointer;
}

.af-cars .af-search__option:hover,
.af-cars .af-search__option.is-selected {
    background: #f3f4f6;
    color: #111827;
}

.af-cars .af-search__filters {
    visibility: visible !important;
    opacity: 1 !important;
    overflow: visible;
}

.af-cars .af-search__submit {
    width: 60px;
    min-width: 60px;
    height: 60px;
    margin: 0;
    padding: 0;
    border: 0 !important;
    border-radius: 0 12px 0 0 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer;
    line-height: 0 !important;
    box-shadow: none !important;
    outline: none;
    background: var(--af-accent) !important;
    color: #fff !important;
    flex: 0 0 60px;
    overflow: hidden;
}

.af-cars .af-search:not(.is-advanced-open) .af-search__submit {
    border-radius: 0 12px 12px 0 !important;
}

.af-cars .af-search__submit:hover {
    filter: brightness(0.95);
}

.af-cars .af-search__submit::before,
.af-cars .af-search__submit::after {
    content: none !important;
    display: none !important;
}

.af-cars .af-search__submit svg {
    display: block;
    width: 18px;
    height: 18px;
    margin: 0;
    flex: 0 0 auto;
}

/* ===== Listing cards ===== */
.af-cars-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 20px;
}

.af-cars-card {
    background: var(--af-bg);
    border: 1px solid var(--af-border);
    border-radius: 16px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.af-cars-card-image {
    position: relative;
    display: block;
    aspect-ratio: 16 / 10;
    background: #1f2937;
    overflow: hidden;
    text-decoration: none;
}

.af-cars-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.af-cars-card-image--empty {
    background: linear-gradient(160deg, #374151 0%, #1f2937 55%, #111827 100%);
}

.af-cars-no-image {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: #9ca3af;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.af-cars-no-image svg {
    width: 72px;
    height: 44px;
    opacity: 0.55;
}

.af-cars-sold,
.af-cars-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    background: #4b5563;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 999px;
    z-index: 2;
}

.af-cars-badge--sold {
    background: #dc2626;
}

.af-cars-badge--instock {
    background: #059669;
}

.af-cars-badge--pending {
    background: #d97706;
}

.af-cars-badge--detail {
    top: 16px;
    left: 16px;
}

.af-cars-card-body {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex: 1;
}

.af-cars-card-body h3 {
    margin: 0;
    font-size: 18px;
    line-height: 1.3;
}

.af-cars-card-body h3 a {
    color: inherit;
    text-decoration: none;
}

.af-cars-card-body ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 8px;
}

.af-cars-card-body li {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    font-size: 13px;
}

.af-cars-card-body li span {
    color: var(--af-muted);
}

.af-cars-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-top: auto;
    min-height: 42px;
    padding: 0 16px;
    border-radius: 10px;
    background: var(--af-accent);
    color: #fff !important;
    text-decoration: none !important;
    font-weight: 600;
}

.af-cars-message {
    padding: 16px 18px;
    border-radius: 12px;
    background: #f3f4f6;
    color: #374151;
}

/* ===== Detail ===== */
.af-cars-detail {
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    padding-top: 0;
}

.af-cars-back-wrap {
    margin: 0 0 12px;
}

.af-cars-back {
    color: var(--af-accent);
    text-decoration: none;
    font-weight: 600;
}

.af-cars-detail-layout {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 32px;
    align-items: start;
}

.af-cars-detail--no-gallery .af-cars-detail-layout {
    grid-template-columns: 1fr;
}

.af-cars-gallery {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.af-cars-gallery-main-wrap {
    display: block;
    width: 100%;
    padding: 0;
    margin: 0;
    border: 0;
    background: transparent;
    cursor: zoom-in;
    border-radius: 16px;
    overflow: hidden;
}

.af-cars-gallery-main,
.af-cars-gallery-placeholder {
    width: 100%;
    border-radius: 16px;
    display: block;
    background: #111827;
    aspect-ratio: 16 / 10;
    object-fit: cover;
}

.af-cars-gallery-placeholder {
    background: linear-gradient(160deg, #374151 0%, #1f2937 55%, #111827 100%);
    position: relative;
    overflow: hidden;
}

.af-cars-gallery-placeholder .af-cars-no-image {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: #d1d5db;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.af-cars-thumbs {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.af-cars-thumb {
    border: 2px solid transparent;
    padding: 0;
    background: transparent;
    cursor: pointer;
    border-radius: 10px;
    overflow: hidden;
    width: 84px;
    height: 62px;
}

.af-cars-thumb.is-active,
.af-cars-thumb:hover {
    border-color: var(--af-accent);
}

.af-cars-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.af-cars-detail-actions {
    margin-top: 24px;
}

.af-cars-detail-actions .af-cars-button {
    width: 100%;
    border: 0;
    cursor: pointer;
}

html.af-cars-modal-open,
html.af-cars-modal-open body {
    overflow: hidden;
}

.af-cars-modal[hidden],
.af-cars-lightbox[hidden] {
    display: none !important;
}

.af-cars-modal {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.af-cars-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
}

.af-cars-modal__dialog {
    position: relative;
    z-index: 1;
    width: min(560px, 100%);
    max-height: min(90vh, 760px);
    overflow: auto;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.28);
}

.af-cars-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 18px 20px;
    border-bottom: 1px solid var(--af-border);
}

.af-cars-modal__header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
}

.af-cars-modal__close {
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 999px;
    background: #f3f4f6;
    color: #111827;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
}

.af-cars-modal__body {
    padding: 20px;
}

.af-cars-modal__vehicle {
    margin: 0 0 16px;
    font-size: 15px;
    font-weight: 700;
    color: var(--af-text);
}

.af-cars-inquiry-form {
    display: grid;
    gap: 14px;
}

.af-cars-inquiry-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.af-cars-inquiry-form label {
    display: grid;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--af-text);
}

.af-cars-inquiry-form input,
.af-cars-inquiry-form textarea {
    width: 100%;
    margin: 0;
    padding: 11px 12px;
    border: 1px solid var(--af-border);
    border-radius: 10px;
    background: #fff;
    color: var(--af-text);
    font-size: 14px;
    font-weight: 400;
    line-height: 1.4;
}

.af-cars-inquiry-form input:focus,
.af-cars-inquiry-form textarea:focus {
    outline: 2px solid color-mix(in srgb, var(--af-accent) 35%, transparent);
    border-color: var(--af-accent);
}

.af-cars-inquiry-note {
    margin: 0;
    font-size: 12px;
    color: var(--af-muted);
    font-weight: 400;
}

.af-cars-inquiry-submit {
    width: 100%;
    border: 0;
    cursor: pointer;
}

.af-cars-inquiry-submit:disabled {
    opacity: 0.7;
    cursor: wait;
}

.af-cars-inquiry-feedback {
    margin: 0;
    font-size: 14px;
}

.af-cars-inquiry-feedback.is-success {
    color: #047857;
}

.af-cars-inquiry-feedback.is-error {
    color: #b91c1c;
}

.af-cars-lightbox {
    position: fixed;
    inset: 0;
    z-index: 100001;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(0, 0, 0, 0.88);
}

.af-cars-lightbox__img {
    max-width: min(1100px, 100%);
    max-height: 90vh;
    object-fit: contain;
    border-radius: 8px;
}

.af-cars-lightbox__close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
}

.af-cars-detail-body h2,
.af-cars-detail-title {
    font-size: 28px;
    font-weight: 700;
    margin: 0 0 8px;
    line-height: 1.25;
}

.af-cars-price {
    margin: 0 0 20px;
    font-size: 24px;
    font-weight: 700;
    color: var(--af-accent);
}

.af-cars-specs {
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
    display: grid;
    gap: 0;
    width: 100%;
}

.af-cars-specs li {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin: 0 !important;
    padding: 12px 0;
    border-bottom: 1px solid var(--af-border);
    list-style: none !important;
}

.af-cars-specs li::before,
.af-cars-specs li::after {
    content: none !important;
}

.af-cars-spec-label {
    color: var(--af-muted);
    font-weight: 500;
    flex: 0 0 auto;
}

.af-cars-spec-value {
    color: var(--af-text);
    font-weight: 700;
    text-align: right;
}

@media (max-width: 900px) {
    .af-cars .af-search__bar {
        flex-wrap: wrap;
        min-height: 0;
    }

    .af-cars .af-search__query {
        flex: 1 1 100%;
        border-radius: 12px 12px 0 0;
    }

    .af-cars .af-search__filters {
        flex: 1 1 100%;
        flex-wrap: wrap;
        border-top: 1px solid #e5e7eb;
    }

    .af-cars .af-search__bar > .af-search__filters > .af-search__select {
        flex: 1 1 50%;
        border-left: 0;
        border-bottom: 1px solid #e5e7eb;
    }

    .af-cars .af-search__bar > .af-search__filters > .af-search__select:nth-child(odd) {
        border-right: 1px solid #e5e7eb;
    }

    .af-cars .af-search__advanced-toggle,
    .af-cars .af-search__submit {
        flex: 1 1 50%;
    }

    .af-cars .af-search__advanced-row,
    .af-cars .af-search__ranges {
        grid-template-columns: 1fr 1fr;
    }

    .af-cars-detail-layout {
        grid-template-columns: 1fr;
    }

    .af-cars-inquiry-row {
        grid-template-columns: 1fr;
    }
}
