/* ============================================
   康一康App - 商城页面样式
   生生健康 © 2024

   设计风格：清新健康风，与主页统一
   支持：PC / Tablet / Mobile 响应式
   ============================================ */

/* 基础重置 */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  /* 品牌色 */
  --primary: #5DB5A0;
  --primary-light: #ACE8D7;
  --primary-lighter: #D3E8EA;
  --primary-dark: #4A9A87;
  --secondary: #7DDBC4;

  /* 文字色 */
  --white: #ffffff;
  --text-dark: #2d3436;
  --text-gray: #636e72;
  --text-light: #999;

  /* 背景色 - 参考 Flutter mine_page 的渐变效果 */
  --bg-gradient-start: #D3E8EA;  /* primaryLighter */
  --bg-gradient-end: #F4F8F9;    /* scaffoldBackground */
  --bg-light: #f8fafa;
  --card-bg: #fff;
  --border-color: rgba(93, 181, 160, 0.15);

  /* 功能色 */
  --price-color: #e74c3c;
  --success: #27ae60;
  --warning: #f39c12;

  /* 阴影 */
  --shadow: 0 4px 20px rgba(93, 181, 160, 0.15);
  --shadow-hover: 0 8px 30px rgba(93, 181, 160, 0.25);
  --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.05);

  /* 圆角 */
  --radius: 16px;
  --radius-lg: 24px;
  --radius-sm: 8px;

  /* 间距 */
  --spacing-sm: 8px;
  --spacing: 16px;
  --spacing-lg: 24px;
  --spacing-xl: 40px;

  /* 最大宽度 */
  --max-width: 1200px;
}

/* 动画 */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes shimmer {
  0% { background-position: -200% center; }
  100% { background-position: 200% center; }
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  line-height: 1.6;
  color: var(--text-dark);
  background: linear-gradient(to bottom, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 25%, var(--bg-gradient-end) 100%);
  min-height: 100vh;
  overflow-x: hidden;
}

a {
  text-decoration: none;
  color: inherit;
  transition: all 0.3s ease;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* ============================================
   顶部导航栏
   ============================================ */
.mall-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.3);
  transition: all 0.3s ease;
}

.mall-header.scrolled {
  background: rgba(255, 255, 255, 0.85);
  box-shadow: var(--shadow-sm);
}

.mall-header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--spacing);
  display: flex;
  align-items: center;
  height: 64px;
}

.mall-header .back-btn {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(93, 181, 160, 0.15);
  border-radius: 50%;
  color: var(--primary-dark);
  font-size: 18px;
  transition: all 0.3s;
}

.mall-header .back-btn:hover {
  background: var(--primary);
  color: var(--white);
  transform: translateX(-2px);
}

.mall-header .logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: 12px;
}

.mall-header .logo-icon {
  font-size: 24px;
}

.mall-header .logo-text {
  font-size: 18px;
  font-weight: 600;
  color: var(--primary-dark);
}

.mall-header .logo-subtitle {
  font-size: 12px;
  color: var(--text-gray);
  margin-left: 8px;
}

/* 语言切换在 header 中的定位 */
.mall-header .lang-switcher,
.mall-header #langSwitcherContainer {
  margin-left: auto;
}

.mall-header .nav-links {
  display: flex;
  gap: 24px;
  margin-left: auto;
  margin-right: 24px;
}

.mall-header .nav-links a {
  font-size: 14px;
  color: var(--text-gray);
  padding: 8px 0;
  position: relative;
}

.mall-header .nav-links a:hover,
.mall-header .nav-links a.active {
  color: var(--primary-dark);
}

.mall-header .nav-links a::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--primary);
  transition: width 0.3s;
}

.mall-header .nav-links a:hover::after,
.mall-header .nav-links a.active::after {
  width: 100%;
}

