/* ============================================================
   SaaSShop Frontend Theme — Design System
   ============================================================
   现代、干净、带有品质感的电商前端视觉体系
   适用: PC端 + H5移动端
   版本: 1.0
   ============================================================ */

/* ========================================
   设计令牌 (Design Tokens)
   ======================================== */

:root {
  /* 品牌色 */
  --primary: #1677ff;
  --primary-light: #e6f4ff;
  --primary-dark: #0958d9;

  /* 功能色 */
  --success: #16a34a;
  --warning: #fa8c16;
  --danger: #ef4444;
  --info: #13c2c2;

  /* 中性色 — 文字 */
  --text: #0f172a;
  --text-secondary: #64748b;
  --text-tertiary: #94a3b8;

  /* 中性色 — 背景 & 边框 */
  --bg: #f5f6fa;
  --bg-card: #ffffff;
  --border: #f1f5f9;

  /* 圆角 */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  /* 阴影 */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);

  /* 字体 */
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-mono: "SF Mono", "Fira Code", "Consolas", monospace;

  /* 过渡 */
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);

  /* 布局 */
  --header-height: 60px;
  --bottom-nav-height: 56px;
  --safe-area-bottom: env(safe-area-inset-bottom, 0px);
}


/* ========================================
   基础样式 (Base)
   ======================================== */

*,
*::before,
*::after {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  padding: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: var(--transition);
}

a:hover {
  color: var(--primary-dark);
}

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

ul, ol {
  list-style: none;
  margin: 0;
  padding: 0;
}

h1, h2, h3, h4, h5, h6 {
  margin: 0;
  font-weight: 600;
  line-height: 1.3;
}

p {
  margin: 0;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  padding: 0;
}

input, textarea, select {
  font-family: inherit;
  font-size: inherit;
}


/* ========================================
   通用容器 (Container)
   ======================================== */

.container {
  width: 100%;
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
  padding-left: 16px;
  padding-right: 16px;
}

.container-wide {
  width: 100%;
  max-width: 1400px;
  margin-left: auto;
  margin-right: auto;
  padding-left: 16px;
  padding-right: 16px;
}

.container-narrow {
  width: 100%;
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
  padding-left: 16px;
  padding-right: 16px;
}

@media (min-width: 768px) {
  .container,
  .container-wide,
  .container-narrow {
    padding-left: 24px;
    padding-right: 24px;
  }
}


/* ========================================
   卡片体系 (Card)
   ======================================== */

.card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: 20px;
  transition: var(--transition);
}

.card-hover {
  cursor: pointer;
  transition: var(--transition);
}

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

.card-compact {
  padding: 12px 14px;
}

.card-plain {
  background: transparent;
  box-shadow: none;
  padding: 0;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.card-title {
  font-size: 16px;
  font-weight: 600;
}

.card-body {
  /* 默认 flex: 1 */
}

.card-footer {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}


/* ========================================
   按钮体系 (Button)
   ======================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 18px;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.4;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: var(--transition);
  user-select: none;
  white-space: nowrap;
  text-align: center;
}

.btn:active {
  transform: scale(0.97);
}

.btn:disabled,
.btn.disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* 主按钮 */
.btn-primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  box-shadow: 0 2px 6px rgba(22, 119, 255, 0.3);
}

.btn-primary:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
  box-shadow: 0 4px 12px rgba(22, 119, 255, 0.4);
}

.btn-primary:active {
  background: var(--primary-dark);
  box-shadow: 0 1px 3px rgba(22, 119, 255, 0.3);
}

/* 次按钮 — 灰色 */
.btn-secondary {
  background: #f1f5f9;
  color: var(--text);
  border-color: #e2e8f0;
}

.btn-secondary:hover {
  background: #e2e8f0;
  border-color: #cbd5e1;
}

/* 线框按钮 */
.btn-outline {
  background: transparent;
  color: var(--primary);
  border-color: var(--primary);
}

.btn-outline:hover {
  background: var(--primary-light);
  border-color: var(--primary);
}

/* 幽灵按钮 */
.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: transparent;
}

.btn-ghost:hover {
  background: #f1f5f9;
  color: var(--text);
}

/* 危险按钮 */
.btn-danger {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
  box-shadow: 0 2px 6px rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
  background: #dc2626;
  border-color: #dc2626;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
}

/* 成功按钮 */
.btn-success {
  background: var(--success);
  color: #fff;
  border-color: var(--success);
  box-shadow: 0 2px 6px rgba(22, 163, 74, 0.3);
}

.btn-success:hover {
  background: #15803d;
  border-color: #15803d;
  box-shadow: 0 4px 12px rgba(22, 163, 74, 0.4);
}

/* 尺寸变体 */
.btn-sm {
  padding: 4px 12px;
  font-size: 12px;
  border-radius: 4px;
}

.btn-lg {
  padding: 12px 24px;
  font-size: 16px;
  border-radius: var(--radius-md);
}

/* 块级按钮 */
.btn-block {
  display: flex;
  width: 100%;
}


/* ========================================
   表单 (Form)
   ======================================== */

.input,
.textarea,
.select {
  width: 100%;
  padding: 9px 12px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg-card);
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-sm);
  transition: var(--transition);
  outline: none;
}

.input:focus,
.textarea:focus,
.select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(22, 119, 255, 0.12);
}

.input::placeholder,
.textarea::placeholder {
  color: var(--text-tertiary);
}

.input:disabled,
.textarea:disabled,
.select:disabled {
  background: #f8f9fa;
  color: var(--text-tertiary);
  cursor: not-allowed;
}

.textarea {
  resize: vertical;
  min-height: 80px;
}

.select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='%2364748b'%3E%3Cpath d='M6 8L0 0h12z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
  cursor: pointer;
}

/* 输入组合 */
.input-group {
  display: flex;
  align-items: stretch;
}

.input-group .input,
.input-group .select {
  flex: 1;
  border-radius: 0;
}

.input-group .input:first-child,
.input-group .select:first-child {
  border-top-left-radius: var(--radius-sm);
  border-bottom-left-radius: var(--radius-sm);
}

.input-group .input:last-child,
.input-group .select:last-child {
  border-top-right-radius: var(--radius-sm);
  border-bottom-right-radius: var(--radius-sm);
}

