/* ==========================================================================
   JiNDA Market Trends — scoped styles
   All rules scoped under .jinda-mt to avoid theme conflicts
   ========================================================================== */

.jinda-mt {
  --mt-teal: #17b8a6;
  --mt-teal-dark: #0e8e80;
  --mt-teal-soft: #e6f8f6;
  --mt-green: #8cc63f;
  --mt-orange: #f5a623;
  --mt-ink: #16202c;
  --mt-body: #44526a;
  --mt-muted: #7b8a9e;
  --mt-line: #e3e9f0;
  --mt-bg-soft: #f7fafc;
  --mt-white: #fff;
  --mt-radius: 14px;
  --mt-shadow: 0 1px 2px rgba(16, 40, 60, .04), 0 10px 26px rgba(16, 40, 60, .06);

  max-width: 1180px;
  margin: 0 auto;
  padding: 0 4px;
  color: var(--mt-body);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  box-sizing: border-box;
}
.jinda-mt *,
.jinda-mt *::before,
.jinda-mt *::after { box-sizing: border-box; }

/* 防止在主题的 flex/grid 容器中被子元素宽度撑开（移动端横向溢出的常见根因） */
.jinda-mt,
.jinda-mt__section,
.jinda-mt__cards,
.jinda-mt__chart-card,
.jinda-mt__table-wrap,
.jinda-mt__bars,
.jinda-mt__bar { min-width: 0; max-width: 100%; }

.jinda-mt__loading,
.jinda-mt__error {
  padding: 56px 20px;
  text-align: center;
  color: var(--mt-muted);
  background: var(--mt-bg-soft);
  border: 1px dashed var(--mt-line);
  border-radius: var(--mt-radius);
}

/* ---------- Header / market switcher ---------- */
.jinda-mt__bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  padding: 16px 20px;
  background: linear-gradient(135deg, #f0fbfa 0%, #f6fdf4 100%);
  border: 1px solid var(--mt-line);
  border-radius: var(--mt-radius);
  margin-bottom: 22px;
}
.jinda-mt__bar-icon { font-size: 20px; line-height: 1; }
.jinda-mt__bar-text { flex: 1 1 240px; min-width: 200px; }
.jinda-mt__bar-title {
  display: block;
  font-size: 15px;
  font-weight: 700;
  color: var(--mt-ink);
}
.jinda-mt__bar-sub { display: block; font-size: 12.5px; color: var(--mt-muted); }

.jinda-mt__select-wrap { position: relative; display: inline-flex; align-items: center; }
.jinda-mt__select {
  appearance: none;
  -webkit-appearance: none;
  padding: 10px 38px 10px 14px;
  font-size: 14px;
  font-weight: 600;
  color: var(--mt-ink);
  background: var(--mt-white);
  border: 1.5px solid var(--mt-teal);
  border-radius: 10px;
  cursor: pointer;
  outline: none;
}
.jinda-mt__select:focus-visible { box-shadow: 0 0 0 3px var(--mt-teal-soft); }
.jinda-mt__select-wrap::after {
  content: "";
  position: absolute;
  right: 14px;
  width: 0; height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid var(--mt-teal);
  pointer-events: none;
}

/* ---------- Section blocks ---------- */
.jinda-mt__section { margin-bottom: 26px; }
.jinda-mt__h2 {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0 0 14px;
  font-size: 17px;
  font-weight: 700;
  color: var(--mt-ink);
  line-height: 1.3;
}
.jinda-mt__h2::before {
  content: "";
  width: 4px;
  height: 17px;
  border-radius: 2px;
  background: linear-gradient(180deg, var(--mt-teal), var(--mt-green));
}
.jinda-mt__hint {
  margin: -6px 0 14px;
  font-size: 12.5px;
  color: var(--mt-muted);
}

/* ---------- Overview cards ---------- */
.jinda-mt__cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px;
}
.jinda-mt__card {
  padding: 18px 18px 16px;
  background: var(--mt-white);
  border: 1px solid var(--mt-line);
  border-radius: var(--mt-radius);
  box-shadow: var(--mt-shadow);
}
.jinda-mt__card-label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: .02em;
  text-transform: uppercase;
  color: var(--mt-muted);
  margin-bottom: 7px;
}
.jinda-mt__card-value {
  display: block;
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -.02em;
  color: var(--mt-teal-dark);
  line-height: 1.15;
}
.jinda-mt__card-foot {
  display: block;
  margin-top: 6px;
  font-size: 12px;
  color: var(--mt-muted);
}

