/* public/style.css — ScentPrice redesign: mobile-first */

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #f4f4f5;
  color: #18181b;
  -webkit-font-smoothing: antialiased;
}

/* ── Header ──────────────────────────────────────────── */
.site-header {
  background: #18181b;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.site-title {
  color: #fff;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin: 0;
}

/* ── Search ──────────────────────────────────────────── */
.search-wrap {
  padding: 16px 16px 0;
}

.search-card {
  background: #fff;
  border-radius: 12px;
  padding: 18px 16px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

.search-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: #a1a1aa;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 10px;
}

.search-row {
  display: flex;
  gap: 8px;
}

.search-input {
  flex: 1;
  border: 1.5px solid #e4e4e7;
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 16px; /* 16px prevents iOS auto-zoom */
  font-family: inherit;
  color: #18181b;
  background: #fafafa;
  outline: none;
  transition: border-color 0.15s;
  min-width: 0;
}

.search-input:focus {
  border-color: #18181b;
  background: #fff;
}

.search-btn {
  background: #18181b;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 12px 20px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  font-family: inherit;
  transition: opacity 0.15s;
  flex-shrink: 0;
}

.search-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.search-btn:active   { opacity: 0.75; }

/* ── Main content area ───────────────────────────────── */
.main-content {
  padding: 16px;
  max-width: 720px;
  margin: 0 auto;
}

/* ── Sort bar ────────────────────────────────────────── */
.sort-bar {
  display: flex;
  gap: 6px 12px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 16px;
}

.sort-group {
  display: flex;
  align-items: center;
  gap: 5px;
}

.sort-label {
  font-size: 11px;
  font-weight: 700;
  color: #a1a1aa;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.sort-btn {
  padding: 6px 13px;
  border: 1.5px solid #e4e4e7;
  border-radius: 20px;
  background: #fff;
  font-size: 12px;
  font-weight: 600;
  color: #52525b;
  cursor: pointer;
  transition: all 0.12s;
  -webkit-tap-highlight-color: transparent;
}

.sort-btn:active { opacity: 0.7; }

.sort-btn--active {
  background: #18181b;
  border-color: #18181b;
  color: #fff;
}

/* ── Status chips ────────────────────────────────────── */
.status-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 11px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
}

.status-success  { background: #dcfce7; color: #15803d; }
.status-error    { background: #fee2e2; color: #dc2626; }
.status-notfound { background: #f4f4f5; color: #71717a; }

/* ── Size card ───────────────────────────────────────── */
.size-card {
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 14px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.07), 0 1px 2px rgba(0,0,0,0.04);
}

.size-card-header {
  padding: 9px 16px;
  background: #f4f4f5;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #71717a;
}

/* ── Product block ───────────────────────────────────── */
.product-block {
  border-top: 1px solid #f4f4f5;
}

.product-block:first-of-type { border-top: none; }

.product-block-name {
  padding: 12px 16px 4px;
  font-size: 13px;
  font-weight: 700;
  color: #18181b;
  line-height: 1.35;
}

/* ── Comparison grid ─────────────────────────────────── */

.compare-header {
  display: grid;
  background: #f4f4f5;
  border-bottom: 1px solid #e4e4e7;
}

.compare-header-size {
  padding: 9px 14px;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #71717a;
}

.compare-header-retailer {
  padding: 9px 14px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #18181b;
  border-left: 1px solid #e4e4e7;
  text-transform: capitalize;
}

.compare-row {
  display: grid;
  border-top: 1px solid #f0f0f0;
}

.compare-name {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  justify-content: center;
}

.compare-name-text {
  font-size: 13px;
  font-weight: 600;
  color: #18181b;
  line-height: 1.35;
}

/* Match confidence badge */
.match-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 10px;
  line-height: 1.4;
  width: fit-content;
}

.match-high { background: #dcfce7; color: #15803d; }
.match-mid  { background: #fef9c3; color: #854d0e; }
.match-low  { background: #fee2e2; color: #dc2626; }
.match-solo { background: #f4f4f5; color: #71717a; }

/* Retailer-specific product name inside each cell */
.offer-product-name {
  font-size: 11px;
  color: #71717a;
  line-height: 1.3;
  margin-bottom: 2px;
}

.compare-cell {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 12px 14px;
  border-left: 1px solid #f0f0f0;
  text-decoration: none;
  color: inherit;
  transition: background 0.1s;
  -webkit-tap-highlight-color: transparent;
}

.compare-cell:active       { background: #f4f4f5; }
.compare-cell--best        { background: #f0fdf4; }
.compare-cell--best:active { background: #dcfce7; }

.compare-cell--missing {
  justify-content: center;
  align-items: center;
  color: #d4d4d8;
  font-size: 18px;
}

.compare-price {
  font-size: 17px;
  font-weight: 700;
  color: #18181b;
  line-height: 1.2;
}

.compare-price--best { color: #15803d; }

.best-tag {
  font-size: 10px;
  font-weight: 700;
  background: #15803d;
  color: #fff;
  padding: 1px 6px;
  border-radius: 8px;
  vertical-align: middle;
  margin-left: 4px;
}

.price-orig {
  display: block;
  font-size: 11px;
  font-weight: 400;
  color: #a1a1aa;
  text-decoration: line-through;
}

.compare-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
}

.badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 10px;
  white-space: nowrap;
  line-height: 1.4;
}

.badge-in     { background: #dcfce7; color: #15803d; }
.badge-out    { background: #fee2e2; color: #dc2626; }
.badge-tester { background: #fef3c7; color: #b45309; }
.badge-sale   { background: #fee2e2; color: #dc2626; }

.compare-link {
  font-size: 12px;
  font-weight: 600;
  color: #3b82f6;
  margin-top: 2px;
}

/* ── Empty / error states ────────────────────────────── */
.results-heading {
  font-size: 15px;
  font-weight: 700;
  margin: 0 0 14px;
  color: #18181b;
}

.empty-msg {
  text-align: center;
  padding: 48px 16px;
  color: #71717a;
  font-size: 14px;
  line-height: 1.6;
}

.error-msg {
  color: #dc2626;
  font-size: 14px;
  padding: 12px 14px;
  background: #fee2e2;
  border-radius: 8px;
}

/* ── Spinner ─────────────────────────────────────────── */
.spinner-wrap {
  display: flex;
  justify-content: center;
  padding: 64px 0;
}

.spinner {
  width: 34px;
  height: 34px;
  border: 3px solid #e4e4e7;
  border-top-color: #18181b;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

/* ── Desktop tweaks ──────────────────────────────────── */
@media (min-width: 600px) {
  .search-wrap      { padding: 24px 24px 0; }
  .main-content     { padding: 20px 24px 40px; }
  .offer-retailer   { font-size: 14px; }
  .offer-price      { font-size: 17px; }
  .product-block-name { font-size: 14px; }
}
