/* ====== 全局样式 ====== */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --primary: #e74c3c;
  --primary-dark: #c0392b;
  --primary-light: #ffeae7;
  --secondary: #2c3e50;
  --accent: #f39c12;
  --success: #27ae60;
  --text: #333;
  --text-light: #777;
  --bg: #f9f9f9;
  --white: #fff;
  --border: #eee;
  --shadow: 0 2px 12px rgba(0,0,0,0.08);
  --shadow-hover: 0 4px 20px rgba(0,0,0,0.15);
}

html { scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { text-decoration: none; color: inherit; transition: all 0.3s; }
img { max-width: 100%; display: block; }
ul { list-style: none; }

.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }

/* ====== 顶部公告 ====== */
.top-bar {
  background: var(--secondary);
  color: #ccc;
  font-size: 13px;
}
.top-bar .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 36px;
}
.top-bar a { color: #ccc; margin-left: 15px; }
.top-bar a:hover { color: var(--white); }

/* ====== 头部导航 ====== */
header {
  background: var(--white);
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 1000;
}
header .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 70px;
}
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 22px;
  font-weight: bold;
  color: var(--primary);
}
.logo-icon {
  width: 40px; height: 40px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: white; font-size: 20px; font-weight: bold;
}

nav ul { display: flex; gap: 30px; }
nav ul li a {
  font-size: 15px;
  font-weight: 500;
  padding: 8px 0;
  position: relative;
}
nav ul li a:hover, nav ul li a.active { color: var(--primary); }
nav ul li a.active::after {
  content: '';
  position: absolute;
  bottom: -4px; left: 0; right: 0;
  height: 2px;
  background: var(--primary);
  border-radius: 2px;
}

.header-actions { display: flex; align-items: center; gap: 18px; }
.header-actions .icon-btn {
  position: relative;
  font-size: 20px;
  color: var(--text);
  background: none; border: none; cursor: pointer;
}
.header-actions .icon-btn:hover { color: var(--primary); }
.cart-count {
  position: absolute;
  top: -8px; right: -12px;
  background: var(--primary);
  color: white;
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
}

.search-box {
  display: flex;
  background: var(--bg);
  border-radius: 20px;
  overflow: hidden;
  width: 240px;
}
.search-box input {
  border: none;
  background: transparent;
  padding: 8px 14px;
  flex: 1;
  font-size: 13px;
  outline: none;
}
.search-box button {
  background: var(--primary);
  color: white;
  border: none;
  padding: 0 14px;
  cursor: pointer;
}

/* ====== 面包屑 ====== */
.breadcrumb {
  background: var(--white);
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-light);
}
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb span { margin: 0 8px; }

/* ====== Hero Banner ====== */
.hero {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  padding: 80px 0;
  color: white;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute;
  top: -50%; left: -50%;
  width: 200%; height: 200%;
  background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 60%);
  animation: pulse 15s infinite;
}
@keyframes pulse {
  0%,100% { transform: scale(1); opacity: 0.5; }
  50% { transform: scale(1.1); opacity: 0.8; }
}
.hero .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 40px;
  position: relative;
}
.hero-content { max-width: 550px; }
.hero-content h1 {
  font-size: 44px;
  font-weight: bold;
  margin-bottom: 18px;
  line-height: 1.2;
}
.hero-content p {
  font-size: 17px;
  margin-bottom: 30px;
  opacity: 0.9;
}
.hero-btns { display: flex; gap: 16px; }
.btn {
  display: inline-block;
  padding: 12px 28px;
  border-radius: 25px;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all 0.3s;
  text-align: center;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-2px); box-shadow: 0 6px 20px rgba(231,76,60,0.4); }
.btn-outline { background: transparent; color: white; border: 2px solid white; }
.btn-outline:hover { background: white; color: var(--secondary); }

.hero-image {
  width: 400px; height: 320px;
  background: rgba(255,255,255,0.1);
  border-radius: 20px;
  display: flex; align-items: center; justify-content: center;
  font-size: 100px;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.2);
}