.mall-header .search-box {
  display: flex;
  align-items: center;
  background: rgba(93, 181, 160, 0.1);
  border-radius: 24px;
  padding: 8px 16px;
  gap: 8px;
  flex: 1;
  max-width: 300px;
}

.mall-header .search-box input {
  border: none;
  background: transparent;
  outline: none;
  flex: 1;
  font-size: 14px;
  color: var(--text-dark);
}

.mall-header .search-box input::placeholder {
  color: var(--text-light);
}

.mall-header .search-icon {
  color: var(--primary);
  font-size: 16px;
}

/* 移动端菜单按钮 */
.mobile-menu-btn {
  display: none;
  width: 40px;
  height: 40px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  cursor: pointer;
  margin-left: 8px;
}

.mobile-menu-btn span {
  width: 22px;
  height: 2px;
  background: var(--primary-dark);
  border-radius: 2px;
  transition: all 0.3s;
}

/* ============================================
   主内容区域
   ============================================ */
.mall-main {
  padding-top: 64px;
  min-height: 100vh;
  padding-bottom: 100px;
}

.mall-container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--spacing);
}

/* ============================================
   Hero 轮播区域
   ============================================ */
.mall-hero {
  padding: var(--spacing-lg) 0;
}

.banner-container {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
  background: var(--card-bg);
}

.banner-list {
  display: flex;
  transition: transform 0.5s ease;
}

.banner-item {
  flex: 0 0 100%;
  /* 兼容性回退：使用 padding-bottom 模拟宽高比 */
  position: relative;
  padding-bottom: 33.33%; /* 3:1 比例 = 1/3 = 33.33% */
  height: 0;
  overflow: hidden;
}

/* 支持 aspect-ratio 的浏览器使用原生属性 */
@supports (aspect-ratio: 3/1) {
  .banner-item {
    aspect-ratio: 3/1;
    padding-bottom: 0;
    height: auto;
  }
}

.banner-item img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* 支持 aspect-ratio 时取消绝对定位 */
@supports (aspect-ratio: 3/1) {
  .banner-item img {
    position: static;
  }
}

.banner-dots {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
}

.banner-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.5);
  cursor: pointer;
  transition: all 0.3s;
}

.banner-dot.active {
  width: 24px;
  border-radius: 4px;
  background: var(--white);
}

/* ============================================
   分类导航
   ============================================ */
.category-section {
  padding: var(--spacing-lg) 0;
}

.category-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: var(--spacing);
  background: var(--card-bg);
  padding: var(--spacing-lg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.category-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--spacing);
  cursor: pointer;
  border-radius: var(--radius);
  transition: all 0.3s;
  text-decoration: none;
}

.category-item:hover {
  background: var(--primary-lighter);
  transform: translateY(-4px);
}

.category-item .icon {
  width: 56px;
  height: 56px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--primary-light), var(--secondary));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  margin-bottom: 8px;
  box-shadow: 0 4px 12px rgba(93, 181, 160, 0.3);
}

.category-item img {
  width: 56px;
  height: 56px;
  border-radius: var(--radius);
  object-fit: cover;
  margin-bottom: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.category-item span {
  font-size: 13px;
  color: var(--text-dark);
  text-align: center;
}

/* 横向滚动分类 */
.category-nav {
  display: flex;
  gap: 12px;
  padding: var(--spacing);
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.category-nav::-webkit-scrollbar {
  display: none;
}

/* 分类tabs */
.category-tabs {
  display: flex;
  gap: 8px;
  padding: var(--spacing);
  background: var(--card-bg);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius);
  margin-bottom: var(--spacing);
  box-shadow: var(--shadow-sm);
}

.category-tabs::-webkit-scrollbar {
  display: none;
}

.category-tab {
  flex: 0 0 auto;
  padding: 8px 16px;
  background: var(--bg-light);
  border-radius: 20px;
  font-size: 13px;
  color: var(--text-gray);
  cursor: pointer;
  transition: all 0.3s;
  white-space: nowrap;
}

.category-tab:hover {
  background: var(--primary-lighter);
}

.category-tab.active {
  background: var(--primary);
  color: var(--white);
}

/* ============================================
   区块标题
   ============================================ */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--spacing);
  padding: var(--spacing) 0;
}

