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

:root {
  --primary-color: #5B8DEF;
  --primary-light: #7BA3F3;
  --primary-dark: #4A7BD9;
  --text-primary: #1F2937;
  --text-secondary: #6B7280;
  --text-light: #9CA3AF;
  --bg-primary: #F9FAFB;
  --bg-card: #FFFFFF;
  --border-color: #E5E7EB;
  --price-color: #DC2626;
  --success-color: #10B981;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
}

html {
  font-size: 16px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* 头部导航 */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 56px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.header-back {
  position: absolute;
  left: 16px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  cursor: pointer;
  border-radius: 50%;
  transition: background 0.2s;
}

.header-back:hover {
  background: var(--bg-primary);
}

.header-back svg {
  width: 24px;
  height: 24px;
  color: var(--text-primary);
}

.header-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-primary);
}

/* 主内容区域 */
.main-content {
  padding-top: 56px;
  min-height: 100vh;
}

/* 页面容器 */
.page {
  display: none;
  animation: fadeIn 0.3s ease;
}

.page.active {
  display: block;
}

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

/* ========== 首页样式 ========== */
.home-banner {
  background: linear-gradient(135deg, #6B9CF5 0%, #5B8DEF 50%, #7BA3F3 100%);
  padding: 32px 20px;
  color: white;
}

.banner-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.banner-subtitle {
  font-size: 0.875rem;
  opacity: 0.9;
}

.company-info {
  margin-top: 16px;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-sm);
  backdrop-filter: blur(10px);
}

.company-name {
  font-size: 1rem;
  font-weight: 600;
}

.company-contact {
  font-size: 0.75rem;
  opacity: 0.85;
  margin-top: 4px;
}

/* 分类网格 */
.category-section {
  padding: 20px;
}

.section-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 16px;
}

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

.category-card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
  cursor: pointer;
  transition: all 0.2s ease;
}

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

.category-card:active {
  transform: scale(0.98);
}

.category-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
}

