/* CPM1 Car ID Lookup — page-specific styles.
   Design tokens, reset, header/footer, buttons and .hero-stats
   are already provided by the shared /styles.css loaded before this file. */

/* ---------- Tool hero ---------- */

.tool-hero {
  position: relative;
  overflow: hidden;
  padding: 110px 0 64px;
  border-bottom: 1px solid var(--border-color);
}

.tool-hero-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
}

.tool-hero-bg img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 65%;
  opacity: 0.4;
  filter: saturate(1.05);
}

.tool-hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, var(--bg-primary) 0%, transparent 22%, transparent 55%, var(--bg-primary) 92%),
    linear-gradient(90deg, var(--bg-primary) 0%, transparent 30%, transparent 70%, var(--bg-primary) 100%);
  opacity: 0.92;
  transition: background 0.4s ease;
}

/* Faint scanlines tie the banner into the rest of the site's HUD aesthetic */
.tool-hero-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.14) 0 1px, transparent 1px 3px);
  opacity: 0.35;
  pointer-events: none;
}

.tool-hero-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--hero-grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--hero-grid-line) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse 70% 60% at 50% 0%, black 40%, transparent 80%);
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 0%, black 40%, transparent 80%);
}

.tool-hero-inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.tool-hero h1 {
  font-size: clamp(2rem, 4.4vw, 3rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 14px;
}

.tool-hero-subtitle {
  color: var(--text-secondary);
  font-size: 1.05rem;
  max-width: 560px;
  margin-bottom: 36px;
}

.tool-hero .hero-stats {
  margin-top: 8px;
}

/* ---------- Search ---------- */

.search-container {
  position: relative;
  width: 100%;
  max-width: 480px;
  margin-bottom: 32px;
}

.search-icon {
  position: absolute;
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

#searchInput {
  width: 100%;
  padding: 14px 46px;
  border-radius: 999px;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.95rem;
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

#searchInput::placeholder {
  color: var(--text-muted);
}

#searchInput:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.18);
}

.search-clear {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%) scale(0.8);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: none;
  background: var(--overlay-soft-hover);
  color: var(--text-secondary);
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, transform 0.2s ease, background 0.2s ease;
}

.search-clear.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(-50%) scale(1);
}

.search-clear:hover {
  background: var(--border-color-hover);
  color: var(--text-primary);
}

/* ---------- Section heading (compact variant) ---------- */

.section-heading-compact {
  text-align: center;
  max-width: 560px;
  margin: 0 auto 32px;
}

.section-heading-compact h2 {
  font-size: clamp(1.4rem, 2.6vw, 1.8rem);
  font-weight: 800;
  letter-spacing: -0.01em;
}

/* ---------- Filters ---------- */

.filters-section {
  padding: 56px 0 40px;
}

.filter-buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

.filter-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: 999px;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.filter-btn:hover {
  border-color: var(--border-color-hover);
  color: var(--text-primary);
  transform: translateY(-1px);
}

.filter-btn.active {
  border-color: transparent;
  background: var(--accent-gradient);
  color: #fff;
}

/* ---------- Results / cars grid ---------- */

.cars-section {
  padding: 0 0 100px;
}

.results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-color);
}

.results-count {
  color: var(--text-muted);
  font-size: 0.88rem;
  font-weight: 600;
}

.view-toggle {
  display: flex;
  gap: 4px;
  padding: 4px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-card);
}

.view-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.view-btn:hover {
  color: var(--text-primary);
}

.view-btn.active {
  background: var(--overlay-soft-hover);
  color: var(--accent);
}

.cars-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 18px;
}

.car-card {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: transform 0.25s var(--ease), border-color 0.25s var(--ease), box-shadow 0.25s var(--ease), background 0.25s var(--ease);
}

.car-card:hover {
  transform: translateY(-4px);
  border-color: rgba(99, 102, 241, 0.5);
  background: var(--bg-card-hover);
  box-shadow: var(--shadow-soft), 0 0 26px rgba(99, 102, 241, 0.12);
}

.car-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px 0;
}

.car-logo {
  width: 26px;
  height: 26px;
  object-fit: contain;
  border-radius: 4px;
  filter: grayscale(1) brightness(1.5);
  opacity: 0.75;
}

[data-theme="light"] .car-logo {
  filter: grayscale(1) brightness(0.4);
}

.car-id {
  font-family: "Fira Code", "Inter", monospace;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent);
  background: var(--overlay-soft);
  border: 1px solid var(--border-color);
  padding: 3px 8px;
  border-radius: 999px;
}

.car-image {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  object-position: center 55%;
  margin-top: 10px;
  transition: transform 0.4s var(--ease);
}

.car-card:hover .car-image {
  transform: scale(1.05);
}

.car-info {
  position: relative;
  z-index: 2;
  padding: 14px 16px 18px;
}

.car-model {
  font-size: 0.94rem;
  font-weight: 700;
  line-height: 1.35;
  margin-bottom: 4px;
}

.car-brand-name {
  font-size: 0.78rem;
  color: var(--text-muted);
  text-transform: capitalize;
}

/* List view */

.cars-grid.is-list {
  grid-template-columns: 1fr;
  gap: 10px;
}

.cars-grid.is-list .car-card {
  display: flex;
  align-items: center;
}

.cars-grid.is-list .car-header {
  flex-direction: column-reverse;
  align-items: flex-start;
  gap: 8px;
  padding: 12px 0 12px 14px;
  flex-shrink: 0;
}

.cars-grid.is-list .car-image {
  width: 96px;
  aspect-ratio: 4 / 3;
  margin-top: 0;
  flex-shrink: 0;
}

.cars-grid.is-list .car-info {
  padding: 10px 16px;
}

/* No results */

.no-results {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 64px 24px;
  text-align: center;
  color: var(--text-muted);
}

.no-results-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--overlay-soft);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
}

.no-results-icon .icon {
  width: 24px;
  height: 24px;
}

.no-results h3 {
  color: var(--text-primary);
  font-size: 1.05rem;
  font-weight: 700;
}

/* Load more */

.load-more-container {
  display: flex;
  justify-content: center;
  margin-top: 36px;
}

@media (max-width: 768px) {
  .tool-hero {
    padding: 96px 0 48px;
  }

  .filters-section {
    padding: 48px 0 32px;
  }

  .cars-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
  }

  .cars-grid.is-list .car-header {
    padding-left: 10px;
  }

  .cars-grid.is-list .car-image {
    width: 72px;
  }

  .results-header {
    flex-wrap: wrap;
  }
}
