/* =================================================================
   TMCARS · Listing Page
   Sleek dark-navy design system
   ================================================================= */

/* (All design tokens are defined in base.html's :root) */

/* ── Layout Shell ──────────────────────────────────────────────── */
.layout {
    display: flex;
    min-height: calc(100vh - var(--header-h));
}


/* ── Sidebar ═════════════════════════════════════════════════════ */
.sidebar {
    width: var(--sidebar-w);
    min-width: var(--sidebar-w);
    background: var(--surface-1);
    border-right: 1px solid var(--border);
    padding: 20px 16px 0 16px;
    position: sticky;
    top: var(--header-h);
    height: calc(100vh - var(--header-h));
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--surface-3) transparent;
}

.filter-actions {
    position: sticky;
    bottom: 0;
    background: var(--surface-1);
    padding: 16px 0 20px 0;
    margin-top: 16px;
    border-top: 1px solid var(--border-dim);
    z-index: 10;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

/* Section headings */
.filter-heading {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--accent);
    margin: 0 0 10px;
    padding: 0;
    line-height: 1;
}

.filter-section {
    padding: 14px 0;
    border-bottom: 1px solid var(--border-dim);
}
.filter-section:first-child { padding-top: 0; }
.filter-section:last-of-type { border-bottom: none; }

/* Collapsible sections (Model filter) */
.filter-section.collapsible .filter-heading {
    display: flex;
    align-items: center;
    gap: 6px;
}
.collapse-toggle {
    background: none;
    border: none;
    color: var(--accent);
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    transition: transform var(--fast) ease;
}
.collapse-toggle[aria-expanded="false"] svg {
    transform: rotate(-90deg);
}
.collapsible-content {
    overflow: hidden;
    transition: max-height 0.3s ease;
}
.filter-section.is-collapsed .collapsible-content {
    max-height: 0;
    opacity: 0;
}
.filter-section.is-expanded .collapsible-content {
    max-height: 500px; /* ample space */
    opacity: 1;
}

/* Checkbox lists (reuse brand-list styles) */
.checkbox-list {
    /* Let the inline style set max-height/overflow based on item count */
}
.checkbox-list .brand-item {
    padding: 4px 6px;
}


/* ── Sidebar: Brand Search & List ──────────────────────────────── */
.brand-search,
.model-search {
    width: 100%;
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text-1);
    padding: 7px 12px;
    border-radius: var(--r-m);
    font-size: 0.82rem;
    font-family: var(--font);
    margin-bottom: 8px;
    transition: border-color var(--fast) ease;
}
.brand-search:focus,
.model-search:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-dim);
}
.brand-search::placeholder,
.model-search::placeholder {
    color: var(--text-3);
}

/* Wrapper for search inputs in filter sections */
.filter-search-wrapper {
    margin-bottom: 8px;
}

.brand-list {
    max-height: 232px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--surface-3) transparent;
    margin: 0 -4px;
    padding: 0 4px;
}
.brand-list::-webkit-scrollbar { width: 4px; }
.brand-list::-webkit-scrollbar-thumb {
    background: var(--surface-3);
    border-radius: var(--r-full);
}

.brand-item {
    display: flex;
    align-items: center;
    border-radius: var(--r-s);
    transition: background var(--fast) ease;
}
.brand-item:hover { background: var(--surface-2); }

.brand-item label {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 4px 6px;
    margin: 0;
    cursor: pointer;
    font-size: 0.82rem;
    color: var(--text-1);
    line-height: 1.3;
}

.brand-item input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 15px;
    height: 15px;
    border: 1.5px solid var(--border-strong);
    border-radius: var(--r-xs);
    background: var(--surface-2);
    flex-shrink: 0;
    cursor: pointer;
    position: relative;
    transition: all var(--fast) ease;
}
.brand-item input[type="checkbox"]:checked {
    background: var(--accent);
    border-color: var(--accent);
}
.brand-item input[type="checkbox"]:checked::after {
    content: '';
    position: absolute;
    top: 1px;
    left: 4px;
    width: 4px;
    height: 8px;
    border: solid var(--surface-0);
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.brand-count {
    margin-left: auto;
    font-size: 0.72rem;
    color: var(--text-3);
    font-variant-numeric: tabular-nums;
}

.brand-empty {
    padding: 8px 6px;
    font-size: 0.8rem;
    color: var(--text-3);
    font-style: italic;
}


/* ── Sidebar: Selects ──────────────────────────────────────────── */
.filter-select {
    width: 100%;
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text-1);
    padding: 7px 12px;
    border-radius: var(--r-m);
    font-size: 0.82rem;
    font-family: var(--font);
    margin-bottom: 6px;
    cursor: pointer;
    transition: border-color var(--fast) ease;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%235a6f82' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 30px;
}
.filter-select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-dim);
}
.filter-select option {
    background: var(--surface-2);
    color: var(--text-1);
}


/* ── Sidebar: Range Inputs ─────────────────────────────────────── */
.range-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.range-input {
    flex: 1;
    min-width: 0;
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text-1);
    padding: 7px 10px;
    border-radius: var(--r-m);
    font-size: 0.82rem;
    font-family: var(--font);
    transition: border-color var(--fast) ease;
    /* hide spin buttons */
    -moz-appearance: textfield;
}
.range-input::-webkit-outer-spin-button,
.range-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.range-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-dim);
}
.range-input::placeholder { color: var(--text-3); }