.input-group .input:not(:last-child),
.input-group .select:not(:last-child) {
  border-right: none;
}

.input-group-addon {
  display: flex;
  align-items: center;
  padding: 0 12px;
  background: #f8f9fa;
  border: 1px solid #e2e8f0;
  font-size: 14px;
  color: var(--text-secondary);
  white-space: nowrap;
}

.input-group-addon:first-child {
  border-right: none;
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
}

.input-group-addon:last-child {
  border-left: none;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

/* 表单标签 */
.form-label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 6px;
}

.form-help {
  display: block;
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: 4px;
}

.form-error {
  display: block;
  font-size: 12px;
  color: var(--danger);
  margin-top: 4px;
}

.form-group {
  margin-bottom: 16px;
}

/* 复选框 & 单选框 */
.checkbox,
.radio {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 14px;
}

.checkbox input[type="checkbox"],
.radio input[type="radio"] {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
}


/* ========================================
   标签 & 徽章 (Tag / Badge)
   ======================================== */

.tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  font-size: 12px;
  font-weight: 500;
  border-radius: 4px;
  line-height: 1.5;
  background: #f1f5f9;
  color: var(--text-secondary);
  white-space: nowrap;
}

.tag-primary {
  background: var(--primary-light);
  color: var(--primary);
}

.tag-success {
  background: #dcfce7;
  color: var(--success);
}

.tag-warning {
  background: #fff7ed;
  color: var(--warning);
}

.tag-danger {
  background: #fef2f2;
  color: var(--danger);
}

.tag-info {
  background: #e6fffb;
  color: var(--info);
}

/* 可关闭标签 */
.tag-close {
  margin-left: 4px;
  cursor: pointer;
  opacity: 0.6;
}

.tag-close:hover {
  opacity: 1;
}

/* 徽章 — 数字 */
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  color: #fff;
  background: var(--danger);
  border-radius: 9px;
  white-space: nowrap;
}

/* 圆点徽标 */
.badge-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--danger);
}

.badge-dot.primary {
  background: var(--primary);
}

.badge-dot.success {
  background: var(--success);
}

.badge-dot.warning {
  background: var(--warning);
}


/* ========================================
   排版 (Typography)
   ======================================== */

.text-primary { color: var(--primary); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger { color: var(--danger); }
.text-info { color: var(--info); }
.text-muted { color: var(--text-tertiary); }
.text-secondary { color: var(--text-secondary); }

.text-xs  { font-size: 11px; }
.text-sm  { font-size: 12px; }
.text-lg  { font-size: 16px; }
.text-xl  { font-size: 20px; }
.text-2xl { font-size: 24px; }

.text-center { text-align: center; }
.text-right  { text-align: right; }
.text-left   { text-align: left; }

.font-bold   { font-weight: 700; }
.font-medium { font-weight: 500; }
.font-normal { font-weight: 400; }

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.line-clamp-1 {
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.line-clamp-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* 价格金额字体 */
.price {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--danger);
  letter-spacing: -0.02em;
}

.price-symbol {
  font-size: 0.75em;
  font-weight: 500;
}

.price-sm {
  font-size: 14px;
}

.price-lg {
  font-size: 22px;
}


/* ========================================
   装饰块 — 轮播图 (Carousel Block)
   ======================================== */

.block-carousel {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  background: #f8f9fa;
}

.block-carousel .slide {
  position: relative;
  display: none;
}

.block-carousel .slide.active {
  display: block;
}

.block-carousel .slide img {
  width: 100%;
  object-fit: cover;
  display: block;
}

.block-carousel .slide-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 40px 20px 16px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.4));
  pointer-events: none;
}

.block-carousel .slide-title {
  color: #fff;
  font-size: 18px;
  font-weight: 700;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

.block-carousel .slide-desc {
  color: rgba(255, 255, 255, 0.85);
  font-size: 13px;
  margin-top: 4px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.block-carousel .dots {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 6px;
  z-index: 2;
}

.block-carousel .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.4);
  transition: var(--transition);
  cursor: pointer;
}

.block-carousel .dot.active {
  width: 20px;
  border-radius: 3px;
  background: #fff;
}

/* PC 轮播箭头 */
.block-carousel .arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  opacity: 0;
  transition: var(--transition);
  z-index: 3;
}

.block-carousel .arrow-left {
  left: 12px;
}

.block-carousel .arrow-right {
  right: 12px;
}

.block-carousel:hover .arrow {
  opacity: 1;
}

.block-carousel .arrow:hover {
  background: #fff;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
}

/* 轮播滑动动画 */
.block-carousel .slide-fade {
  animation: carouselFade 0.4s ease;
}

@keyframes carouselFade {
  from { opacity: 0.4; }
  to { opacity: 1; }
}


/* ========================================
   装饰块 — 商品列表 (Products Block)
   ======================================== */

.product-grid {
  display: grid;
  gap: 12px;
}

.product-card {
  position: relative;
  background: var(--bg-card);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
  cursor: pointer;
}

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

.product-card .product-img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  display: block;
  background: #f8f9fa;
}

.product-card .product-img-wrapper {
  position: relative;
  overflow: hidden;
}

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

.product-card .product-name {
  font-size: 14px;
  font-weight: 500;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  color: var(--text);
}

.product-card .product-name:hover {
  color: var(--primary);
}

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

.product-card .product-price {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-top: 6px;
  flex-wrap: wrap;
}

.product-card .current-price {
  font-size: 18px;
  font-weight: 700;
  color: var(--danger);
  font-family: var(--font-mono);
  letter-spacing: -0.02em;
}

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

.product-card .sales-count {
  font-size: 11px;
  color: var(--text-tertiary);
  margin-top: 4px;
}

.product-card .product-tag {
  position: absolute;
  top: 8px;
  left: 8px;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  color: #fff;
  z-index: 2;
  line-height: 1.5;
}

.product-tag-new {
  background: var(--primary);
}

.product-tag-hot {
  background: var(--danger);
}

.product-tag-recommend {
  background: var(--warning);
}

.product-tag-sale {
  background: var(--success);
}

