/* B&H Automotive — Parts Catalog · Direction B: clean white & racing green (2026-09)
   Same tokens as /assets/site.css. Class names are shared with index.php, item.php, admin/. */

:root {
  --bg: #FFFFFF;
  --surface: #F5F6F4;
  --ink: #111418;
  --ink-2: #2C3238;
  --muted: #5E656D;
  --line: #E7E9EC;
  --line-strong: #D5D9DE;
  --green: #1F4D3A;
  --green-hover: #173B2C;
  --green-tint: #E6EFEA;
  --danger: #A3312A;
  --danger-tint: #FBECEA;
  --font-display: 'Inter Tight', 'Inter', system-ui, sans-serif;
  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', monospace;
  --radius: 8px;
  --radius-lg: 14px;
}

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

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

/* ── Header ─────────────────────────────────────────────── */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: saturate(180%) blur(10px);
  -webkit-backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--line);
}
.header-inner {
  max-width: 1120px; margin: 0 auto; padding: 0 40px;
  height: 68px; display: flex; align-items: center; gap: 32px;
}
.wordmark { display: flex; align-items: center; text-decoration: none; flex-shrink: 0; }
.logo-square { display: none; }
.wordmark span {
  font-family: var(--font-display); font-weight: 700; font-size: 18px;
  letter-spacing: -0.01em; white-space: nowrap; color: var(--ink);
}
.header-nav { display: flex; gap: 4px; flex: 1; justify-content: flex-end; align-items: center; }
.header-nav a {
  font-size: 14px; font-weight: 500; color: var(--muted);
  text-decoration: none; padding: 8px 12px; border-radius: var(--radius);
  transition: color 150ms, background 150ms;
}
.header-nav a:hover { color: var(--ink); background: var(--surface); }
.header-nav a.header-phone { font-weight: 600; color: var(--green); margin-left: 8px; }
.header-nav a.header-phone:hover { color: var(--green-hover); background: transparent; }

/* ── Page frame ─────────────────────────────────────────── */
.page { max-width: 1120px; margin: 0 auto; padding: 56px 40px 96px; width: 100%; flex: 1; }
.page-label {
  display: inline-block; font-family: var(--font-mono); font-size: 12px; font-weight: 500;
  color: var(--green); background: var(--green-tint);
  padding: 4px 12px; border-radius: 999px; margin-bottom: 16px;
}
.page h1 {
  font-family: var(--font-display); font-weight: 700; font-size: 48px;
  letter-spacing: -0.03em; line-height: 1.05; margin-bottom: 12px;
}
.page-sub { font-size: 17px; color: var(--muted); margin-bottom: 36px; max-width: 64ch; }

