/* ===== 全局重置与变量 ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --primary: #1a73e8;
  --primary-dark: #1557b0;
  --accent: #e53935;
  --bg: #f5f6fa;
  --card-bg: #fff;
  --text: #222;
  --text-sub: #666;
  --border: #e0e0e0;
  --radius: 8px;
  --shadow: 0 2px 12px rgba(0,0,0,.08);
  --shadow-hover: 0 6px 24px rgba(26,115,232,.18);
}
html { scroll-behavior: smooth; }
body { font-family: 'PingFang SC','Microsoft YaHei',sans-serif; background: var(--bg); color: var(--text); }
a { color: inherit; text-decoration: none; }
ul { list-style: none; }
input, textarea, button { font-family: inherit; outline: none; }
.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }

/* ===== 顶部公告栏 ===== */
.top-bar {
  background: #333; color: #ccc; font-size: .82em;
  display: flex; justify-content: center; gap: 40px;
  padding: 6px 20px;
}
.top-bar span { display: flex; align-items: center; gap: 6px; }

/* ===== 导航头部 ===== */
.header {
  background: #fff; box-shadow: 0 2px 8px rgba(0,0,0,.08);
  position: sticky; top: 0; z-index: 100;
}
.header .container {
  display: flex; align-items: center; gap: 20px;
  height: 64px;
}
.logo {
  display: flex; align-items: center; gap: 10px;
  font-size: 1.4em; font-weight: 700; color: var(--primary);
  white-space: nowrap; flex-shrink: 0;
}
.nav { display: flex; gap: 4px; flex: 1; }
.nav a {
  padding: 6px 14px; border-radius: 20px;
  font-size: .95em; transition: all .2s; white-space: nowrap;
}
.nav a:hover, .nav a.active {
  background: var(--primary); color: #fff;
}
.header-actions { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.search-box { display: flex; border: 2px solid var(--primary); border-radius: 24px; overflow: hidden; }
.search-box input {
  border: none; padding: 7px 16px; width: 200px;
  font-size: .9em; background: transparent;
}
.search-box button {
  background: var(--primary); color: #fff; border: none;
  padding: 0 16px; cursor: pointer; transition: background .2s;
}
.search-box button:hover { background: var(--primary-dark); }
.cart-btn {
  position: relative; display: flex; align-items: center;
  font-size: 1.4em; padding: 4px 12px; border-radius: 8px;
  transition: color .2s;
}
.cart-btn:hover { color: var(--primary); }
.cart-count {
  position: absolute; top: -4px; right: 0;
  background: var(--accent); color: #fff; font-size: .6em;
  width: 18px; height: 18px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
}

/* ===== Banner 轮播 ===== */
.banner { position: relative; height: 380px; overflow: hidden; }
.banner-slides { height: 100%; }
.slide {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 10%;
  opacity: 0; transition: opacity .6s; pointer-events: none;
}
.slide.active { opacity: 1; pointer-events: all; }
.slide-content { color: #fff; max-width: 500px; }
.slide-content h2 { font-size: 2.2em; font-weight: 700; margin-bottom: 12px; }
.slide-content p  { font-size: 1.1em; opacity: .9; margin-bottom: 24px; }
.slide-img { opacity: .15; }
.btn-primary {
  display: inline-block;
  background: #fff; color: var(--primary);
  padding: 12px 32px; border-radius: 30px;
  font-weight: 600; font-size: .95em;
  transition: all .2s; cursor: pointer;
}
.btn-primary:hover { background: var(--primary); color: #fff; transform: translateY(-2px); }
.btn-outline {
  display: inline-block;
  border: 2px solid var(--primary); color: var(--primary);
  padding: 10px 28px; border-radius: 30px;
  font-weight: 600; transition: all .2s;
}
.btn-outline:hover { background: var(--primary); color: #fff; }
.slide-prev, .slide-next {
  position: absolute; top: 50%; transform: translateY(-50%);
  background: rgba(255,255,255,.25); color: #fff; border: none;
  width: 44px; height: 44px; border-radius: 50%;
  font-size: 1.1em; cursor: pointer; transition: background .2s;
  display: flex; align-items: center; justify-content: center;
}
.slide-prev { left: 20px; }
.slide-next { right: 20px; }
.slide-prev:hover, .slide-next:hover { background: rgba(255,255,255,.5); }
.slide-dots {
  position: absolute; bottom: 16px; left: 50%; transform: translateX(-50%);
  display: flex; gap: 8px;
}
.dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: rgba(255,255,255,.5); cursor: pointer; transition: all .3s;
}
.dot.active { background: #fff; width: 24px; border-radius: 4px; }

/* ===== 通用节标题 ===== */
.section-title {
  font-size: 1.5em; font-weight: 700; color: var(--text);
  margin-bottom: 24px; position: relative; padding-bottom: 10px;
}
.section-title::after {
  content: ''; position: absolute; bottom: 0; left: 0;
  width: 40px; height: 3px; background: var(--primary); border-radius: 2px;
}
.section-header {
  display: flex; justify-content: space-between; align-items: flex-end;
  margin-bottom: 24px;
}
.section-header .section-title { margin-bottom: 0; }
.more-link { color: var(--primary); font-size: .95em; display: flex; align-items: center; gap: 4px; }
.more-link:hover { text-decoration: underline; }

/* ===== 分类快捷入口 ===== */
.categories { padding: 40px 0; }
.cat-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 16px; }
.cat-item { display: flex; flex-direction: column; align-items: center; gap: 8px; cursor: pointer; }
.cat-icon {
  width: 64px; height: 64px; border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.6em; transition: transform .2s, box-shadow .2s;
}
.cat-item:hover .cat-icon { transform: translateY(-4px); box-shadow: var(--shadow-hover); }
.cat-item span { font-size: .88em; color: var(--text-sub); font-weight: 500; }

/* ===== 商品网格 ===== */
.product-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
.product-card {
  background: var(--card-bg); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden; position: relative;
  transition: transform .25s, box-shadow .25s;
  display: flex; flex-direction: column;
}
.product-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-hover); }
.product-badge {
  position: absolute; top: 10px; left: 10px;
  background: var(--accent); color: #fff;
  padding: 2px 10px; border-radius: 20px; font-size: .78em; font-weight: 600;
  z-index: 1;
}
.product-img {
  background: linear-gradient(135deg,#e3f2fd,#f8f9fa);
  height: 180px;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; position: relative;
}
.product-img img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform .3s ease;
}
.product-card:hover .product-img img {
  transform: scale(1.05);
}
.product-img-fallback {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  font-size: 3.5em; color: var(--primary);
}
.product-info { padding: 14px; flex: 1; display: flex; flex-direction: column; }
.product-name { font-weight: 600; font-size: .95em; margin-bottom: 6px; line-height: 1.4; }
.product-desc { font-size: .82em; color: var(--text-sub); margin-bottom: 8px; flex: 1; }
.product-rating { display: flex; align-items: center; gap: 4px; font-size: .82em; margin-bottom: 10px; }
.sales-count { margin-left: 6px; color: #999; }
.product-footer { display: flex; align-items: center; justify-content: space-between; }
.product-price { font-size: 1em; color: var(--accent); }
.product-price strong { font-size: 1.2em; }
.btn-add-cart {
  background: var(--primary); color: #fff; border: none;
  padding: 7px 14px; border-radius: 20px;
  font-size: .82em; cursor: pointer; transition: background .2s;
  display: flex; align-items: center; gap: 4px;
}
.btn-add-cart:hover { background: var(--primary-dark); }

/* ===== 热销商品区 ===== */
.hot-products { padding: 0 0 40px; }

/* ===== 品牌展示 ===== */
.brands { background: #fff; padding: 40px 0; }
.brand-list {
  display: flex; flex-wrap: wrap; gap: 16px; justify-content: center;
  margin-top: 24px;
}
.brand-item {
  padding: 12px 28px; border: 2px solid var(--border); border-radius: 8px;
  font-weight: 600; color: var(--text-sub);
  transition: all .2s; cursor: default;
}
.brand-item:hover { border-color: var(--primary); color: var(--primary); }

/* ===== 服务保障 ===== */
.services {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 24px; padding: 40px 0;
}
.service-item {
  text-align: center; padding: 24px;
  background: var(--card-bg); border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.service-item i { font-size: 2em; color: var(--primary); margin-bottom: 12px; display: block; }
.service-item h4 { font-size: 1em; margin-bottom: 6px; }
.service-item p { font-size: .85em; color: var(--text-sub); }

/* ===== 页脚 ===== */
.footer { background: #1c2536; color: #aaa; margin-top: 0; }
.footer-inner {
  display: grid; grid-template-columns: 2fr 1fr 1fr 1.5fr;
  gap: 40px; padding: 50px 20px;
}
.footer-col h3 { color: #fff; font-size: 1.1em; margin-bottom: 16px; display: flex; align-items: center; gap: 8px; }
.footer-col h4 { color: #fff; margin-bottom: 16px; }
.footer-col p { font-size: .88em; line-height: 1.7; margin-bottom: 8px; display: flex; align-items: center; gap: 8px; }
.footer-col ul li { margin-bottom: 10px; }
.footer-col ul li a:hover { color: #fff; }
.footer-bottom {
  border-top: 1px solid #2e3a50; text-align: center;
  padding: 18px 20px; font-size: .85em; color: #666;
}

/* ===== 面包屑 ===== */
.breadcrumb {
  padding: 14px 20px; font-size: .88em; color: var(--text-sub);
  display: flex; align-items: center; gap: 8px;
}
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb i { font-size: .7em; }

/* ===== 商品列表页 ===== */
.products-page {
  display: grid; grid-template-columns: 220px 1fr;
  gap: 24px; padding: 20px 20px 40px;
}
.filter-sidebar {
  background: var(--card-bg); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px; height: fit-content;
  position: sticky; top: 80px;
}
.filter-sidebar h3 { font-size: .95em; margin: 16px 0 10px; color: var(--text-sub); }
.filter-sidebar h3:first-child { margin-top: 0; }
.filter-cats li { margin-bottom: 4px; }
.cat-link {
  display: block; padding: 7px 12px; border-radius: 6px;
  font-size: .9em; transition: all .2s;
}
.cat-link:hover, .cat-link.active {
  background: #e3f2fd; color: var(--primary); font-weight: 600;
}
.price-filter { display: flex; align-items: center; gap: 6px; }
.price-filter input {
  width: 70px; border: 1px solid var(--border); border-radius: 6px;
  padding: 6px 8px; font-size: .85em;
}
.price-filter button {
  background: var(--primary); color: #fff; border: none;
  padding: 6px 12px; border-radius: 6px; cursor: pointer; font-size: .85em;
}
.filter-sorts li { margin-bottom: 4px; }
.sort-link {
  display: block; padding: 6px 12px; border-radius: 6px;
  font-size: .88em; transition: all .2s;
}
.sort-link:hover, .sort-link.active {
  background: #e3f2fd; color: var(--primary); font-weight: 600;
}
.products-toolbar {
  display: flex; align-items: center; padding: 12px 16px;
  background: var(--card-bg); border-radius: var(--radius);
  margin-bottom: 16px; box-shadow: var(--shadow);
  font-size: .88em; color: var(--text-sub);
}
.no-results {
  flex-direction: column; align-items: center; gap: 16px;
  padding: 60px; color: var(--text-sub); display: flex;
}

/* ===== 购物车页 ===== */
.cart-page {
  display: grid; grid-template-columns: 1fr 300px;
  gap: 24px; padding: 20px 20px 40px; align-items: start;
}
.cart-main { background: var(--card-bg); border-radius: var(--radius); box-shadow: var(--shadow); }
.cart-header {
  display: grid; grid-template-columns: 60px 1fr 100px 140px 100px 80px;
  padding: 14px 20px; background: var(--bg); border-radius: var(--radius) var(--radius) 0 0;
  font-size: .88em; color: var(--text-sub); font-weight: 600;
  align-items: center; gap: 10px;
}
.cart-row {
  display: grid; grid-template-columns: 60px 1fr 100px 140px 100px 80px;
  padding: 16px 20px; border-top: 1px solid var(--border);
  align-items: center; gap: 10px;
  transition: background .2s;
}
.cart-row:hover { background: #f9fbff; }
.cart-item-info { display: flex; align-items: center; gap: 12px; }
.cart-item-icon {
  width: 60px; height: 60px; background: #e3f2fd; border-radius: 8px;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.cart-item-name { font-weight: 600; font-size: .92em; margin-bottom: 4px; }
.cart-item-desc { font-size: .8em; color: var(--text-sub); }
.cart-price { font-weight: 600; }
.cart-qty { display: flex; align-items: center; gap: 4px; }
.cart-qty button {
  width: 28px; height: 28px; border: 1px solid var(--border); background: #f5f5f5;
  border-radius: 6px; cursor: pointer; font-size: 1em; transition: all .2s;
}
.cart-qty button:hover { border-color: var(--primary); color: var(--primary); }
.cart-qty input {
  width: 50px; text-align: center; border: 1px solid var(--border);
  border-radius: 6px; padding: 4px; font-size: .9em;
}
.cart-subtotal { color: var(--accent); font-weight: 700; }
.btn-remove {
  background: none; border: 1px solid var(--border); color: #999;
  width: 32px; height: 32px; border-radius: 6px;
  cursor: pointer; transition: all .2s;
  display: flex; align-items: center; justify-content: center;
}
.btn-remove:hover { border-color: var(--accent); color: var(--accent); }
.cart-empty {
  flex-direction: column; align-items: center; gap: 16px;
  padding: 60px; display: flex;
}
.cart-empty i { font-size: 3em; color: #ddd; }
.cart-empty p { color: var(--text-sub); }
.cart-summary {
  background: var(--card-bg); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px;
  position: sticky; top: 80px;
  transition: opacity .3s;
}
.cart-summary h3 { margin-bottom: 16px; font-size: 1em; }
.summary-row {
  display: flex; justify-content: space-between;
  padding: 10px 0; border-bottom: 1px solid var(--border);
  font-size: .92em;
}
.summary-total {
  display: flex; justify-content: space-between;
  padding: 16px 0; font-weight: 700; font-size: 1.05em;
}
.btn-checkout {
  width: 100%; padding: 14px; border: none; border-radius: 8px;
  background: var(--accent); color: #fff; font-size: 1.05em; font-weight: 700;
  cursor: pointer; margin-top: 16px; transition: background .2s;
}
.btn-checkout:hover { background: #c62828; }
.continue-shopping {
  display: block; text-align: center; margin-top: 12px;
  color: var(--primary); font-size: .9em;
}
.continue-shopping:hover { text-decoration: underline; }

/* ===== 步骤条 ===== */
.checkout-steps {
  display: flex; align-items: center; justify-content: center;
  padding: 24px 0;
}
.step {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  font-size: .88em; color: #999;
}
.step span {
  width: 32px; height: 32px; border-radius: 50%;
  background: #e0e0e0; color: #999; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.step.active span { background: var(--primary); color: #fff; }
.step.done span  { background: #4caf50; color: #fff; }
.step.active, .step.done { color: var(--text); font-weight: 600; }
.step-line { flex: 1; max-width: 80px; height: 2px; background: #e0e0e0; }
.step-line.active { background: #4caf50; }

/* ===== 结算页 ===== */
.checkout-page {
  display: grid; grid-template-columns: 1fr 320px;
  gap: 24px; padding: 0 20px 40px; align-items: start;
}
.checkout-form { display: flex; flex-direction: column; gap: 20px; }
.form-section {
  background: var(--card-bg); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px;
}
.form-section h3 {
  font-size: 1em; margin-bottom: 16px; color: var(--text);
  display: flex; align-items: center; gap: 8px;
}
.form-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.form-grid .full { grid-column: 1 / -1; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label { font-size: .88em; color: var(--text-sub); font-weight: 600; }
.form-group input {
  border: 1px solid var(--border); border-radius: 6px;
  padding: 10px 12px; font-size: .92em;
  transition: border-color .2s;
}
.form-group input:focus { border-color: var(--primary); }
.payment-methods { display: flex; gap: 12px; flex-wrap: wrap; }
.pay-opt {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 20px; border: 2px solid var(--border); border-radius: 8px;
  cursor: pointer; font-size: .9em; transition: all .2s;
}
.pay-opt input { display: none; }
.pay-opt.active { border-color: var(--primary); color: var(--primary); background: #e3f2fd; }
.pay-opt:hover { border-color: var(--primary); }
textarea {
  width: 100%; border: 1px solid var(--border); border-radius: 6px;
  padding: 10px 12px; font-size: .92em; resize: vertical;
  transition: border-color .2s;
}
textarea:focus { border-color: var(--primary); }
.order-summary {
  background: var(--card-bg); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px;
  position: sticky; top: 80px;
}
.order-summary h3 { margin-bottom: 16px; font-size: 1em; }
.order-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 0; border-bottom: 1px solid var(--border);
}
.order-total-box { margin-top: 12px; }

/* ===== 成功页 ===== */
.success-page { padding: 40px 20px; display: flex; justify-content: center; }
.success-box {
  background: var(--card-bg); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 48px;
  text-align: center; max-width: 520px; width: 100%;
}
.success-icon { font-size: 4em; color: #4caf50; margin-bottom: 20px; }
.success-box h2 { font-size: 1.6em; margin-bottom: 12px; }
.success-box p { color: var(--text-sub); margin-bottom: 8px; }
.order-no { font-size: 1em; color: var(--text); margin: 16px 0; }
.success-tips {
  background: #f5f6fa; border-radius: 8px; padding: 16px;
  margin: 20px 0; text-align: left;
}
.success-tips p { font-size: .88em; display: flex; align-items: center; gap: 8px; color: var(--text-sub); }
.success-tips p i { color: var(--primary); }
.success-actions { display: flex; gap: 16px; justify-content: center; margin-top: 24px; }

/* ===== 加入购物车提示 ===== */
.add-tip {
  position: fixed; bottom: -60px; left: 50%; transform: translateX(-50%);
  background: #333; color: #fff; padding: 12px 24px; border-radius: 24px;
  font-size: .9em; display: flex; align-items: center; gap: 8px;
  transition: bottom .3s; z-index: 9999; white-space: nowrap;
}
.add-tip.show { bottom: 30px; }
.add-tip i { color: #4caf50; }

/* ===== 响应式 ===== */
@media (max-width: 900px) {
  .product-grid { grid-template-columns: repeat(2, 1fr); }
  .cat-grid { grid-template-columns: repeat(4, 1fr); }
  .services { grid-template-columns: repeat(2, 1fr); }
  .footer-inner { grid-template-columns: 1fr 1fr; gap: 24px; }
  .products-page { grid-template-columns: 1fr; }
  .filter-sidebar { position: static; }
  .cart-page { grid-template-columns: 1fr; }
  .checkout-page { grid-template-columns: 1fr; }
  .cart-header { display: none; }
  .cart-row { grid-template-columns: 40px 1fr; row-gap: 8px; }
  .cart-price, .cart-qty, .cart-subtotal, .cart-actions { grid-column: 2; }
}
@media (max-width: 600px) {
  .banner { height: 240px; }
  .slide-content h2 { font-size: 1.4em; }
  .nav { display: none; }
  .product-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .cat-grid { grid-template-columns: repeat(4, 1fr); }
  .top-bar { font-size: .75em; gap: 16px; }
  .search-box input { width: 130px; }
}