/* 商品列表模式（非网格） */
.product-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.product-list .product-card {
  display: flex;
  border-radius: 0;
  box-shadow: none;
  border-bottom: 1px solid var(--border);
  padding: 12px 16px;
}

.product-list .product-card:last-child {
  border-bottom: none;
}

.product-list .product-card .product-img {
  width: 100px;
  height: 100px;
  aspect-ratio: auto;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

.product-list .product-card .product-info {
  flex: 1;
  padding: 4px 0 4px 12px;
}


/* ========================================
   装饰块 — 分类导航 (Category Block)
   ======================================== */

.category-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
}

@media (max-width: 400px) {
  .category-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
  }
}

.category-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  text-decoration: none;
}

.category-item .category-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  background: var(--primary-light);
  transition: var(--transition);
  color: var(--primary);
}

.category-item:hover .category-icon {
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(22, 119, 255, 0.2);
}

.category-item:active .category-icon {
  transform: scale(0.95);
}

.category-item .category-name {
  font-size: 12px;
  color: var(--text-secondary);
  text-align: center;
  line-height: 1.3;
}


/* ========================================
   装饰块 — 图片广告 (Image Ad Block)
   ======================================== */

.image-ad-grid {
  display: grid;
  gap: 8px;
}

.image-ad-item {
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: var(--transition);
  cursor: pointer;
}

.image-ad-item:hover {
  transform: scale(1.02);
  box-shadow: var(--shadow-md);
}

.image-ad-item:active {
  transform: scale(0.98);
}

.image-ad-item img {
  width: 100%;
  display: block;
}

/* 广告布局变体 */
.image-ad-single .image-ad-grid {
  grid-template-columns: 1fr;
}

.image-ad-double .image-ad-grid {
  grid-template-columns: 1fr 1fr;
}

.image-ad-triple .image-ad-grid {
  grid-template-columns: 1fr 1fr 1fr;
}

.image-ad-big-left .image-ad-grid {
  grid-template-columns: 2fr 1fr;
}

.image-ad-big-right .image-ad-grid {
  grid-template-columns: 1fr 2fr;
}


/* ========================================
   装饰块 — 商家列表 (Merchant Block)
   ======================================== */

.merchant-list {
  display: grid;
  gap: 12px;
}

.merchant-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: var(--bg-card);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
  cursor: pointer;
}

.merchant-card:hover {
  box-shadow: var(--shadow-md);
}

.merchant-card:active {
  transform: scale(0.99);
}

.merchant-card .merchant-logo {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  background: #f8f9fa;
}

.merchant-card .merchant-info {
  flex: 1;
  min-width: 0;
}

.merchant-card .merchant-name {
  font-weight: 600;
  font-size: 15px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.merchant-card .merchant-stats {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.merchant-card .merchant-action {
  flex-shrink: 0;
}


/* ========================================
   装饰块 — 数据统计 (Statistics Block)
   ======================================== */

.stat-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, 1fr);
}

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

.stat-item {
  text-align: center;
  padding: 20px 16px;
  border-radius: var(--radius-md);
  position: relative;
  overflow: hidden;
  color: #fff;
}

.stat-item .stat-value {
  font-size: 32px;
  font-weight: 800;
  line-height: 1.1;
  font-family: var(--font-mono);
  position: relative;
  z-index: 1;
}

.stat-item .stat-label {
  font-size: 13px;
  margin-top: 4px;
  opacity: 0.85;
  position: relative;
  z-index: 1;
}

.stat-item .stat-icon {
  position: absolute;
  right: 12px;
  bottom: -8px;
  font-size: 60px;
  opacity: 0.12;
  pointer-events: none;
}

/* 统计项配色 */
.stat-blue {
  background: linear-gradient(135deg, #1677ff, #0958d9);
}

.stat-green {
  background: linear-gradient(135deg, #16a34a, #15803d);
}

.stat-orange {
  background: linear-gradient(135deg, #fa8c16, #d97706);
}

.stat-purple {
  background: linear-gradient(135deg, #8b5cf6, #7c3aed);
}

.stat-red {
  background: linear-gradient(135deg, #ef4444, #dc2626);
}

.stat-cyan {
  background: linear-gradient(135deg, #13c2c2, #08979c);
}


/* ========================================
   装饰块 — 图标导航 (Icon Nav Block)
   ======================================== */

.icon-nav-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px 4px;
}

.icon-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px 4px;
  border-radius: var(--radius-md);
  transition: var(--transition);
  cursor: pointer;
  text-decoration: none;
  background: transparent;
}

.icon-nav-item:active {
  background: var(--primary-light);
  transform: scale(0.95);
}

.icon-nav-item .icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: var(--primary);
  background: var(--primary-light);
}

.icon-nav-item .label {
  font-size: 11px;
  color: var(--text-secondary);
  text-align: center;
  line-height: 1.2;
}


/* ========================================
   装饰块 — 公告 (Notice Block)
   ======================================== */

.notice-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--primary-light);
  border-radius: var(--radius-sm);
}

.notice-bar .notice-icon {
  font-size: 16px;
  flex-shrink: 0;
  color: var(--primary);
}

.notice-bar .notice-text {
  flex: 1;
  font-size: 13px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.notice-bar .notice-more {
  font-size: 12px;
  color: var(--text-tertiary);
  flex-shrink: 0;
  cursor: pointer;
  white-space: nowrap;
}

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


/* ========================================
   装饰块 — 分隔符 (Divider Block)
   ======================================== */

.block-divider {
  height: 8px;
  background: var(--bg);
  margin: 0 -16px;
}

.container .block-divider,
.container-wide .block-divider,
.container-narrow .block-divider {
  margin-left: -16px;
  margin-right: -16px;
}

@media (min-width: 768px) {
  .container .block-divider,
  .container-wide .block-divider,
  .container-narrow .block-divider {
    margin-left: -24px;
    margin-right: -24px;
  }
}


/* ========================================
   装饰块 — 底部 (Footer Block)
   ======================================== */

.block-footer {
  text-align: center;
  padding: 20px 16px 80px;
  font-size: 12px;
  color: var(--text-tertiary);
  border-top: 1px solid var(--border);
  line-height: 1.8;
}

.block-footer a {
  color: var(--text-tertiary);
}

.block-footer a:hover {
  color: var(--primary);
}

.block-footer .footer-links {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 4px;
  flex-wrap: wrap;
}

.block-footer .footer-links a {
  font-size: 12px;
}


/* ========================================
   装饰块 — 标题栏 (Title Bar Block)
   ======================================== */

.block-title-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
}

.block-title-bar .title-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.block-title-bar .title-bar-decor {
  width: 3px;
  height: 16px;
  border-radius: 2px;
  background: var(--primary);
}

.block-title-bar .title-bar-text {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}

.block-title-bar .title-bar-more {
  font-size: 12px;
  color: var(--text-tertiary);
  cursor: pointer;
}

.block-title-bar .title-bar-more:hover {
  color: var(--primary);
}


/* ========================================
   H5 布局组件 (Mobile Layout)
   ======================================== */

/* 顶部导航栏 */
.h5-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  height: var(--header-height);
  padding: 0 12px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  transition: var(--transition);
}

