/**
 * Mobile-first baseline for /cars/{id}/ and /cars/.
 *
 * The plugin doesn't impose a designed look — themes own that. This file
 * provides the structural responsive layer so the page works out of the box
 * on mobile even with a bare theme. Themes can override every selector.
 */

/* === single car === */

.pc-tm-car {
    max-width: 1100px;
    margin: 0 auto;
    padding: 16px;
    box-sizing: border-box;
}

.pc-tm-car__header { margin-bottom: 16px; }
.pc-tm-car__title { font-size: 1.5rem; line-height: 1.2; margin: 0 0 4px; }
.pc-tm-car__subtitle { color: #555; font-size: 0.95rem; margin: 0; }

.pc-tm-car__image {
    margin: 0 0 20px;
}
.pc-tm-car__image img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 4px;
    background: #f6f7f7;
}
.pc-tm-car__image-note {
    font-size: 0.75rem;
    color: #999;
    margin: 6px 0 0;
}

.pc-tm-car__summary dl {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px 0;
    margin: 0 0 24px;
}
.pc-tm-car__summary dt {
    font-size: 0.75rem;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin: 0;
}
.pc-tm-car__summary dd { margin: 0 0 8px; font-size: 1rem; }
.pc-tm-car__price { font-size: 1.6rem; font-weight: 600; }
.pc-tm-car__delta--down { color: #2e7d32; }
.pc-tm-car__delta--up   { color: #b71c1c; }

.pc-tm-car__resale-note,
.pc-tm-car__market-position {
    margin: 0 0 16px;
    padding: 10px 12px;
    background: #f6f7f7;
    border-left: 3px solid #2271b1;
    border-radius: 2px;
    font-size: 0.95rem;
}

.pc-tm-car__issues {
    margin: 0 0 24px;
}
.pc-tm-car__issues h2 { font-size: 1.1rem; margin: 0 0 8px; }
.pc-tm-car__issues ul { margin: 0; padding: 0; list-style: none; }
.pc-tm-car__issues li {
    padding: 8px 12px;
    margin: 0 0 6px;
    background: #fff8e1;
    border-left: 3px solid #ef6c00;
    font-size: 0.95rem;
}
.pc-tm-car__issues li[data-severity="critical"] { background: #ffebee; border-left-color: #b71c1c; }
.pc-tm-car__issues li[data-severity="warning"]  { background: #fff8e1; border-left-color: #ef6c00; }
.pc-tm-car__issues li[data-severity="notice"]   { background: #e3f2fd; border-left-color: #2271b1; }
.pc-tm-car__issues li[data-severity="info"]     { background: #f6f7f7; border-left-color: #888; }

.pc-tm-car__price-history,
.pc-tm-car__listings,
.pc-tm-car__sellers { margin: 0 0 24px; }

.pc-tm-car__price-history h2,
.pc-tm-car__listings h2,
.pc-tm-car__sellers h2 { font-size: 1.1rem; margin: 0 0 8px; }

.pc-tm-car__price-history table,
.pc-tm-car__listings table {
    width: 100%;
    border-collapse: collapse;
}
.pc-tm-car__price-history th,
.pc-tm-car__price-history td,
.pc-tm-car__listings th,
.pc-tm-car__listings td {
    padding: 8px;
    border-bottom: 1px solid #eee;
    text-align: left;
    font-size: 0.9rem;
}

/* Stack tables into rows on small screens */
@media (max-width: 600px) {
    .pc-tm-car__price-history table,
    .pc-tm-car__price-history thead,
    .pc-tm-car__price-history tbody,
    .pc-tm-car__price-history tr,
    .pc-tm-car__price-history th,
    .pc-tm-car__price-history td,
    .pc-tm-car__listings table,
    .pc-tm-car__listings thead,
    .pc-tm-car__listings tbody,
    .pc-tm-car__listings tr,
    .pc-tm-car__listings th,
    .pc-tm-car__listings td {
        display: block;
    }
    .pc-tm-car__price-history thead,
    .pc-tm-car__listings thead { display: none; }
    .pc-tm-car__price-history tr,
    .pc-tm-car__listings tr {
        margin-bottom: 12px;
        padding: 8px;
        background: #f6f7f7;
        border-radius: 4px;
    }
    .pc-tm-car__price-history td,
    .pc-tm-car__listings td {
        border-bottom: 0;
        padding: 4px 8px;
    }
    .pc-tm-car__price-history td::before,
    .pc-tm-car__listings td::before {
        content: attr(data-label) ":\00a0";
        font-weight: 600;
        color: #666;
        font-size: 0.8rem;
    }
}

@media (min-width: 768px) {
    .pc-tm-car {
        padding: 24px;
    }
    .pc-tm-car__title { font-size: 2rem; }
    .pc-tm-car__summary dl {
        grid-template-columns: 200px 1fr;
        gap: 8px 16px;
    }
    .pc-tm-car__summary dt { padding-top: 6px; }
}

/* === archive === */

.pc-tm-cars-archive {
    max-width: 1200px;
    margin: 0 auto;
    padding: 16px;
    box-sizing: border-box;
}
.pc-tm-cars-archive__header { margin-bottom: 16px; }
.pc-tm-cars-archive__header h1 { font-size: 1.5rem; margin: 0 0 4px; }
.pc-tm-cars-archive__count { color: #666; font-size: 0.9rem; margin: 0; }

.pc-tm-cars-archive__filters {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: end;
    margin: 0 0 20px;
    padding: 12px;
    background: #f6f7f7;
    border-radius: 4px;
}
.pc-tm-cars-archive__filters label {
    display: flex;
    flex-direction: column;
    font-size: 0.85rem;
    flex: 1 1 140px;
    min-width: 140px;
}
.pc-tm-cars-archive__filters label > span {
    color: #666;
    font-weight: 600;
    margin-bottom: 4px;
}
.pc-tm-cars-archive__filters select,
.pc-tm-cars-archive__filters input[type="number"] {
    padding: 6px 8px;
    font-size: 0.95rem;
    width: 100%;
    box-sizing: border-box;
}
.pc-tm-cars-archive__filters button {
    padding: 8px 16px;
}

.pc-tm-cars-archive__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}
.pc-tm-cars-archive__card {
    background: #fff;
    border: 1px solid #eee;
    border-radius: 6px;
    overflow: hidden;
    transition: box-shadow .2s;
}
.pc-tm-cars-archive__card:hover { box-shadow: 0 2px 8px rgba(0,0,0,.06); }
.pc-tm-cars-archive__card-link {
    display: block;
    text-decoration: none;
    color: inherit;
}
.pc-tm-cars-archive__card-image img {
    width: 100%;
    height: auto;
    display: block;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    background: #f6f7f7;
}
.pc-tm-cars-archive__card-body { padding: 12px; }
.pc-tm-cars-archive__card-title {
    font-size: 1rem;
    margin: 0 0 4px;
    line-height: 1.3;
}
.pc-tm-cars-archive__card-meta {
    color: #666;
    font-size: 0.85rem;
    margin: 0 0 8px;
}
.pc-tm-cars-archive__card-price {
    margin: 0;
    font-size: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}
.pc-tm-cars-archive__card-km {
    color: #888;
    font-size: 0.85rem;
}

.pc-tm-cars-archive__pagination {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
    margin-top: 24px;
}
.pc-tm-cars-archive__pagination-link {
    display: inline-block;
    padding: 6px 12px;
    border: 1px solid #ddd;
    border-radius: 3px;
    text-decoration: none;
    color: #2271b1;
    font-size: 0.9rem;
}
.pc-tm-cars-archive__pagination-link:hover { background: #f6f7f7; }
.pc-tm-cars-archive__pagination-link--current {
    background: #2271b1;
    color: #fff;
    border-color: #2271b1;
    cursor: default;
}

@media (min-width: 600px) {
    .pc-tm-cars-archive__list { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 900px) {
    .pc-tm-cars-archive__list { grid-template-columns: 1fr 1fr 1fr; }
}

/* v0.19: single-car listings table — "best price" highlight + inactive collapse */
.pc-tm-car__listing-count { color: #888; font-weight: normal; font-size: 0.9rem; }
.pc-tm-car__listing--best { background: #f0f9ff; }
.pc-tm-car__listing--best td { font-weight: 600; }
.pc-tm-car__best-badge {
    display: inline-block;
    background: #2e7d32;
    color: #fff;
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-left: 4px;
    vertical-align: middle;
}
.pc-tm-car__listings--inactive { margin-top: 16px; }
.pc-tm-car__listings--inactive summary {
    cursor: pointer;
    color: #666;
    font-size: 0.95rem;
    padding: 8px 12px;
    background: #f6f7f7;
    border: 1px solid #e5e5e5;
}
.pc-tm-car__listings--inactive summary:hover { background: #ececec; }
.pc-tm-car__listing--sold td,
.pc-tm-car__listing--removed td,
.pc-tm-car__listing--expired td { color: #888; }
