/* SIM 二手 · 基础样式(移动端优先) */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #f5f5f7;
  color: #1a1a1a;
  line-height: 1.5;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: #fff;
  border-bottom: 1px solid #eee;
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar h1 {
  font-size: 18px;
}

.topbar a {
  color: #0a7cff;
  text-decoration: none;
  font-size: 15px;
}

.btn {
  background: #0a7cff;
  color: #fff;
  padding: 8px 14px;
  border-radius: 6px;
  text-decoration: none;
  font-size: 14px;
}

/* 覆盖 .topbar a 的蓝色,保证按钮文字为白色 */
a.btn {
  color: #fff;
}

main {
  padding: 12px;
}

/* 商品卡片 */
.card {
  display: flex;
  gap: 12px;
  background: #fff;
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 10px;
  text-decoration: none;
  color: inherit;
}

.card.sold-out {
  opacity: 0.55;
}

.card-img {
  font-size: 40px;
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f0f0f2;
  border-radius: 8px;
  flex-shrink: 0;
  overflow: hidden;
}

.card-body {
  flex: 1;
  min-width: 0;
}

.card-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-price {
  color: #ff4d4f;
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 6px;
}

.card-meta {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
  font-size: 12px;
  color: #666;
}

.tag {
  background: #eef4ff;
  color: #0a7cff;
  padding: 2px 8px;
  border-radius: 4px;
}

.sold {
  background: #ccc;
  color: #fff;
  padding: 2px 8px;
  border-radius: 4px;
}

/* 筛选栏 */
.filter-bar {
  margin-bottom: 12px;
}

.tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 8px;
}

.tab {
  flex-shrink: 0;
  border: 1px solid #ddd;
  background: #fff;
  padding: 6px 12px;
  border-radius: 16px;
  font-size: 13px;
  color: #444;
  cursor: pointer;
}

.tab.active {
  background: #0a7cff;
  border-color: #0a7cff;
  color: #fff;
}

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

#search {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 14px;
}

#sort {
  padding: 8px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 14px;
  background: #fff;
}

/* 详情页 */
.detail-img {
  font-size: 80px;
  width: 100%;
  height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f0f0f2;
  border-radius: 12px;
  margin-bottom: 14px;
  overflow: hidden;
}

.card-img img,
.detail-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.detail h2 {
  font-size: 19px;
  margin-bottom: 6px;
}

.detail-price {
  color: #ff4d4f;
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 10px;
}

.detail-meta {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
  font-size: 13px;
  color: #666;
  margin-bottom: 14px;
}

.detail-desc {
  font-size: 15px;
  color: #333;
  margin-bottom: 14px;
}

.section {
  background: #fff;
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 12px;
}

.section h3 {
  font-size: 15px;
  margin-bottom: 10px;
}

.contact {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 6px 0;
  font-size: 14px;
}

.contact-type {
  background: #eef4ff;
  color: #0a7cff;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
  flex-shrink: 0;
}

.tip {
  background: #fff7e6;
  border: 1px solid #ffe1a8;
  color: #8a5a00;
  padding: 12px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 12px;
}

.report-btn {
  width: 100%;
  padding: 10px;
  background: #fff;
  border: 1px solid #ff4d4f;
  color: #ff4d4f;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
}

.report-form {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.report-form select,
.report-form textarea,
.report-form button {
  padding: 8px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 14px;
}

.report-form button {
  background: #ff4d4f;
  color: #fff;
  border: none;
}

/* 发布表单 */
.form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #fff;
  padding: 16px;
  border-radius: 12px;
}

.form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 14px;
  color: #333;
}

.form input,
.form select,
.form textarea {
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 15px;
}

.form fieldset {
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 10px 12px;
}

.form legend {
  font-size: 13px;
  color: #666;
  padding: 0 6px;
}

.channels {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.channels label {
  flex-direction: row;
  gap: 4px;
  font-size: 14px;
}

.confirm {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #666;
}

.submit {
  background: #0a7cff;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 12px;
  font-size: 16px;
  cursor: pointer;
}

/* 桌面端(≥768px):居中 + 双列卡片;手机端默认单列 */
@media (min-width: 768px) {
  main {
    max-width: 768px;
    margin: 0 auto;
  }

  #app {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }

  .card {
    margin-bottom: 0;
  }
}

/* 管理后台 */
.muted {
  color: #999;
}

.report-row,
.admin-row {
  background: #fff;
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 8px;
  font-size: 14px;
}

.report-row .muted {
  font-size: 12px;
  margin-top: 4px;
}

.admin-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.row-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.row-actions button {
  padding: 6px 10px;
  border: 1px solid #ddd;
  border-radius: 6px;
  background: #fff;
  font-size: 13px;
  cursor: pointer;
}

.row-actions .danger {
  color: #ff4d4f;
  border-color: #ff4d4f;
}
