:root {
  --bg: #f7f7f8;
  --surface: #ffffff;
  --border: #e4e4e7;
  --text: #18181b;
  --text-muted: #71717a;
  --accent: #2563eb;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 4px 12px rgba(0, 0, 0, 0.04);
  --radius: 12px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f0f11;
    --surface: #18181b;
    --border: #27272a;
    --text: #f4f4f5;
    --text-muted: #a1a1aa;
    --accent: #3b82f6;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 4px 12px rgba(0, 0, 0, 0.3);
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

a {
  color: inherit;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.5rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.logo {
  font-weight: 700;
  font-size: 1.1rem;
  text-decoration: none;
  white-space: nowrap;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.9rem;
  overflow-x: auto;
  white-space: nowrap;
}

.crumb {
  text-decoration: none;
  color: var(--text-muted);
}

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

.crumb.current {
  color: var(--text);
  font-weight: 600;
}

.crumb-sep {
  color: var(--border);
}

#view {
  max-width: 960px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
  min-height: calc(100vh - 65px);
}

/* Home / search */

.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.25rem;
  padding-top: 4rem;
}

.hero h1 {
  font-size: 2.25rem;
  font-weight: 700;
  margin: 0;
}

.subtitle {
  color: var(--text-muted);
  margin: 0 0 2rem;
}

.vehicle-picker {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  width: 100%;
  max-width: 360px;
}

.vehicle-picker select {
  width: 100%;
  padding: 0.85rem 2.5rem 0.85rem 1.1rem;
  font-size: 1rem;
  font-family: inherit;
  color: var(--text);
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='9' viewBox='0 0 14 9'%3E%3Cpath d='M1 1l6 6 6-6' fill='none' stroke='%23888888' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  cursor: pointer;
}

.vehicle-picker select:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

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

.trim-picker {
  margin-top: 1.5rem;
}

.trim-prompt {
  color: var(--text-muted);
  margin: 0 0 0.6rem;
}

.trim-chips {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  flex-wrap: wrap;
}

.chip {
  padding: 0.5rem 1.1rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font-size: 0.9rem;
  font-family: inherit;
}

.chip:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* Vehicle system / part accordion */

.accordion {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.category {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.category-body {
  padding: 0 1.25rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.component {
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) - 4px);
  overflow: hidden;
}

.category-summary,
.component-summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.category-summary::-webkit-details-marker,
.component-summary::-webkit-details-marker {
  display: none;
}

.category-summary::after,
.component-summary::after {
  content: "";
  width: 8px;
  height: 8px;
  flex-shrink: 0;
  margin-left: 1rem;
  border-right: 2px solid var(--text-muted);
  border-bottom: 2px solid var(--text-muted);
  transform: rotate(-45deg);
  transition: transform 0.15s ease;
}

details[open] > .category-summary::after,
details[open] > .component-summary::after {
  transform: rotate(45deg);
}

.category-summary {
  padding: 1.1rem 1.25rem;
  font-size: 1.05rem;
  font-weight: 600;
}

.component-summary {
  padding: 0.85rem 1.1rem;
  font-size: 0.95rem;
  font-weight: 600;
}

/* Specs */

.specs-grid {
  margin: 0;
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--border);
}

.spec-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 1.2rem;
  border-bottom: 1px solid var(--border);
}

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

.spec-row dt {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin: 0;
}

.spec-row dd {
  color: var(--text);
  font-weight: 600;
  font-size: 0.95rem;
  margin: 0;
  text-align: right;
}

.empty {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin: 0;
  padding: 0 1.1rem 0.9rem;
  border-top: 1px solid var(--border);
  padding-top: 0.9rem;
}

.error,
.not-found {
  color: var(--text-muted);
  text-align: center;
  padding: 3rem 1rem;
}

.not-found a {
  color: var(--accent);
  text-decoration: none;
}

/* Suggest-an-edit form */

.suggest-btn {
  margin-top: 1.5rem;
  padding: 0.7rem 1.1rem;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  background: none;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-family: inherit;
  cursor: pointer;
  width: 100%;
}

.suggest-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.suggest-form {
  margin-top: 1.5rem;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.suggest-form label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  flex: 1;
}

.suggest-form input,
.suggest-form textarea {
  padding: 0.6rem 0.75rem;
  font-size: 0.95rem;
  font-family: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  resize: vertical;
}

.suggest-form input:focus,
.suggest-form textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.form-row {
  display: flex;
  gap: 0.9rem;
}

.hp-field {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 0.9rem;
}

.form-actions button {
  padding: 0.65rem 1.2rem;
  border: none;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 0.9rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
}

.form-actions button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.suggest-status {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.suggest-status.success {
  color: #16a34a;
}

.suggest-status.error {
  color: #dc2626;
}

/* Admin */

.admin-view {
  max-width: 720px;
  margin: 0 auto;
}

.admin-login {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding-top: 3rem;
  text-align: center;
}

.admin-login form {
  display: flex;
  gap: 0.6rem;
}

.admin-login input {
  padding: 0.7rem 1rem;
  font-size: 1rem;
  font-family: inherit;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
}

.admin-login button {
  padding: 0.7rem 1.2rem;
  border: none;
  border-radius: var(--radius);
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
}

.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.admin-header h1 {
  font-size: 1.4rem;
  margin: 0;
}

.suggestion-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.suggestion-card {
  padding: 1.1rem 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.suggestion-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.6rem;
}

.suggestion-meta a {
  font-weight: 700;
  text-decoration: none;
  color: var(--accent);
}

.suggestion-path {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.suggestion-value-label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.suggestion-value-label input {
  padding: 0.55rem 0.7rem;
  font-size: 0.95rem;
  font-family: inherit;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
}

.suggestion-note {
  font-size: 0.85rem;
  color: var(--text);
  margin: 0;
  font-style: italic;
}

.suggestion-submitter {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin: 0;
}

.suggestion-actions {
  display: flex;
  gap: 0.6rem;
}

.suggestion-actions .approve-btn {
  border-color: #16a34a;
  color: #16a34a;
}

.suggestion-actions .reject-btn {
  border-color: #dc2626;
  color: #dc2626;
}

@media (max-width: 480px) {
  .hero {
    padding-top: 2rem;
  }

  .hero h1 {
    font-size: 1.75rem;
  }

  .site-header {
    padding: 0.85rem 1rem;
  }

  #view {
    padding: 1.5rem 1rem 3rem;
  }

  .form-row {
    flex-direction: column;
  }

  .admin-login form {
    flex-direction: column;
    width: 100%;
    max-width: 280px;
  }
}