.section-title {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-dark);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: var(--spacing) 0;
}

.section-title::before {
  content: '';
  width: 4px;
  height: 20px;
  background: linear-gradient(180deg, var(--primary), var(--secondary));
  border-radius: 2px;
}

.section-more {
  font-size: 14px;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 4px;
}

.section-more:hover {
  color: var(--primary-dark);
}

/* ============================================
   搜索栏
   ============================================ */
.search-section {
  position: relative;
  margin-bottom: var(--spacing);
}

.search-bar {
  display: flex;
  align-items: center;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 24px;
  padding: 10px 16px;
  gap: 10px;
  transition: all 0.3s;
}

.search-bar:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(93, 181, 160, 0.15);
}

.search-bar .search-icon {
  flex-shrink: 0;
  font-size: 18px;
  opacity: 0.6;
}

.search-bar input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 15px;
  color: var(--text-dark);
  outline: none;
}

.search-bar input::placeholder {
  color: var(--text-light);
}

.search-bar .search-clear {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  border: none;
  background: var(--text-light);
  color: var(--white);
  border-radius: 50%;
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.search-bar .search-clear:hover {
  background: var(--text-gray);
}

/* 搜索历史下拉 */
.search-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
  z-index: 100;
  max-height: 300px;
  overflow-y: auto;
}

.search-dropdown .dropdown-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  font-size: 13px;
  color: var(--text-light);
}

.search-dropdown .clear-history-btn {
  border: none;
  background: transparent;
  color: var(--primary);
  font-size: 13px;
  cursor: pointer;
}

.search-dropdown .clear-history-btn:hover {
  color: var(--primary-dark);
}

.search-dropdown .dropdown-list {
  padding: 8px 0;
}

.search-dropdown .history-item {
  display: flex;
  align-items: center;
  padding: 10px 16px;
  font-size: 14px;
  color: var(--text-dark);
  cursor: pointer;
  transition: background 0.2s;
}

.search-dropdown .history-item:hover {
  background: var(--bg-light);
}

.search-dropdown .history-item::before {
  content: '🕒';
  margin-right: 10px;
  opacity: 0.5;
}

.search-dropdown .empty-history {
  padding: 20px;
  text-align: center;
  color: var(--text-light);
  font-size: 13px;
}

/* 搜索结果模式 */
.search-result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--spacing) 0;
}

.search-result-header .keyword {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-dark);
}

.search-result-header .keyword em {
  color: var(--primary);
  font-style: normal;
}

.search-result-header .back-to-hot {
  font-size: 14px;
  color: var(--primary);
  cursor: pointer;
}

.search-result-header .back-to-hot:hover {
  color: var(--primary-dark);
}

/* ============================================
   商品卡片
   ============================================ */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: var(--spacing);
}

/* 瀑布流布局 */
.product-grid.waterfall {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--spacing);
}

@media (min-width: 768px) {
  .product-grid.waterfall {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 992px) {
  .product-grid.waterfall {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (min-width: 1200px) {
  .product-grid.waterfall {
    grid-template-columns: repeat(5, 1fr);
  }
}

/* 加载更多 */
.load-more {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--spacing-lg);
  color: var(--text-light);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.3s;
}

.load-more:hover {
  color: var(--primary);
}

.load-more-loading {
  display: flex;
  align-items: center;
  gap: 8px;
}

.load-more .spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--primary-lighter);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.product-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: all 0.3s ease;
  cursor: pointer;
  animation: fadeInUp 0.5s ease;
  text-decoration: none;
  display: block;
}

.product-card:hover {
  transform: translateY(-8px);
  box-shadow: var(--shadow-hover);
}

