* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg: #ffffff;
  --bg-card: #f8f9fa;
  --bg-card-hover: #f0f1f2;
  --text: #1a1a1a;
  --text-muted: #666666;
  --green: #16a34a;
  --yellow: #ca8a04;
  --red: #dc2626;
  --border: #e5e5e5;
  --accent: #2563eb;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Header */
header {
  padding: 40px 0 30px;
}

header h1 {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.tagline {
  color: var(--text-muted);
  font-size: 1rem;
}

/* Filters */
.filters {
  display: flex;
  gap: 16px;
  padding: 24px 0;
  flex-wrap: wrap;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.filter-group label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.filter-group select {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 32px 10px 12px;
  border-radius: 6px;
  font-size: 0.9rem;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23888' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}

.filter-group select:hover {
  border-color: #444;
}

.filter-group select:focus {
  outline: none;
  border-color: var(--accent);
}

/* Results info */
.results-info {
  padding: 16px 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* EV Grid */
.ev-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
  padding: 20px 0 60px;
}

/* Card */
.ev-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
}

.ev-card:hover {
  background: var(--bg-card-hover);
  border-color: #ccc;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.ev-card-image {
  width: 100%;
  height: 180px;
  object-fit: cover;
  background: linear-gradient(135deg, #e5e5e5 0%, #d0d0d0 100%);
}

.ev-card-image.error {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  color: #999;
}

.ev-card-body {
  padding: 20px;
}

.ev-card-header {
  margin-bottom: 16px;
}

.ev-card-title {
  font-size: 1.25rem;
  font-weight: 600;
}

.ev-card-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 4px;
}

.ev-card-brand {
  font-size: 0.85rem;
  color: var(--text-muted);
}


/* Stats row */
.ev-card-stats {
  display: flex;
  gap: 20px;
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.stat {
  display: flex;
  flex-direction: column;
}

.stat-value {
  font-size: 1.1rem;
  font-weight: 600;
}

.stat-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

/* Issues */
.ev-card-issues {
  margin-bottom: 16px;
}

.issue {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--text-muted);
  padding: 6px 0;
}

.issue-text {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.severity-bar {
  width: 60px;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
  flex-shrink: 0;
}

.severity-fill {
  display: block;
  height: 100%;
  border-radius: 3px;
  transition: width 0.3s ease;
}

/* Price row */
.ev-card-price {
  display: flex;
  gap: 16px;
  font-size: 0.9rem;
}

.price-used {
  color: var(--text);
}

.price-new {
  color: var(--text-muted);
}

.price-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
}

/* Availability badge */
.availability {
  display: inline-block;
  font-size: 0.7rem;
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 8px;
  text-transform: uppercase;
}

.availability.new {
  background: rgba(59, 130, 246, 0.15);
  color: var(--accent);
}

.availability.used-only {
  background: rgba(136, 136, 136, 0.15);
  color: var(--text-muted);
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  z-index: 1000;
  overflow-y: auto;
  padding: 40px 20px;
}

.modal.active {
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

.modal-content {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  max-width: 600px;
  width: 100%;
  padding: 32px;
  position: relative;
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
}

.modal-close:hover {
  color: var(--text);
}

.modal-image {
  width: 100%;
  height: 200px;
  object-fit: cover;
  border-radius: 8px;
  margin-bottom: 20px;
}

.modal-header {
  margin-bottom: 24px;
}

.modal-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.modal-brand {
  color: var(--text-muted);
}

.modal-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  padding: 20px;
  background: var(--bg);
  border-radius: 8px;
  margin-bottom: 24px;
}

.modal-stat {
  text-align: center;
}

.modal-stat-value {
  font-size: 1.5rem;
  font-weight: 700;
}

.modal-stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
}

.modal-section {
  margin-bottom: 24px;
}

.modal-section h3 {
  font-size: 0.85rem;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 12px;
  letter-spacing: 0.05em;
}

.modal-issues {
  list-style: none;
}

.modal-issues li {
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
}

.modal-issue-text {
  flex: 1;
}

.modal-severity {
  width: 80px;
}

.modal-summary {
  color: var(--text-muted);
  line-height: 1.7;
}

.modal-prices {
  display: flex;
  gap: 24px;
}

.modal-price-block {
  flex: 1;
  padding: 16px;
  background: var(--bg);
  border-radius: 8px;
}

.modal-price-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.modal-price-value {
  font-size: 1.25rem;
  font-weight: 600;
}

/* Footer */
footer {
  border-top: 1px solid var(--border);
  padding: 24px 0;
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* Responsive */
@media (max-width: 640px) {
  header h1 {
    font-size: 1.5rem;
  }

  .filters {
    gap: 12px;
  }

  .filter-group {
    flex: 1;
    min-width: 140px;
  }

  .ev-grid {
    grid-template-columns: 1fr;
  }

  .ev-card-stats {
    flex-wrap: wrap;
  }

  .modal-stats {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .modal-prices {
    flex-direction: column;
    gap: 12px;
  }
}
