/* ===== 全局基础样式 ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary: #8B4513;
  --primary-light: #A0522D;
  --primary-dark: #5D2E0C;
  --accent: #D4A017;
  --accent-light: #F0C040;
  --bg: #FAFAF7;
  --bg-card: #FFFFFF;
  --text: #2C1A0E;
  --text-light: #6B4A2A;
  --text-muted: #9E8070;
  --border: #E8D8C4;
  --border-light: #F2EAE0;
  --shadow: 0 2px 16px rgba(139,69,19,0.10);
  --shadow-hover: 0 8px 32px rgba(139,69,19,0.18);
  --radius: 12px;
  --radius-sm: 8px;
  --font-serif: 'Noto Serif SC', serif;
  --font-sans: 'Noto Sans SC', sans-serif;
  --header-h: 68px;
  --announce-h: 36px;
}

html { scroll-behavior: smooth; }
body { background: var(--bg); color: var(--text); font-family: var(--font-sans); line-height: 1.6; }
a { text-decoration: none; color: inherit; }
img { max-width: 100%; object-fit: cover; }
ul, ol { list-style: none; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }

.container { max-width: 1240px; margin: 0 auto; padding: 0 20px; }
.hidden { display: none !important; }

/* ===== 公告栏 ===== */
.announcement-bar {
  background: linear-gradient(90deg, var(--primary-dark), var(--primary));
  color: #fff;
  text-align: center;
  font-size: 13px;
  height: var(--announce-h);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  letter-spacing: 0.3px;
}
.announcement-bar .sep { opacity: 0.4; }