/* ---------- Keyword chips ---------- */
.jinda-mt__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 16px;
}
.jinda-mt__chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 11px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--mt-body);
  background: var(--mt-white);
  border: 1.5px solid var(--mt-line);
  border-radius: 999px;
  cursor: pointer;
  transition: border-color .15s, background .15s, color .15s;
}
.jinda-mt__chip:hover { border-color: #b9d9d5; }
.jinda-mt__chip.is-active {
  color: var(--mt-teal-dark);
  background: var(--mt-teal-soft);
  border-color: var(--mt-teal);
}
.jinda-mt__chip-dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  flex: 0 0 auto;
}
.jinda-mt__chip-trend { font-size: 11px; font-weight: 700; }
.jinda-mt__chip-trend.is-up { color: #12876f; }
.jinda-mt__chip-trend.is-down { color: #c2410c; }
.jinda-mt__chip-trend.is-flat { color: var(--mt-muted); }

/* ---------- Chart ---------- */
.jinda-mt__chart-card {
  padding: 18px 16px 10px;
  background: var(--mt-white);
  border: 1px solid var(--mt-line);
  border-radius: var(--mt-radius);
  box-shadow: var(--mt-shadow);
}
.jinda-mt__chart-svg { display: block; width: 100%; height: auto; overflow: visible; }
.jinda-mt__grid-line { stroke: #eef2f7; stroke-width: 1; }
.jinda-mt__axis-text { font-size: 11px; fill: var(--mt-muted); }
.jinda-mt__area { opacity: .14; }
.jinda-mt__line { fill: none; stroke-width: 2.4; stroke-linejoin: round; stroke-linecap: round; }
.jinda-mt__dot { stroke: #fff; stroke-width: 2; }
.jinda-mt__tooltip {
  font-size: 11.5px;
  font-weight: 600;
  fill: var(--mt-ink);
}

/* ---------- Products table ---------- */
.jinda-mt__table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--mt-white);
  border: 1px solid var(--mt-line);
  border-radius: var(--mt-radius);
  box-shadow: var(--mt-shadow);
}
.jinda-mt__table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
  min-width: 680px;
}
.jinda-mt__table thead th {
  padding: 12px 14px;
  text-align: left;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .03em;
  text-transform: uppercase;
  color: var(--mt-muted);
  background: var(--mt-bg-soft);
  border-bottom: 1px solid var(--mt-line);
  white-space: nowrap;
}
.jinda-mt__table tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
}
.jinda-mt__table tbody tr:last-child td { border-bottom: 0; }
.jinda-mt__table tbody tr:hover { background: #fbfdfe; }
.jinda-mt__prod { display: flex; align-items: center; gap: 11px; min-width: 260px; }
.jinda-mt__prod-img {
  width: 46px; height: 46px;
  flex: 0 0 auto;
  object-fit: contain;
  background: var(--mt-bg-soft);
  border: 1px solid var(--mt-line);
  border-radius: 9px;
}
.jinda-mt__prod-title {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 13px;
  font-weight: 600;
  color: var(--mt-ink);
  line-height: 1.4;
}
.jinda-mt__num { font-weight: 700; color: var(--mt-ink); white-space: nowrap; }
.jinda-mt__rank {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px; height: 22px;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--mt-muted);
  background: var(--mt-bg-soft);
  border-radius: 6px;
}
.jinda-mt__rank.is-top { color: #fff; background: var(--mt-teal); }
.jinda-mt__stars { color: var(--mt-orange); font-size: 12px; white-space: nowrap; }
.jinda-mt__stars span { color: var(--mt-muted); }

/* ---------- Bar lists (brands / price) ---------- */
.jinda-mt__bars {
  padding: 18px;
  background: var(--mt-white);
  border: 1px solid var(--mt-line);
  border-radius: var(--mt-radius);
  box-shadow: var(--mt-shadow);
}
.jinda-mt__bar-row { margin-bottom: 14px; }
.jinda-mt__bar-row:last-child { margin-bottom: 0; }
.jinda-mt__bar-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
  font-size: 13px;
}
.jinda-mt__bar-name {
  font-weight: 600;
  color: var(--mt-ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.jinda-mt__bar-val { font-weight: 700; color: var(--mt-teal-dark); white-space: nowrap; }
.jinda-mt__bar-track {
  height: 8px;
  background: #eef2f7;
  border-radius: 999px;
  overflow: hidden;
}
.jinda-mt__bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--mt-teal), var(--mt-green));
}
.jinda-mt__bar-fill.is-alt { background: linear-gradient(90deg, #6fc3e8, var(--mt-teal)); }
.jinda-mt__bar-fill.is-warm { background: linear-gradient(90deg, var(--mt-orange), #ffd28a); }

/* ---------- Footer note ---------- */
.jinda-mt__note {
  margin-top: 26px;
  padding: 14px 16px;
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--mt-muted);
  background: var(--mt-bg-soft);
  border-left: 3px solid var(--mt-teal);
  border-radius: 0 10px 10px 0;
}
.jinda-mt__note strong { color: var(--mt-body); }
.jinda-mt__updated { font-size: 12.5px; color: var(--mt-muted); }

/* ---------- CTA ---------- */
.jinda-mt__cta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 26px;
  padding: 22px 24px;
  background: linear-gradient(135deg, #0e8e80 0%, #17b8a6 100%);
  border-radius: var(--mt-radius);
  color: #fff;
}
.jinda-mt__cta-text { flex: 1 1 320px; }
.jinda-mt__cta-title { display: block; font-size: 17px; font-weight: 700; margin-bottom: 4px; }
.jinda-mt__cta-sub { display: block; font-size: 13.5px; opacity: .92; }
.jinda-mt__cta-btn {
  display: inline-block;
  padding: 12px 24px;
  font-size: 14px;
  font-weight: 700;
  color: var(--mt-teal-dark);
  background: #fff;
  border-radius: 10px;
  text-decoration: none;
  white-space: nowrap;
  transition: transform .15s, box-shadow .15s;
}
.jinda-mt__cta-btn:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(0, 0, 0, .18); }

/* ---------- Responsive ---------- */
@media (max-width: 782px) {
  .jinda-mt { font-size: 14px; }
  .jinda-mt__card-value { font-size: 22px; }
  .jinda-mt__bar { padding: 14px; gap: 11px; }
  .jinda-mt__select { width: 100%; }
  .jinda-mt__select-wrap { flex: 1 1 100%; }
  .jinda-mt__table { min-width: 560px; font-size: 13px; }
  .jinda-mt__prod { min-width: 200px; }
  .jinda-mt__cards { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
  .jinda-mt__card { padding: 14px; }
  .jinda-mt__cta { padding: 18px; }
}
@media (max-width: 480px) {
  .jinda-mt__cards { grid-template-columns: 1fr 1fr; }
  .jinda-mt__card-value { font-size: 19px; }
}

/* ---------- Category tag on chips ---------- */
.jinda-mt__chip-cat {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .03em;
  text-transform: uppercase;
  color: var(--mt-muted);
  background: var(--mt-bg-soft);
  border-radius: 4px;
  padding: 1px 5px;
}
.jinda-mt__chip.is-active .jinda-mt__chip-cat {
  color: var(--mt-teal-dark);
  background: rgba(255, 255, 255, .75);
}

/* ==========================================================================
   商品卡片流（卖家精灵风格）
   ========================================================================== */
.jinda-mt__muted { color: var(--mt-muted); font-weight: 400; }
.jinda-mt__stars-chars { color: var(--mt-orange); letter-spacing: -.5px; }
.jinda-mt__hint--top { margin-top: 0; }
.jinda-mt__cards--2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.jinda-mt__chip-vol { font-size: 11px; font-weight: 700; color: var(--mt-teal-dark); }

/* 区块标题 + 排序控件 */
.jinda-mt__listhead {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 4px;
}
.jinda-mt__listhead .jinda-mt__h2 { margin: 0; }
.jinda-mt__sortwrap { display: inline-flex; align-items: center; gap: 7px; }
.jinda-mt__sortlabel { font-size: 12px; font-weight: 600; color: var(--mt-muted); }
.jinda-mt__sort {
  appearance: none;
  -webkit-appearance: none;
  padding: 7px 28px 7px 11px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--mt-ink);
  background: var(--mt-white) url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%2317b8a6'/%3E%3C/svg%3E") no-repeat right 10px center;
  border: 1.5px solid var(--mt-line);
  border-radius: 9px;
  cursor: pointer;
}
.jinda-mt__sort:focus-visible { outline: none; border-color: var(--mt-teal); }

/* 卡片网格 */
.jinda-mt__pgrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(268px, 1fr));
  gap: 16px;
  align-items: start;
}

