/* Parts Section */
.parts-section {
  margin-top: 2.5rem;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  animation: slideUp 0.4s ease-out;
  margin: 0 0 16px;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.parts-header {
  padding: 2rem;
  background: #000;
  color: #fff;
}

.parts-title {
  font-family: 'Barlow', sans-serif;
  font-size: 24px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: -0.5px;
  margin-bottom: 4px;
}

.parts-sub {
  font-size: 14px;
  color: #888;
}

.parts-search-box {
  margin-top: 1.5rem;
  display: flex;
  gap: 10px;
}

.parts-search-box input {
  flex: 1;
  height: 48px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  padding: 0 16px;
  color: #fff;
  font-family: 'Barlow', sans-serif;
  font-size: 14px;
}

.parts-search-box input:focus {
  outline: none;
  border-color: #fff;
  background: rgba(255, 255, 255, 0.15);
}

.parts-search-box button {
  height: 48px;
  padding: 0 24px;
  background: #fff;
  color: #000;
  border: none;
  border-radius: 6px;
  font-family: 'Barlow', sans-serif;
  font-weight: 700;
  text-transform: uppercase;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.parts-search-box button:hover {
  background: #eee;
  transform: translateY(-1px);
}

/* --- Model/Engine selection --- */
.select-container {
  padding: 1.5rem 2rem;
  background: #fff;
  border-bottom: 1px solid #eee;
}
.select-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 1rem;
}
.select-title:last-child {
  margin-bottom: 0;
}
.select-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}
.select-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 0.5rem;
  background: #fdfdfd;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text);
  transition: all 0.2s;
  text-align: center;
}
.select-btn:hover {
  border-color: var(--blue);
  color: var(--blue);
}
.select-btn.active {
  background: var(--blue-light);
  border-color: var(--blue);
  color: var(--blue);
}

#engineSelect .select-btn {
  text-transform: uppercase;
}

/* --- Categories Grid --- */
.categories-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  padding: 1.5rem 2rem;
  background: #fff;
  border-bottom: 1px solid #eee;
}

.categories-grid .lookup-loading {
  grid-column: 1 / -1;
}

.category-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.25rem 0.5rem;
  background: #fdfdfd;
  border: 1px solid #f0f0f0;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  text-align: center;
  position: relative;
}

.category-btn:hover {
  background: #fff;
  border-color: #000;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.category-btn.active {
  background: #000;
  border-color: #000;
  color: #fff;
  box-shadow: 0 8px 20px rgba(0,0,0,0.15);
}

.cat-icon-box {
  width: 32px;
  height: 32px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.3s ease;
}

.cat-icon-box svg {
  width: 24px;
  height: 24px;
  stroke: currentColor;
}

.category-btn:hover .cat-icon-box {
  transform: scale(1.1);
}

.cat-label {
  font-family: 'Barlow', sans-serif;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  line-height: 1.2;
}

/* Image search icon on category */
.cat-img-btn {
  position: absolute;
  top: 5px;
  right: 6px;
  opacity: 0.4;
  color: #9ca3af;
  cursor: pointer;
  transition: opacity 0.15s ease, color 0.15s ease, background 0.15s ease;
  padding: 3px 4px;
  border-radius: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
}

.category-btn:hover .cat-img-btn {
  opacity: 1;
  color: #4b5563;
}

.cat-img-btn:hover {
  color: #000;
  background: rgba(0,0,0,0.06);
}

.category-btn.active .cat-img-btn {
  color: rgba(255,255,255,0.5);
}

.category-btn.active .cat-img-btn:hover {
  color: #fff;
  background: rgba(255,255,255,0.15);
}

/* --- Parts List --- */
.parts-list {
  padding: 1.5rem 2rem;
  background: #f9f9f9;
  border-bottom: 1px solid #eee;
}