/* ── Toolbar (search + filters) ─────────────────────────── */
.toolbar { display: flex; gap: 16px; flex-wrap: wrap; align-items: center; margin-bottom: 32px; }
.toolbar form { display: flex; gap: 8px; flex: 1; min-width: 260px; }
.search-input {
  flex: 1; font-family: var(--font-sans); font-size: 15px;
  padding: 11px 14px; background: var(--bg);
  border: 1px solid var(--line-strong); border-radius: var(--radius);
  color: var(--ink); outline: none; transition: border-color 150ms, box-shadow 150ms;
}
.search-input:focus, input[type=text]:focus, input[type=password]:focus, textarea:focus, select:focus {
  border-color: var(--green); box-shadow: 0 0 0 3px var(--green-tint);
}
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  font-size: 13px; font-weight: 500; text-decoration: none;
  padding: 7px 14px; border-radius: 999px;
  border: 1px solid var(--line-strong); color: var(--muted); background: var(--bg);
  transition: all 150ms;
}
.chip:hover { border-color: var(--ink); color: var(--ink); }
.chip.active { background: var(--green); border-color: var(--green); color: #fff; }

/* ── Part cards ─────────────────────────────────────────── */
.grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}
.card {
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 20px; overflow: hidden;
  transition: border-color 150ms, box-shadow 150ms, transform 150ms;
  display: block; text-decoration: none; color: inherit;
}
.card:hover {
  border-color: var(--line-strong);
  box-shadow: 0 8px 24px rgba(17, 20, 24, 0.08);
  transform: translateY(-2px);
}
.card-top { display: none; }
.card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.card-cat { font-size: 13px; font-weight: 500; color: var(--muted); }
.badge {
  font-size: 12px; font-weight: 500; padding: 3px 10px; border-radius: 999px; white-space: nowrap;
}
.badge.in  { background: var(--green-tint); color: var(--green); }
.badge.out { background: var(--surface); color: var(--muted); }
.card-title {
  font-family: var(--font-display); font-weight: 700; font-size: 19px;
  letter-spacing: -0.015em; line-height: 1.25; margin-bottom: 6px;
}
.card-desc { font-size: 14px; color: var(--muted); line-height: 1.55; margin-bottom: 16px; }
.card-rule { height: 1px; background: var(--line); margin-bottom: 12px; }
.card-foot { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.part-no { font-family: var(--font-mono); font-size: 12px; color: var(--green); }
.fits { font-size: 13px; color: var(--muted); text-align: right; }

.card-photo {
  margin: -20px -20px 16px; height: 190px; overflow: hidden;
  border-bottom: 1px solid var(--line); background: var(--surface);
}
.card-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ── Part detail page ───────────────────────────────────── */
.back-link {
  display: inline-block; font-size: 14px; font-weight: 500; color: var(--muted);
  text-decoration: none; margin-bottom: 28px;
}
.back-link:hover { color: var(--ink); }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 56px; align-items: start; }
.detail-grid.no-photo { grid-template-columns: 1fr; max-width: 680px; }
.detail-photo {
  border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface);
  overflow: hidden;
}
.detail-photo img { width: 100%; display: block; }
.detail-meta { display: flex; gap: 12px; align-items: center; margin-bottom: 14px; }
.detail-info h1 { font-size: 40px; margin-bottom: 10px; }
.detail-partno { font-family: var(--font-mono); font-size: 14px; color: var(--green); margin-bottom: 22px; }
.detail-desc { font-size: 17px; line-height: 1.7; color: var(--ink-2); margin-bottom: 28px; max-width: 60ch; }
.detail-facts {
  display: grid; grid-template-columns: auto 1fr; gap: 0 24px;
  background: var(--surface); border-radius: var(--radius-lg); padding: 8px 20px; margin-bottom: 28px;
}
.detail-facts dt, .detail-facts dd { padding: 12px 0; border-bottom: 1px solid var(--line); }
.detail-facts dt:last-of-type, .detail-facts dd:last-of-type { border-bottom: none; }
.detail-facts dt { font-size: 13px; font-weight: 500; color: var(--muted); }
.detail-facts dd { font-size: 15px; margin: 0; }
.detail-cta { margin-bottom: 16px; }
.detail-note { font-size: 14px; color: var(--muted); max-width: 48ch; }

.empty {
  border: 1px dashed var(--line-strong); border-radius: var(--radius-lg);
  padding: 64px 20px; text-align: center; font-size: 15px; color: var(--muted);
}