/* 单个商品卡片 */
.jinda-mt__pcard {
  display: flex;
  flex-direction: column;
  background: var(--mt-white);
  border: 1px solid var(--mt-line);
  border-radius: var(--mt-radius);
  box-shadow: var(--mt-shadow);
  overflow: hidden;
  transition: box-shadow .18s ease, transform .18s ease;
}
.jinda-mt__pcard:hover {
  box-shadow: 0 2px 4px rgba(16, 40, 60, .05), 0 14px 34px rgba(16, 40, 60, .12);
  transform: translateY(-2px);
}
.jinda-mt__pcard-media {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 190px;
  padding: 14px;
  background: #fff;
  border-bottom: 1px solid var(--mt-line);
}
.jinda-mt__pcard-media img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  mix-blend-mode: multiply;
}
.jinda-mt__pcard-noimg { font-size: 12px; color: var(--mt-muted); }

.jinda-mt__pcard-body { display: flex; flex-direction: column; flex: 1; padding: 14px 15px 15px; }

.jinda-mt__pcard-title {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 8px;
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.45;
  color: var(--mt-ink);
  text-decoration: none;
}
.jinda-mt__pcard-title:hover { color: var(--mt-teal-dark); text-decoration: underline; }

.jinda-mt__pcard-rating {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12.5px;
  color: var(--mt-body);
  margin-bottom: 6px;
}
.jinda-mt__pcard-bought {
  display: inline-block;
  align-self: flex-start;
  margin-bottom: 9px;
  padding: 3px 9px;
  font-size: 11.5px;
  font-weight: 700;
  color: #0b7261;
  background: var(--mt-teal-soft);
  border-radius: 999px;
}
.jinda-mt__pcard-price {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 21px;
  font-weight: 800;
  letter-spacing: -.02em;
  color: var(--mt-ink);
  margin-bottom: 11px;
}
.jinda-mt__pcard-brandof { font-size: 12px; font-weight: 600; color: var(--mt-muted); }