.h5-header.transparent {
  background: transparent;
  border-bottom: none;
  color: #fff;
}

.h5-header.transparent .header-title {
  color: #fff;
}

.h5-header.transparent .header-btn {
  color: rgba(255, 255, 255, 0.9);
}

.h5-header .header-back {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 14px;
  cursor: pointer;
  color: var(--text);
  flex-shrink: 0;
}

.h5-header.transparent .header-back {
  color: #fff;
}

.h5-header .header-title {
  flex: 1;
  text-align: center;
  font-size: 17px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 0 12px;
}

.h5-header .header-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.h5-header .header-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  font-size: 20px;
  color: var(--text);
  cursor: pointer;
  border-radius: 50%;
  transition: var(--transition);
}

.h5-header .header-btn:active {
  background: rgba(0, 0, 0, 0.05);
}

/* 底部标签导航 */
.h5-bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  align-items: flex-start;
  height: var(--bottom-nav-height);
  padding-bottom: var(--safe-area-bottom);
  background: var(--bg-card);
  border-top: 1px solid var(--border);
}

.h5-bottom-nav a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 6px 0 4px;
  font-size: 10px;
  color: var(--text-secondary);
  text-decoration: none;
  transition: var(--transition);
  position: relative;
}

.h5-bottom-nav a .nav-icon {
  font-size: 22px;
  line-height: 1;
  transition: var(--transition);
}

.h5-bottom-nav a .nav-label {
  font-size: 10px;
  line-height: 1.2;
}

.h5-bottom-nav a.active {
  color: var(--primary);
}

.h5-bottom-nav a.active .nav-icon {
  transform: scale(1.05);
}

/* 底部导航购物车角标 */
.h5-bottom-nav a .cart-badge {
  position: absolute;
  top: 2px;
  right: 50%;
  margin-right: -18px;
}

/* 主内容区域 */
.h5-page {
  min-height: 100vh;
  padding-top: var(--header-height);
  padding-bottom: var(--bottom-nav-height);
}

.h5-page.no-header {
  padding-top: 0;
}

.h5-page.no-bottom-nav {
  padding-bottom: 0;
}


/* ========================================
   PC 布局组件 (Desktop Layout)
   ======================================== */

.pc-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  transition: var(--transition);
}

.pc-header .pc-header-inner {
  display: flex;
  align-items: center;
  height: 64px;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  gap: 24px;
}

.pc-header.scrolled {
  box-shadow: var(--shadow-sm);
}

.pc-header.scrolled .pc-header-inner {
  height: 52px;
}

.pc-header .logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  flex-shrink: 0;
}

.pc-header .logo img {
  height: 32px;
}

.pc-header .logo:hover {
  color: var(--primary);
}

.pc-header .nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.pc-header .nav-links a {
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  transition: var(--transition);
  text-decoration: none;
}

.pc-header .nav-links a:hover {
  color: var(--primary);
  background: var(--primary-light);
}

.pc-header .nav-links a.active {
  color: var(--primary);
  background: var(--primary-light);
  font-weight: 600;
}

.pc-header .search-box {
  flex: 1;
  max-width: 400px;
  display: flex;
  align-items: center;
}

.pc-header .search-box .input {
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
  border-right: none;
  height: 36px;
  font-size: 13px;
}

.pc-header .search-box .search-btn {
  height: 36px;
  padding: 0 16px;
  background: var(--primary);
  color: #fff;
  border: 1px solid var(--primary);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 14px;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.pc-header .search-box .search-btn:hover {
  background: var(--primary-dark);
}

.pc-header .user-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.pc-header .user-actions .action-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 18px;
  color: var(--text-secondary);
  transition: var(--transition);
  cursor: pointer;
}

.pc-header .user-actions .action-btn:hover {
  background: #f1f5f9;
  color: var(--primary);
}

/* PC 底部 */
.pc-footer {
  background: #1e293b;
  color: rgba(255, 255, 255, 0.7);
  padding: 40px 24px 24px;
  font-size: 13px;
  line-height: 1.8;
}

.pc-footer .footer-inner {
  max-width: 1200px;
  margin: 0 auto;
}

.pc-footer .footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 32px;
  margin-bottom: 32px;
}

.pc-footer .footer-brand {
  font-size: 20px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 8px;
}

.pc-footer .footer-desc {
  font-size: 13px;
  line-height: 1.7;
  color: rgba(255, 255, 255, 0.6);
}

.pc-footer .footer-col-title {
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  margin-bottom: 12px;
}

.pc-footer .footer-links {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pc-footer .footer-links a {
  color: rgba(255, 255, 255, 0.6);
  text-decoration: none;
  transition: var(--transition);
}

.pc-footer .footer-links a:hover {
  color: #fff;
}

.pc-footer .footer-bottom {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-top: 16px;
  text-align: center;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.4);
}

.pc-footer .footer-bottom a {
  color: rgba(255, 255, 255, 0.4);
}

.pc-footer .footer-bottom a:hover {
  color: #fff;
}

/* PC 容器 */
.pc-container {
  width: 100%;
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
  padding-left: 24px;
  padding-right: 24px;
}


/* ========================================
   工具类 (Utilities)
   ======================================== */