.product-card .image-wrap {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  background: var(--bg-light);
}

.product-card .image-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.product-card:hover .image-wrap img {
  transform: scale(1.08);
}

.product-card .tag {
  position: absolute;
  top: 12px;
  left: 12px;
  padding: 4px 10px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: var(--white);
  font-size: 11px;
  border-radius: 12px;
  font-weight: 500;
}

.product-card .info {
  padding: var(--spacing);
}

.product-card .name {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-dark);
  line-height: 1.5;
  margin-bottom: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 42px;
}

.product-card .desc {
  font-size: 12px;
  color: var(--text-light);
  margin-bottom: 10px;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.product-card .price-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.product-card .price {
  font-size: 18px;
  font-weight: 700;
  color: var(--price-color);
}

.product-card .original-price {
  font-size: 12px;
  color: var(--text-light);
  text-decoration: line-through;
}

.product-card .sales {
  font-size: 11px;
  color: var(--text-light);
  margin-left: auto;
}

/* 列表视图 */
.product-list .product-card {
  display: flex;
  flex-direction: row;
}

.product-list .product-card .image-wrap {
  flex: 0 0 120px;
  aspect-ratio: 1;
}

.product-list .product-card .info {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

/* ============================================
   优惠券区域
   ============================================ */
.coupon-section {
  padding: var(--spacing-lg);
  background: linear-gradient(135deg, #fff5e6, #ffe8cc);
  border-radius: var(--radius-lg);
  margin-bottom: var(--spacing);
  box-shadow: var(--shadow-sm);
}

.coupon-section .title {
  font-size: 16px;
  font-weight: 600;
  color: #e67e22;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.coupon-list {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 4px;
}

.coupon-list::-webkit-scrollbar {
  display: none;
}

.coupon-item {
  flex: 0 0 auto;
  min-width: 120px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: var(--white);
  padding: 16px 20px;
  border-radius: var(--radius);
  text-align: center;
  box-shadow: 0 4px 12px rgba(93, 181, 160, 0.3);
  transition: transform 0.3s;
  cursor: pointer;
}

.coupon-item:hover {
  transform: translateY(-4px);
}

.coupon-item .amount {
  font-size: 28px;
  font-weight: 700;
}

.coupon-item .desc {
  font-size: 12px;
  margin-top: 4px;
  opacity: 0.9;
}

/* ============================================
   筛选栏
   ============================================ */
.filter-bar {
  display: flex;
  align-items: center;
  padding: var(--spacing);
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  gap: 16px;
  margin-bottom: var(--spacing);
  flex-wrap: wrap;
}

.filter-item {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 14px;
  color: var(--text-gray);
  cursor: pointer;
  padding: 8px 16px;
  border-radius: 20px;
  transition: all 0.3s;
  background: var(--bg-light);
}

.filter-item:hover {
  background: var(--primary-lighter);
  color: var(--primary-dark);
}

.filter-item.active {
  background: var(--primary);
  color: var(--white);
}

.filter-item .icon {
  font-size: 10px;
  transition: transform 0.3s;
}

.filter-item.desc .icon {
  transform: rotate(180deg);
}

.view-toggle {
  margin-left: auto;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  cursor: pointer;
  background: var(--bg-light);
  border-radius: 50%;
  color: var(--text-gray);
  transition: all 0.3s;
}

.view-toggle:hover {
  background: var(--primary-lighter);
  color: var(--primary-dark);
}

/* ============================================
   商品详情
   ============================================ */
.detail-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: transparent;
  padding: 12px var(--spacing);
  display: flex;
  align-items: center;
  transition: all 0.3s;
}

.detail-header.scrolled {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: var(--shadow-sm);
}

.detail-header .back-btn {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 50%;
  color: var(--white);
  font-size: 18px;
  transition: all 0.3s;
}

.detail-header.scrolled .back-btn {
  background: var(--primary-lighter);
  color: var(--primary-dark);
}

.detail-header .title {
  flex: 1;
  text-align: center;
  font-size: 16px;
  font-weight: 500;
  color: var(--white);
  opacity: 0;
  transition: opacity 0.3s;
  margin: 0 50px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.detail-header.scrolled .title {
  color: var(--text-dark);
  opacity: 1;
}

/* 商品图片轮播 */
.detail-gallery {
  position: relative;
  aspect-ratio: 1;
  background: var(--card-bg);
}

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

.detail-gallery .gallery-list {
  display: flex;
  transition: transform 0.5s ease;
}

.detail-gallery .gallery-item {
  flex: 0 0 100%;
}

/* 商品信息 */
.detail-info {
  background: var(--card-bg);
  padding: var(--spacing-lg);
  margin-top: -20px;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  position: relative;
  z-index: 10;
}

.detail-info .price-section {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 12px;
}

.detail-info .price {
  font-size: 28px;
  font-weight: 700;
  color: var(--price-color);
}

.detail-info .original-price {
  font-size: 14px;
  color: var(--text-light);
  text-decoration: line-through;
}

.detail-info .discount {
  padding: 2px 8px;
  background: linear-gradient(135deg, var(--price-color), #c0392b);
  color: var(--white);
  font-size: 11px;
  border-radius: 4px;
}

.detail-info .name {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-dark);
  line-height: 1.5;
  margin-bottom: 8px;
}

.detail-info .desc {
  font-size: 14px;
  color: var(--text-gray);
  line-height: 1.6;
}

.detail-info .stats {
  display: flex;
  gap: 24px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border-color);
}

.detail-info .stat-item {
  font-size: 13px;
  color: var(--text-light);
}

.detail-info .stat-item strong {
  color: var(--text-dark);
  font-weight: 600;
}

/* 商品规格 */
.detail-section {
  background: var(--card-bg);
  padding: var(--spacing-lg);
  margin-top: 8px;
}

.detail-section .section-title {
  font-size: 16px;
  margin-bottom: 16px;
  padding: 0;
}

.detail-section .section-title::before {
  display: none;
}

.spec-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.spec-item {
  padding: 8px 16px;
  background: var(--bg-light);
  border-radius: 20px;
  font-size: 13px;
  color: var(--text-dark);
  cursor: pointer;
  transition: all 0.3s;
  border: 2px solid transparent;
}

.spec-item:hover {
  background: var(--primary-lighter);
}

.spec-item.active {
  background: var(--primary-lighter);
  border-color: var(--primary);
  color: var(--primary-dark);
}

/* 商品推荐 */
.recommend-section {
  padding: var(--spacing-lg);
  background: var(--card-bg);
  margin-top: 8px;
}

.recommend-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.recommend-title::before {
  content: '';
  width: 3px;
  height: 14px;
  background: var(--primary);
  border-radius: 2px;
}

.recommend-grid {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 4px;
}

.recommend-grid::-webkit-scrollbar {
  display: none;
}

.recommend-item {
  flex: 0 0 140px;
  cursor: pointer;
  transition: transform 0.3s;
}

.recommend-item:hover {
  transform: translateY(-4px);
}

.recommend-item img {
  width: 140px;
  height: 140px;
  object-fit: cover;
  border-radius: var(--radius);
}

.recommend-item .name {
  font-size: 12px;
  color: var(--text-dark);
  margin-top: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.recommend-item .price {
  font-size: 14px;
  font-weight: 600;
  color: var(--price-color);
  margin-top: 4px;
}

/* ============================================
   底部操作栏
   ============================================ */
.bottom-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: var(--card-bg);
  padding: 12px var(--spacing);
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.bottom-bar .btn {
  flex: 1;
  max-width: 400px;
  height: 48px;
  border: none;
  border-radius: 24px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.3s;
}

.bottom-bar .btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: var(--white);
  box-shadow: 0 4px 15px rgba(93, 181, 160, 0.4);
}

.bottom-bar .btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(93, 181, 160, 0.5);
}

.bottom-bar .btn-secondary {
  background: var(--bg-light);
  color: var(--primary-dark);
  border: 2px solid var(--primary);
}

.bottom-bar .btn-secondary:hover {
  background: var(--primary-lighter);
}

/* ============================================
   空状态/加载/错误
   ============================================ */
.loading-spinner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  color: var(--text-light);
}