/* ===== 导航 ===== */
.main-header {
  position: sticky;
  top: 0;
  z-index: 900;
  background: #fff;
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 8px rgba(0,0,0,0.06);
  height: var(--header-h);
}
.header-inner {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 20px;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 32px;
}
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.logo-icon { font-size: 28px; }
.logo-main { display: block; font-family: var(--font-serif); font-size: 20px; font-weight: 700; color: var(--primary); line-height: 1.2; }
.logo-sub { display: block; font-size: 11px; color: var(--text-muted); }
.main-nav { display: flex; gap: 4px; flex: 1; }
.nav-item {
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-light);
  transition: all 0.2s;
  white-space: nowrap;
}
.nav-item:hover, .nav-item.active {
  color: var(--primary);
  background: var(--border-light);
}
.header-actions { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.search-box {
  display: flex;
  align-items: center;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 20px;
  overflow: hidden;
  transition: border-color 0.2s;
}
.search-box:focus-within { border-color: var(--primary); }
.search-box input { border: none; background: transparent; padding: 7px 14px; font-size: 13px; width: 180px; outline: none; }
.search-box button { padding: 7px 14px; color: var(--primary); background: transparent; }
.cart-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px; height: 42px;
  border-radius: 50%;
  background: var(--border-light);
  color: var(--primary);
  font-size: 18px;
  transition: all 0.2s;
}
.cart-btn:hover { background: var(--primary); color: #fff; }
.cart-badge {
  position: absolute;
  top: -4px; right: -4px;
  background: #E53935;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  min-width: 18px; height: 18px;
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  padding: 0 4px;
  border: 2px solid #fff;
}
.cart-badge.zero { display: none; }

/* ===== Hero Banner ===== */
.hero-banner {
  background: linear-gradient(135deg, #3B1F0A 0%, #7A3B10 45%, #A05220 100%);
  color: #fff;
  padding: 72px 20px 48px;
  position: relative;
  overflow: hidden;
}
.hero-banner::before {
  content: '';
  position: absolute;
  top: -50%; right: -20%;
  width: 600px; height: 600px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(212,160,23,0.15) 0%, transparent 70%);
  pointer-events: none;
}
.hero-content { max-width: 1240px; margin: 0 auto; }
.hero-tag {
  display: inline-block;
  background: rgba(212,160,23,0.25);
  border: 1px solid rgba(212,160,23,0.5);
  color: var(--accent-light);
  padding: 4px 14px;
  border-radius: 20px;
  font-size: 13px;
  margin-bottom: 20px;
}
.hero-title {
  font-family: var(--font-serif);
  font-size: clamp(36px, 6vw, 64px);
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 20px;
  text-shadow: 0 2px 12px rgba(0,0,0,0.3);
}
.hero-desc {
  font-size: 16px;
  opacity: 0.85;
  line-height: 1.8;
  margin-bottom: 32px;
}
.hero-btns { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 48px; }
.btn-primary {
  padding: 13px 32px;
  background: var(--accent);
  color: #3B1F0A;
  font-weight: 700;
  font-size: 15px;
  border-radius: 24px;
  transition: all 0.2s;
  box-shadow: 0 4px 16px rgba(212,160,23,0.4);
}
.btn-primary:hover { background: var(--accent-light); transform: translateY(-2px); }
.btn-outline {
  padding: 13px 32px;
  border: 2px solid rgba(255,255,255,0.6);
  color: #fff;
  font-weight: 500;
  font-size: 15px;
  border-radius: 24px;
  transition: all 0.2s;
}
.btn-outline:hover { background: rgba(255,255,255,0.12); border-color: #fff; }
.hero-stats { display: flex; gap: 40px; flex-wrap: wrap; }
.stat-item { display: flex; flex-direction: column; gap: 2px; }
.stat-num { font-family: var(--font-serif); font-size: 28px; font-weight: 700; color: var(--accent-light); }
.stat-label { font-size: 13px; opacity: 0.75; }

/* ===== 分类Tab ===== */
.category-nav {
  background: #fff;
  border-bottom: 1px solid var(--border);
  padding: 0;
  position: sticky;
  top: var(--header-h);
  z-index: 800;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.category-nav .container { padding: 0 20px; }
.cat-tabs { display: flex; gap: 0; overflow-x: auto; padding: 0; border-bottom: 1px solid var(--border-light); }
.cat-tabs::-webkit-scrollbar { display: none; }
.cat-tab {
  padding: 14px 22px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-light);
  white-space: nowrap;
  border-bottom: 3px solid transparent;
  margin-bottom: -1px;
  transition: all 0.2s;
}
.cat-tab:hover { color: var(--primary); }
.cat-tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
.sort-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
}
.total-count { font-size: 13px; color: var(--text-muted); }
.sort-opts { display: flex; gap: 6px; }
.sort-btn {
  padding: 5px 14px;
  border-radius: 16px;
  font-size: 13px;
  color: var(--text-light);
  border: 1px solid var(--border);
  transition: all 0.2s;
}
.sort-btn:hover, .sort-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ===== 产品列表 ===== */
.products-section { padding: 28px 0 60px; }
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 20px;
}
.product-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: all 0.3s;
  cursor: pointer;
  border: 1px solid var(--border-light);
}
.product-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-hover);
}
.card-img-wrap {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  background: var(--bg);
}
.card-img-wrap img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform 0.4s;
}
.product-card:hover .card-img-wrap img { transform: scale(1.06); }
.card-badges {
  position: absolute;
  top: 10px; left: 10px;
  display: flex; flex-direction: column; gap: 4px;
}
.badge {
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
}
.badge-hot { background: #E53935; color: #fff; }
.badge-new { background: var(--accent); color: #3B1F0A; }
.card-body { padding: 14px; }
.card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.4;
  margin-bottom: 8px;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}
.card-meta { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.card-meta span {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  background: var(--border-light);
  color: var(--text-muted);
}
.card-price-row { display: flex; align-items: baseline; gap: 8px; margin-bottom: 8px; }
.price-from { font-size: 11px; color: var(--text-muted); }
.price-main { font-size: 20px; font-weight: 700; color: #E53935; font-family: var(--font-serif); }
.price-main::before { content: '¥'; font-size: 13px; }
.price-original { font-size: 12px; color: var(--text-muted); text-decoration: line-through; }
.price-original::before { content: '¥'; }
.card-sales { font-size: 12px; color: var(--text-muted); }
.card-footer { display: flex; gap: 8px; padding: 0 14px 14px; }
.btn-cart {
  flex: 1;
  padding: 9px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  border: 2px solid var(--primary);
  color: var(--primary);
  background: #fff;
  transition: all 0.2s;
}
.btn-cart:hover { background: var(--primary); color: #fff; }
.btn-buy {
  flex: 1;
  padding: 9px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: #fff;
  transition: all 0.2s;
}
.btn-buy:hover { background: linear-gradient(135deg, var(--primary-dark), var(--primary)); transform: translateY(-1px); }

/* ===== 面包屑 ===== */
.breadcrumb-bar {
  padding: 12px 0;
  background: #fff;
  border-bottom: 1px solid var(--border-light);
  font-size: 13px;
  color: var(--text-muted);
}
.breadcrumb-bar a { color: var(--text-muted); transition: color 0.2s; }
.breadcrumb-bar a:hover { color: var(--primary); }
.breadcrumb-bar .fa-chevron-right { font-size: 10px; margin: 0 8px; opacity: 0.5; }

/* ===== 特色区域 ===== */
.features-section {
  background: #fff;
  padding: 60px 0;
  border-top: 1px solid var(--border-light);
}
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 32px;
}
.feature-item { text-align: center; padding: 20px; }
.feature-item i {
  font-size: 36px;
  color: var(--primary);
  margin-bottom: 16px;
  display: block;
}
.feature-item h3 { font-size: 16px; font-weight: 700; margin-bottom: 8px; color: var(--text); }
.feature-item p { font-size: 13px; color: var(--text-muted); line-height: 1.6; }

/* ===== 页脚 ===== */
.main-footer { background: #2C1A0E; color: rgba(255,255,255,0.85); }
.footer-inner {
  max-width: 1240px;
  margin: 0 auto;
  padding: 48px 20px 32px;
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 40px;
}
.footer-brand .logo-icon { font-size: 32px; }
.footer-name { font-family: var(--font-serif); font-size: 22px; font-weight: 700; color: var(--accent-light); margin-left: 8px; }
.footer-brand p { font-size: 13px; opacity: 0.7; margin-top: 12px; line-height: 1.7; }
.footer-links h4, .footer-contact h4 { font-size: 14px; font-weight: 600; color: var(--accent-light); margin-bottom: 14px; }
.footer-links a { display: block; font-size: 13px; opacity: 0.7; margin-bottom: 8px; transition: opacity 0.2s; }
.footer-links a:hover { opacity: 1; }
.footer-contact p { font-size: 13px; opacity: 0.7; margin-bottom: 8px; display: flex; align-items: center; gap: 8px; }
.footer-contact i { color: var(--accent); }
.footer-bottom { border-top: 1px solid rgba(255,255,255,0.1); text-align: center; padding: 16px 20px; font-size: 12px; opacity: 0.5; }

/* ===== 加载动画 ===== */
.loading-spinner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 60px;
  color: var(--text-muted);
  font-size: 14px;
  grid-column: 1 / -1;
}
.loading-spinner i { font-size: 24px; color: var(--primary); }

/* ===== 空状态 ===== */
.no-result {
  text-align: center;
  padding: 80px 20px;
  color: var(--text-muted);
}
.no-result i { font-size: 48px; margin-bottom: 16px; display: block; opacity: 0.4; }
.no-result p { font-size: 15px; }

/* ===== AI 悬浮按钮 ===== */
.ai-float-btn {
  position: fixed;
  bottom: 30px; right: 30px;
  z-index: 1000;
  width: 58px; height: 58px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px;
  box-shadow: 0 4px 20px rgba(139,69,19,0.4);
  cursor: pointer;
  transition: all 0.3s;
  flex-direction: column;
  gap: 2px;
}
.ai-float-btn:hover { transform: scale(1.1) translateY(-4px); box-shadow: 0 8px 32px rgba(139,69,19,0.5); }
.ai-tip {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.5px;
}

/* ===== AI 聊天弹窗 ===== */
.ai-chat-modal {
  position: fixed;
  bottom: 100px; right: 30px;
  z-index: 1001;
  width: 360px;
  display: none;
  animation: slideUp 0.3s ease;
}
.ai-chat-modal.open { display: block; }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
.ai-chat-box {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.18);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: 520px;
}
.ai-chat-header {
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
  color: #fff;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.ai-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
}
.ai-title { flex: 1; }
.ai-title span:first-child { display: block; font-size: 14px; font-weight: 600; }
.ai-status { font-size: 11px; opacity: 0.8; }
.ai-status::before { content: '● '; color: #4CAF50; font-size: 9px; }
.ai-close { background: transparent; color: rgba(255,255,255,0.8); font-size: 16px; padding: 4px; border-radius: 4px; transition: all 0.2s; }
.ai-close:hover { background: rgba(255,255,255,0.2); color: #fff; }
.ai-chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 200px;
  max-height: 300px;
}
.ai-chat-body::-webkit-scrollbar { width: 4px; }
.ai-chat-body::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
.ai-msg { display: flex; gap: 8px; max-width: 90%; }
.ai-msg.bot { align-self: flex-start; }
.ai-msg.user { align-self: flex-end; flex-direction: row-reverse; }
.ai-msg-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 13px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.ai-msg.user .ai-msg-avatar { background: var(--text-muted); }
.ai-msg-bubble {
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.6;
}
.ai-msg.bot .ai-msg-bubble {
  background: var(--border-light);
  color: var(--text);
  border-top-left-radius: 4px;
}
.ai-msg.user .ai-msg-bubble {
  background: var(--primary);
  color: #fff;
  border-top-right-radius: 4px;
}
.ai-quick-btns {
  padding: 8px 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  border-top: 1px solid var(--border-light);
  border-bottom: 1px solid var(--border-light);
  background: var(--bg);
}
.ai-quick-btn {
  padding: 5px 12px;
  border-radius: 14px;
  font-size: 12px;
  background: #fff;
  border: 1px solid var(--border);
  color: var(--text-light);
  transition: all 0.2s;
}
.ai-quick-btn:hover { background: var(--primary); color: #fff; border-color: var(--primary); }
.ai-chat-input {
  display: flex;
  gap: 8px;
  padding: 12px;
  background: #fff;
}
.ai-chat-input input {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 8px 16px;
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s;
}
.ai-chat-input input:focus { border-color: var(--primary); }
.ai-chat-input button {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 14px;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}
.ai-chat-input button:hover { background: var(--primary-dark); }

/* ===== Toast 提示 ===== */
.toast {
  position: fixed;
  top: 80px; left: 50%;
  transform: translateX(-50%) translateY(-100px);
  background: #333;
  color: #fff;
  padding: 12px 24px;
  border-radius: 24px;
  font-size: 14px;
  z-index: 9999;
  transition: transform 0.3s ease;
  pointer-events: none;
  white-space: nowrap;
}
.toast.show { transform: translateX(-50%) translateY(0); }
.toast.success { background: #4CAF50; }
.toast.error { background: #E53935; }

/* ===== 下单弹窗 ===== */
.order-modal {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  z-index: 2000;
  width: min(520px, 95vw);
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
  overflow: hidden;
}
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1999;
  backdrop-filter: blur(2px);
}
.order-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--border-light);
}
.order-header h3 { font-size: 16px; font-weight: 700; color: var(--text); }
.order-header button { font-size: 18px; color: var(--text-muted); padding: 4px; transition: color 0.2s; }
.order-header button:hover { color: var(--primary); }
.order-body { padding: 24px; max-height: 70vh; overflow-y: auto; }
.order-product-info {
  background: var(--border-light);
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 20px;
  font-size: 13px;
  color: var(--text-light);
}
.form-row { margin-bottom: 16px; }
.form-row label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--text); }
.form-row label em { color: #E53935; font-style: normal; }
.form-row input, .form-row textarea, .form-row select {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
  color: var(--text);
}
.form-row input:focus, .form-row textarea:focus { border-color: var(--primary); }
.form-row textarea { resize: vertical; min-height: 72px; }
.order-total {
  padding: 12px 0;
  margin: 12px 0;
  border-top: 1px dashed var(--border);
  border-bottom: 1px dashed var(--border);
  font-size: 14px;
  color: var(--text-light);
}
.order-submit-btn {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  border-radius: 10px;
  margin-top: 4px;
  transition: all 0.2s;
}
.order-submit-btn:hover { transform: translateY(-2px); box-shadow: 0 4px 16px rgba(139,69,19,0.35); }

/* ===== 响应式 ===== */
@media (max-width: 768px) {
  .main-nav { display: none; }
  .search-box { display: none; }
  .hero-banner { padding: 48px 20px 32px; }
  .hero-stats { gap: 24px; }
  .footer-inner { grid-template-columns: 1fr; gap: 24px; }
  .product-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .ai-chat-modal { width: calc(100vw - 20px); right: 10px; bottom: 80px; }
  .announcement-bar { font-size: 12px; gap: 8px; flex-wrap: wrap; height: auto; padding: 8px; }
  .announcement-bar .sep { display: none; }
}
@media (max-width: 480px) {
  .product-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .card-body { padding: 10px; }
  .card-title { font-size: 12px; }
  .price-main { font-size: 16px; }
}