/* Flexbox */
.flex        { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-col    { display: flex; flex-direction: column; }
.flex-wrap   { flex-wrap: wrap; }
.flex-1      { flex: 1; }
.flex-shrink-0 { flex-shrink: 0; }
.items-center { align-items: center; }
.items-start  { align-items: flex-start; }
.justify-center   { justify-content: center; }
.justify-between  { justify-content: space-between; }
.justify-end      { justify-content: flex-end; }
.gap-4  { gap: 4px; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-24 { gap: 24px; }

/* 边距 */
.m-0    { margin: 0; }
.mt-8   { margin-top: 8px; }
.mt-16  { margin-top: 16px; }
.mt-24  { margin-top: 24px; }
.mb-8   { margin-bottom: 8px; }
.mb-16  { margin-bottom: 16px; }
.mb-24  { margin-bottom: 24px; }
.ml-8   { margin-left: 8px; }
.mr-8   { margin-right: 8px; }
.mx-auto { margin-left: auto; margin-right: auto; }

/* 内边距 */
.p-0   { padding: 0; }
.p-4   { padding: 4px; }
.p-8   { padding: 8px; }
.p-12  { padding: 12px; }
.p-16  { padding: 16px; }
.p-24  { padding: 24px; }
.px-16 { padding-left: 16px; padding-right: 16px; }
.py-8  { padding-top: 8px; padding-bottom: 8px; }
.py-16 { padding-top: 16px; padding-bottom: 16px; }

/* 圆角 */
.rounded-sm   { border-radius: var(--radius-sm); }
.rounded      { border-radius: var(--radius-md); }
.rounded-lg   { border-radius: var(--radius-lg); }
.rounded-xl   { border-radius: var(--radius-xl); }
.rounded-full { border-radius: 50%; }
.rounded-none { border-radius: 0; }

/* 阴影 */
.shadow-sm { box-shadow: var(--shadow-sm); }
.shadow    { box-shadow: var(--shadow-md); }
.shadow-lg { box-shadow: var(--shadow-lg); }
.shadow-none { box-shadow: none; }

/* 网格布局 */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); }
.grid-5 { display: grid; grid-template-columns: repeat(5, 1fr); }

/* 完整穿透 */
.full-bleed {
  margin-left: -16px;
  margin-right: -16px;
}

@media (min-width: 768px) {
  .full-bleed {
    margin-left: -24px;
    margin-right: -24px;
  }
}

/* iPhone X 安全区域 */
.safe-bottom {
  padding-bottom: var(--safe-area-bottom);
}

.safe-top {
  padding-top: env(safe-area-inset-top, 0px);
}

/* 显示控制 */
.hidden     { display: none; }
.block      { display: block; }
.inline     { display: inline; }
.inline-block { display: inline-block; }

/* 溢出 */
.overflow-hidden { overflow: hidden; }
.overflow-auto   { overflow: auto; }

/* 定位 */
.relative { position: relative; }
.absolute { position: absolute; }
.fixed    { position: fixed; }
.sticky   { position: sticky; }

/* 宽高 */
.w-full  { width: 100%; }
.h-full  { height: 100%; }
.object-cover { object-fit: cover; }
.object-contain { object-fit: contain; }

/* 光标 */
.cursor-pointer { cursor: pointer; }
.pointer-events-none { pointer-events: none; }

/* 透明 */
.opacity-0   { opacity: 0; }
.opacity-50  { opacity: 0.5; }
.opacity-100 { opacity: 1; }

/* 背景 */
.bg-white  { background: var(--bg-card); }
.bg-page   { background: var(--bg); }
.bg-primary-light { background: var(--primary-light); }


/* ========================================
   响应式断点 (Responsive)
   ======================================== */

/* 手机端（默认样式即为手机优先） */

/* 平板及以上 */
@media (min-width: 768px) {
  .sm-hidden { display: none; }
  .sm-block  { display: block; }
  .sm-flex   { display: flex; }
  .sm-grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); }
  .sm-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); }
  .sm-grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); }
  .sm-text-center { text-align: center; }
  .sm-text-left   { text-align: left; }
  .sm-p-16 { padding: 16px; }
  .sm-p-24 { padding: 24px; }
}

/* 桌面端 */
@media (min-width: 1024px) {
  .md-hidden { display: none; }
  .md-block  { display: block; }
  .md-flex   { display: flex; }
  .md-text-center { text-align: center; }
  .md-text-left   { text-align: left; }
}

/* 宽屏 */
@media (min-width: 1280px) {
  .lg-hidden { display: none; }
  .lg-block  { display: block; }
}


/* ========================================
   CSS 动画 (Animations)
   ======================================== */

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

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

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

@keyframes countUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-12px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

@keyframes slideLeft {
  from { transform: translateX(100%); }
  to   { transform: translateX(0); }
}

@keyframes slideRight {
  from { transform: translateX(-100%); }
  to   { transform: translateX(0); }
}

/* 动画工具类 */
.animate-fade-in {
  animation: fadeIn 0.3s ease forwards;
}

.animate-slide-up {
  animation: slideUp 0.35s ease forwards;
}

.animate-scale-in {
  animation: scaleIn 0.3s ease forwards;
}

.animate-pulse {
  animation: pulse 2s ease-in-out infinite;
}

.animate-spin {
  animation: spin 1s linear infinite;
}

.animate-slide-down {
  animation: slideDown 0.3s ease forwards;
}

.animate-shimmer {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
}


/* ========================================
   骨架屏 (Skeleton Loading)
   ======================================== */

.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e8e8e8 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: var(--radius-sm);
}

.skeleton-text {
  height: 14px;
  margin-bottom: 8px;
  border-radius: 4px;
  width: 100%;
}

.skeleton-text:last-child {
  width: 60%;
}

.skeleton-title {
  height: 18px;
  width: 70%;
  margin-bottom: 12px;
  border-radius: 4px;
}

.skeleton-image {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: var(--radius-sm);
}

.skeleton-block {
  height: 100px;
  border-radius: var(--radius-md);
  margin-bottom: 12px;
}

.skeleton-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
}

.skeleton-card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  overflow: hidden;
  padding: 16px;
}

.skeleton-card .skeleton-img {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
}

.skeleton-card .skeleton-line {
  height: 12px;
  border-radius: 4px;
  margin-bottom: 8px;
  width: 100%;
}

