/* ── App shell ──────────────────────────────────────────────────────────── */
.app-body {
  background: #faf9f6;
  color: #1a1a18;
  min-height: 100vh;
  font-family: 'DM Sans', sans-serif;
}

.app-nav {
  background: #1a1a18;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  gap: 2rem;
  height: 52px;
}
.app-nav-logo {
  font-family: 'DM Serif Display', serif;
  font-size: 1.25rem;
  color: #f5f0e8;
  text-decoration: none;
  letter-spacing: -0.02em;
}
.app-nav-links { display: flex; gap: 0.25rem; }
.app-nav-link {
  color: #9e9b94;
  text-decoration: none;
  font-size: 0.875rem;
  padding: 0.375rem 0.75rem;
  border-radius: 6px;
  transition: color 0.15s, background 0.15s;
}
.app-nav-link:hover { color: #f5f0e8; background: rgba(255,255,255,0.06); }
.app-nav-link.active { color: #f5f0e8; background: rgba(255,255,255,0.1); }

.app-main {
  max-width: 760px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 4rem;
}

.app-header { margin-bottom: 2rem; }
.app-title {
  font-family: 'DM Serif Display', serif;
  font-size: 2rem;
  color: #1a1a18;
  margin: 0 0 0.5rem;
  letter-spacing: -0.03em;
}
.app-subtitle { color: #6b6860; margin: 0; font-size: 1rem; }

/* ── Search form ────────────────────────────────────────────────────────── */
.search-form { margin-bottom: 2rem; }
.search-row { display: flex; gap: 0.75rem; }
.search-input {
  flex: 1;
  max-width: 240px;
  padding: 0.625rem 1rem;
  border: 1.5px solid #d4d0c8;
  border-radius: 10px;
  font-size: 1rem;
  font-family: 'DM Sans', sans-serif;
  background: #fff;
  transition: border-color 0.15s;
  outline: none;
}
.search-input:focus { border-color: #c8a96e; }
.search-btn {
  padding: 0.625rem 1.5rem;
  background: #1a1a18;
  color: #f5f0e8;
  border: none;
  border-radius: 10px;
  font-size: 0.9rem;
  font-family: 'DM Sans', sans-serif;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
}
.search-btn:hover { background: #2d2d2b; }
.search-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.search-hint { margin: 0.625rem 0 0; font-size: 0.8rem; color: #9e9b94; }

/* ── Results ────────────────────────────────────────────────────────────── */
.results-header {
  display: flex;
  gap: 0.5rem;
  align-items: baseline;
  margin-bottom: 1rem;
}
.results-count { font-weight: 600; font-size: 0.9rem; }
.results-zip { font-size: 0.875rem; color: #6b6860; }

.sale-card {
  background: #fff;
  border: 1.5px solid #e8e4db;
  border-radius: 14px;
  padding: 1.25rem;
  margin-bottom: 1rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.sale-card:hover { border-color: #c8a96e; box-shadow: 0 2px 12px rgba(0,0,0,0.06); }
.sale-card-top { display: flex; gap: 1rem; align-items: flex-start; }
.sale-info { flex: 1; }
.sale-title { font-size: 1rem; font-weight: 600; margin: 0 0 0.25rem; color: #1a1a18; }
.sale-address { font-size: 0.875rem; color: #6b6860; margin: 0 0 0.375rem; }
.sale-meta { display: flex; gap: 1rem; font-size: 0.8rem; color: #9e9b94; margin: 0 0 0.375rem; }
.sale-desc { font-size: 0.825rem; color: #6b6860; margin: 0; }

.sale-score-col { display: flex; flex-direction: column; align-items: center; gap: 0.25rem; flex-shrink: 0; }
.sale-score {
  width: 52px; height: 52px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 1.1rem;
  color: #fff;
}
.sale-score-high { background: #2d7a4f; }
.sale-score-med  { background: #c8a96e; }
.sale-score-low  { background: #aaa49a; }
.sale-score-label { font-size: 0.65rem; color: #9e9b94; text-align: center; line-height: 1.3; }

.sale-link {
  display: inline-block;
  margin-top: 0.75rem;
  font-size: 0.8rem;
  color: #c8a96e;
  text-decoration: none;
}
.sale-link:hover { text-decoration: underline; }

/* ── Upload zone ────────────────────────────────────────────────────────── */
.upload-zone {
  border: 2px dashed #d4d0c8;
  border-radius: 16px;
  padding: 2.5rem 1.5rem;
  text-align: center;
  background: #fff;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  position: relative;
  overflow: hidden;
}
.upload-zone:hover, .upload-zone.drag-over {
  border-color: #c8a96e;
  background: #fffbf4;
}
.upload-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}
.upload-icon { font-size: 2.5rem; line-height: 1; }
.upload-label { font-size: 1rem; color: #1a1a18; margin: 0; }
.upload-link {
  background: none; border: none; color: #c8a96e; cursor: pointer;
  font-size: 1rem; font-family: inherit; padding: 0; text-decoration: underline;
}
.upload-hint { font-size: 0.8rem; color: #9e9b94; margin: 0; }
.upload-preview {
  max-width: 100%; max-height: 320px;
  border-radius: 10px;
  object-fit: contain;
  display: block; margin: 0 auto;
}

.scan-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1rem;
  align-items: center;
}
.scan-btn {
  padding: 0.7rem 2rem;
  background: #1a1a18;
  color: #f5f0e8;
  border: none; border-radius: 10px;
  font-size: 0.95rem; font-family: inherit; font-weight: 500;
  cursor: pointer; transition: background 0.15s, opacity 0.15s;
}
.scan-btn:hover { background: #2d2d2b; }
.scan-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.scan-clear {
  background: none; border: 1.5px solid #d4d0c8;
  border-radius: 10px; padding: 0.6rem 1rem;
  font-size: 0.875rem; font-family: inherit;
  color: #6b6860; cursor: pointer;
  transition: border-color 0.15s;
}
.scan-clear:hover { border-color: #9e9b94; }

/* ── Loading spinner ────────────────────────────────────────────────────── */
.scan-loading {
  display: flex; flex-direction: column; align-items: center; gap: 1rem;
  padding: 2rem; color: #6b6860; font-size: 0.9rem;
}
.scan-spinner {
  width: 36px; height: 36px;
  border: 3px solid #e8e4db;
  border-top-color: #c8a96e;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Scan result ────────────────────────────────────────────────────────── */
.scan-result { margin-top: 1.5rem; }
.result-card {
  background: #fff;
  border: 1.5px solid #e8e4db;
  border-radius: 16px;
  padding: 1.5rem;
}
.result-top { display: flex; gap: 1.25rem; align-items: flex-start; margin-bottom: 1.25rem; }
.result-info { flex: 1; }
.result-category { font-size: 0.75rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: #9e9b94; margin-bottom: 0.375rem; }
.result-name { font-family: 'DM Serif Display', serif; font-size: 1.4rem; color: #1a1a18; margin: 0 0 0.5rem; letter-spacing: -0.02em; }
.result-desc { font-size: 0.875rem; color: #4a4844; margin: 0 0 0.5rem; line-height: 1.55; }
.result-condition { font-size: 0.825rem; color: #6b6860; margin: 0 0 0.75rem; }

.confidence-badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
  font-size: 0.72rem; font-weight: 600; letter-spacing: 0.04em;
  text-transform: uppercase;
}
.confidence-high   { background: #e6f4ec; color: #2d7a4f; }
.confidence-medium { background: #fef6e6; color: #b87d2a; }
.confidence-low    { background: #f5f0e8; color: #9e9b94; }

.result-score-col { display: flex; flex-direction: column; align-items: center; gap: 0.25rem; flex-shrink: 0; }
.flip-score {
  width: 64px; height: 64px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 1.4rem; color: #fff;
}
.flip-strong { background: #2d7a4f; }
.flip-decent { background: #c8a96e; }
.flip-weak   { background: #aaa49a; }
.flip-label  { font-size: 0.72rem; color: #6b6860; text-align: center; line-height: 1.3; }

.price-summary {
  display: flex;
  gap: 0;
  border: 1.5px solid #e8e4db;
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 1.25rem;
}
.price-stat {
  flex: 1; text-align: center; padding: 0.875rem 0.5rem;
  border-right: 1px solid #e8e4db;
}
.price-stat:last-child { border-right: none; }
.price-stat-num { display: block; font-weight: 700; font-size: 1.3rem; color: #1a1a18; }
.price-avg { color: #2d7a4f; }
.price-stat-label { font-size: 0.72rem; color: #9e9b94; text-transform: uppercase; letter-spacing: 0.04em; }

.comps-section { border-top: 1.5px solid #f0ece3; padding-top: 1rem; }
.comps-label { font-size: 0.72rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: #9e9b94; margin-bottom: 0.5rem; }
.comp-row { display: flex; justify-content: space-between; align-items: baseline; padding: 0.375rem 0; border-bottom: 1px solid #f5f2eb; }
.comp-row:last-child { border-bottom: none; }
.comp-title { font-size: 0.85rem; color: #4a4844; flex: 1; padding-right: 1rem; }
.comp-price { font-size: 0.9rem; font-weight: 600; color: #1a1a18; flex-shrink: 0; }

/* ── eBay comp confidence badge ─────────────────────────────────────────── */
.comp-tier-badge {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.5rem 0.85rem; border-radius: 6px;
  margin: 0.75rem 0; font-size: 0.82rem;
}
.comp-tier-label { font-weight: 600; }
.comp-tier-hint { color: inherit; opacity: 0.75; font-size: 0.78rem; }
.comp-tier-green { background: #f0fdf4; border: 1px solid #86efac; color: #166534; }
.comp-tier-yellow { background: #fefce8; border: 1px solid #fde047; color: #854d0e; }
.comp-tier-red { background: #fff7ed; border: 1px solid #fed7aa; color: #9a3412; }
.comp-tier-gpt { background: #f8f7f4; border: 1px solid #e5e0d8; color: #6b6860; }

/* ── eBay sample listing links ───────────────────────────────────────────── */
.ebay-sample-links { display: flex; flex-direction: column; gap: 0.4rem; padding: 0.75rem 0; border-top: 1.5px solid #f0ece3; }
.ebay-sample-link { font-size: 0.82rem; color: #2563eb; text-decoration: none; }
.ebay-sample-link:hover { text-decoration: underline; }

/* ── Error & empty states ───────────────────────────────────────────────── */
.empty-state, .error-state, .scan-error {
  padding: 1.25rem;
  border-radius: 12px;
  font-size: 0.9rem;
}
.empty-state { background: #f5f2eb; color: #6b6860; }
.error-state, .scan-error { background: #fef2f2; color: #9b2c2c; border: 1px solid #fecaca; }

/* ── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 520px) {
  .search-row { flex-direction: column; }
  .search-input { max-width: 100%; }
  .sale-card-top { flex-direction: column; }
  .result-top { flex-direction: column; }
  .price-summary { flex-direction: column; }
  .price-stat { border-right: none; border-bottom: 1px solid #e8e4db; }
  .price-stat:last-child { border-bottom: none; }
}
