:root {
  --bg: #f8fafc;
  --bg-glow-1: radial-gradient(circle at 18% -20%, rgba(129, 140, 248, 0.26), transparent 58%);
  --bg-glow-2: radial-gradient(circle at 82% -35%, rgba(45, 212, 191, 0.21), transparent 55%);
  --text: #0f172a;
  --muted: #475569;
  --card: #ffffff;
  --border: #d7e3f8;
  --accent: #2563eb;
  --accent-strong: #1d4ed8;
  --accent-soft: #e0edff;
  --accent-muted: #cbd5f5;
  --shadow: 0 28px 60px rgba(15, 23, 42, 0.12);
  --radius: 22px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background-color: var(--bg);
  background-image:
    var(--bg-glow-1),
    var(--bg-glow-2),
    linear-gradient(180deg, rgba(255, 255, 255, 0.9), var(--bg));
  min-height: 100vh;
  color: var(--text);
  line-height: 1.6;
}

.auto-page {
  width: min(1120px, 100% - 2rem);
  margin: 0 auto;
  padding: 2rem 0 3rem;
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

.hero {
  background:
    radial-gradient(circle at 85% -20%, rgba(59, 130, 246, 0.35), transparent 60%),
    linear-gradient(135deg, #101a32, #162947 65%, #1c4583);
  border-radius: calc(var(--radius) + 2px);
  color: #f8fafc;
  padding: 1.8rem clamp(1rem, 3vw, 2rem);
  box-shadow: 0 18px 40px rgba(10, 23, 55, 0.45);
  position: relative;
  overflow: hidden;
  text-align: center;
  border: 1px solid rgba(148, 163, 184, 0.25);
}
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at top right, rgba(255, 255, 255, 0.22), transparent 58%);
  pointer-events: none;
}
.hero > * {
  position: relative;
  z-index: 1;
}
.hero h1 {
  margin: 0;
  font-size: clamp(1.6rem, 2.5vw, 2.05rem);
  letter-spacing: -0.01em;
  color: #fdfdfd;
  text-shadow: 0 5px 20px rgba(15, 23, 42, 0.55);
}
.hero-subhead {
  color: #fef9c3;
  font-size: 1rem;
  font-weight: 500;
  max-width: 580px;
  margin: 0.65rem auto 0;
  padding: 0.55rem 1.3rem;
  border-radius: 14px;
  background: rgba(14, 70, 110, 0.45);
  border: 1px solid rgba(254, 240, 138, 0.55);
  display: inline-flex;
  justify-content: center;
  text-shadow: 0 2px 8px rgba(2, 6, 23, 0.45);
}

.panel {
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: clamp(1.25rem, 3vw, 1.9rem);
  box-shadow: var(--shadow);
}
.panel h2 {
  margin-top: 0;
  margin-bottom: 1rem;
  font-size: 1.35rem;
  letter-spacing: -0.01em;
  color: var(--text);
}
.fitment-heading-note {
  font-size: 1.1rem;
  color: var(--text);
  font-weight: 700;
  margin-left: 0.4rem;
}
.fitment-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.fitment-heading h2 {
  margin: 0;
}
.fitment-heading-change {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--accent);
}
.fitment-heading-change.hidden {
  display: none;
}

.fitment-panel.disabled {
  opacity: 0.5;
  pointer-events: none;
}

.fitment-hint {
  font-size: 0.9rem;
  color: var(--muted);
  margin-bottom: 0.25rem;
}
.fitment-hint.hidden {
  display: none;
}


.muted { color: var(--muted); }
.err {
  color: #b91c1c;
  background: #fee2e2;
  border: 1px solid #fecaca;
  border-radius: 14px;
  padding: 0.75rem 1rem;
  margin: 0 0 1rem;
}

.affiliate-inline {
  text-align: center;
  font-size: 0.82rem;
  color: #f8fafc;
  margin: 0.3rem auto 0;
  padding: 0.28rem 0.55rem;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.18);
  display: inline-flex;
  justify-content: center;
}

.grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}
.search-row {
  margin-bottom: 0.5rem;
}
.search-action {
  align-self: end;
  display: flex;
}

.vehicle-grid {
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  column-gap: 0.9rem;
  row-gap: 0.9rem;
  align-items: end;
  position: relative;
}