.loading-spinner::before {
  content: '';
  width: 40px;
  height: 40px;
  border: 3px solid var(--primary-lighter);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 16px;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 20px;
  color: var(--text-light);
  text-align: center;
}

.empty-state .icon {
  font-size: 64px;
  margin-bottom: 16px;
  opacity: 0.5;
}

.empty-state .title {
  font-size: 16px;
  margin-bottom: 8px;
  color: var(--text-gray);
}

.empty-state .desc {
  font-size: 14px;
}

.error-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 20px;
  color: var(--text-light);
  text-align: center;
}

.error-state .icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.error-state .btn {
  margin-top: 16px;
  padding: 10px 24px;
  background: var(--primary);
  color: var(--white);
  border: none;
  border-radius: 20px;
  cursor: pointer;
}

/* ============================================
   微信提示
   ============================================ */
.browser-tip {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.85);
  z-index: 10000;
  display: none;
  flex-direction: column;
  align-items: flex-end;
  padding: 20px;
  color: var(--white);
}

.browser-tip.show {
  display: flex;
}

.browser-tip .tip-arrow {
  width: 60px;
  height: 60px;
  margin-right: 20px;
  animation: float 1.5s ease-in-out infinite;
}

.browser-tip .tip-text {
  margin-top: 20px;
  margin-right: 20px;
  text-align: right;
  font-size: 16px;
  line-height: 1.8;
}

