/* AutoParts Source — mobile-first responsive styles */
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif; background: #f8fafc; color: #0f172a; line-height: 1.5; }
.wrap { max-width: 64rem; margin: 0 auto; padding: 0 1rem; }

.site-header { background: #fff; border-bottom: 1px solid #e2e8f0; }
.header-inner { display: flex; align-items: center; gap: .5rem; padding: 1rem; }
.logo { font-size: 1.25rem; font-weight: 800; color: #0f172a; text-decoration: none; }
.logo span { color: #ea580c; }
.tagline { margin-left: auto; font-size: .8rem; color: #64748b; display: none; }
@media (min-width: 640px) { .tagline { display: block; } }

.hero { background: linear-gradient(180deg, #0f172a, #1e293b); color: #fff; text-align: center; padding: 3rem 1rem; margin: 0 -1rem 2rem; }
.hero h1 { font-size: clamp(1.5rem, 4vw, 2.25rem); max-width: 40rem; margin: 0 auto; }
.hero p { color: #cbd5e1; max-width: 34rem; margin: .75rem auto 0; }

.picker { display: grid; gap: .75rem; grid-template-columns: 1fr; max-width: 56rem; margin: 2rem auto 0; background: rgba(255,255,255,.08); padding: 1rem; border-radius: 1rem; }
@media (min-width: 640px) { .picker { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .picker { grid-template-columns: repeat(5, 1fr); } }
.picker select { width: 100%; padding: .65rem .75rem; border: 1px solid #cbd5e1; border-radius: .5rem; background: #fff; font-size: .95rem; color: #0f172a; }
.picker select:disabled { opacity: .55; cursor: not-allowed; }

.features { display: grid; gap: 1rem; grid-template-columns: 1fr; padding-bottom: 2.5rem; }
@media (min-width: 640px) { .features { grid-template-columns: repeat(3, 1fr); } }
.feature { background: #fff; border: 1px solid #e2e8f0; border-radius: .75rem; padding: 1.25rem; }
.feature h3 { font-size: 1rem; margin-bottom: .25rem; }
.feature p { font-size: .875rem; color: #64748b; }

.crumbs { font-size: .875rem; color: #64748b; margin-bottom: 1.25rem; }
.crumbs a { color: #ea580c; text-decoration: none; }
.sub { color: #64748b; font-size: .9rem; margin: .25rem 0 1.5rem; }

.supplier-list { display: grid; gap: 1rem; padding-bottom: 2.5rem; }
.supplier-card { background: #fff; border: 1px solid #e2e8f0; border-radius: .75rem; padding: 1.25rem; }
.supplier-card:hover { box-shadow: 0 4px 12px rgba(15,23,42,.08); }
.sc-top { display: flex; justify-content: space-between; gap: .75rem; align-items: flex-start; }
.sc-top h3 { font-size: 1rem; display: inline; }
.sc-meta { font-size: .85rem; color: #64748b; margin-top: .25rem; }
.trust { white-space: nowrap; font-size: .75rem; font-weight: 700; border-radius: 999px; padding: .25rem .6rem; border: 1px solid; }
.trust-high { background: #ecfdf5; color: #065f46; border-color: #6ee7b7; }
.trust-mid  { background: #fffbeb; color: #92400e; border-color: #fcd34d; }
.trust-low  { background: #f1f5f9; color: #475569; border-color: #cbd5e1; }

.badge { display: inline-block; font-size: .72rem; font-weight: 600; border-radius: .35rem; padding: .15rem .45rem; border: 1px solid; margin: .35rem .35rem 0 0; }
.badge-top { background: #f59e0b; color: #fff; border-color: #f59e0b; }
.badge-blue { color: #1d4ed8; border-color: #93c5fd; }
.badge-green { color: #047857; border-color: #6ee7b7; }

.sc-stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: .5rem 1.5rem; margin-top: 1rem; font-size: .9rem; }
@media (min-width: 640px) { .sc-stats { grid-template-columns: repeat(4, 1fr); } }
.sc-stats dt { color: #94a3b8; font-size: .8rem; }
.sc-stats dd { font-weight: 600; }

.sc-foot { display: flex; justify-content: space-between; align-items: center; gap: 1rem; border-top: 1px solid #e2e8f0; margin-top: 1rem; padding-top: 1rem; }
.price { font-size: 1.1rem; font-weight: 800; }
.btn { background: #ea580c; color: #fff; text-decoration: none; font-weight: 600; font-size: .9rem; padding: .55rem 1rem; border-radius: .5rem; white-space: nowrap; }
.btn:hover { background: #c2410c; }

.site-footer { border-top: 1px solid #e2e8f0; background: #fff; padding: 1.5rem 0; text-align: center; font-size: .8rem; color: #94a3b8; }

/* Admin */
.admin-box { max-width: 26rem; margin: 4rem auto; background: #fff; border: 1px solid #e2e8f0; border-radius: .75rem; padding: 2rem; }
.admin-box input { width: 100%; padding: .6rem; margin-bottom: .75rem; border: 1px solid #cbd5e1; border-radius: .5rem; }
.admin-table { width: 100%; border-collapse: collapse; background: #fff; font-size: .9rem; }
.admin-table th, .admin-table td { border-bottom: 1px solid #e2e8f0; padding: .6rem .75rem; text-align: left; }
.stat-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: .75rem; margin: .5rem 0 1rem; }
.stat-card { background: #fff; border: 1px solid #e2e8f0; border-radius: .75rem; padding: 1rem; text-align: center; }
.stat-num { display: block; font-size: 1.6rem; font-weight: 800; color: #0f172a; }
.stat-label { font-size: .8rem; color: #64748b; }
@media (max-width: 480px) { .stat-cards { grid-template-columns: 1fr; } }
.admin-table th { background: #f1f5f9; }
.admin-tabs { display: flex; flex-wrap: wrap; gap: .25rem; border-bottom: 2px solid #e2e8f0; margin: 1rem 0 0; }
.admin-tabs a { padding: .55rem .9rem; font-size: .88rem; font-weight: 600; color: #64748b; text-decoration: none; border-radius: .5rem .5rem 0 0; border: 1px solid transparent; border-bottom: 0; }
.admin-tabs a:hover { color: #0f172a; background: #f1f5f9; }
.admin-tabs a.active { color: #ea580c; background: #fff; border-color: #e2e8f0; position: relative; top: 2px; }
.admin-tabs a.logout { margin-left: auto; color: #b91c1c; }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0 1rem; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }
.check-row { display: flex; gap: 1.25rem; margin: .25rem 0 .75rem; }
.check-row label { display: inline-flex; align-items: center; gap: .35rem; font-size: .9rem; }
.picker-retry { background: none; border: 0; color: #ea580c; font: inherit; font-weight: 600; text-decoration: underline; cursor: pointer; padding: 0; }
.picker-status:not(.visually-hidden) { display: block; margin: .75rem auto 0; max-width: 34rem; padding: .6rem .9rem; background: #fef3c7; border: 1px solid #fcd34d; border-radius: .5rem; color: #92400e; font-size: .9rem; }

/* ─── Accessibility (WCAG 2.1 AA) ─────────────────────────────────────────── */

.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute; left: -999px; top: 0; z-index: 100;
  background: #0f172a; color: #fff; padding: .6rem 1rem; border-radius: 0 0 .5rem 0;
}
.skip-link:focus { left: 0; color: #fff; }

/* Visible keyboard focus everywhere */
a:focus-visible, button:focus-visible, select:focus-visible, input:focus-visible,
summary:focus-visible, textarea:focus-visible, [tabindex]:focus-visible {
  outline: 3px solid #ea580c; outline-offset: 2px;
}

/* Respect reduced-motion preferences */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ─── Navigation ──────────────────────────────────────────────────────────── */
.nav-list { display: flex; gap: 1rem; list-style: none; margin-left: auto; }
.nav-list a { color: #334155; text-decoration: none; font-size: .9rem; white-space: nowrap; }
.nav-list a:hover { color: #ea580c; }
@media (max-width: 480px) {
  .header-inner { flex-wrap: wrap; row-gap: .35rem; }
  .nav-list { gap: .8rem; }
  .nav-list a { font-size: .82rem; }
}

/* ─── Breadcrumbs ─────────────────────────────────────────────────────────── */
.crumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: .4rem; padding: 0; }

/* ─── Page titles, FAQ, legal ─────────────────────────────────────────────── */
.page-title { font-size: clamp(1.4rem, 3.5vw, 2rem); }
.faq { margin: 2rem 0; }
.faq h2 { font-size: 1.25rem; margin-bottom: .75rem; }
.faq details { background: #fff; border: 1px solid #e2e8f0; border-radius: .5rem; padding: .9rem 1rem; margin-bottom: .5rem; }
.faq summary { cursor: pointer; font-weight: 600; }
.faq details p { margin-top: .5rem; color: #475569; font-size: .9rem; }
.legal { max-width: 46rem; padding-bottom: 2.5rem; }
.legal h2 { font-size: 1.1rem; margin: 1.5rem 0 .4rem; }
.legal p, .legal li { color: #334155; font-size: .95rem; margin-bottom: .4rem; }
.legal ul { padding-left: 1.25rem; }
.legal a { color: #ea580c; }

/* ─── Footer ──────────────────────────────────────────────────────────────── */
.footer-links { list-style: none; display: flex; flex-wrap: wrap; gap: 1rem; justify-content: center; padding: 0 0 .75rem; }
.footer-links a { color: #64748b; font-size: .82rem; }
.footer-links a:hover { color: #ea580c; }

/* ─── Cookie consent banner ───────────────────────────────────────────────── */
#cookie-banner {
  position: fixed; inset: auto 0 0 0; z-index: 200;
  background: #0f172a; color: #e2e8f0; padding: 1rem;
  box-shadow: 0 -4px 20px rgba(0,0,0,.3);
}
.cb-inner { max-width: 64rem; margin: 0 auto; display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; }
.cb-inner p { flex: 1 1 20rem; font-size: .85rem; margin: 0; }
.cb-inner a { color: #fdba74; }
.cb-actions { display: flex; gap: .5rem; }
.btn-ghost { background: transparent; border: 1px solid #94a3b8; }
.btn-ghost:hover { background: rgba(255,255,255,.1); }


/* ─── 4-input picker (Make / Model / Year / Part name) ────────────────────── */
.picker-4 { grid-template-columns: 1fr; }
@media (min-width: 640px) { .picker-4 { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .picker-4 { grid-template-columns: 1fr 1fr 1fr 1.6fr auto; } }
.picker-field { position: relative; }
.picker input[type="search"] {
  width: 100%; padding: .65rem .75rem; border: 1px solid #cbd5e1; border-radius: .5rem;
  background: #fff; font-size: .95rem; color: #0f172a;
}
.picker-submit {
  width: 100%; padding: .65rem 1.1rem; border: 0; border-radius: .5rem;
  background: #ea580c; color: #fff; font-size: .95rem; font-weight: 700; cursor: pointer;
  white-space: nowrap;
}
.picker-submit:hover { background: #c2410c; }
.picker-status { grid-column: 1 / -1; }

/* Part-name suggestion dropdown */
.part-suggestions {
  position: absolute; top: calc(100% + .25rem); left: 0; right: 0; z-index: 60;
  list-style: none; margin: 0; padding: .25rem; background: #fff; color: #0f172a;
  border: 1px solid #cbd5e1; border-radius: .5rem; box-shadow: 0 8px 24px rgba(15,23,42,.18);
  max-height: 16rem; overflow-y: auto; text-align: left;
}
.part-suggestions li {
  display: flex; justify-content: space-between; align-items: baseline; gap: .75rem;
  padding: .5rem .6rem; border-radius: .35rem; cursor: pointer; font-size: .92rem;
}
.part-suggestions li:hover, .part-suggestions li.active { background: #ffedd5; }
.part-suggestions .sugg-cat { color: #64748b; font-size: .78rem; white-space: nowrap; }

/* "Did you mean" match list (typed part names with several close matches) */
.match-list { list-style: none; margin: 1rem 0 2rem; padding: 0; max-width: 40rem; }
.match-list li {
  display: flex; justify-content: space-between; align-items: baseline; gap: 1rem;
  background: #fff; border: 1px solid #e2e8f0; border-radius: .5rem;
  padding: .7rem 1rem; margin-bottom: .5rem;
}
.match-list a { color: #ea580c; font-weight: 600; text-decoration: none; }
.match-list a:hover { text-decoration: underline; }
.match-cat { color: #64748b; font-size: .8rem; white-space: nowrap; }

/* ─── 404 page ────────────────────────────────────────────────────────────── */
.notfound { text-align: center; padding: 4rem 1rem; }
.notfound .btn { display: inline-block; margin: .5rem .35rem 0; }
.notfound .btn-ghost { border-color: #cbd5e1; color: #334155; }