.range-sep {
    color: var(--text-3);
    font-size: 0.75rem;
    flex-shrink: 0;
}


/* ── Sidebar: Date Preset Pills ────────────────────────────────── */
.preset-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    align-items: center;
}

.preset-sep {
    color: var(--text-3);
    font-size: 0.8rem;
    user-select: none;
}

.preset-btn {
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text-2);
    padding: 6px 12px;
    border-radius: var(--r-full);
    font-size: 0.74rem;
    font-family: var(--font);
    cursor: pointer;
    transition: all var(--fast) ease;
    white-space: nowrap;
    line-height: 1.4;
}
.preset-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-dim);
}
.preset-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--surface-0);
    font-weight: 600;
}

/* Hourly presets (hot deals) — more prominent */
.preset-hours {
    margin-bottom: 6px;
}
.preset-hours .preset-btn {
    background: var(--accent-dim);
    border-color: var(--accent);
    color: var(--accent);
    padding: 6px 10px;
    font-weight: 500;
}
.preset-hours .preset-btn:hover {
    background: var(--accent);
    color: var(--surface-0);
}
.preset-hours .preset-btn.active {
    background: var(--accent);
    color: var(--surface-0);
}

/* Daily presets (collapsed by default) */
.preset-details {
    margin: 4px 0 0;
    font-size: 0.72rem;
}
.preset-details summary {
    cursor: pointer;
    color: var(--text-3);
    user-select: none;
    padding: 2px 0;
    list-style: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.preset-details summary::after {
    content: '▶';
    font-size: 0.6rem;
    transition: transform var(--fast) ease;
}
.preset-details[open] summary::after {
    transform: rotate(90deg);
}
.preset-details summary:hover {
    color: var(--text-2);
}
.preset-details .preset-buttons {
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid var(--border-dim);
}
.preset-details .preset-btn {
    font-size: 0.7rem;
    padding: 4px 10px;
}


.custom-days {
    width: 60px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text-1);
    padding: 5px 8px;
    border-radius: var(--r-m);
    font-size: 0.8rem;
    font-family: var(--font);
    text-align: center;
    -moz-appearance: textfield;
}
.custom-days::-webkit-outer-spin-button,
.custom-days::-webkit-inner-spin-button { -webkit-appearance: none; }
.custom-days:focus {
    outline: none;
    border-color: var(--accent);
}

.btn-small {
    padding: 5px 12px;
    font-size: 0.76rem;
    border-radius: var(--r-s);
    flex-shrink: 0;
}


/* ── Sidebar: Action Buttons ───────────────────────────────────── */
.filter-actions {
    display: flex;
    gap: 8px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border-dim);
}

.btn-apply {
    flex: 1;
    background: var(--accent);
    color: var(--surface-0);
    border: none;
    padding: 9px 16px;
    border-radius: var(--r-m);
    font-weight: 600;
    font-size: 0.84rem;
    font-family: var(--font);
    cursor: pointer;
    transition: all var(--fast) ease;
}
.btn-apply:hover {
    background: var(--accent-bright);
    box-shadow: var(--shadow-glow);
}

.btn-clear {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    color: var(--text-2);
    border: 1px solid var(--border);
    padding: 9px 16px;
    border-radius: var(--r-m);
    font-size: 0.84rem;
    font-family: var(--font);
    cursor: pointer;
    text-decoration: none;
    transition: all var(--fast) ease;
}
.btn-clear:hover {
    border-color: var(--red);
    color: var(--red);
    background: var(--red-dim);
}


/* ── Main Content ──────────────────────────────────────────────── */
.main-content {
    flex: 1;
    min-width: 0;
    padding: 20px 24px;
}


/* ── Results Header ────────────────────────────────────────────── */
.results-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-dim);
}

.results-count {
    font-size: 0.92rem;
    color: var(--text-2);
}
.results-count strong {
    color: var(--accent-bright);
    font-variant-numeric: tabular-nums;
}

.results-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

.sort-select {
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text-1);
    padding: 7px 32px 7px 12px;
    border-radius: var(--r-m);
    font-size: 0.82rem;
    font-family: var(--font);
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%235a6f82' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    transition: border-color var(--fast) ease;
}
.sort-select:focus {
    outline: none;
    border-color: var(--accent);
}

.export-buttons {
    display: flex;
    gap: 4px;
}

.export-btn {
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text-3);
    padding: 6px 12px;
    border-radius: var(--r-s);
    font-size: 0.72rem;
    font-weight: 600;
    font-family: var(--font);
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    cursor: pointer;
    transition: all var(--fast) ease;
}
.export-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-dim);
}


/* ── Car Grid ──────────────────────────────────────────────────── */
.car-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}


/* ── Car Card ──────────────────────────────────────────────────── */
.car-card {
    background: var(--surface-1);
    border: 1px solid var(--border);
    border-radius: var(--r-l);
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    position: relative;
    transition:
        transform var(--normal) var(--ease),
        border-color var(--normal) ease,
        box-shadow var(--normal) ease;
    cursor: pointer; /* indicate clickable */

    /* stagger entrance */
    opacity: 0;
    transform: translateY(16px);
    animation: card-enter var(--slow) var(--ease) forwards;
}