/* ====== 分类入口 ====== */
.section { padding: 50px 0; }
.section-title {
  text-align: center;
  margin-bottom: 40px;
}
.section-title h2 {
  font-size: 28px;
  color: var(--secondary);
  margin-bottom: 8px;
}
.section-title p { color: var(--text-light); font-size: 14px; }

.categories {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
}
.category-card {
  background: var(--white);
  border-radius: 14px;
  padding: 30px 20px;
  text-align: center;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: all 0.3s;
}
.category-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-hover);
}
.category-icon {
  width: 70px; height: 70px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 32px;
  margin: 0 auto 16px;
}
.cat-1 { background: #ffeaea; color: #e74c3c; }
.cat-2 { background: #e8f5e9; color: #27ae60; }
.cat-3 { background: #e3f2fd; color: #2980b9; }
.cat-4 { background: #fff3e0; color: #e67e22; }
.category-card h3 { font-size: 17px; margin-bottom: 6px; }
.category-card p { font-size: 13px; color: var(--text-light); }

/* ====== 商品网格 ====== */
.products-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
}
.product-card {
  background: var(--white);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: all 0.3s;
  cursor: pointer;
}
.product-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-hover);
}
.product-img {
  aspect-ratio: 1;
  background: linear-gradient(135deg, #f5f7fa, #e4e8ec);
  display: flex; align-items: center; justify-content: center;
  font-size: 60px;
  position: relative;
  overflow: hidden;
}
/* 图片+emoji 双层：真实图覆盖兜底emoji，加载失败自动隐藏 */
.product-img .img-fallback {
  font-size: 60px;
  position: relative;
  z-index: 0;
}
.product-img .product-real-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 1;
  transition: transform 0.3s;
}
.product-card:hover .product-real-img {
  transform: scale(1.05);
}
.product-tag {
  position: absolute;
  top: 12px; left: 12px;
  background: var(--primary);
  color: white;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 500;
}
.product-tag.hot { background: var(--accent); }
.product-tag.new { background: var(--success); }

.product-info { padding: 16px; }
.product-name {
  font-size: 15px;
  color: var(--text);
  margin-bottom: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 42px;
}
.product-price-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.product-price {
  color: var(--primary);
  font-size: 20px;
  font-weight: bold;
}
.product-price .old-price {
  font-size: 13px;
  color: var(--text-light);
  text-decoration: line-through;
  margin-left: 6px;
  font-weight: normal;
}
.product-rating { font-size: 13px; color: var(--accent); }

/* ====== 商品详情 ====== */
.product-detail {
  padding: 40px 0;
}
.detail-container {
  background: var(--white);
  border-radius: 14px;
  padding: 30px;
  box-shadow: var(--shadow);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
}
.detail-gallery {
  background: linear-gradient(135deg, #f5f7fa, #e4e8ec);
  border-radius: 12px;
  aspect-ratio: 1;
  display: flex; align-items: center; justify-content: center;
  font-size: 140px;
  position: relative;
  overflow: hidden;
}
.detail-gallery .img-fallback { position: relative; z-index: 0; }
.detail-gallery .product-real-img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; z-index: 1;
}
.cart-product-img {
  width: 80px; height: 80px;
  background: linear-gradient(135deg, #f5f7fa, #e4e8ec);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 36px;
  position: relative;
  overflow: hidden;
}
.cart-product-img .img-fallback { position: relative; z-index: 0; font-size: 36px; }
.cart-product-img .product-real-img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; z-index: 1;
}
.detail-info h1 {
  font-size: 26px;
  margin-bottom: 12px;
  line-height: 1.3;
}
.detail-price-row {
  display: flex;
  align-items: baseline;
  gap: 14px;
  margin: 20px 0;
  padding: 18px;
  background: var(--primary-light);
  border-radius: 10px;
}
.detail-price { font-size: 32px; color: var(--primary); font-weight: bold; }
.detail-price .old {
  font-size: 16px;
  color: var(--text-light);
  text-decoration: line-through;
}
.detail-price .discount {
  background: var(--primary);
  color: white;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
}

.detail-desc {
  color: var(--text-light);
  font-size: 14px;
  line-height: 1.8;
  margin-bottom: 20px;
}

.detail-specs {
  border-top: 1px solid var(--border);
  padding-top: 20px;
  margin-bottom: 20px;
}
.detail-specs h4 { margin-bottom: 12px; font-size: 15px; }
.spec-item {
  display: flex;
  padding: 6px 0;
  font-size: 13px;
}
.spec-item .label { width: 100px; color: var(--text-light); }
.spec-item .value { color: var(--text); }

.qty-row {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}
.qty-row .label { font-size: 14px; color: var(--text-light); }
.qty-control {
  display: flex;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}
.qty-control button {
  width: 36px; height: 36px;
  border: none;
  background: var(--bg);
  cursor: pointer;
  font-size: 16px;
}
.qty-control button:hover { background: #eee; }
.qty-control input {
  width: 50px;
  text-align: center;
  border: none;
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
  font-size: 15px;
  outline: none;
}

.detail-btns { display: flex; gap: 14px; }
.btn-cart {
  flex: 1;
  background: var(--white);
  color: var(--primary);
  border: 2px solid var(--primary);
  padding: 14px;
  border-radius: 8px;
  font-size: 15px;
  cursor: pointer;
  transition: all 0.3s;
}
.btn-cart:hover { background: var(--primary-light); }
.btn-buy {
  flex: 1;
  background: var(--primary);
  color: white;
  border: none;
  padding: 14px;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s;
}
.btn-buy:hover { background: var(--primary-dark); }

/* ====== 购物车 ====== */
.cart-page { padding: 40px 0; }
.cart-container {
  background: var(--white);
  border-radius: 12px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.cart-header, .cart-item {
  display: grid;
  grid-template-columns: 3fr 1fr 1fr 1fr 50px;
  gap: 20px;
  align-items: center;
  padding: 18px 24px;
}
.cart-header {
  background: var(--bg);
  font-size: 13px;
  color: var(--text-light);
  font-weight: 500;
}
.cart-item {
  border-bottom: 1px solid var(--border);
}
.cart-item:last-child { border-bottom: none; }
.cart-product {
  display: flex;
  gap: 14px;
  align-items: center;
}
.cart-product-img {
  width: 80px; height: 80px;
  background: linear-gradient(135deg, #f5f7fa, #e4e8ec);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 36px;
}
.cart-product-info h4 {
  font-size: 14px;
  margin-bottom: 4px;
}
.cart-product-info p {
  font-size: 12px;
  color: var(--text-light);
}
.cart-price { color: var(--primary); font-weight: 500; }
.cart-total { color: var(--primary); font-weight: bold; font-size: 17px; }
.cart-remove {
  background: none;
  border: none;
  font-size: 20px;
  color: var(--text-light);
  cursor: pointer;
}
.cart-remove:hover { color: var(--primary); }

.cart-footer {
  padding: 20px 24px;
  background: var(--bg);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.cart-summary { text-align: right; }
.cart-summary .label { font-size: 14px; color: var(--text-light); }
.cart-summary .amount { font-size: 28px; color: var(--primary); font-weight: bold; }

.empty-cart {
  text-align: center;
  padding: 80px 20px;
  color: var(--text-light);
}
.empty-cart .icon { font-size: 80px; margin-bottom: 20px; opacity: 0.5; }

/* ====== 结算页 ====== */
.checkout-page { padding: 40px 0; }
.checkout-container {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 24px;
}
.checkout-card {
  background: var(--white);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 28px;
  margin-bottom: 20px;
}
.checkout-card h3 {
  font-size: 17px;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--bg);
}
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block;
  font-size: 13px;
  color: var(--text-light);
  margin-bottom: 6px;
}
.form-group input, .form-group select {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  outline: none;
  transition: border 0.3s;
}
.form-group input:focus, .form-group select:focus {
  border-color: var(--primary);
}
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.payment-methods { display: flex; gap: 14px; }
.payment-option {
  flex: 1;
  border: 2px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s;
}
.payment-option:hover { border-color: var(--primary); }
.payment-option.active {
  border-color: var(--primary);
  background: var(--primary-light);
}
.payment-option .icon { font-size: 28px; margin-bottom: 6px; }
.payment-option .name { font-size: 13px; font-weight: 500; }

.order-summary-table { width: 100%; }
.order-summary-table tr {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  font-size: 14px;
}
.order-summary-table tr.total {
  border-top: 1px solid var(--border);
  margin-top: 10px;
  padding-top: 16px;
  font-size: 18px;
  font-weight: bold;
  color: var(--primary);
}

.place-order-btn {
  width: 100%;
  padding: 14px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  margin-top: 16px;
  transition: all 0.3s;
}
.place-order-btn:hover { background: var(--primary-dark); }

/* ====== 联系 / 关于 ====== */
.info-page { padding: 40px 0; }
.info-card {
  background: var(--white);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 40px;
}
.info-card h1 { font-size: 28px; margin-bottom: 24px; color: var(--secondary); }
.info-card h2 { font-size: 19px; margin: 24px 0 12px; color: var(--secondary); }
.info-card p { margin-bottom: 14px; color: var(--text-light); line-height: 1.8; }

.contact-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-top: 30px;
}
.contact-item {
  text-align: center;
  padding: 24px;
  background: var(--bg);
  border-radius: 10px;
}
.contact-item .icon { font-size: 36px; margin-bottom: 12px; }
.contact-item h4 { font-size: 15px; margin-bottom: 6px; }
.contact-item p { font-size: 13px; color: var(--text-light); }

/* ====== 成功弹窗 ====== */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}
.modal-overlay.show { display: flex; }
.modal {
  background: white;
  border-radius: 14px;
  padding: 40px;
  text-align: center;
  max-width: 400px;
  width: 90%;
  animation: modalIn 0.3s;
}
@keyframes modalIn {
  from { transform: scale(0.8); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
.modal .success-icon {
  width: 70px; height: 70px;
  background: var(--success);
  color: white;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 36px;
  margin: 0 auto 18px;
}
.modal h3 { font-size: 20px; margin-bottom: 10px; }
.modal p { color: var(--text-light); margin-bottom: 24px; font-size: 14px; }

/* ====== 页脚 ====== */
footer {
  background: var(--secondary);
  color: #bbb;
  padding: 50px 0 20px;
  margin-top: auto;
}
.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 40px;
  margin-bottom: 40px;
}
.footer-col h4 {
  color: white;
  font-size: 16px;
  margin-bottom: 18px;
}
.footer-col p, .footer-col a {
  font-size: 13px;
  line-height: 2;
}
.footer-col a:hover { color: white; }
.footer-col .brand {
  display: flex; align-items: center; gap: 10px;
  font-size: 20px; font-weight: bold; color: white;
  margin-bottom: 14px;
}
.footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.1);
  padding-top: 20px;
  text-align: center;
  font-size: 12px;
  color: #999;
}
.footer-bottom a { color: #aaa; }
.footer-bottom a:hover { color: white; }

/* ====== 响应式 ====== */
@media (max-width: 1024px) {
  .products-grid { grid-template-columns: repeat(3, 1fr); }
  .categories { grid-template-columns: repeat(2, 1fr); }
  .cart-header, .cart-item { grid-template-columns: 2fr 1fr 1fr 1fr 40px; padding: 14px 16px; }
  .checkout-container { grid-template-columns: 1fr; }
  .detail-container { grid-template-columns: 1fr; }
  .hero .container { flex-direction: column; text-align: center; }
  .hero-btns { justify-content: center; }
}
@media (max-width: 768px) {
  nav ul { gap: 16px; }
  .search-box { display: none; }
  .products-grid { grid-template-columns: repeat(2, 1fr); }
  .hero-content h1 { font-size: 30px; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .contact-grid { grid-template-columns: 1fr; }
  .cart-header { display: none; }
  .cart-item { grid-template-columns: 1fr; gap: 10px; }
}
