/* AutoPref Frontend Styles */
.autopref-vehicles-container {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #333;
}

/* Filters */
.autopref-filters {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 30px;
}

.autopref-filter-form .filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: end;
    margin-bottom: 15px;
}

.autopref-filter-form .filter-row:last-child {
    margin-bottom: 0;
}

.filter-field {
    flex: 1;
    min-width: 200px;
}

.filter-field label {
    display: block;
    font-weight: 600;
    margin-bottom: 5px;
    color: #495057;
    font-size: 14px;
}

.filter-field input,
.filter-field select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 14px;
    background-color: #fff;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.filter-field input:focus,
.filter-field select:focus {
    outline: none;
    border-color: #80bdff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

.filter-actions {
    display: flex;
    gap: 10px;
    align-items: end;
}

.autopref-filter-btn,
.autopref-reset-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease-in-out;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.autopref-filter-btn {
    background-color: #007cba;
    color: #fff;
}

.autopref-filter-btn:hover {
    background-color: #005a87;
}

.autopref-reset-btn {
    background-color: #6c757d;
    color: #fff;
}

.autopref-reset-btn:hover {
    background-color: #545b62;
}

/* Loading state */
.autopref-vehicles-results.loading {
    opacity: 0.6;
    pointer-events: none;
}

.autopref-loading {
    text-align: center;
    padding: 40px;
    color: #6c757d;
}

/* Results header */
.autopref-vehicles-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e9ecef;
}

.results-count {
    font-weight: 600;
    color: #495057;
}

/* No results */
.autopref-no-results {
    text-align: center;
    padding: 60px 20px;
    color: #6c757d;
    font-size: 16px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

/* Vehicle Grid */
.autopref-vehicles-grid {
    display: grid;
    gap: 25px;
    margin-bottom: 30px;
}

.autopref-vehicles-grid.columns-1 {
    grid-template-columns: 1fr;
}

.autopref-vehicles-grid.columns-2 {
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
}

.autopref-vehicles-grid.columns-3 {
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

.autopref-vehicles-grid.columns-4 {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

/* Vehicle Card */
.autopref-vehicle-card {
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.autopref-vehicle-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.vehicle-image {
    position: relative;
    height: 200px;
    background: #f8f9fa;
    overflow: hidden;
}

.vehicle-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

/* Fallback for broken images */
.vehicle-image img[alt]:after { 
    display: flex;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    color: #6c757d;
    font-size: 14px;
    content: "Image non disponible";
    align-items: center;
    justify-content: center;
    text-align: center;
}

.autopref-vehicle-card:hover .vehicle-image img {
    transform: scale(1.05);
}

.vehicle-image .no-image {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #6c757d;
    font-size: 14px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
}

.vehicle-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    color: #fff;
    text-transform: uppercase;
}

.vehicle-badge.accident {
    background-color: #dc3545;
}

.vehicle-badge.first-hand {
    background-color: #28a745;
    top: 10px;
    left: 10px;
    right: auto;
}

.vehicle-badge.photo-count {
    background-color: #007cba;
    bottom: 10px;
    top: auto;
    font-size: 11px;
    padding: 3px 6px;
}

.vehicle-content {
    padding: 20px;
}

.vehicle-header {
    margin-bottom: 15px;
}

.vehicle-title {
    margin: 0 0 5px 0;
    font-size: 18px;
    font-weight: 700;
    color: #212529;
    line-height: 1.3;
}

.vehicle-version {
    margin: 0;
    font-size: 14px;
    color: #6c757d;
    font-weight: 500;
}

.vehicle-details {
    margin-bottom: 20px;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    border-bottom: 1px solid #f1f3f4;
    font-size: 14px;
}

.detail-row:last-child {
    border-bottom: none;
}

.detail-label {
    color: #6c757d;
    font-weight: 500;
}

.detail-value {
    color: #495057;
    font-weight: 600;
}

.vehicle-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 15px;
    border-top: 1px solid #e9ecef;
}

.vehicle-price {
    font-size: 20px;
    font-weight: 700;
    color: #007cba;
}

.vehicle-contact-btn {
    padding: 8px 16px;
    background-color: #007cba;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.15s ease-in-out;
    text-decoration: none;
}

.vehicle-contact-btn:hover {
    background-color: #005a87;
}

/* Pagination */
.autopref-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 30px;
    flex-wrap: wrap;
}

.pagination-btn {
    padding: 8px 12px;
    border: 1px solid #dee2e6;
    background-color: #fff;
    color: #007cba;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.15s ease-in-out;
    text-decoration: none;
    min-width: 40px;
    text-align: center;
}

.pagination-btn:hover {
    background-color: #e9ecef;
    border-color: #adb5bd;
}

.pagination-btn.current {
    background-color: #007cba;
    color: #fff;
    border-color: #007cba;
}

.pagination-btn.current:hover {
    background-color: #005a87;
    border-color: #005a87;
}

.pagination-dots {
    padding: 8px 4px;
    color: #6c757d;
}

/* Responsive Design */
@media (max-width: 768px) {
    .autopref-filter-form .filter-row {
        flex-direction: column;
        align-items: stretch;
    }
    
    .filter-field {
        min-width: auto;
    }
    
    .filter-actions {
        justify-content: stretch;
    }
    
    .autopref-filter-btn,
    .autopref-reset-btn {
        flex: 1;
    }
    
    .autopref-vehicles-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .vehicle-footer {
        flex-direction: column;
        gap: 10px;
        align-items: stretch;
    }
    
    .vehicle-contact-btn {
        width: 100%;
        text-align: center;
    }
    
    .autopref-pagination {
        gap: 4px;
    }
    
    .pagination-btn {
        padding: 6px 8px;
        font-size: 13px;
        min-width: 35px;
    }
}

@media (max-width: 480px) {
    .autopref-filters {
        padding: 15px;
    }
    
    .vehicle-content {
        padding: 15px;
    }
    
    .vehicle-image {
        height: 160px;
    }
    
    .vehicle-title {
        font-size: 16px;
    }
    
    .vehicle-price {
        font-size: 18px;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .autopref-vehicles-container {
        color: #e9ecef;
    }
    
    .autopref-filters {
        background: #343a40;
        border-color: #495057;
    }
    
    .filter-field label {
        color: #adb5bd;
    }
    
    .filter-field input,
    .filter-field select {
        background-color: #495057;
        border-color: #6c757d;
        color: #fff;
    }
    
    .autopref-vehicle-card {
        background: #495057;
        border-color: #6c757d;
    }
    
    .vehicle-title {
        color: #f8f9fa;
    }
    
    .detail-row {
        border-color: #6c757d;
    }
    
    .vehicle-footer {
        border-color: #6c757d;
    }
    
    .pagination-btn {
        background-color: #495057;
        border-color: #6c757d;
        color: #adb5bd;
    }
}

/* Print styles */
@media print {
    .autopref-filters,
    .autopref-pagination,
    .vehicle-contact-btn {
        display: none;
    }
    
    .autopref-vehicles-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    
    .autopref-vehicle-card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #000;
    }
}
