/**
 * Site 商城前台样式
 * 响应式设计，支持 PC 和 H5
 * 
 * @author chenjun1216
 * @date 2026-03-21
 */

/* 基础样式重置 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB',
    'Microsoft YaHei', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  color: #333;
  background-color: #f5f5f5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* 响应式容器 */
.container {
  width: 100%;
  margin: 0 auto;
  padding-left: 16px;
  padding-right: 16px;
}

@media (min-width: 640px) {
  .container {
    max-width: 640px;
  }
}

@media (min-width: 768px) {
  .container {
    max-width: 768px;
  }
}

@media (min-width: 1024px) {
  .container {
    max-width: 1024px;
    padding-left: 24px;
    padding-right: 24px;
  }
}

@media (min-width: 1280px) {
  .container {
    max-width: 1280px;
  }
}

/* 商品卡片响应式布局 */
.product-grid {
  display: grid;
  gap: 16px;
}

/* 移动端：2 列 */
.product-grid {
  grid-template-columns: repeat(2, 1fr);
}

/* 平板：3 列 */
@media (min-width: 640px) {
  .product-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
  }
}

/* 桌面：4 列 */
@media (min-width: 768px) {
  .product-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* 大桌面：6 列 */
@media (min-width: 1024px) {
  .product-grid {
    grid-template-columns: repeat(6, 1fr);
    gap: 24px;
  }
}

/* 商品卡片样式 */
.product-card {
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
  transition: box-shadow 0.3s ease;
}

.product-card:hover {
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

.product-card img {
  width: 100%;
  height: 160px;
  object-fit: cover;
}

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

.product-card .product-title {
  font-size: 14px;
  color: #333;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  line-height: 1.5;
}

.product-card .product-price {
  margin-top: 8px;
  font-size: 18px;
  font-weight: bold;
  color: #e53935;
}

/* 移动端优化 */
@media (max-width: 640px) {
  .product-card img {
    height: 120px;
  }

  .product-card .product-title {
    font-size: 13px;
  }

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

/* 按钮样式 */
.btn {
  display: inline-block;
  padding: 10px 24px;
  font-size: 14px;
  font-weight: 500;
  text-align: center;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  border: none;
  outline: none;
}

.btn-primary {
  background-color: #2563eb;
  color: #fff;
}

.btn-primary:hover {
  background-color: #1d4ed8;
}

.btn-outline {
  background-color: transparent;
  border: 2px solid #2563eb;
  color: #2563eb;
}

.btn-outline:hover {
  background-color: #eff6ff;
}

/* 移动端按钮适配 */
@media (max-width: 640px) {
  .btn {
    padding: 8px 16px;
    font-size: 13px;
  }
}

/* 文字截断工具类 */
.line-clamp-2 {
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

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

/* 隐藏滚动条但保留滚动功能 */
.hide-scrollbar {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.hide-scrollbar::-webkit-scrollbar {
  display: none;
}

/* 加载动画 */
.loading {
  display: inline-block;
  width: 24px;
  height: 24px;
  border: 3px solid rgba(37, 99, 235, 0.2);
  border-radius: 50%;
  border-top-color: #2563eb;
  animation: spin 0.8s linear infinite;
}

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

/* 空状态 */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: #9ca3af;
}

.empty-state svg {
  width: 64px;
  height: 64px;
  margin-bottom: 16px;
}

.empty-state p {
  font-size: 16px;
}