.car-card:focus {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}
.car-card:hover {
    transform: translateY(-6px);
    border-color: var(--accent-glow);
    box-shadow: var(--shadow-l), var(--shadow-glow);
}

@keyframes card-enter {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Respect reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
    .car-card {
        opacity: 1;
        transform: none;
        animation: none;
    }
}

/* Image wrapper */
.card-image {
    position: relative;
    height: var(--card-img-h);
    background: var(--surface-2);
    overflow: hidden;
}

.card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform var(--slow) var(--ease);
}
.car-card:hover .card-image img {
    transform: scale(1.04);
}

/* Placeholder when no thumbnails stored */
.no-image-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: var(--text-muted);
    background: var(--surface-2);
}
.no-image-placeholder svg {
    opacity: 0.4;
    stroke-width: 1.5;
}
.no-image-placeholder span {
    font-size: 0.75rem;
    opacity: 0.7;
}

/* Gradient overlay on image bottom for depth */
.card-image::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 50%;
    background: linear-gradient(to top, var(--surface-1) 0%, transparent 100%);
    opacity: 0.5;
    pointer-events: none;
}

/* Image placeholder when src fails */
.card-image.no-image img { display: none; }
.card-image.no-image {
    display: flex;
    align-items: center;
    justify-content: center;
}
.card-image.no-image::after {
    display: none;
}
.card-image.no-image::before {
    content: '';
    width: 48px;
    height: 48px;
    background: var(--surface-3);
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='currentColor'%3E%3Cpath d='M18.92 6.01C18.72 5.42 18.16 5 17.5 5h-11c-.66 0-1.21.42-1.42 1.01L3 12v8c0 .55.45 1 1 1h1c.55 0 1-.45 1-1v-1h12v1c0 .55.45 1 1 1h1c.55 0 1-.45 1-1v-8l-2.08-5.99zM6.5 16c-.83 0-1.5-.67-1.5-1.5S5.67 13 6.5 13s1.5.67 1.5 1.5S7.33 16 6.5 16zm11 0c-.83 0-1.5-.67-1.5-1.5s.67-1.5 1.5-1.5 1.5.67 1.5 1.5-.67 1.5-1.5 1.5zM5 11l1.5-4.5h11L19 11H5z'/%3E%3C/svg%3E") center / contain no-repeat;
    opacity: 0.25;
}

/* Badges on image */
.card-badge {
    position: absolute;
    z-index: 2;
    padding: 3px 10px;
    border-radius: var(--r-full);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.badge-fresh {
    bottom: 10px;
    left: 10px;
    background: rgba(52, 211, 153, 0.85);
    color: #052e16;
}


.badge-deal {
    bottom: 10px;
    left: 10px;
    background: rgba(79, 195, 247, 0.9);
    color: #052e16;
    font-size: 0.7rem;
}

.badge-gallery {
    bottom: 10px;
    right: 10px;
    background: rgba(100, 100, 100, 0.85);
    color: #fff;
    font-size: 0.7rem;
}

/* Card image navigation arrows (desktop only) */
.card-nav {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 40%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.9);
    font-size: 32px; /* for arrow glyphs */
    cursor: pointer;
    z-index: 3;
    opacity: 0;
    transition: opacity var(--fast) ease, background var(--fast) ease;
    padding: 0;
}
.card-nav:hover {
    opacity: 1 !important;
    background: rgba(0, 0, 0, 0.15);
}
.card-nav-prev {
    left: 0;
    border-radius: 0 4px 4px 0;
    justify-content: flex-start;
    padding-left: 8px;
}
.card-nav-next {
    right: 0;
    border-radius: 4px 0 0 4px;
    justify-content: flex-end;
    padding-right: 8px;
}
.card-nav::before {
    content: '';
    display: block;
    width: auto;
    height: auto;
    border: none;
}
.card-nav-prev::before {
    content: '‹';
    font-family: Arial, Helvetica, sans-serif;
    font-weight: bold;
}
.card-nav-next::before {
    content: '›';
    font-family: Arial, Helvetica, sans-serif;
    font-weight: bold;
}
.card-image:hover .card-nav {
    opacity: 0.5;
}
.card-nav:hover {
    opacity: 1 !important;
}

/* View larger button (magnifier) */
.view-larger-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.6);
    border: none;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    z-index: 4;
    opacity: 0;
    transition: opacity var(--fast) ease, background var(--fast) ease;
    padding: 0;
}
.card-image:hover .view-larger-btn {
    opacity: 1;
}
.view-larger-btn:hover {
    opacity: 1 !important;
    background: rgba(0, 0, 0, 0.8);
}

/* Card image carousel */
.card-image-carousel {
    position: relative;
    width: 100%;
    height: 100%;
}
.card-image-carousel img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 1;
    transition: opacity 0.15s ease;
}

/* Loading shimmer while image loads */
.card-image-carousel img.img-loading {
    opacity: 0.5;
}

/* Error state: dim and show icon via parent */
.card-image-carousel img.img-error {
    opacity: 0.15;
}

/* Shimmer background visible behind loading/error images */
.card-image-carousel::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 0;
    background: var(--surface-2);
    background-image: linear-gradient(
        90deg,
        var(--surface-2) 0%,
        var(--surface-3) 40%,
        var(--surface-2) 80%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Dot indicators for photo position */
.card-dots {
    position: absolute;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 5px;
    z-index: 5;
    pointer-events: none;
}
.card-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.4);
    transition: background var(--fast) ease, transform var(--fast) ease;
}
.card-dot.active {
    background: #fff;
    transform: scale(1.3);
}