.skeleton-card .skeleton-line:last-child {
  width: 50%;
}


/* ========================================
   空状态 / 加载 / 错误状态
   ======================================== */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  text-align: center;
}

.empty-state .empty-icon {
  font-size: 64px;
  color: var(--text-tertiary);
  margin-bottom: 16px;
  opacity: 0.5;
}

.empty-state .empty-image {
  width: 120px;
  height: auto;
  margin-bottom: 16px;
  opacity: 0.6;
}

.empty-state .empty-title {
  font-size: 16px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.empty-state .empty-desc {
  font-size: 13px;
  color: var(--text-tertiary);
  margin-bottom: 20px;
  max-width: 280px;
}

/* 加载状态 */
.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
}

.loading-state .loading-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 12px;
}

.loading-state .loading-text {
  font-size: 13px;
  color: var(--text-tertiary);
}

/* 错误状态 */
.error-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  text-align: center;
}

.error-state .error-icon {
  font-size: 56px;
  color: var(--danger);
  margin-bottom: 12px;
  opacity: 0.6;
}

.error-state .error-title {
  font-size: 16px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 6px;
}

.error-state .error-desc {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 20px;
}


/* ========================================
   Toast 通知 (Toast)
   ======================================== */

.toast {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.9);
  z-index: 9999;
  padding: 12px 24px;
  background: rgba(0, 0, 0, 0.75);
  color: #fff;
  font-size: 14px;
  border-radius: var(--radius-sm);
  text-align: center;
  max-width: 280px;
  pointer-events: none;
  opacity: 0;
  transition: all 0.25s ease;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.toast.toast-success {
  background: rgba(22, 163, 74, 0.9);
}

.toast.toast-error {
  background: rgba(239, 68, 68, 0.9);
}

.toast.toast-warning {
  background: rgba(250, 140, 22, 0.9);
}

/* 顶部 Toast（常用于 H5） */
.toast-top {
  top: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(-12px);
  min-width: 200px;
}

.toast-top.show {
  transform: translateX(-50%) translateY(0);
}


/* ========================================
   购物车角标 (Cart Badge)
   ======================================== */

.cart-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  color: #fff;
  background: var(--danger);
  border-radius: 8px;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: 0 0 0 2px var(--bg-card);
}

.cart-badge-sm {
  min-width: 14px;
  height: 14px;
  font-size: 9px;
  padding: 0 3px;
}

.cart-badge-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--danger);
  box-shadow: 0 0 0 2px var(--bg-card);
  position: absolute;
  top: 4px;
  right: 4px;
}


/* ========================================
   半透明遮罩 (Overlay)
   ======================================== */

.overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 900;
  background: rgba(0, 0, 0, 0.5);
  transition: opacity 0.3s ease;
}

.overlay-light {
  background: rgba(0, 0, 0, 0.3);
}

.overlay-dark {
  background: rgba(0, 0, 0, 0.7);
}

.overlay-hidden {
  opacity: 0;
  pointer-events: none;
}


/* ========================================
   分隔线 (Divider)
   ======================================== */

.divider {
  height: 1px;
  background: var(--border);
  margin: 16px 0;
  border: none;
}

.divider-dashed {
  height: 0;
  border-top: 1px dashed var(--border);
  margin: 16px 0;
}


/* ========================================
   页面加载进度条 (Page Loader)
   ======================================== */

.page-loader {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 99999;
  height: 3px;
  background: transparent;
  pointer-events: none;
}

.page-loader::after {
  content: "";
  display: block;
  height: 100%;
  width: 0;
  background: var(--primary);
  animation: loaderProgress 2s ease-in-out infinite;
}

@keyframes loaderProgress {
  0%   { width: 0; margin-left: 0; }
  50%  { width: 60%; margin-left: 20%; }
  100% { width: 100%; margin-left: 100%; }
}


/* ========================================
   用户头像 (Avatar)
   ======================================== */

.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--primary-light);
  color: var(--primary);
  font-size: 16px;
  font-weight: 600;
  flex-shrink: 0;
  overflow: hidden;
}

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

.avatar-sm {
  width: 28px;
  height: 28px;
  font-size: 12px;
}

.avatar-lg {
  width: 56px;
  height: 56px;
  font-size: 22px;
}

.avatar-xl {
  width: 72px;
  height: 72px;
  font-size: 28px;
}


/* ========================================
   评分 (Rating)
   ======================================== */

.rating {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 14px;
  color: #f59e0b;
}

.rating .star-empty {
  color: #d1d5db;
}

.rating .rating-num {
  font-size: 12px;
  color: var(--text-secondary);
  margin-left: 4px;
}


/* ========================================
   步骤条 (Steps)
   ======================================== */

.steps {
  display: flex;
  align-items: flex-start;
  gap: 0;
}

.steps .step {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  text-align: center;
}

.steps .step:not(:last-child)::after {
  content: "";
  position: absolute;
  top: 14px;
  left: 50%;
  right: -50%;
  height: 2px;
  background: var(--border);
  z-index: 0;
}

.steps .step.active:not(:last-child)::after {
  background: var(--primary);
}

.steps .step-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  background: var(--border);
  color: var(--text-tertiary);
  position: relative;
  z-index: 1;
}

.steps .step.active .step-dot {
  background: var(--primary);
  color: #fff;
}

.steps .step.completed .step-dot {
  background: var(--success);
  color: #fff;
}

.steps .step-label {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: 6px;
}

.steps .step.active .step-label {
  color: var(--primary);
  font-weight: 500;
}


/* ========================================
   搜索栏 (Search Bar) — H5 专用
   ======================================== */

.search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--bg);
  border-radius: var(--radius-sm);
}

.search-bar .search-icon {
  font-size: 16px;
  color: var(--text-tertiary);
  flex-shrink: 0;
}

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

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

.search-bar .search-clear {
  font-size: 14px;
  color: var(--text-tertiary);
  cursor: pointer;
  flex-shrink: 0;
}


/* ========================================
   底部弹出面板 (Bottom Sheet)
   ======================================== */

.bottom-sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: var(--bg-card);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.15);
  transform: translateY(100%);
  transition: transform 0.3s ease;
  max-height: 80vh;
  overflow-y: auto;
}

.bottom-sheet.show {
  transform: translateY(0);
}

