/* 拼多多商品类目查询 - 主样式表 */

/* ==================== CSS变量定义 ==================== */
:root {
  --red: #e02f2f;
  --red-dark: #b91621;
  --red-soft: #fff1f1;
  --yellow: #ffd43b;
  --ink: #1d1f23;
  --muted: #69707d;
  --line: #eceef2;
  --bg: #fff8f7;
  --panel: #ffffff;
  --green: #15a06f;
  --shadow: 0 16px 40px rgba(142, 38, 38, .08);
}

/* ==================== 全局样式 ==================== */
* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: linear-gradient(180deg, #fff0ef 0, #fff8f7 260px, #f7f8fb 100%);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
  letter-spacing: 0;
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

/* ==================== 页面布局 ==================== */
.page {
  width: min(100%, 1120px);
  margin: 0 auto;
  padding: 14px 16px 48px;
}

/* ==================== 顶部导航栏 ==================== */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 48px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 16px;
  font-weight: 800;
}

.brand-mark {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  color: #fff;
  background: var(--red);
  border-radius: 8px;
  box-shadow: 0 10px 22px rgba(224, 47, 47, .25);
}

.icon-button {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  color: var(--red-dark);
  background: rgba(255, 255, 255, .72);
  border: 1px solid rgba(224, 47, 47, .16);
  border-radius: 8px;
}

/* ==================== 主标题区域 ==================== */
.hero {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  padding-top: 18px;
}

.intro {
  padding: 6px 0 2px;
  text-align: left;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  color: var(--red-dark);
  background: rgba(224, 47, 47, .1);
  border: 1px solid rgba(224, 47, 47, .12);
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
}

h1 {
  margin: 14px 0 8px;
  font-size: clamp(28px, 8vw, 44px);
  line-height: 1.12;
  letter-spacing: 0;
}

.subtitle {
  max-width: 620px;
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.7;
}

/* ==================== 卡片样式 ==================== */
.search-card,
.result-card,
.history-card,
.tip-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

/* ==================== 搜索卡片 ==================== */
.search-card {
  width: 100%;
  padding: 14px;
}

.field-wrap {
  display: grid;
  gap: 10px;
}

.input-shell {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 50px;
  padding: 0 12px;
  background: #fff;
  border: 1px solid #dadde4;
  border-radius: 8px;
  transition: border-color .18s ease, box-shadow .18s ease;
}

.input-shell:focus-within {
  border-color: var(--red);
  box-shadow: 0 0 0 4px rgba(224, 47, 47, .1);
}

.input-shell svg {
  flex: 0 0 auto;
  color: #a5aab4;
}

#productUrl {
  width: 100%;
  min-width: 0;
  color: var(--ink);
  background: transparent;
  border: 0;
  outline: 0;
  font-size: 14px;
}

#productUrl::placeholder {
  color: #9aa1ad;
}

/* ==================== 按钮样式 ==================== */
.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 50px;
  color: #fff;
  background: linear-gradient(135deg, var(--red), #f04444);
  border-radius: 8px;
  font-weight: 800;
  box-shadow: 0 12px 24px rgba(224, 47, 47, .28);
  transition: transform .18s ease, filter .18s ease;
}

.primary-button:active {
  transform: translateY(1px);
  filter: brightness(.95);
}

.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 42px;
  color: #3a3f49;
  background: #fff;
  border: 1px solid #dfe2e8;
  border-radius: 8px;
  font-weight: 800;
  transition: border-color .18s ease, color .18s ease, background .18s ease;
}

.secondary-button:hover {
  color: var(--red-dark);
  background: #fffafa;
  border-color: rgba(224, 47, 47, .32);
}

/* ==================== 标签组 ==================== */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 8px;
  color: #784143;
  background: #fff7f2;
  border: 1px solid #ffe1d7;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
}

/* ==================== 主内容网格 ==================== */
.main-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  margin-top: 16px;
}

/* ==================== 卡片头部 ==================== */
.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
}

.card-title {
  margin: 0;
  font-size: 16px;
  font-weight: 850;
}

.card-desc {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.badge {
  flex: 0 0 auto;
  padding: 7px 8px;
  color: var(--red-dark);
  background: var(--red-soft);
  border: 1px solid rgba(224, 47, 47, .18);
  border-radius: 6px;
  font-size: 12px;
  font-weight: 800;
}

/* ==================== 结果卡片 ==================== */
.result-body {
  padding: 14px;
}

.product-name {
  display: flex;
  gap: 10px;
  padding: 12px;
  background: #fafbfc;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.product-name svg {
  flex: 0 0 auto;
  margin-top: 2px;
  color: var(--red);
}

.product-name span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.product-name strong {
  display: block;
  margin-top: 4px;
  font-size: 15px;
  line-height: 1.45;
}

/* ==================== 指标展示 ==================== */
.metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 12px;
}

.metric {
  min-width: 0;
  padding: 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.metric strong {
  display: block;
  margin-top: 6px;
  overflow-wrap: anywhere;
  font-size: 14px;
  line-height: 1.35;
}

.metric.wide {
  grid-column: 1 / -1;
}

.status-ok {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--green);
}

/* ==================== 操作按钮组 ==================== */
.actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-top: 12px;
}

/* ==================== 历史记录卡片 ==================== */
.history-card {
  overflow: hidden;
}

.history-list {
  display: grid;
}

.history-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  padding: 13px 14px;
  border-top: 1px solid var(--line);
}

.history-item:first-child {
  border-top: 0;
}

.history-item strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}

.history-item span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.history-time {
  color: #9aa1ad;
  font-size: 12px;
  white-space: nowrap;
}

/* ==================== 提示卡片 ==================== */
.tip-card {
  display: flex;
  gap: 10px;
  margin-top: 14px;
  padding: 13px;
  color: #7b2d2d;
  background: #fff1f1;
  border-color: #ffd6d6;
  box-shadow: none;
  font-size: 13px;
  line-height: 1.55;
}

/* ==================== Toast提示 ==================== */
.toast {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 10;
  max-width: calc(100vw - 32px);
  padding: 11px 13px;
  color: #fff;
  background: #22272f;
  border-radius: 8px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, .2);
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
  font-size: 13px;
  font-weight: 700;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

/* ==================== 响应式设计 - 平板及以上 ==================== */
@media (min-width: 760px) {
  .page {
    padding: 22px 28px 64px;
  }

  .hero {
    grid-template-columns: 1fr;
    justify-items: center;
    gap: 22px;
    padding-top: 40px;
  }

  .intro {
    width: min(100%, 980px);
    text-align: center;
  }

  .subtitle {
    margin-right: auto;
    margin-left: auto;
  }

  .search-card {
    width: min(100%, 760px);
    padding: 18px;
  }

  .field-wrap {
    grid-template-columns: minmax(0, 1fr) 170px;
  }

  .main-grid {
    grid-template-columns: minmax(0, 1.28fr) minmax(310px, .72fr);
    align-items: start;
    gap: 16px;
    margin-top: 18px;
  }

  .actions {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* ==================== 响应式设计 - 小屏幕 ==================== */
@media (max-width: 390px) {
  .metrics {
    grid-template-columns: 1fr;
  }

  .metric.wide {
    grid-column: auto;
  }

  h1 {
    font-size: 27px;
  }
}
