/* ===== 基础重置 ===== */
* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --primary: #1c5fc4;
  --primary-dark: #16499b;
  --primary-light: #eaf1fb;
  --text: #1f2933;
  --muted: #6b7785;
  --border: #e3e8ef;
  --bg: #f5f7fa;
  --card: #ffffff;
  --danger: #c0392b;
  --radius: 10px;
  --shadow: 0 2px 12px rgba(20, 40, 80, 0.06);
}
html { scroll-behavior: smooth; }
body {
  font-family: "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", system-ui, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.65;
  font-size: 15px;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
.container { max-width: 1180px; margin: 0 auto; padding: 0 18px; }
.section { padding: 42px 0; }
.section-title { font-size: 22px; font-weight: 700; margin-bottom: 6px; }
.section-sub { color: var(--muted); margin-bottom: 22px; }
.text-primary { color: var(--primary); }
.muted { color: var(--muted); }

/* ===== 按钮 ===== */
.btn {
  display: inline-block; padding: 10px 22px; border-radius: var(--radius);
  border: 1px solid transparent; cursor: pointer; font-size: 14px; font-weight: 600;
  transition: all .15s ease; background: var(--primary); color: #fff;
}
.btn:hover { background: var(--primary-dark); }
.btn-outline { background: #fff; color: var(--primary); border-color: var(--primary); }
.btn-outline:hover { background: var(--primary-light); }
.btn-block { display: block; width: 100%; text-align: center; }
.btn-lg { padding: 13px 30px; font-size: 15px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* ===== 页头 ===== */
.site-header {
  position: sticky; top: 0; z-index: 100; background: #fff;
  border-bottom: 1px solid var(--border); box-shadow: 0 1px 4px rgba(0,0,0,.03);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.brand { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; }
.brand-icon { display: inline-flex; color: var(--primary); }
.brand-icon svg { display: block; }
.brand-logo { font-size: 20px; font-weight: 800; color: var(--primary); letter-spacing: .5px; }
.main-nav { display: flex; align-items: center; gap: 4px; }
.main-nav > a {
  padding: 8px 14px; border-radius: 8px; font-size: 14px; color: var(--text); font-weight: 500;
}
.main-nav > a:hover { background: var(--primary-light); color: var(--primary); }
.cart-link { position: relative; }
.cart-badge {
  position: absolute; top: -2px; right: 2px; background: var(--danger); color: #fff;
  font-size: 11px; min-width: 16px; height: 16px; line-height: 16px; text-align: center;
  border-radius: 9px; padding: 0 4px;
}
.nav-login, .nav-register { padding: 7px 14px; border-radius: 8px; font-size: 14px; font-weight: 600; }
.nav-login { color: var(--primary); }
.nav-login:hover { background: var(--primary-light); }
.nav-register { background: var(--primary); color: #fff; }
.nav-register:hover { background: var(--primary-dark); }
.user-menu { position: relative; }
.user-btn {
  background: var(--primary-light); color: var(--primary); border: none; cursor: pointer;
  padding: 7px 12px; border-radius: 8px; font-weight: 600; font-size: 14px;
}
.user-drop {
  display: none; position: absolute; right: 0; top: 42px; background: #fff;
  border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow); overflow: hidden; min-width: 130px;
}
.user-drop.show { display: block; }
.user-drop a { display: block; padding: 10px 16px; font-size: 14px; }
.user-drop a:hover { background: var(--bg); color: var(--primary); }
.menu-toggle { display: none; background: none; border: none; cursor: pointer; flex-direction: column; gap: 4px; padding: 6px; }
.menu-toggle span { width: 22px; height: 2px; background: var(--text); display: block; }

/* ===== 首页 Hero ===== */
.hero { background: linear-gradient(135deg, #1c5fc4 0%, #2f7ad6 100%); color: #fff; padding: 60px 0; }
.hero h1 { font-size: 32px; font-weight: 800; margin-bottom: 14px; }
.hero p { font-size: 16px; opacity: .92; max-width: 620px; margin-bottom: 26px; }
.hero .btn-outline { background: rgba(255,255,255,.12); color: #fff; border-color: rgba(255,255,255,.6); }
.hero .btn-outline:hover { background: rgba(255,255,255,.22); }

/* ===== 模块卡片 ===== */
.module-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.module-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 26px 22px; box-shadow: var(--shadow); transition: transform .15s ease, box-shadow .15s ease;
}
.module-card:hover { transform: translateY(-3px); box-shadow: 0 8px 22px rgba(20,40,80,.1); }
.module-card h3 { font-size: 18px; margin-bottom: 8px; color: var(--primary); }
.module-card p { color: var(--muted); font-size: 14px; margin-bottom: 16px; }
.module-card .more { color: var(--primary); font-weight: 600; font-size: 14px; }

/* ===== 通用网格/卡片 ===== */
.grid { display: grid; gap: 20px; }
.products-grid { grid-template-columns: repeat(4, 1fr); }
.card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow); display: flex; flex-direction: column;
  transition: transform .15s ease, box-shadow .15s ease;
}
.card:hover { transform: translateY(-3px); box-shadow: 0 8px 22px rgba(20,40,80,.1); }
.card-img { aspect-ratio: 1 / 1; overflow: hidden; background: #f0f3f7; }
.card-img img { width: 100%; height: 100%; object-fit: cover; }
.card-body { padding: 14px 15px 16px; display: flex; flex-direction: column; flex: 1; }
.card-name { font-size: 15px; font-weight: 600; line-height: 1.4; margin-bottom: 6px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 42px; }
.card-merchant { font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.card-price { color: var(--danger); font-weight: 700; font-size: 17px; }
.card-price .origin { color: var(--muted); font-weight: 400; font-size: 13px; text-decoration: line-through; margin-left: 6px; }
.card-foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; padding-top: 10px; }
.card-sales { font-size: 12px; color: var(--muted); }
.tag-row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.tag { font-size: 11px; color: var(--primary); background: var(--primary-light); padding: 2px 8px; border-radius: 20px; }

/* ===== 筛选条 ===== */
.filters { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 22px; align-items: center; }
.filter-btn {
  border: 1px solid var(--border); background: #fff; padding: 7px 16px; border-radius: 20px;
  cursor: pointer; font-size: 14px; color: var(--text);
}
.filter-btn:hover { border-color: var(--primary); color: var(--primary); }
.filter-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.search-box { margin-left: auto; display: flex; }
.search-box input {
  border: 1px solid var(--border); border-radius: 8px 0 0 8px; padding: 8px 12px; width: 220px; outline: none; font-size: 14px;
}
.search-box button { border: 1px solid var(--primary); background: var(--primary); color: #fff; border-radius: 0 8px 8px 0; padding: 0 16px; cursor: pointer; }

/* ===== 商品详情 ===== */
.detail-wrap { display: grid; grid-template-columns: 1fr 1fr; gap: 36px; }
.gallery-main { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: #f0f3f7; aspect-ratio: 1/1; }
.gallery-main img { width: 100%; height: 100%; object-fit: cover; }
.gallery-thumbs { display: flex; gap: 10px; margin-top: 12px; }
.gallery-thumbs img { width: 72px; height: 72px; object-fit: cover; border: 2px solid transparent; border-radius: 8px; cursor: pointer; background: #f0f3f7; }
.gallery-thumbs img.active { border-color: var(--primary); }
.detail-info h1 { font-size: 24px; margin-bottom: 12px; }
.price-box { background: var(--primary-light); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 18px; }
.price-now { color: var(--danger); font-size: 26px; font-weight: 800; }
.price-origin { color: var(--muted); text-decoration: line-through; margin-left: 10px; font-size: 15px; }
.detail-meta { font-size: 13px; color: var(--muted); margin-top: 6px; }
.spec-table { width: 100%; border-collapse: collapse; margin: 16px 0; }
.spec-table td { border: 1px solid var(--border); padding: 9px 12px; font-size: 14px; }
.spec-table td:first-child { background: var(--bg); width: 120px; color: var(--muted); }
.merchant-card { border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; margin: 16px 0; background: #fff; }
.merchant-card h4 { font-size: 15px; margin-bottom: 8px; }
.merchant-card .row { display: flex; justify-content: space-between; font-size: 14px; padding: 4px 0; }
.merchant-card .row span:first-child { color: var(--muted); }
.qty-row { display: flex; align-items: center; gap: 14px; margin: 18px 0; }
.qty-ctrl { display: inline-flex; align-items: center; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.qty-ctrl button { width: 38px; height: 38px; border: none; background: #fff; font-size: 18px; cursor: pointer; color: var(--text); }
.qty-ctrl button:hover { background: var(--bg); }
.qty-ctrl input { width: 54px; height: 38px; border: none; text-align: center; font-size: 15px; border-left: 1px solid var(--border); border-right: 1px solid var(--border); }
.detail-actions { display: flex; gap: 12px; }
.detail-block { margin-top: 40px; }
.detail-block h3 { font-size: 18px; margin-bottom: 12px; border-left: 4px solid var(--primary); padding-left: 10px; }
.detail-block p { color: #3a4654; }
.detail-photos { display: flex; flex-direction: column; gap: 18px; }
.detail-photo { border-radius: var(--radius); overflow: hidden; background: #f0f3f7; border: 1px solid var(--border); }
.detail-photo img { width: 100%; display: block; }
.notice-list { list-style: disc; padding-left: 20px; color: #3a4654; line-height: 1.8; }
.notice-list li { margin-bottom: 6px; }

/* ===== 购物车 ===== */
.cart-table { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.cart-table th, .cart-table td { padding: 14px 12px; text-align: left; border-bottom: 1px solid var(--border); font-size: 14px; }
.cart-table th { background: var(--bg); color: var(--muted); font-weight: 600; }
.cart-prod { display: flex; align-items: center; gap: 12px; }
.cart-prod img { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; background: #f0f3f7; }
.cart-qty { display: inline-flex; align-items: center; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.cart-qty button { width: 30px; height: 30px; border: none; background: #fff; cursor: pointer; }
.cart-qty input { width: 44px; height: 30px; border: none; text-align: center; border-left: 1px solid var(--border); border-right: 1px solid var(--border); }
.cart-summary { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 20px 22px; margin-top: 20px; }
.cart-summary .line { display: flex; justify-content: space-between; padding: 6px 0; font-size: 14px; }
.cart-summary .total { font-size: 20px; font-weight: 800; color: var(--danger); }
.cart-empty { text-align: center; padding: 60px 0; color: var(--muted); }
.cart-empty a { color: var(--primary); font-weight: 600; }

/* ===== 鉴权表单 ===== */
.auth-wrap { max-width: 420px; margin: 40px auto; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 32px 30px; box-shadow: var(--shadow); }
.auth-wrap h2 { font-size: 22px; margin-bottom: 6px; }
.auth-wrap .sub { color: var(--muted); font-size: 14px; margin-bottom: 22px; }
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 14px; margin-bottom: 6px; font-weight: 500; }
.field input[type=text], .field input[type=password] {
  width: 100%; border: 1px solid var(--border); border-radius: 8px; padding: 11px 13px; font-size: 14px; outline: none;
}
.field input:focus { border-color: var(--primary); }
.agree-row { display: flex; align-items: flex-start; gap: 8px; margin: 6px 0 18px; font-size: 13px; color: var(--muted); }
.agree-row input { margin-top: 3px; }
.agree-row a { color: var(--primary); }
.auth-switch { text-align: center; font-size: 14px; color: var(--muted); margin-top: 18px; }
.auth-switch a { color: var(--primary); font-weight: 600; }
.form-error { color: var(--danger); font-size: 13px; min-height: 18px; margin-bottom: 8px; }

/* ===== 关于/协议页 ===== */
.prose { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 28px 30px; box-shadow: var(--shadow); }
.prose h2 { font-size: 20px; margin: 18px 0 10px; }
.prose h3 { font-size: 16px; margin: 14px 0 8px; color: var(--primary); }
.prose p, .prose li { color: #3a4654; font-size: 15px; margin-bottom: 8px; }
.prose ul { padding-left: 22px; }
.info-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px 30px; margin: 14px 0; }
.info-list .item { display: flex; justify-content: space-between; border-bottom: 1px dashed var(--border); padding: 8px 0; font-size: 14px; }
.info-list .item span:first-child { color: var(--muted); }
.merchant-grid { grid-template-columns: repeat(2, 1fr); }

/* ===== 提示条 ===== */
.notice { background: var(--primary-light); border: 1px solid #cfe0f7; color: var(--primary-dark); border-radius: var(--radius); padding: 12px 16px; font-size: 14px; margin-bottom: 20px; }

/* ===== 页尾 ===== */
.site-footer { background: #ffffff; color: #1c5fc4; margin-top: 50px; border-top: 3px solid #1c5fc4; }
.footer-inner { max-width: 1180px; margin: 0 auto; padding: 40px 18px 26px; display: grid; grid-template-columns: 1.6fr 1fr 1fr 1.4fr; gap: 26px; }
.footer-brand { font-size: 18px; font-weight: 800; color: #0d3a7e; margin-bottom: 10px; letter-spacing: .5px; }
.footer-desc { font-size: 13px; line-height: 1.7; color: #16499b; }
.footer-col h4 { color: #0d3a7e; font-size: 15px; font-weight: 700; margin-bottom: 14px; letter-spacing: 1px; }
.footer-col a, .footer-col p { display: block; font-size: 14px; font-weight: 500; color: #1c5fc4; margin-bottom: 8px; }
.footer-col a:hover { color: #0d3a7e; text-decoration: underline; }
.footer-bottom { background: #f5f7fa; border-top: 1px solid #e3e8ef; padding: 16px 18px; text-align: center; font-size: 12px; color: #16499b; display: flex; flex-wrap: wrap; gap: 6px 18px; justify-content: center; }
.footer-bottom a.beian-link { color: #1c5fc4; text-decoration: underline; }
.footer-bottom a.beian-link:hover { color: #0d3a7e; }

/* ===== Toast ===== */
.toast {
  position: fixed; left: 50%; bottom: 40px; transform: translateX(-50%) translateY(20px);
  background: rgba(31,41,55,.95); color: #fff; padding: 11px 22px; border-radius: 24px; font-size: 14px;
  opacity: 0; pointer-events: none; transition: all .25s ease; z-index: 999;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ===== 响应式 ===== */
@media (max-width: 980px) {
  .products-grid { grid-template-columns: repeat(3, 1fr); }
  .module-grid { grid-template-columns: 1fr 1fr; }
  .footer-inner { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 760px) {
  .menu-toggle { display: flex; }
  .main-nav {
    display: none; position: absolute; top: 64px; left: 0; right: 0; background: #fff;
    flex-direction: column; align-items: stretch; padding: 10px 18px; border-bottom: 1px solid var(--border); gap: 2px;
  }
  .main-nav.open { display: flex; }
  .main-nav > a { padding: 12px 8px; }
  .detail-wrap { grid-template-columns: 1fr; gap: 22px; }
  .products-grid { grid-template-columns: repeat(2, 1fr); }
  .module-grid { grid-template-columns: 1fr; }
  .merchant-grid { grid-template-columns: 1fr; }
  .info-list { grid-template-columns: 1fr; }
  .footer-inner { grid-template-columns: 1fr; }
  .hero h1 { font-size: 26px; }
  .cart-table thead { display: none; }
  .cart-table, .cart-table tbody, .cart-table tr, .cart-table td { display: block; width: 100%; }
  .cart-table tr { border-bottom: 10px solid var(--bg); }
  .cart-table td { border: none; padding: 8px 12px; }
}
@media (max-width: 460px) {
  .products-grid { grid-template-columns: 1fr; }
  .search-box input { width: 150px; }
}

/* ===== 信息发布模块 ===== */
.breadcrumb { font-size: 14px; color: var(--muted); margin-bottom: 14px; }
.breadcrumb a { color: var(--primary); }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb span { margin: 0 8px; }

.post-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 20px; }
.post-card {
  display: block; background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow); transition: transform .15s ease, box-shadow .15s ease;
}
.post-card:hover { transform: translateY(-3px); box-shadow: 0 8px 20px rgba(20,40,80,.1); }
.post-img { aspect-ratio: 4 / 3; overflow: hidden; background: #f0f3f7; }
.post-img img { width: 100%; height: 100%; object-fit: cover; }
.post-body { padding: 16px; }
.post-cat {
  display: inline-block; font-size: 12px; color: var(--primary); background: var(--primary-light);
  padding: 3px 10px; border-radius: 12px; margin-bottom: 8px;
}
.post-title { font-size: 16px; font-weight: 700; color: var(--text); margin-bottom: 8px; line-height: 1.4; }
.post-price { font-size: 18px; font-weight: 800; color: var(--danger); margin-bottom: 8px; }
.post-summary { font-size: 13px; color: var(--muted); margin-bottom: 12px; line-height: 1.6; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.post-meta { display: flex; justify-content: space-between; font-size: 12px; color: #8b96a3; margin-bottom: 10px; }
.post-publisher { display: flex; justify-content: space-between; align-items: center; font-size: 13px; padding-top: 10px; border-top: 1px solid var(--border); }
.post-name { color: var(--text); font-weight: 600; }
.post-phone { color: var(--primary); font-weight: 600; }

.post-detail { display: grid; grid-template-columns: 1.1fr 1fr; gap: 30px; margin-bottom: 24px; }
.post-detail .detail-cat { display: inline-block; font-size: 13px; color: var(--primary); background: var(--primary-light); padding: 4px 12px; border-radius: 14px; margin-bottom: 10px; }
.post-detail .detail-title { font-size: 24px; font-weight: 800; margin-bottom: 12px; color: var(--text); }
.post-detail .detail-price { font-size: 28px; font-weight: 800; color: var(--danger); margin-bottom: 18px; }
.post-detail .detail-meta { display: grid; gap: 8px; font-size: 14px; color: #3a4654; margin-bottom: 20px; }
.post-detail .detail-meta b { color: var(--text); }

.publisher-card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 22px 24px; box-shadow: var(--shadow); margin-bottom: 24px; }
.publisher-card h3 { font-size: 17px; margin-bottom: 14px; color: var(--text); }
.publisher-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px dashed var(--border); }
.publisher-row:last-child { border-bottom: none; }
.publisher-label { width: 80px; color: var(--muted); font-size: 14px; flex-shrink: 0; }
.publisher-value { font-size: 15px; color: var(--text); font-weight: 500; }
.publisher-value.phone-value { font-size: 18px; color: var(--primary); font-weight: 700; letter-spacing: 1px; }
.phone-tip { font-size: 12px; color: var(--muted); margin-left: 8px; }
.publisher-card .btn { margin-top: 14px; }

.post-notice { background: var(--primary-light); border: 1px solid #cfe0f7; border-radius: var(--radius); padding: 18px 22px; color: var(--primary-dark); }
.post-notice h3 { font-size: 15px; margin-bottom: 8px; }
.post-notice ul { padding-left: 18px; font-size: 14px; line-height: 1.8; }
.post-notice a { color: var(--primary); text-decoration: underline; }

@media (max-width: 768px) {
  .post-detail { grid-template-columns: 1fr; }
  .post-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 460px) {
  .post-grid { grid-template-columns: 1fr; }
}
