/* Market Insights — eBay-style post-scan / product price panel.
   Kurrent-styled, self-contained so it works in both the SPA and the
   standalone scanner (public/scanner.html). Dark glass palette.
   All spacing in rem to match the rest of the design system. */

.mi-panel { display: flex; flex-direction: column; gap: 1.125rem; color: #f6f1ea; }

/* Inline mount inside the product page Market card */
.pdp-insights:not(:empty) { margin-top: 1.125rem; padding-top: 1.125rem; border-top: 1px solid rgba(246, 241, 234, .08); }

.mi-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 0.75rem; }
.mi-kicker { display: block; font-size: 0.6875rem; letter-spacing: .04em; text-transform: uppercase; color: rgba(246, 241, 234, .5); margin-bottom: 0.1875rem; }
.mi-price strong { font-size: 1.875rem; font-weight: 800; line-height: 1; letter-spacing: -.01em; }
.mi-last { text-align: right; }
.mi-last strong { font-size: 1.125rem; font-weight: 700; display: block; }
.mi-last em { font-style: normal; font-size: 0.75rem; color: rgba(246, 241, 234, .5); }

.mi-trend { display: inline-flex; align-items: center; gap: 0.25rem; font-size: 0.8125rem; font-weight: 700; padding: 0.125rem 0.5rem; border-radius: 999px; margin-left: 0.375rem; }
.mi-trend.is-up   { color: #34d399; background: rgba(52, 211, 153, .12); }
.mi-trend.is-down { color: #f87171; background: rgba(248, 113, 113, .12); }
.mi-trend.is-flat { color: rgba(246, 241, 234, .6); background: rgba(246, 241, 234, .08); }

.mi-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.625rem; }
.mi-stat { background: rgba(246, 241, 234, .04); border: 1px solid rgba(246, 241, 234, .08); border-radius: 0.875rem; padding: 0.625rem 0.75rem; }
.mi-stat span { display: block; font-size: 0.6875rem; color: rgba(246, 241, 234, .5); margin-bottom: 0.1875rem; }
.mi-stat strong { font-size: 1.0625rem; font-weight: 700; }

.mi-section { display: flex; flex-direction: column; gap: 0.625rem; }
.mi-h3 { font-size: 0.8125rem; font-weight: 700; color: rgba(246, 241, 234, .7); margin: 0; }

.mi-hint { font-size: 0.6875rem; font-weight: 500; color: rgba(246, 241, 234, .4); text-transform: none; letter-spacing: 0; }
.mi-grades { display: flex; gap: 0.5rem; overflow-x: auto; padding-bottom: 0.125rem; -webkit-overflow-scrolling: touch; }
.mi-grade { flex: 0 0 auto; min-width: 5.75rem; text-align: left; background: rgba(246, 241, 234, .04); border: 1px solid rgba(246, 241, 234, .1); border-radius: 0.875rem; padding: 0.625rem 0.75rem; cursor: pointer; color: #f6f1ea; transition: border-color .12s ease, background .12s ease; }
.mi-grade:hover { border-color: rgba(228, 201, 143, .5); }
.mi-grade.is-on { border-color: #e4c98f; background: rgba(228, 201, 143, .12); }
.mi-grade-label { display: block; font-size: 0.6875rem; color: rgba(246, 241, 234, .6); margin-bottom: 0.25rem; white-space: nowrap; }
.mi-grade-price { font-size: 1rem; font-weight: 700; }

/* Clickable active-listing rows */
.mi-row { width: 100%; text-align: left; background: transparent; border: 0; cursor: pointer; color: #f6f1ea; }
.mi-row:hover { background: rgba(246, 241, 234, .04); }
.mi-row-price { display: inline-flex; align-items: center; gap: 0.5rem; }
.mi-go { color: rgba(246, 241, 234, .4); font-size: 1.125rem; line-height: 1; }

/* View full market link in the scan sheet */
.mi-fulllink { display: inline-block; margin-top: 0.25rem; font-size: 0.8125rem; font-weight: 600; color: #e4c98f; text-decoration: none; }
.mi-fulllink:hover { text-decoration: underline; }

.mi-chart { height: 11.25rem; position: relative; }

.mi-sales, .mi-active { display: flex; flex-direction: column; }
.mi-sale { display: flex; align-items: center; justify-content: space-between; gap: 0.625rem; padding: 0.5625rem 0; border-bottom: 1px solid rgba(246, 241, 234, .06); font-size: 0.875rem; }
.mi-sale:last-child { border-bottom: 0; }
.mi-sale-date { color: rgba(246, 241, 234, .5); font-size: 0.75rem; min-width: 3.25rem; }
.mi-sale-facts { flex: 1; color: rgba(246, 241, 234, .7); font-size: 0.75rem; }

.mi-empty   { color: rgba(246, 241, 234, .5); font-size: 0.8125rem; }
.mi-loading { color: rgba(246, 241, 234, .5); font-size: 0.8125rem; padding: 1rem 0; }
.mi-src     { font-size: 0.6875rem; color: rgba(246, 241, 234, .4); }

/* --- Scan result sheet (overlay) --- */
.mi-overlay { position: fixed; inset: 0; z-index: 9999; display: flex; align-items: flex-end; justify-content: center; background: rgba(0, 0, 0, .6); opacity: 0; transition: opacity .18s ease; -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.mi-overlay.is-open { opacity: 1; }
.mi-sheet-card {
  width: 100%;
  max-width: 30rem;
  max-height: 92vh;
  overflow-y: auto;
  background: #14130f;
  border: 1px solid rgba(246, 241, 234, .1);
  border-radius: 1.375rem 1.375rem 0 0;
  padding: 1.125rem 1.125rem calc(1.125rem + env(safe-area-inset-bottom));
  transform: translateY(1.125rem);
  transition: transform .22s ease;
  color: #f6f1ea;
  position: relative;
}
.mi-overlay.is-open .mi-sheet-card { transform: translateY(0); }
@media (min-width: 560px) {
  .mi-overlay { align-items: center; }
  .mi-sheet-card { border-radius: 1.375rem; }
}

.mi-x {
  position: absolute;
  top: 0.75rem;
  right: 0.875rem;
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  border: 0;
  background: rgba(246, 241, 234, .08);
  color: #f6f1ea;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
}
.mi-sheet-top { display: flex; gap: 0.75rem; align-items: center; margin-bottom: 1rem; padding-right: 2.25rem; }
.mi-sheet-img { width: 3.375rem; height: 3.375rem; border-radius: 0.75rem; object-fit: cover; background: rgba(246, 241, 234, .06); flex-shrink: 0; }
.mi-sheet-title h2 { font-size: 1.125rem; font-weight: 800; margin: 0.125rem 0 0; line-height: 1.2; }
.mi-sheet-body { margin-bottom: 1rem; }
.mi-sheet-cta {
  display: flex;
  gap: 0.625rem;
  position: sticky;
  bottom: 0;
  background: linear-gradient(to top, #14130f 70%, transparent);
  padding-top: 0.5rem;
}
.mi-cta { flex: 1; padding: 0.875rem; border-radius: 0.875rem; font-size: 0.9375rem; font-weight: 700; cursor: pointer; border: 1px solid transparent; }
.mi-cta.is-primary { background: #e4c98f; color: #1a1712; }
.mi-cta.is-ghost   { background: transparent; border-color: rgba(246, 241, 234, .18); color: #f6f1ea; }
