/* ===== Auto API Cars v1.1 ===== */

/* --- Grid --- */
.aac-grid,
.aac-featured-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
    margin: 20px 0;
}

/* --- Car Card --- */
.aac-car-card {
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0,0,0,0.1);
    transition: transform 0.2s, box-shadow 0.2s;
}
.aac-car-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
}

/* --- Image --- */
.aac-car-image-wrap {
    position: relative;
    height: 200px;
    background: #e8e8e8;
    overflow: hidden;
}
.aac-car-image-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s;
}
.aac-car-card:hover .aac-car-image-wrap img {
    transform: scale(1.04);
}
.aac-no-image {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #999;
    font-size: 14px;
}
.aac-img-count {
    position: absolute;
    bottom: 8px;
    right: 10px;
    background: rgba(0,0,0,0.6);
    color: #fff;
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 4px;
}

/* --- Card Body --- */
.aac-car-body { padding: 16px; }
.aac-car-title {
    font-size: 15px;
    font-weight: 600;
    color: #1a1a2e;
    margin: 0 0 10px;
    line-height: 1.4;
    min-height: 40px;
}
.aac-car-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 14px;
}
.aac-meta-item {
    font-size: 11px;
    color: #555;
    background: #f0f0f5;
    padding: 3px 8px;
    border-radius: 4px;
}
.aac-car-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 12px;
    border-top: 1px solid #eee;
}
.aac-price {
    font-size: 20px;
    font-weight: 700;
    color: #1a3a6b;
}
.aac-btn-detail {
    background: #1a3a6b;
    color: #fff !important;
    padding: 7px 16px;
    border-radius: 5px;
    font-size: 13px;
    text-decoration: none !important;
    transition: background 0.2s;
}
.aac-btn-detail:hover { background: #c8a951 !important; }

/* --- Filters --- */
.aac-listing-wrap { width: 100%; }
.aac-filters {
    background: #1a1a2e;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 24px;
}
.aac-filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 10px;
}
.aac-filter-row:last-child { margin-bottom: 0; }
.aac-filter {
    flex: 1;
    min-width: 150px;
    padding: 9px 12px;
    border: 1px solid #3a3a5c;
    border-radius: 5px;
    background: #2a2a4a;
    color: #fff;
    font-size: 14px;
}
.aac-filter::placeholder { color: #888; }
.aac-filter option { background: #2a2a4a; }
.aac-btn-search {
    padding: 9px 24px;
    background: #c8a951;
    color: #1a1a2e;
    font-weight: 600;
    border: none;
    border-radius: 5px;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s;
}
.aac-btn-search:hover { background: #e0c06a; }
.aac-btn-reset {
    padding: 9px 18px;
    background: transparent;
    border: 1px solid #888;
    color: #aaa;
    border-radius: 5px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}
.aac-btn-reset:hover { border-color: #fff; color: #fff; }
.aac-results-info { font-size: 14px; color: #888; margin-bottom: 8px; }
.aac-api-error { background: #fff3cd; border: 1px solid #ffc107; padding: 12px 16px; border-radius: 6px; margin-bottom: 16px; color: #856404; }
.aac-no-results { grid-column: 1/-1; text-align: center; color: #888; padding: 40px; }
.aac-loading { grid-column: 1/-1; text-align: center; padding: 40px; color: #888; }

/* --- Pagination --- */
.aac-pagination { text-align: center; margin-top: 32px; }
.aac-btn-loadmore {
    background: #1a3a6b;
    color: #fff;
    padding: 12px 40px;
    border: none;
    border-radius: 6px;
    font-size: 15px;
    cursor: pointer;
    transition: background 0.2s;
}
.aac-btn-loadmore:hover { background: #c8a951; }

/* ===== Single Car Detail Page ===== */
.aac-detail-wrap { max-width: 1100px; margin: 0 auto; padding: 20px 0; }
.aac-back-link {
    display: inline-block;
    color: #1a3a6b;
    text-decoration: none;
    font-size: 14px;
    margin-bottom: 16px;
    transition: color 0.2s;
}
.aac-back-link:hover { color: #c8a951; }
.aac-detail-title {
    font-size: 26px;
    font-weight: 700;
    color: #1a1a2e;
    margin: 0 0 24px;
}
.aac-detail-layout {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 32px;
    align-items: start;
}

/* Gallery */
.aac-main-image {
    border-radius: 8px;
    overflow: hidden;
    background: #f0f0f0;
    margin-bottom: 12px;
}
.aac-main-image img {
    width: 100%;
    height: 420px;
    object-fit: cover;
    display: block;
    transition: opacity 0.2s;
}
.aac-thumb-strip {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.aac-thumb {
    width: 80px;
    height: 60px;
    object-fit: cover;
    border-radius: 4px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: border-color 0.15s, opacity 0.15s;
    opacity: 0.7;
}
.aac-thumb:hover, .aac-thumb.active {
    border-color: #c8a951;
    opacity: 1;
}
.aac-no-image-lg {
    height: 400px;
    background: #eee;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #aaa;
    border-radius: 8px;
    font-size: 16px;
}

/* Specs + Actions sidebar */
.aac-detail-info {
    background: #fff;
    border-radius: 8px;
    padding: 24px;
    box-shadow: 0 2px 16px rgba(0,0,0,0.08);
    position: sticky;
    top: 20px;
}
.aac-detail-price {
    font-size: 32px;
    font-weight: 700;
    color: #1a3a6b;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 2px solid #f0f0f0;
}
.aac-specs-table { width: 100%; border-collapse: collapse; margin-bottom: 20px; }
.aac-specs-table tr { border-bottom: 1px solid #f0f0f0; }
.aac-specs-table th {
    text-align: left;
    font-size: 13px;
    color: #888;
    font-weight: 500;
    padding: 8px 0;
    width: 40%;
}
.aac-specs-table td {
    font-size: 14px;
    color: #1a1a2e;
    font-weight: 500;
    padding: 8px 0;
}
.aac-detail-actions { display: flex; flex-direction: column; gap: 10px; }
.aac-btn-enquire {
    display: block;
    background: #c8a951;
    color: #1a1a2e !important;
    text-align: center;
    padding: 14px;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 600;
    text-decoration: none !important;
    transition: background 0.2s;
}
.aac-btn-enquire:hover { background: #e0c06a !important; }
.aac-btn-source {
    display: block;
    background: #f0f0f5;
    color: #555 !important;
    text-align: center;
    padding: 10px;
    border-radius: 6px;
    font-size: 13px;
    text-decoration: none !important;
    transition: background 0.2s;
}
.aac-btn-source:hover { background: #e0e0ea !important; }

/* --- Responsive --- */
@media (max-width: 900px) {
    .aac-detail-layout { grid-template-columns: 1fr; }
    .aac-detail-info { position: static; }
}
@media (max-width: 768px) {
    .aac-grid, .aac-featured-grid { grid-template-columns: 1fr 1fr; }
    .aac-filter { min-width: 130px; }
    .aac-main-image img { height: 260px; }
}
@media (max-width: 480px) {
    .aac-grid, .aac-featured-grid { grid-template-columns: 1fr; }
}

/* ===== Vehicle History Section ===== */
.aac-history-section {
    margin-top: 48px;
    padding-top: 32px;
    border-top: 2px solid #f0f0f0;
}
.aac-section-title {
    font-size: 20px;
    font-weight: 700;
    color: #1a1a2e;
    margin: 0 0 20px;
}
.aac-sub-title {
    font-size: 16px;
    font-weight: 600;
    color: #1a1a2e;
    margin: 28px 0 14px;
    padding-bottom: 8px;
    border-bottom: 1px solid #eee;
}

/* Summary bar */
.aac-history-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 32px;
}
.aac-hist-item {
    flex: 1;
    min-width: 120px;
    padding: 14px 18px;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    border: 1px solid transparent;
}
.aac-hist-item.aac-good  { background: #f0faf0; border-color: #c3e6c3; }
.aac-hist-item.aac-warn  { background: #fffbf0; border-color: #ffe082; }
.aac-hist-item.aac-bad   { background: #fff0f0; border-color: #ffcdd2; }
.aac-hist-item.aac-neutral { background: #f5f5f5; border-color: #e0e0e0; }
.aac-hist-label { font-size: 12px; color: #666; }
.aac-hist-value { font-size: 18px; font-weight: 700; color: #1a1a2e; }
.aac-hist-sub   { font-size: 11px; color: #999; }

/* Accident table */
.aac-accident-table-wrap { overflow-x: auto; }
.aac-accident-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.aac-accident-table thead tr {
    background: #1a1a2e;
    color: #fff;
}
.aac-accident-table th,
.aac-accident-table td {
    padding: 10px 14px;
    text-align: left;
    border-bottom: 1px solid #eee;
}
.aac-accident-table tbody tr:hover { background: #fafafa; }
.aac-accident-table tr.aac-acc-mine td { background: #fffde7; }
.aac-acc-type {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
}
.aac-acc-mine-badge  { background: #fff3cd; color: #856404; }
.aac-acc-other-badge { background: #e8f5e9; color: #2e7d32; }

/* Owner timeline */
.aac-owner-timeline {
    display: flex;
    flex-direction: column;
    gap: 0;
    border-left: 2px solid #1a3a6b;
    padding-left: 20px;
    margin-left: 8px;
}
.aac-owner-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    position: relative;
}
.aac-owner-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #c8a951;
    position: absolute;
    left: -26px;
    top: 50%;
    transform: translateY(-50%);
    border: 2px solid #fff;
    box-shadow: 0 0 0 2px #1a3a6b;
}
.aac-owner-label { font-size: 13px; font-weight: 600; color: #1a1a2e; min-width: 80px; }
.aac-owner-date  { font-size: 13px; color: #666; }

/* Inspection */
.aac-insp-comments {
    background: #f8f9fa;
    border-left: 3px solid #c8a951;
    padding: 12px 16px;
    font-size: 13px;
    color: #444;
    border-radius: 0 6px 6px 0;
    margin-bottom: 16px;
}
.aac-insp-outer-title,
.aac-insp-issue-title {
    font-size: 13px;
    font-weight: 600;
    color: #555;
    margin: 0 0 10px;
}
.aac-outer-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}
.aac-outer-tag {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffe082;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 12px;
}
.aac-outer-tag em { color: #999; font-style: normal; }
.aac-insp-issues {
    background: #fff8f8;
    border: 1px solid #ffcdd2;
    border-radius: 6px;
    padding: 14px 18px;
}
.aac-insp-issues ul {
    margin: 0;
    padding-left: 18px;
}
.aac-insp-issues li {
    font-size: 13px;
    color: #c62828;
    padding: 3px 0;
}

@media (max-width: 600px) {
    .aac-history-summary { flex-direction: column; }
    .aac-hist-item { min-width: unset; }
}