/* 规格数据表 */
.jinda-mt__specs {
  margin: 0 0 13px;
  padding: 11px 0 0;
  border-top: 1px dashed var(--mt-line);
  font-size: 12.5px;
}
.jinda-mt__specs > div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 3px 0;
}
.jinda-mt__specs dt { flex: 0 0 auto; color: var(--mt-muted); font-weight: 600; }
.jinda-mt__specs dd {
  flex: 1 1 auto;
  margin: 0;
  text-align: right;
  color: var(--mt-ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.jinda-mt__specs dd strong { font-weight: 800; }

/* 卖家类型标记 */
.jinda-mt__badge {
  display: inline-block;
  padding: 1px 6px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .03em;
  border-radius: 5px;
  vertical-align: middle;
  background: #eef2f7;
  color: var(--mt-body);
}
.jinda-mt__badge.is-amz { background: #fff3e0; color: #a35b00; }
.jinda-mt__badge.is-fba { background: #e8f4ff; color: #1668b3; }
.jinda-mt__badge.is-fbm { background: #f0f0f4; color: #55556b; }

/* 卡片按钮 */
.jinda-mt__pcard-cta {
  display: block;
  margin-top: auto;
  padding: 10px 14px;
  text-align: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--mt-teal-dark);
  background: var(--mt-teal-soft);
  border: 1.5px solid transparent;
  border-radius: 10px;
  text-decoration: none;
  transition: background .15s, color .15s, transform .15s;
}
.jinda-mt__pcard-cta:hover {
  color: #fff;
  background: var(--mt-teal);
  transform: translateY(-1px);
}

/* 响应式 */
@media (max-width: 782px) {
  .jinda-mt__pgrid { grid-template-columns: repeat(auto-fill, minmax(238px, 1fr)); gap: 12px; }
  .jinda-mt__pcard-media { height: 160px; padding: 10px; }
  .jinda-mt__pcard-title { font-size: 13px; -webkit-line-clamp: 3; }
  .jinda-mt__pcard-price { font-size: 19px; }
  .jinda-mt__specs { font-size: 12px; }
}
@media (max-width: 520px) {
  .jinda-mt__pgrid { grid-template-columns: 1fr; }
  .jinda-mt__pcard-media { height: 200px; }
}