.browser-tip .tip-close {
  margin-top: auto;
  align-self: center;
  padding: 12px 40px;
  background: var(--primary);
  border: none;
  border-radius: 24px;
  color: var(--white);
  font-size: 15px;
  cursor: pointer;
}

/* ============================================
   加载更多
   ============================================ */
.load-more {
  text-align: center;
  padding: 24px;
  color: var(--text-light);
  font-size: 14px;
}

.load-more.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.load-more.loading::after {
  content: '';
  width: 16px;
  height: 16px;
  border: 2px solid var(--primary-lighter);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* ============================================
   页脚
   ============================================ */
.mall-footer {
  background: var(--card-bg);
  padding: var(--spacing-xl) var(--spacing) var(--spacing-lg);
  margin-top: var(--spacing-xl);
  text-align: center;
}

.mall-footer .brand {
  font-size: 18px;
  font-weight: 600;
  color: var(--primary-dark);
  margin-bottom: 8px;
}

.mall-footer .copyright {
  font-size: 12px;
  color: var(--text-light);
}

/* ============================================
   旧样式兼容 (逐步迁移)
   ============================================ */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.3);
}

.header .back-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(93, 181, 160, 0.15);
  border-radius: 50%;
  cursor: pointer;
  text-decoration: none;
  color: var(--primary-dark);
  font-size: 16px;
  transition: all 0.3s;
}

.header .back-btn:hover {
  background: var(--primary);
  color: var(--white);
}

.header .title {
  flex: 1;
  font-size: 17px;
  font-weight: 600;
  color: var(--text-dark);
}

/* ============================================
   响应式设计 - 平板
   ============================================ */
@media (max-width: 992px) {
  .mall-header .nav-links {
    display: none;
  }

  .mobile-menu-btn {
    display: flex;
  }

  .product-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .banner-item {
    padding-bottom: 40%; /* 2.5:1 比例 */
  }

  @supports (aspect-ratio: 2.5/1) {
    .banner-item {
      aspect-ratio: 2.5/1;
      padding-bottom: 0;
    }
  }
}