/* Mobile: hide hover arrows, show view-larger, enable swipe */
@media (max-width: 768px) {
    .card-nav {
        display: none;
    }
    /* Make view-larger and gallery badge always visible on mobile */
    .view-larger-btn {
        opacity: 1;
        width: 36px;
        height: 36px;
        font-size: 18px;
        top: 10px;
        right: 10px;
        left: auto;
        transform: none;
    }
    .badge-gallery {
        cursor: pointer;
    }
}


/* Card body */
.card-body {
    padding: 14px 14px 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
}

.card-title {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-1);
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin: 0;
}

.card-price-row {
    display: flex;
    align-items: baseline;
    gap: 8px;
    flex-wrap: wrap;
}

.price-primary {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-1);
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.01em;
}

.price-secondary {
    font-size: 0.78rem;
    color: var(--text-3);
    font-variant-numeric: tabular-nums;
}

/* ── Discount Badge (Hero Deal Signal) ───────────────────────────── */
.discount-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    /* Background gets brighter green based on how good the deal is */
    background: rgba(52, 211, 153, calc(0.1 + var(--score-opacity, 0.4)));
    color: var(--green);
    padding: 4px 10px;
    border-radius: var(--r-full);
    font-size: 0.88rem;
    font-weight: 700;
    margin-bottom: 6px;
    width: fit-content;
    border: 1px solid rgba(52, 211, 153, calc(0.2 + var(--score-opacity, 0.4) * 0.8));
    animation: badge-pulse 2s ease-out;
}