/* ── Buttons & forms ────────────────────────────────────── */
.btn {
  font-family: var(--font-sans); font-size: 14px; font-weight: 500;
  padding: 10px 18px; cursor: pointer; border-radius: var(--radius);
  background: var(--bg); border: 1px solid var(--line-strong); color: var(--ink);
  text-decoration: none; display: inline-block; line-height: 1.4;
  transition: background 150ms, border-color 150ms, color 150ms;
}
.btn:hover { border-color: var(--ink); }
.btn-primary { background: var(--green); border-color: var(--green); color: #fff; }
.btn-primary:hover { background: var(--green-hover); border-color: var(--green-hover); }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-danger { border-color: #E9C6C2; color: var(--danger); }
.btn-danger:hover { background: var(--danger-tint); border-color: var(--danger); }

.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.form-grid .full { grid-column: 1 / -1; }
label.field-label {
  display: block; font-size: 13px; font-weight: 500; color: var(--ink-2); margin-bottom: 6px;
}
input[type=text], input[type=password], textarea, select {
  width: 100%; font-family: var(--font-sans); font-size: 15px;
  padding: 10px 12px; background: var(--bg);
  border: 1px solid var(--line-strong); border-radius: var(--radius);
  color: var(--ink); outline: none; transition: border-color 150ms, box-shadow 150ms;
}
textarea { resize: vertical; min-height: 72px; }
.check-row { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 500; }
.check-row input { accent-color: var(--green); width: 16px; height: 16px; }

.panel {
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 28px; margin-bottom: 36px;
}
.panel h2 {
  font-family: var(--font-display); font-size: 22px; font-weight: 700;
  letter-spacing: -0.015em; margin-bottom: 20px;
}
.panel-accent { border-color: var(--green); box-shadow: 0 0 0 3px var(--green-tint); }

.alert {
  border: 1px solid #E9C6C2; background: var(--danger-tint); color: var(--danger);
  border-radius: var(--radius); font-size: 14px; font-weight: 500;
  padding: 12px 16px; margin-bottom: 24px;
}

/* ── Admin table ────────────────────────────────────────── */
.admin-table { width: 100%; border-collapse: collapse; }
.admin-table th {
  font-size: 12px; font-weight: 600; color: var(--muted); text-align: left;
  text-transform: uppercase; letter-spacing: 0.05em;
  padding: 10px 12px; border-bottom: 1px solid var(--line-strong);
}
.admin-table td {
  padding: 12px; border-bottom: 1px solid var(--line);
  font-size: 14px; vertical-align: top;
}
.admin-table tr:hover td { background: var(--surface); }
.admin-table td.mono { font-family: var(--font-mono); font-size: 12px; color: var(--green); }
.admin-table .row-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.admin-table form { display: inline; }

/* ── Footer ─────────────────────────────────────────────── */
.site-footer { background: var(--ink); color: #C9CDD2; margin-top: auto; }
.footer-inner {
  max-width: 1120px; margin: 0 auto; padding: 56px 40px 40px;
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 48px; flex-wrap: wrap;
}
.footer-brand { display: flex; flex-direction: column; gap: 6px; }
.footer-logo-row { display: flex; align-items: center; }
.footer-logo-square { display: none; }
.footer-logo-row span {
  font-family: var(--font-display); font-weight: 700; font-size: 18px;
  color: #fff; letter-spacing: -0.01em;
}
.footer-tagline { font-size: 14px; color: #8C939B; }
.footer-info { display: flex; flex-direction: column; gap: 4px; align-items: flex-end; text-align: right; }
.footer-line { font-size: 14px; color: #C9CDD2; }
.footer-phone { font-size: 16px; font-weight: 600; color: #fff; text-decoration: none; }
.footer-phone:hover { color: #E3B32A; }
.footer-bottom {
  border-top: 1px solid #262B31; max-width: 1120px; margin: 0 auto;
  padding: 18px 40px; display: flex; justify-content: space-between; gap: 16px;
}
.footer-copy { font-size: 13px; color: #8C939B; }

.thumb { width: 48px; height: 36px; object-fit: cover; border: 1px solid var(--line); border-radius: 6px; display: block; }
.no-thumb { color: var(--muted); font-size: 13px; }

@media (max-width: 800px) {
  .detail-grid { grid-template-columns: 1fr; gap: 32px; }
}
@media (max-width: 640px) {
  .header-inner, .page, .footer-inner, .footer-bottom { padding-left: 16px; padding-right: 16px; }
  .header-inner { gap: 12px; }
  .page { padding-top: 40px; }
  .page h1 { font-size: 36px; }
  .header-nav a { padding: 8px 6px; font-size: 13px; }
  .footer-info { align-items: flex-start; text-align: left; }
  .footer-bottom { flex-direction: column; gap: 4px; }
  .admin-table { display: block; overflow-x: auto; }
}