/* ============================================
   响应式设计 - 手机
   ============================================ */
@media (max-width: 768px) {
  :root {
    --spacing-sm: 6px;
    --spacing: 12px;
    --spacing-lg: 16px;
    --radius: 12px;
    --radius-lg: 16px;
  }

  .mall-header-inner {
    height: 56px;
  }

  /* 语言切换器在移动端靠右 */
  .mall-header .lang-switcher,
  .mall-header #langSwitcherContainer {
    margin-left: auto;
    margin-right: 8px;
  }

  .mall-header .logo-subtitle {
    display: none;
  }

  .mall-header .search-box {
    max-width: none;
  }

  .mall-main {
    padding-top: 56px;
  }

  /* 移动端上方模块间距优化 */
  .mall-hero {
    padding: 10px 0 6px;
  }

  .category-section {
    padding: 6px 0;
  }

  .category-grid {
    padding: 10px;
  }

  .coupon-section {
    padding: 10px;
    margin-bottom: 8px;
  }

  .coupon-list {
    justify-content: center;
  }

  .search-section {
    margin-bottom: 10px;
  }

  .product-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .product-card .info {
    padding: 10px;
  }

  .product-card .name {
    font-size: 13px;
    min-height: 36px;
  }

  .product-card .price {
    font-size: 16px;
  }

  .banner-item {
    padding-bottom: 50%; /* 2:1 比例 */
  }

  @supports (aspect-ratio: 2/1) {
    .banner-item {
      aspect-ratio: 2/1;
      padding-bottom: 0;
    }
  }

  .category-grid {
    grid-template-columns: repeat(4, 1fr);
    padding: var(--spacing);
    gap: 8px;
  }

  .category-item {
    padding: 8px 4px;
  }

  .category-item .icon,
  .category-item img {
    width: 44px;
    height: 44px;
    font-size: 22px;
  }

  .category-item span {
    font-size: 11px;
  }

  .section-title {
    font-size: 16px;
  }

  .filter-bar {
    gap: 8px;
    padding: 10px;
  }

  .filter-item {
    padding: 6px 12px;
    font-size: 13px;
  }

  .detail-info {
    padding: var(--spacing);
  }

  .detail-info .price {
    font-size: 24px;
  }

  .detail-info .name {
    font-size: 16px;
  }

  .bottom-bar {
    padding: 10px var(--spacing);
    padding-bottom: calc(10px + env(safe-area-inset-bottom, 0));
  }

  .bottom-bar .btn {
    height: 44px;
    font-size: 14px;
  }

  .coupon-section {
    margin: 0;
    margin-bottom: 10px;
    padding: var(--spacing);
    border-radius: var(--radius);
  }

  .coupon-list {
    justify-content: center;
  }

  .coupon-item {
    min-width: 100px;
    padding: 12px 16px;
  }

  .coupon-item .amount {
    font-size: 22px;
  }
}

/* ============================================
   小屏手机
   ============================================ */
@media (max-width: 375px) {
  .product-card .price {
    font-size: 14px;
  }

  .product-card .name {
    font-size: 12px;
  }

  .category-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* ============================================
   RTL 支持 (阿拉伯语等)
   ============================================ */
html[dir="rtl"] .mall-header .back-btn:hover {
  transform: translateX(2px);
}

html[dir="rtl"] .section-title::before {
  margin-left: 10px;
  margin-right: 0;
}

html[dir="rtl"] .product-card .sales {
  margin-left: 0;
  margin-right: auto;
}

html[dir="rtl"] .filter-bar .view-toggle {
  margin-left: 0;
  margin-right: auto;
}

/* ============================================
   打印样式
   ============================================ */
@media print {
  .mall-header,
  .header,
  .bottom-bar,
  .browser-tip {
    display: none !important;
  }

  body {
    background: white;
  }
}