@keyframes badge-pulse {
    0% { transform: scale(0.95); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

.discount-arrow {
    font-size: 0.9rem;
    font-weight: 800;
}

.discount-pct {
    font-variant-numeric: tabular-nums;
}

.discount-context {
    font-size: 0.76rem;
    font-weight: 500;
    opacity: 0.85;
    white-space: nowrap;
}

/* Motivation fire emoji for recent price drops */
.motivation-fire {
    color: var(--amber);
    font-size: 0.75rem;
    animation: fire-flicker 1.5s infinite alternate;
}

@keyframes fire-flicker {
    from { opacity: 0.7; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1.05); }
}

/* Separator inside badges */
.discount-badge .sep {
    opacity: 0.4;
    font-size: 0.8rem;
}


/* Average / Median comparison (deprecated — replaced by discount-badge) */
.card-avg {
    display: none; /* Remove old median line */
}

/* Meta line (city, year) */
.card-meta {
    font-size: 0.78rem;
    color: var(--text-2);
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.card-meta .sep {
    color: var(--text-3);
    font-size: 0.5rem;
}

/* Feature badges */
.card-features {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    margin-left: auto;
}

.feat-badge {
    display: inline-flex;
    padding: 1px 7px;
    border-radius: var(--r-full);
    font-size: 0.64rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.feat-credit {
    background: var(--accent-dim);
    color: var(--accent);
    border: 1px solid rgba(79, 195, 247, 0.2);
}

.feat-exchange {
    background: var(--amber-dim);
    color: var(--amber);
    border: 1px solid rgba(251, 191, 36, 0.2);
}


/* ── Deal Score Bar ────────────────────────────────────────────── */
/* Hidden: Discount badge is the hero. Score bar is redundant.
   Uncomment if you want both.
*/
.score-row {
    display: none; /* remove to show score bar again */
}

/*
.score-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: auto;
    padding-top: 6px;
}

.score-label {
    font-size: 0.7rem;
    color: var(--text-3);
    white-space: nowrap;
    min-width: 40px;
}

.score-track {
    flex: 1;
    height: 5px;
    background: var(--surface-3);
    border-radius: var(--r-full);
    overflow: hidden;
    position: relative;
}

.score-fill {
    height: 100%;
    border-radius: var(--r-full);
    width: 0;
    animation: score-grow var(--slow) var(--ease) forwards;
    animation-delay: calc(var(--delay, 0) + 0.3s);
    --hue: calc(var(--score, 0) * 1.2);
    background: linear-gradient(
        90deg,
        hsl(var(--hue), 75%, 50%),
        hsl(calc(var(--hue) + 20), 75%, 60%)
    );
}

@keyframes score-grow {
    to { width: calc(var(--score, 0) * 1%); }
}

.score-pct {
    font-size: 0.7rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    min-width: 28px;
    text-align: right;
    color: var(--text-2);
}
*/


/* ── Tooltip (desktop only) ────────────────────────────────────── */
.tooltip-card {
    display: none;
    position: fixed;
    z-index: 9000;
    background: var(--surface-2);
    border: 1px solid var(--border-strong);
    border-radius: var(--r-l);
    padding: 14px 18px;
    min-width: 210px;
    max-width: 290px;
    box-shadow: var(--shadow-l);
    pointer-events: none;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.tooltip-card .tt-row {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 3px 0;
    font-size: 0.82rem;
}

.tooltip-card .tt-label { color: var(--text-3); }
.tooltip-card .tt-value {
    color: var(--text-1);
    font-weight: 500;
    text-align: right;
}

.tooltip-card .tt-divider {
    border: none;
    border-top: 1px solid var(--border-dim);
    margin: 6px 0;
}

.tooltip-card .tt-notes {
    line-height: 1.4;
}


/* ── Empty State ───────────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 80px 24px;
}
.empty-state-icon {
    font-size: 3rem;
    margin-bottom: 16px;
    opacity: 0.3;
}
.empty-state p {
    color: var(--text-3);
    font-size: 1.05rem;
    margin-bottom: 12px;
}
.empty-state a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
}
.empty-state a:hover { text-decoration: underline; }


/* ── Mobile Filter FAB ─────────────────────────────────────────── */
.mobile-fab {
    display: none;
    position: fixed;
    bottom: 24px;
    left: 24px;
    z-index: 8000;
    background: var(--accent);
    color: var(--surface-0);
    border: none;
    border-radius: 50%;
    width: 56px;
    height: 56px;
    font-size: 1.4rem;
    cursor: pointer;
    box-shadow: var(--shadow-l), var(--shadow-glow);
    transition: transform var(--fast) ease, box-shadow var(--fast) ease;
}
.mobile-fab:hover {
    transform: scale(1.08);
}
.mobile-fab:active {
    transform: scale(0.95);
}

/* Sidebar close button (mobile only) */
.sidebar-close-btn {
    display: none;
    position: absolute;
    top: 12px;
    right: 12px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text-2);
    border-radius: var(--r-m);
    width: 32px;
    height: 32px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    transition: all var(--fast) ease;
    z-index: 1;
}
.sidebar-close-btn:hover {
    border-color: var(--red);
    color: var(--red);
    background: var(--red-dim);
}

.sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 7999;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity var(--normal) ease, visibility 0s linear var(--normal);
}
.sidebar-backdrop.open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transition: opacity var(--normal) ease, visibility 0s linear 0s;
}


/* ── Responsive ────────────────────────────────────────────────── */
@media (max-width: 1280px) {
    .car-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 900px) {
    .car-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
    :root { --card-img-h: 160px; }
}

@media (max-width: 768px) {
    /* Sidebar becomes a drawer */
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        width: 300px;
        min-width: 300px;
        height: 100dvh;
        z-index: 8000;
        transform: translateX(-100%);
        transition: transform var(--normal) var(--ease);
        border-right: 1px solid var(--border-strong);
        padding-top: 24px;
        overscroll-behavior: contain;
    }
    .sidebar.open {
        transform: translateX(0);
    }

    .mobile-fab { display: flex; align-items: center; justify-content: center; }
    .sidebar-close-btn { display: flex; align-items: center; justify-content: center; }

    /* Two-column grid on wider phones, single on narrow */
    .car-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    :root {
        --card-img-h: 140px;
    }

    .main-content {
        padding: 12px 10px;
        padding-bottom: 90px; /* space for mobile bottom bar */
    }

    .results-header {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
        margin-bottom: 12px;
        padding-bottom: 10px;
    }
    .results-actions {
        justify-content: space-between;
    }

    /* Hide desktop-only elements on mobile */
    .view-larger-btn { display: none; }
    .export-buttons { display: none; }
    .tooltip-card { display: none !important; }
    #sortSelect { display: none; } /* replaced by mobile bottom bar sort */

    /* Compact card on mobile */
    .card-body {
        padding: 10px 10px 8px;
        gap: 4px;
    }
    .card-title {
        font-size: 0.78rem;
        line-height: 1.25;
    }
    .price-main-row {
        margin: 4px 0 2px;
        gap: 6px;
    }
    .price-primary {
        font-size: 1.1rem;
        font-weight: 800;
    }
    .price-secondary {
        font-size: 0.72rem;
    }
    .specs-chips {
        gap: 4px;
        margin-top: 4px;
    }
    .specs-chips .chip {
        padding: 2px 6px;
        font-size: 0.64rem;
    }
    .card-footer {
        margin-top: 4px;
        font-size: 0.68rem;
        gap: 4px;
    }
    .value-context {
        font-size: 0.68rem;
        line-height: 1.3;
    }

    /* Compact badges on mobile */
    .card-badge {
        padding: 2px 7px;
        font-size: 0.6rem;
    }
    .card-badge.discount-badge {
        padding: 3px 8px;
        font-size: 0.65rem;
    }
    .card-badge.badge-gallery {
        font-size: 0.6rem;
        padding: 2px 6px;
    }
    .card-badge.badge-suspicious {
        padding: 3px 8px;
        font-size: 0.62rem;
    }
    .card-badge.badge-rare {
        padding: 3px 8px;
        font-size: 0.65rem;
    }

    /* Disable hover transform on touch devices */
    .car-card:hover {
        transform: none;
        border-color: var(--border);
        box-shadow: none;
    }
    .car-card:active {
        transform: scale(0.98);
        transition: transform 100ms ease;
    }
    .car-card:hover .card-image img {
        transform: none;
    }

    /* Reduce entrance animation on mobile for performance */
    .car-card {
        animation-duration: 200ms;
    }

    /* Sidebar touch targets — larger checkboxes & labels */
    .brand-item label {
        padding: 8px 6px;
        min-height: 40px;
        font-size: 0.85rem;
    }
    .brand-item input[type="checkbox"] {
        width: 18px;
        height: 18px;
    }
    .filter-select {
        padding: 10px 12px;
        font-size: 0.88rem;
        min-height: 44px;
    }
    .range-input {
        padding: 10px;
        font-size: 0.88rem;
        min-height: 44px;
    }
    .preset-btn {
        padding: 8px 12px;
        font-size: 0.78rem;
        min-height: 36px;
    }

    /* Better filter actions on mobile sidebar */
    .filter-actions {
        padding: 12px 16px 16px;
        margin: 12px -16px 0;
        gap: 10px;
    }
    .btn-apply, .btn-clear {
        padding: 12px 16px;
        font-size: 0.9rem;
        min-height: 44px;
    }

    /* Active filters bar compact + sticky on mobile */
    .active-filters-bar {
        padding: 8px 10px;
        gap: 8px;
        margin-bottom: 12px;
        position: sticky;
        top: var(--header-h);
        z-index: 5900;
        border-radius: 0;
        border-left: none;
        border-right: none;
        margin-left: -10px;
        margin-right: -10px;
    }
    .filter-pill {
        padding: 4px 8px;
        font-size: 0.72rem;
    }

    /* Results count on mobile */
    .results-count {
        font-size: 0.82rem;
    }
}