.bottom-sheet .sheet-handle {
  width: 36px;
  height: 4px;
  border-radius: 2px;
  background: #d1d5db;
  margin: 8px auto;
}

.bottom-sheet .sheet-header {
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
}

.bottom-sheet .sheet-title {
  font-size: 16px;
  font-weight: 600;
}

.bottom-sheet .sheet-close {
  font-size: 20px;
  color: var(--text-tertiary);
  cursor: pointer;
}

.bottom-sheet .sheet-body {
  padding: 16px;
}


/* ========================================
   数量选择器 (Quantity Selector)
   ======================================== */

.qty-selector {
  display: inline-flex;
  align-items: center;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.qty-selector .qty-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: var(--text-secondary);
  background: var(--bg);
  cursor: pointer;
  transition: var(--transition);
  user-select: none;
}

.qty-selector .qty-btn:active {
  background: #e2e8f0;
}

.qty-selector .qty-btn.disabled {
  color: #d1d5db;
  cursor: not-allowed;
}

.qty-selector .qty-value {
  width: 44px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 500;
  border-left: 1px solid #e2e8f0;
  border-right: 1px solid #e2e8f0;
}


/* ========================================
   顶部 Tab 切换 (Tabs)
   ======================================== */

.tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  background: var(--bg-card);
}

.tabs .tab {
  flex: 1;
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  border: none;
  background: transparent;
}

.tabs .tab::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 2px;
  background: var(--primary);
  transition: var(--transition);
  border-radius: 1px 1px 0 0;
}

.tabs .tab.active {
  color: var(--primary);
  font-weight: 600;
}

.tabs .tab.active::after {
  width: 24px;
}

.tabs .tab:active {
  background: var(--primary-light);
}

.tabs-scroll {
  overflow-x: auto;
  flex-wrap: nowrap;
  -webkit-overflow-scrolling: touch;
}

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

.tabs-scroll .tab {
  flex: 0 0 auto;
  white-space: nowrap;
}


/* ========================================
   面包屑 (Breadcrumb)
   ======================================== */

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-tertiary);
  padding: 12px 0;
}

.breadcrumb a {
  color: var(--text-secondary);
}

.breadcrumb a:hover {
  color: var(--primary);
}

.breadcrumb .breadcrumb-sep {
  color: var(--text-tertiary);
  font-size: 12px;
}

.breadcrumb .breadcrumb-current {
  color: var(--text);
  font-weight: 500;
}


/* ========================================
   回到顶部 (Back to Top)
   ======================================== */

.back-to-top {
  position: fixed;
  bottom: 80px;
  right: 16px;
  z-index: 99;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--bg-card);
  color: var(--text-secondary);
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  cursor: pointer;
  transition: var(--transition);
  opacity: 0;
  pointer-events: none;
}

.back-to-top.show {
  opacity: 1;
  pointer-events: auto;
}

.back-to-top:active {
  transform: scale(0.9);
}

@media (min-width: 768px) {
  .back-to-top {
    right: 40px;
    bottom: 40px;
  }
}


/* ========================================
   弹窗 / 对话框 (Modal / Dialog)
   ======================================== */

.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.modal .modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
}

.modal .modal-content {
  position: relative;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  max-width: 480px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
  animation: scaleIn 0.2s ease;
}

.modal .modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.modal .modal-title {
  font-size: 16px;
  font-weight: 600;
}

.modal .modal-close {
  font-size: 20px;
  color: var(--text-tertiary);
  cursor: pointer;
  transition: var(--transition);
}

.modal .modal-close:hover {
  color: var(--text);
}

.modal .modal-body {
  padding: 20px;
}

.modal .modal-footer {
  display: flex;
  gap: 12px;
  padding: 16px 20px;
  border-top: 1px solid var(--border);
}

.modal .modal-footer .btn {
  flex: 1;
}


/* ========================================
   开关 (Switch)
   ======================================== */

.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  cursor: pointer;
}

.switch input {
  display: none;
}

.switch .slider {
  position: absolute;
  inset: 0;
  background: #d1d5db;
  border-radius: 12px;
  transition: var(--transition);
}

.switch .slider::before {
  content: "";
  position: absolute;
  left: 2px;
  bottom: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  transition: var(--transition);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.switch input:checked + .slider {
  background: var(--primary);
}

.switch input:checked + .slider::before {
  transform: translateX(20px);
}


/* ========================================
   进度条 (Progress Bar)
   ======================================== */

.progress-bar {
  width: 100%;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}

.progress-bar .progress-fill {
  height: 100%;
  border-radius: 3px;
  background: var(--primary);
  transition: width 0.4s ease;
}

.progress-bar .progress-fill.success {
  background: var(--success);
}

.progress-bar .progress-fill.warning {
  background: var(--warning);
}

.progress-bar .progress-fill.danger {
  background: var(--danger);
}


/* ========================================
   操作列表 (Action Sheet)
   ======================================== */

.action-sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1001;
  background: var(--bg-card);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  transform: translateY(100%);
  transition: transform 0.3s ease;
}

.action-sheet.show {
  transform: translateY(0);
}

.action-sheet .action-sheet-item {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  font-size: 16px;
  color: var(--text);
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: var(--transition);
}

.action-sheet .action-sheet-item:last-child {
  border-bottom: none;
}

.action-sheet .action-sheet-item:active {
  background: var(--primary-light);
}

.action-sheet .action-sheet-item.danger {
  color: var(--danger);
}