.parts-list-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.part-item {
  background: #fff;
  border: 1px solid #ddd;
  padding: 8px 32px 8px 16px;
  border-radius: 20px;
  font-family: 'Barlow', sans-serif;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.part-item:hover {
  border-color: #000;
  background: #000;
  color: #fff;
}

.part-item.active {
  background: #000;
  color: #fff;
  border-color: #000;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.part-img-btn {
  position: absolute;
  right: 7px;
  top: 50%;
  transform: translateY(-50%);
  opacity: 0.4;
  color: #9ca3af;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2px;
  border-radius: 4px;
  transition: opacity 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.part-item:hover .part-img-btn {
  opacity: 1;
  color: #fff;
}

.part-item:hover .part-img-btn:hover {
  background: rgba(255,255,255,0.2);
  color: #fff;
}

.part-item.active .part-img-btn {
  color: rgba(255,255,255,0.5);
}

.part-item.active .part-img-btn:hover {
  color: #fff;
  background: rgba(255,255,255,0.15);
}

/* --- Lookup Results --- */
.lookup-results {
  padding: 2rem;
}

.lookup-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding: 3rem;
  color: var(--text-muted);
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid #eee;
  border-top-color: #000;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.result-card {
  background: #fff;
}

.result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid #000;
}

.result-title {
  font-size: 20px;
  font-weight: 800;
  text-transform: uppercase;
  margin: 0;
}

.result-img-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  border-radius: 6px;
  color: #9ca3af;
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease;
  flex-shrink: 0;
}

.result-img-btn:hover {
  color: #000;
  background: rgba(0,0,0,0.05);
}

.result-body {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.section-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: #999;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 0.75rem;
}

.oem-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.oem-row.marketplace-search-trigger {
  cursor: pointer;
}

.oem-row.marketplace-search-trigger:hover .oem-value {
  color: var(--blue);
}

.oem-row.marketplace-search-trigger.active {
  color: #fff;
  background: var(--blue);
  padding: 2px 8px;
  border-radius: 6px;
}

.oem-row.marketplace-search-trigger.active .oem-value {
  color: #fff;
}

.oem-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 24px;
  font-weight: 700;
  color: #000;
}

.market-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  border-radius: 5px;
  color: #9ca3af;
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease;
  flex-shrink: 0;
}

.oem-row:hover .market-icon,
.aftermarket-item:hover .market-icon {
  color: #4b5563;
  background: rgba(0,0,0,0.05);
}

.aftermarket-item {
  padding: 1rem;
  background: #f8f8f8;
  border-radius: 8px;
  transition: background 0.15s ease, box-shadow 0.15s ease;
  cursor: pointer;
  position: relative;
}

.aftermarket-item .market-icon {
  position: absolute;
  right: 10px;
  bottom: 10px;
  color: #9ca3af;
  transition: color 0.15s ease, background 0.15s ease;
}

.aftermarket-item:hover {
  background: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.aftermarket-item:hover .market-icon {
  color: #111;
  background: rgba(0,0,0,0.05);
}

.aftermarket-item:active {
  background: #f0f0f0;
}

.aftermarket-item.active {
  background: #eff6ff;
  box-shadow: 0 0 0 1px var(--blue);
}

.aftermarket-item .code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 16px;
  font-weight: 700;
  color: #000;
  margin: 4px 0;
}

.aftermarket-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.aftermarket-item .code.marketplace-search-trigger {
  cursor: pointer;
}

.error-msg {
  color: #ef4444;
  font-weight: 600;
  text-align: center;
  padding: 2rem;
}

.parts-disclaimer {
  font-size: 11px;
  color: #888;
  margin-top: 8px;
  line-height: 1.4;
}

.result-footer {
  margin-top: 1.5rem;
  padding: 1.5rem 2rem;
  background: #fcfcfc;
  border-top: 1px solid #eee;
  display: flex;
  align-items: center;
  gap: 12px;
  color: #888;
  font-size: 11px;
  line-height: 1.4;
}

.disclaimer-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  stroke: #facc15;
  opacity: 1;
}