@media (max-width: 480px) {
    /* Single column on narrow phones */
    .car-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    :root {
        --card-img-h: 200px;
    }
    .card-body {
        padding: 12px 12px 10px;
        gap: 5px;
    }
    .card-title { font-size: 0.85rem; }
    .price-primary { font-size: 1.3rem; }
    .price-secondary { font-size: 0.8rem; }
    .specs-chips .chip {
        padding: 3px 8px;
        font-size: 0.7rem;
    }
    .card-footer { font-size: 0.72rem; }
}

@media (max-width: 420px) {
    /* Full-width sidebar on small phones */
    .sidebar {
        width: 100vw;
        min-width: 100vw;
    }

    .main-content {
        padding: 10px 8px;
        padding-bottom: 90px;
    }

    /* Slightly tighter bottom bar */
    .mobile-bottom-bar {
        padding: 8px 16px;
        gap: 12px;
    }
}

/* Body scroll lock when sidebar is open on mobile */
body.sidebar-locked,
body.gallery-locked {
    overflow: hidden;
}

/* Hide bottom bar while filter drawer is open so it doesn't stack over Apply buttons */
body.sidebar-locked .mobile-bottom-bar {
    display: none !important;
}


/* ── Print ─────────────────────────────────────────────────────── */
@media print {
    .sidebar, .mobile-fab, .sidebar-backdrop, .tooltip-card,
    .filter-actions, .export-buttons, .gallery-modal { display: none !important; }
    .main-content { padding: 0; }
    .car-card { break-inside: avoid; box-shadow: none; border: 1px solid #ccc; }
    .car-grid { grid-template-columns: repeat(2, 1fr); }
}


/* ── Photo Gallery Lightbox ───────────────────────────────────── */
.gallery-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 10000;
}
.gallery-modal.open {
    display: block;
}

.gallery-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.92);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.gallery-content {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

.gallery-main {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-height: 80vh;
    padding: 20px;
}

.gallery-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: var(--r-m);
    box-shadow: var(--shadow-l);
    transition: opacity 0.2s ease;
}

.gallery-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: var(--text-1);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--fast) ease;
    z-index: 1;
    /* Safe area for notched phones */
    top: max(16px, env(safe-area-inset-top, 16px));
}
.gallery-close:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: var(--red);
    color: var(--red);
}

.gallery-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: var(--text-1);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--fast) ease;
    z-index: 1;
}
.gallery-nav:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: var(--accent);
    color: var(--accent);
}
.gallery-prev { left: 16px; }
.gallery-next { right: 16px; }

.gallery-counter {
    padding: 8px 16px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: var(--r-full);
    font-size: 0.78rem;
    color: var(--text-2);
    margin-bottom: 12px;
}

.gallery-thumbs {
    display: flex;
    gap: 8px;
    padding: 12px 16px 24px;
    max-width: 90vw;
    overflow-x: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.3) transparent;
}
.gallery-thumbs::-webkit-scrollbar { height: 4px; }
.gallery-thumbs::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.3);
    border-radius: var(--r-full);
}

.gallery-thumb {
    width: 64px;
    height: 48px;
    flex-shrink: 0;
    border-radius: var(--r-s);
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: border-color var(--fast) ease;
    opacity: 0.6;
}
.gallery-thumb:hover { opacity: 0.9; }
.gallery-thumb.active {
    border-color: var(--accent);
    opacity: 1;
}
.gallery-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Mobile gallery optimizations */
@media (max-width: 768px) {
    .gallery-main {
        padding: 8px;
        max-height: 70vh;
    }
    .gallery-nav {
        width: 40px;
        height: 40px;
    }
    .gallery-nav svg {
        width: 22px;
        height: 22px;
    }
    .gallery-prev { left: 8px; }
    .gallery-next { right: 8px; }
    .gallery-close {
        width: 40px;
        height: 40px;
        right: 8px;
    }
    .gallery-thumbs {
        padding: 8px 12px 16px;
        padding-bottom: max(16px, env(safe-area-inset-bottom, 16px));
        gap: 6px;
    }
    .gallery-thumb {
        width: 52px;
        height: 40px;
    }
    .gallery-counter {
        font-size: 0.72rem;
        padding: 6px 12px;
    }
}
@media (max-width: 420px) {
    /* Hide thumbs strip on very small phones — swipe is enough */
    .gallery-thumbs {
        display: none;
    }
    .gallery-nav {
        width: 36px;
        height: 36px;
        background: rgba(255, 255, 255, 0.12);
    }
}