.category-name {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.category-count {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

/* 热门推荐 */
.hot-products {
  padding: 0 12px 24px;
}

.hot-products-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.hot-product-card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: row;
  padding: 16px;
}

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

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

.hot-product-image {
  width: 100px;
  height: 100px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}

.hot-product-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hot-product-placeholder {
  font-size: 2.5rem;
  opacity: 0.5;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hot-product-info {
  flex: 1;
  margin-left: 12px;
  display: flex;
  flex-direction: column;
}

.hot-product-tag {
  display: inline-block;
  font-size: 0.625rem;
  padding: 2px 6px;
  background: var(--bg-primary);
  border-radius: 4px;
  color: var(--text-secondary);
  margin-bottom: 4px;
  width: fit-content;
}

.hot-product-name {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.hot-product-summary {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 6px;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.hot-product-price {
  margin-top: auto;
  padding-top: 8px;
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.hot-product-price .price {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--price-color);
}

.hot-product-price .original-price {
  font-size: 0.75rem;
  color: var(--text-light);
  text-decoration: line-through;
}

/* ========== 产品列表页样式 ========== */
.list-header {
  padding: 16px 20px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
}

.list-header-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.list-header-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.list-header-text h2 {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-primary);
}

.list-header-text p {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* 产品列表 */
.product-list {
  padding: 12px;
}

.product-card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  margin-bottom: 12px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
  cursor: pointer;
  transition: all 0.2s ease;
}

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

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

.product-card-inner {
  display: flex;
  padding: 16px;
}

.product-image {
  width: 100px;
  height: 100px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}

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

.product-image-placeholder {
  font-size: 2.5rem;
  opacity: 0.5;
}

.product-info {
  flex: 1;
  margin-left: 12px;
  display: flex;
  flex-direction: column;
}

.product-brand {
  display: inline-block;
  font-size: 0.625rem;
  padding: 2px 6px;
  background: var(--bg-primary);
  border-radius: 4px;
  color: var(--text-secondary);
  margin-bottom: 4px;
  width: fit-content;
}

.product-name {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.product-summary {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 6px;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.product-price-row {
  margin-top: auto;
  padding-top: 8px;
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.product-price {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--price-color);
}

.product-price::before {
  content: '¥';
  font-size: 0.875rem;
}

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

.product-original-price::before {
  content: '¥';
}

/* ========== 产品详情页样式 ========== */
.detail-image-section {
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  padding: 40px 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.detail-image {
  width: 200px;
  height: 200px;
  background: white;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-lg);
}

.detail-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: var(--radius-lg);
}

.detail-image-placeholder {
  font-size: 5rem;
  opacity: 0.4;
}

.detail-info-section {
  background: var(--bg-card);
  padding: 20px;
  border-bottom: 1px solid var(--border-color);
}

.detail-brand-tag {
  display: inline-block;
  font-size: 0.75rem;
  padding: 4px 10px;
  background: var(--primary-light);
  color: white;
  border-radius: 20px;
  margin-bottom: 8px;
}

.detail-name {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.4;
  margin-bottom: 8px;
}

.detail-model {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.detail-price-section {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 16px;
  background: linear-gradient(135deg, #FEF2F2 0%, #FEE2E2 100%);
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
}

.detail-price-label {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.detail-price {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--price-color);
}

.detail-price::before {
  content: '¥';
  font-size: 1rem;
}

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

.detail-original-price::before {
  content: '原价 ¥';
}

.detail-summary {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* 产品特点 */
.detail-features-section {
  background: var(--bg-card);
  padding: 20px;
  margin-top: 12px;
}

.detail-section-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.detail-section-title::before {
  content: '';
  width: 4px;
  height: 16px;
  background: var(--primary-color);
  border-radius: 2px;
}

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

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

.feature-icon {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--success-color);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.feature-icon svg {
  width: 14px;
  height: 14px;
  color: white;
}

.feature-text {
  font-size: 0.8125rem;
  color: var(--text-primary);
  font-weight: 500;
}

/* 规格参数 */
.detail-specs-section {
  background: var(--bg-card);
  padding: 20px;
  margin-top: 12px;
}

.specs-table {
  width: 100%;
}

.specs-row {
  display: flex;
  border-bottom: 1px solid var(--border-color);
}

.specs-row:last-child {
  border-bottom: none;
}

.specs-label {
  width: 100px;
  padding: 12px 0;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.specs-value {
  flex: 1;
  padding: 12px 0;
  font-size: 0.8125rem;
  color: var(--text-primary);
}

/* 底部联系按钮 */
.detail-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 12px 20px;
  padding-bottom: calc(12px + env(safe-area-inset-bottom));
  background: var(--bg-card);
  border-top: 1px solid var(--border-color);
  display: flex;
  gap: 12px;
  z-index: 100;
}

.btn-contact {
  flex: 1;
  height: 48px;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-contact.primary {
  background: var(--primary-color);
  color: white;
}

.btn-contact.primary:hover {
  background: var(--primary-light);
}

.btn-contact.secondary {
  background: var(--bg-primary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-contact.secondary:hover {
  background: var(--border-color);
}

/* 详情页需要底部padding */
.page-detail .main-content {
  padding-bottom: calc(72px + env(safe-area-inset-bottom));
}

/* 响应式适配 */
@media (max-width: 375px) {
  html {
    font-size: 14px;
  }

  .category-grid {
    gap: 8px;
  }

  .product-image {
    width: 88px;
    height: 88px;
  }
}

@media (min-width: 414px) {
  html {
    font-size: 17px;
  }
}

/* 安全区域适配 */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .detail-footer {
    padding-bottom: calc(12px + env(safe-area-inset-bottom));
  }
}

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

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

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

/* 空状态 */
.empty-state {
  text-align: center;
  padding: 60px 20px;
}

.empty-icon {
  font-size: 4rem;
  opacity: 0.3;
  margin-bottom: 16px;
}

.empty-text {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

/* 手势返回指示器 */
.swipe-indicator {
  position: fixed;
  left: 0;
  top: 50%;
  transform: translateY(-50%) translateX(-36px);
  width: 36px;
  height: 72px;
  background: rgba(0, 0, 0, 0.7);
  border-radius: 0 36px 36px 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  z-index: 99999;
  pointer-events: none;
  will-change: transform, opacity;
}

.swipe-indicator.ready {
  background: var(--primary-color);
}

.swipe-arrow {
  color: white;
  font-size: 28px;
  font-weight: 300;
  font-family: system-ui, -apple-system, sans-serif;
  line-height: 1;
}