.action-sheet .action-sheet-cancel {
  margin-top: 6px;
  padding: 16px;
  font-size: 16px;
  color: var(--text-secondary);
  text-align: center;
  cursor: pointer;
  border-top: 6px solid var(--bg);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.action-sheet .action-sheet-cancel:active {
  background: var(--bg);
}


/* ========================================
   消息气泡 (Message Bubble)
   ======================================== */

.msg-bubble {
  display: inline-block;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 14px;
  line-height: 1.5;
  max-width: 80%;
  word-break: break-word;
}

.msg-bubble-left {
  background: #f1f5f9;
  color: var(--text);
  border-bottom-left-radius: 4px;
}

.msg-bubble-right {
  background: var(--primary);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.msg-time {
  font-size: 11px;
  color: var(--text-tertiary);
  margin: 4px 0;
}


/* ========================================
   页面刷新指示器 (Pull to Refresh)
   ======================================== */

.pull-refresh {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  color: var(--text-tertiary);
  font-size: 13px;
}

.pull-refresh .refresh-spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-right: 8px;
}


/* ========================================
   浮动操作按钮 (FAB)
   ======================================== */

.fab {
  position: fixed;
  bottom: 80px;
  right: 16px;
  z-index: 99;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  box-shadow: 0 4px 16px rgba(22, 119, 255, 0.4);
  cursor: pointer;
  transition: var(--transition);
}

.fab:active {
  transform: scale(0.92);
}


/* ========================================
   订单状态时间轴 (Order Timeline)
   ======================================== */

.timeline {
  position: relative;
  padding-left: 24px;
}

.timeline::before {
  content: "";
  position: absolute;
  left: 7px;
  top: 4px;
  bottom: 4px;
  width: 2px;
  background: var(--border);
}

.timeline-item {
  position: relative;
  padding-bottom: 20px;
}

.timeline-item:last-child {
  padding-bottom: 0;
}

.timeline-item .timeline-dot {
  position: absolute;
  left: -20px;
  top: 4px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--primary);
  border: 2px solid var(--bg-card);
}

.timeline-item.completed .timeline-dot {
  background: var(--success);
}

.timeline-item.pending .timeline-dot {
  background: var(--text-tertiary);
}

.timeline-item .timeline-content {
  font-size: 13px;
  color: var(--text);
}

.timeline-item .timeline-time {
  font-size: 11px;
  color: var(--text-tertiary);
  margin-top: 2px;
}


/* ========================================
   打印样式 (Print)
   ======================================== */

@media print {
  body {
    background: #fff;
    color: #000;
  }

  .h5-header,
  .h5-bottom-nav,
  .pc-header,
  .back-to-top,
  .fab,
  .toast,
  .overlay,
  .bottom-sheet,
  .modal {
    display: none !important;
  }

  .h5-page {
    padding-top: 0;
    padding-bottom: 0;
  }

  .card {
    box-shadow: none;
    border: 1px solid #e2e8f0;
  }
}


/* ========================================
   辅助功能 (Accessibility)
   ======================================== */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}


/* ========================================
   暗色模式准备 (Dark Mode — 预留)
   ======================================== */

/*
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f172a;
    --bg-card: #1e293b;
    --border: #334155;
    --text: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-tertiary: #64748b;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);
  }
}
*/


/* ============================================================
   End of SaaSShop Frontend Theme
   ============================================================ */

/* ===== 营销活动入口（秒杀/拼团）===== */
.activity-entry { display: flex; gap: 16px; flex-wrap: wrap; }
.activity-entry .entry-card {
    flex: 1; min-width: 240px; display: flex; align-items: center; gap: 12px;
    padding: 18px 20px; border-radius: 12px; text-decoration: none; color: #fff;
    box-shadow: 0 4px 14px rgba(0,0,0,.08); transition: transform .2s, box-shadow .2s;
}
.activity-entry .entry-card:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(0,0,0,.14); }
.activity-entry .entry-flash { background: linear-gradient(135deg, #ff4757 0%, #e74c3c 100%); }
.activity-entry .entry-group { background: linear-gradient(135deg, #fd79a8 0%, #e84393 100%); }
.activity-entry .entry-icon { font-size: 34px; line-height: 1; }
.activity-entry .entry-text { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.activity-entry .entry-title { font-size: 18px; font-weight: 700; }
.activity-entry .entry-sub { font-size: 13px; opacity: .85; margin-top: 2px; }
.activity-entry .entry-arrow { font-size: 22px; opacity: .8; }

/* V3-G 全局风格补全：按钮圆角 / 导航 / 字体 消费 CSS 变量 */
.page-global-style .btn-primary,
.page-global-style .hero-section-btn,
.page-global-style .vmall-btn,
.page-global-style .block-btn,
.page-global-style .section-btn {
  border-radius: var(--saas-button-radius, 8px);
}
.page-global-style {
  font-family: var(--saas-font-family, inherit);
}
.pc-header,
.pc-header.scrolled {
  background: var(--saas-header-bg, var(--bg-card, #ffffff));
}
.pc-header .pc-header-brand,
.pc-header .nav-links a,
.pc-header .user-actions .action-btn,
.pc-header .pc-nav-link {
  color: var(--saas-header-color, inherit);
}
.pc-header .nav-links a:hover,
.pc-header .user-actions .action-btn:hover {
  color: var(--saas-theme, #1677ff);
}

/* ============ V3-I 响应式适配（2026-08-01）：PC 装修页窄屏降级 ============ */
@media (max-width: 767px) {
    /* PC 顶部导航：收缩，隐藏导航链接（保留 logo+搜索+用户操作） */
    .pc-header .pc-header-inner { height: 56px; padding: 0 12px; gap: 10px; }
    .pc-header .nav-links { display: none !important; }
    .pc-header .search-box { max-width: none; min-width: 0; }
    .pc-header .search-box .input { min-width: 0; }
    .pc-header .user-actions .action-btn { width: 32px; height: 32px; font-size: 16px; }
    .pc-header .logo { font-size: 17px; }
    .pc-header .logo img { height: 26px; }

    /* 页面容器收窄（装修页容器 + PC 壳容器） */
    .page-global-style,
    .pc-page-content,
    .container { padding-left: 12px !important; padding-right: 12px !important; }

    /* PC 页脚收窄 */
    .pc-footer { padding: 24px 16px 20px; }
}

/* H5 通用 toast（flash 提示） */
.h5-toast{position:fixed;top:14px;left:50%;transform:translateX(-50%);z-index:9999;max-width:86%;padding:10px 18px;border-radius:10px;font-size:14px;color:#fff;box-shadow:0 4px 14px rgba(0,0,0,.15);animation:h5ToastIn .3s ease;}
.h5-toast-success{background:rgba(82,196,26,.95);}
.h5-toast-error{background:rgba(233,59,61,.95);}
@keyframes h5ToastIn{from{opacity:0;transform:translate(-50%,-12px);}to{opacity:1;transform:translate(-50%,0);}}