.vehicle-field {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.vehicle-field select {
  min-height: 52px;
}

.vehicle-field--hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.vehicle-action {
  align-self: stretch;
  display: flex;
  align-items: flex-end;
  padding-top: 1.65rem; /* matches label height so button baseline aligns */
}

.vehicle-action button {
  width: 100%;
  min-height: 56px;
  align-self: stretch;
  transition: background 0.2s ease, transform 0.2s ease, opacity 0.2s ease;
}

.vehicle-action button[disabled] {
  opacity: 0.6;
  cursor: not-allowed;
  background: linear-gradient(120deg, #94a3b8, #94a3b8);
  box-shadow: none;
}
.vehicle-action button.is-locked {
  background: linear-gradient(120deg, #94a3b8, #94a3b8);
  color: #fff;
}

label {
  display: inline-flex;
  font-size: 0.92rem;
  font-weight: 600;
  margin-bottom: 0.45rem;
  color: var(--text);
  gap: 0.35rem;
  align-items: center;
}
.auto-page select,
.auto-page input,
.auto-page button {
  width: 100%;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: #fff;
  padding: 0.85rem 0.95rem;
  font: inherit;
  color: var(--text);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.auto-page input:focus,
.auto-page select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.18);
}
.auto-page select:disabled,
.auto-page input:disabled {
  background: #f1f5f9;
  color: #94a3b8;
  cursor: not-allowed;
}

.auto-page button {
  border: none;
  cursor: pointer;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(120deg, var(--accent), var(--accent-strong));
  box-shadow: 0 12px 25px rgba(37, 99, 235, 0.25);
}
.auto-page button:hover:not(:disabled) {
  background: linear-gradient(120deg, var(--accent-strong), #0ea5e9);
  transform: translateY(-1px);
}
.auto-page button:disabled {
  opacity: 0.55;
  box-shadow: none;
  cursor: not-allowed;
}

.hidden { display: none; }

.current-vehicle-display {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  border: 1px solid var(--accent-muted);
  background: linear-gradient(110deg, rgba(37, 99, 235, 0.08), rgba(14, 165, 233, 0.06));
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
}
.current-vehicle-label {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.78rem;
  color: var(--muted);
}
.current-vehicle-text {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
  text-align: left;
  flex: 1;
  min-width: 200px;
}
.current-vehicle-display.is-empty {
  border-style: dashed;
  background: rgba(15, 23, 42, 0.03);
}
.current-vehicle-display.is-empty .current-vehicle-text {
  color: var(--muted);
  font-weight: 500;
}
.current-vehicle-display.is-empty .current-vehicle-change-form {
  display: none;
}
.current-vehicle-change-form {
  margin-left: auto;
}
.current-vehicle-change {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 999px;
  padding: 0.35rem 0.9rem;
  border: 1px solid rgba(37, 99, 235, 0.35);
  color: var(--accent);
  font-weight: 600;
  font-size: 0.8rem;
  box-shadow: 0 6px 14px rgba(15, 23, 42, 0.12);
  cursor: pointer;
  white-space: nowrap;
}
.current-vehicle-change:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  text-decoration: none;
}

.link-row a {
  color: var(--accent);
  font-weight: 600;
}

#vehicle-form button {
  align-self: end;
}

#keyword-wrap input {
  border-radius: 999px;
  padding-left: 1.15rem;
  padding-right: 1.15rem;
}

#search-status {
  margin-top: 0.35rem;
  font-size: 0.95rem;
  color: var(--muted);
}

.affiliate-note {
  margin-top: 1.25rem;
  font-size: 0.78rem;
  color: var(--muted);
  background: rgba(15, 23, 42, 0.03);
  border-radius: 12px;
  padding: 0.75rem 1rem;
}


@media (max-width: 768px) {
  .auto-page { width: min(100%, 100% - 1rem); padding-top: 2rem; }
  .hero { padding: 1.65rem; }
  .hero h1 { font-size: 1.75rem; }
  .panel { padding: 1.1rem; }
  .vehicle-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .current-vehicle-label {
    justify-self: center;
  }
  .current-vehicle-display {
    flex-direction: column;
    text-align: center;
    gap: 0.4rem;
    align-items: stretch;
  }
  .current-vehicle-change-form {
    margin-left: 0;
    width: 100%;
    margin-top: 0.1rem;
  }
  .current-vehicle-change {
    width: 100%;
    justify-content: center;
  }
}

.vehicle-grid[data-locked="1"] label {
  opacity: 0.65;
  cursor: not-allowed;
}
.vehicle-grid[data-locked="1"] select {
  opacity: 0.8;
  color: #1f2933;
  cursor: not-allowed;
}
.fitment-more-wrap {
  margin-top: 1rem;
  text-align: center;
}
.fitment-more-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 0.85rem 1.8rem;
  font-size: 0.95rem;
  font-weight: 600;
  background: linear-gradient(120deg, var(--accent), var(--accent-strong));
  color: #fff;
  box-shadow: 0 18px 30px rgba(37, 99, 235, 0.25);
}
.fitment-more-btn:hover {
  background: linear-gradient(120deg, var(--accent-strong), #0ea5e9);
  text-decoration: none;
}

.auto-body .back-to-top {
  bottom: 1rem;
  right: 0.8rem;
  padding: 0.45rem 0.75rem;
  font-size: 0.85rem;
}

.auto-body .back-to-top svg {
  width: 0.85rem;
  height: 0.85rem;
}