/* =================================================================
   NEW: Mobile Bottom Bar (replaces FAB)
   ================================================================= */
.mobile-bottom-bar {
    display: none; /* Hidden on desktop */
    position: fixed;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(14, 21, 37, 0.92);
    border: 1px solid var(--border-strong);
    border-radius: 100px;
    padding: 6px 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(79, 195, 247, 0.08);
    z-index: 8000;
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    align-items: center;
    gap: 4px;
    /* Safe area for notched phones */
    bottom: max(16px, env(safe-area-inset-bottom, 16px));
}

.mobile-bar-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: transparent;
    border: none;
    color: var(--text-1);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    padding: 10px 14px;
    border-radius: var(--r-full);
    transition: background var(--fast) ease;
    min-height: 44px;
    position: relative;
    -webkit-tap-highlight-color: transparent;
}

.mobile-bar-btn:active {
    background: var(--surface-3);
}

.mobile-bar-btn svg {
    flex-shrink: 0;
}

/* Filter count badge */
.filter-count-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: var(--accent);
    color: var(--surface-0);
    font-size: 0.65rem;
    font-weight: 700;
    border-radius: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

/* Mobile results count in bottom bar */
.mobile-result-count {
    font-size: 0.72rem;
    color: var(--text-3);
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    padding: 0 6px;
    white-space: nowrap;
}

.mobile-bottom-bar .divider {
    width: 1px;
    height: 24px;
    background: var(--border);
    flex-shrink: 0;
}

/* Show mobile bottom bar only on mobile */
@media (max-width: 768px) {
    .mobile-bottom-bar {
        display: flex;
    }
    /* Hide the old FAB since we have bottom bar */
    .mobile-fab {
        display: none !important;
    }
}

/* =================================================================
   NEW: Active Filter Pills
   ================================================================= */
.active-filters-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    background: var(--surface-2);
    border: 1px solid var(--border-dim);
    border-radius: var(--r-md);
    margin-bottom: 20px;
}

.active-filters-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    flex: 1;
}

.filter-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--surface-1);
    border: 1px solid var(--border);
    border-radius: var(--r-full);
    font-size: 0.82rem;
    color: var(--text-2);
    cursor: pointer;
    transition: all var(--fast) ease;
    user-select: none;
}

.filter-pill:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.filter-pill::after {
    content: '✕';
    font-size: 0.9rem;
    opacity: 0.6;
}

.clear-all-btn {
    font-size: 0.85rem;
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
    white-space: nowrap;
}

.clear-all-btn:hover {
    text-decoration: underline;
}

/* =================================================================
   NEW: Swipeable Card Image (Mobile)
   ================================================================= */
.card-image-carousel {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
}

.card-image-carousel::-webkit-scrollbar {
    display: none; /* Chrome/Safari */
}

.card-image-carousel img {
    flex: 0 0 100%;
    scroll-snap-align: start;
    object-fit: cover;
}

/* Scroll indicator dots for mobile carousel */
.card-image-carousel {
    position: relative;
}

/* On desktop, keep arrow navigation (handled by existing CSS) */
@media (min-width: 769px) {
    .card-image-carousel {
        overflow-x: hidden;
        scroll-snap-type: none;
        display: block;
        height: 100%;
    }
    .card-image-carousel img {
        display: none;
        width: 100%;
        height: 100%;
        object-fit: cover;
    }
    .card-image-carousel img:first-child {
        display: block;
        position: relative;
    }
}

/* =================================================================
   NEW: Load More Button (replaces pagination)
   ================================================================= */
.load-more-container {
    text-align: center;
    padding: 30px 0;
}

.load-more-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 32px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: var(--r-full);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--fast) ease;
}

.load-more-btn:hover {
    background: var(--accent-dim);
    transform: translateY(-1px);
}

.load-more-btn:disabled {
    background: var(--surface-3);
    color: var(--text-3);
    cursor: not-allowed;
    transform: none;
}

.loading-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* =================================================================
   Light Mode Support (respects system preference)
   ================================================================= */
@media (prefers-color-scheme: light) {
    :root {
        --surface-0: #f8fafc;
        --surface-1: #ffffff;
        --surface-2: #f1f5f9;
        --surface-3: #e2e8f0;
        --surface-4: #cbd5e1;
        --text-1: #0f172a;
        --text-2: #334155;
        --text-3: #64748b;
        --border-dim: rgba(0, 0, 0, 0.05);
        --border: rgba(0, 0, 0, 0.1);
        --border-strong: rgba(0, 0, 0, 0.15);
    }
    
    .mobile-bottom-bar {
        background: rgba(255, 255, 255, 0.92);
    }
    .active-filters-bar,
    .filter-pill {
        background: var(--surface-1);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    }
}

/* =================================================================
   Card Layout Redesign (Best Version)
   ================================================================= */

/* Price row — massive and bold */
.price-main-row {
    margin: 8px 0 4px;
    display: flex;
    align-items: baseline;
    gap: 8px;
    flex-wrap: wrap;
}

.price-primary {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--text-1);
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.02em;
}

.price-secondary {
    font-size: 1rem;
    color: var(--text-3);
    font-weight: 500;
}


/* Specs chips instead of text */
.specs-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.specs-chips .chip {
    display: inline-block;
    padding: 3px 10px;
    background: var(--surface-2);
    border: 1px solid var(--border-dim);
    border-radius: var(--r-md);
    font-size: 0.72rem;
    color: var(--text-2);
    font-weight: 500;
}

/* Card footer (location + posted time) */
.card-footer {
    margin-top: 8px;
    font-size: 0.75rem;
    color: var(--text-3);
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.card-location {
    color: var(--text-2);
    font-weight: 500;
}


/* Mobile carousel: ensure image container has proper height */
.card-image {
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: var(--surface-2);
}

.card-image-carousel img {
    width: 100%;
    height: 100%;
}

/* Improve car-card grid spacing */
.car-grid {
    gap: 20px;
    padding-bottom: 40px;
}

/* Discount badge positioning as overlay on image */
.card-badge.discount-badge {
    top: 10px;
    left: 10px;
    z-index: 3; /* above other badges */
    padding: 6px 12px;
    font-size: 0.8rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

/* Tier-based colors (overrides default .discount-badge background) */
/* tier-1: Amber/gold — "fire sale", the hottest deal. Warm and exciting, not alarming. */
.discount-badge.tier-1 {
    background: rgba(245, 158, 11, 0.92);
    border: 1px solid rgba(245, 158, 11, 0.7);
    color: #1c0a00;
}
/* tier-2: Green — solid confirmed deal. Green = positive. */
.discount-badge.tier-2 {
    background: rgba(34, 197, 94, 0.88);
    border: 1px solid rgba(34, 197, 94, 0.6);
    color: #052e16;
}
/* tier-3: Muted teal — informational. Cheaper than median but score is modest. */
.discount-badge.tier-3 {
    background: rgba(20, 184, 166, 0.75);
    border: 1px solid rgba(20, 184, 166, 0.5);
    color: #fff;
}

/* Rare Find badge (insufficient peer data) */
.card-badge.badge-rare {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(251, 191, 36, 0.15); /* amber */
    border: 1px solid rgba(251, 191, 36, 0.4);
    color: #f59e0b; /* amber-500 */
    padding: 4px 10px;
    border-radius: var(--r-full);
    font-size: 0.78rem;
    font-weight: 600;
    margin-bottom: 6px;
    width: fit-content;
    top: 10px;
    left: 10px;
    z-index: 3;
    animation: badge-pulse 2s ease-out;
}
.card-badge.badge-rare .rare-icon {
    font-size: 0.9rem;
}

/* Suspicious Badge - Warning Red */
.card-badge.badge-suspicious {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: rgba(239, 68, 68, 0.9); /* bright red */
    border: 1px solid rgba(239, 68, 68, 0.6);
    color: white;
    padding: 6px 12px;
    border-radius: var(--r-full);
    font-size: 0.75rem;
    font-weight: 800;
    margin-bottom: 6px;
    width: fit-content;
    top: 10px;
    left: 10px;
    z-index: 5;
    box-shadow: 0 0 15px rgba(239, 68, 68, 0.4);
    animation: alert-pulse 1.5s infinite;
}
.card-badge.badge-suspicious .alert-icon {
    font-size: 0.9rem;
}
.card-badge.badge-suspicious .alert-text {
    letter-spacing: 0.03em;
}

/* Typo variant: amber, no animation (informative) */
.badge-suspicious.typo {
    background: #f59e0b !important; /* amber-500 */
    border-color: #d97706 !important;
    animation: none !important;
}

/* Scam variant: bright red, with pulse (warning) */
.badge-suspicious.scam {
    background: #dc2626 !important; /* red-600 */
}

@keyframes alert-pulse {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.05); opacity: 0.9; }
    100% { transform: scale(1); opacity: 1; }
}

/* Suspicious card border highlighting */
.car-card[data-suspicious="true"] {
    border-color: rgba(239, 68, 68, 0.3);
    box-shadow: 0 4px 20px rgba(239, 68, 68, 0.15);
}

/* Motivation fire animation */
.motivation-fire {
    color: #fbbf24;
    font-size: 0.8rem;
    animation: fire-flicker 1.5s infinite alternate;
}

@keyframes fire-flicker {
    from { opacity: 0.7; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1.05); }
}

/* ── Damage Tags ────────────────────────────────────────────────── */
.damage-indicator {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 2px;
}

.damage-tag {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: var(--r-full);
    font-size: 0.70rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    cursor: default;
    white-space: nowrap;
}

.sev-minor {
    background: rgba(251, 191, 36, 0.12);
    color: var(--amber);
    border: 1px solid rgba(251, 191, 36, 0.25);
}

.sev-moderate {
    background: rgba(248, 113, 113, 0.12);
    color: var(--red);
    border: 1px solid rgba(248, 113, 113, 0.25);
}

.sev-severe {
    background: rgba(248, 113, 113, 0.22);
    color: #ff4444;
    border: 1px solid rgba(248, 113, 113, 0.45);
    font-weight: 700;
}
