/*
Theme Name: HayLoGo Mobile Shop
Theme URI: https://haylogo.com/mobile-shop
Author: HayLoGo Team
Author URI: https://haylogo.com
Description: 一个专为移动端优化的WooCommerce主题，提供现代化的电商购物体验。采用微信小程序风格设计，支持PWA安装。
Version: 1.0.1
Requires at least: 6.0
Tested up to: 6.8.3
Requires PHP: 8.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: haylogo-mobile
Tags: woocommerce, mobile, e-commerce, responsive, one-column, wechat-style, pwa

This theme requires WooCommerce plugin to be installed and activated.
*/

/* ==========================================================================
   Base Styles - 基础样式
   ========================================================================== */

:root {
  /* 主色调 - 温馨浅绿色系 */
  --primary-color: #4CAF50;
  --primary-light: #81C784;
  --primary-dark: #388E3C;
  
  /* 辅助颜色 */
  --secondary-color: #FF6B6B;
  --accent-color: #FFB74D;
  --success-color: #66BB6A;
  --warning-color: #FFA726;
  --error-color: #EF5350;
  
  /* 中性颜色 */
  --bg-color: #F5F5F5;
  --card-bg: #FFFFFF;
  --text-primary: #333333;
  --text-secondary: #666666;
  --text-muted: #999999;
  --border-color: #E0E0E0;
  
  /* 间距 */
  --spacing-xs: 4px;
  --spacing-sm: 8px;
  --spacing-md: 16px;
  --spacing-lg: 24px;
  --spacing-xl: 32px;
  
  /* 圆角 */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  
  /* 阴影 */
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.12);
  --shadow-lg: 0 8px 16px rgba(0, 0, 0, 0.15);
  
  /* 动画时长 */
  --transition-fast: 150ms;
  --transition-base: 300ms;
  --transition-slow: 500ms;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-primary);
  background-color: var(--bg-color);
  overflow-x: hidden;
  padding-bottom: 60px; /* 底部导航高度 */
}

a {
  color: inherit;
  text-decoration: none;
  transition: opacity var(--transition-fast);
}

a:active {
  opacity: 0.7;
}

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

button {
  border: none;
  background: none;
  cursor: pointer;
  font-family: inherit;
  -webkit-tap-highlight-color: transparent;
}

input, textarea, select {
  font-family: inherit;
  font-size: inherit;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: var(--spacing-sm) var(--spacing-md);
  outline: none;
  transition: border-color var(--transition-fast);
}

input:focus, textarea:focus, select:focus {
  border-color: var(--primary-color);
}

/* ==========================================================================
   Layout - 布局
   ========================================================================== */

.container {
  width: 100%;
  max-width: 750px;
  margin: 0 auto;
  padding: 0 var(--spacing-md);
}

/* ==========================================================================
   Header - 顶部栏
   ========================================================================== */

.site-header {
  position: sticky;
  top: 0;
  left: 0;
  right: 0;
  background: var(--card-bg);
  box-shadow: var(--shadow-sm);
  z-index: 100;
  padding: var(--spacing-md);
}

.header-top {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  margin-bottom: var(--spacing-md);
}

.site-logo {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  overflow: hidden;
}

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

.search-bar {
  flex: 1;
  position: relative;
}

.search-input {
  width: 100%;
  padding: var(--spacing-sm) var(--spacing-lg) var(--spacing-sm) 36px;
  background: var(--bg-color);
  border: none;
  border-radius: var(--radius-xl);
}

.search-icon {
  position: absolute;
  left: var(--spacing-md);
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}

.add-to-home {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-color);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
}

/* ==========================================================================
   Category Navigation - 分类导航 (已移至 pages.css)
   ========================================================================== */

/* 分类导航样式已移至 assets/css/pages.css 以便更好的维护 */

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

.category-name {
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
}

.category-item.active .category-name {
  color: var(--primary-color);
  font-weight: 600;
}

.category-more {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--bg-color);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
}

/* ==========================================================================
   Slider/Banner - 轮播图
   ========================================================================== */

.banner-slider {
  position: relative;
  margin: var(--spacing-md) 0;
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.slider-wrapper {
  display: flex;
  transition: transform var(--transition-base);
}

.slider-item {
  flex-shrink: 0;
  width: 100%;
  aspect-ratio: 16 / 9;
}

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

.slider-dots {
  position: absolute;
  bottom: var(--spacing-sm);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: var(--spacing-xs);
}

.slider-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.5);
  transition: all var(--transition-fast);
}

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

/* ==========================================================================
   Product Grid - 商品网格
   ========================================================================== */

.products-section {
  padding: var(--spacing-md) 0;
}

.section-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: var(--spacing-md);
  padding: 0 var(--spacing-md);
}

.products-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--spacing-md);
  padding: 0 var(--spacing-md);
}

.product-card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-fast);
}

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

.product-image {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  background: var(--bg-color);
}

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

.product-badge {
  position: absolute;
  top: var(--spacing-sm);
  left: var(--spacing-sm);
  padding: 2px 8px;
  background: var(--secondary-color);
  color: #fff;
  font-size: 11px;
  border-radius: var(--radius-sm);
}

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

.product-name {
  font-size: 14px;
  font-weight: 500;
  margin-bottom: var(--spacing-xs);
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.product-price {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  margin-bottom: var(--spacing-sm);
}

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

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

.product-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-muted);
}

/* ==========================================================================
   Bottom Navigation - 底部导航
   ========================================================================== */

.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--card-bg);
  box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.1);
  z-index: 100;
  padding: var(--spacing-sm) 0;
  padding-bottom: max(var(--spacing-sm), env(safe-area-inset-bottom));
}

.nav-items {
  display: flex;
  justify-content: space-around;
  align-items: center;
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: var(--spacing-xs) 0;
  color: var(--text-muted);
  transition: color var(--transition-fast);
  position: relative;
}

.nav-item.active {
  color: var(--primary-color);
}

.nav-icon {
  font-size: 24px;
}

.nav-label {
  font-size: 11px;
}

.nav-badge {
  position: absolute;
  top: 0;
  right: 25%;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  background: var(--secondary-color);
  color: #fff;
  font-size: 10px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ==========================================================================
   Buttons - 按钮
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: var(--spacing-md) var(--spacing-lg);
  border-radius: var(--radius-lg);
  font-weight: 600;
  transition: all var(--transition-fast);
  cursor: pointer;
}

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

.btn-primary {
  background: var(--primary-color);
  color: #fff;
}

.btn-secondary {
  background: var(--secondary-color);
  color: #fff;
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--primary-color);
  color: var(--primary-color);
}

.btn-block {
  width: 100%;
}

/* ==========================================================================
   Card - 卡片
   ========================================================================== */

.card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: var(--spacing-md);
  box-shadow: var(--shadow-sm);
}

/* ==========================================================================
   Loading - 加载动画
   ========================================================================== */

.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--spacing-xl);
}

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

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

/* ==========================================================================
   Utility Classes - 工具类
   ========================================================================== */

.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.text-primary { color: var(--primary-color); }
.text-error { color: var(--error-color); }

.mt-0 { margin-top: 0; }
.mt-sm { margin-top: var(--spacing-sm); }
.mt-md { margin-top: var(--spacing-md); }
.mt-lg { margin-top: var(--spacing-lg); }

.mb-0 { margin-bottom: 0; }
.mb-sm { margin-bottom: var(--spacing-sm); }
.mb-md { margin-bottom: var(--spacing-md); }
.mb-lg { margin-bottom: var(--spacing-lg); }

.hide { display: none !important; }
.show { display: block !important; }

/* ==========================================================================
   Customer Service Modal - 客服联系弹框
   ========================================================================== */

/* 遮罩层 */
.customer-service-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 9999;
  display: flex !important;  /* !important 防止被全局 .show 类覆盖 */
  align-items: center;
  justify-content: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--transition-base) ease-out,
              pointer-events 0s var(--transition-base);
}

.customer-service-overlay.show {
  opacity: 1;
  pointer-events: auto;
  transition: opacity var(--transition-base) ease-out,
              pointer-events 0s 0s;
}

/* 弹框容器 */
.customer-service-modal {
  background: var(--card-bg);
  border-radius: 20px;
  width: calc(100% - 32px);
  max-width: 500px;
  max-height: 90vh;
  padding: 24px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  transform: scale(0.9);
  opacity: 0;
  transition: all var(--transition-base) ease-out;
  overflow-y: auto;
}

.customer-service-overlay.show .customer-service-modal {
  transform: scale(1);
  opacity: 1;
}

/* 标题区 */
.cs-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.cs-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.cs-close {
  background: transparent;
  border: none;
  padding: 4px;
  cursor: pointer;
  color: var(--text-secondary);
  transition: color var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.cs-close:active {
  transform: scale(0.95);
}

/* 按钮区域 */
.cs-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* 按钮基础样式 */
.cs-btn {
  display: flex;
  align-items: center;
  padding: 16px 20px;
  border-radius: 12px;
  text-decoration: none;
  color: #fff;
  transition: all var(--transition-fast);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.cs-btn:active {
  transform: translateY(2px);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
  opacity: 1;
}

.cs-btn-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 16px;
  flex-shrink: 0;
}

.cs-btn-text {
  flex: 1;
  text-align: left;
}

.cs-btn-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 2px;
}

.cs-btn-desc {
  font-size: 13px;
  opacity: 0.9;
}

/* WhatsApp 按钮 */
.cs-btn-whatsapp {
  background: linear-gradient(135deg, #25D366 0%, #1DA851 100%);
}

.cs-btn-whatsapp:hover {
  background: linear-gradient(135deg, #1DA851 0%, #128C7E 100%);
}

/* Facebook 按钮 */
.cs-btn-facebook {
  background: linear-gradient(135deg, #1877F2 0%, #0C63D4 100%);
}

.cs-btn-facebook:hover {
  background: linear-gradient(135deg, #0C63D4 0%, #0952B8 100%);
}

/* 响应式调整 */
@media (max-width: 375px) {
  .customer-service-modal {
    padding: 20px;
  }
  
  .cs-btn {
    padding: 14px 16px;
  }
  
  .cs-btn-icon {
    width: 44px;
    height: 44px;
    margin-right: 12px;
  }
  
  .cs-btn-title {
    font-size: 15px;
  }
  
  .cs-btn-desc {
    font-size: 12px;
  }
}

/* ==========================================================================
   PWA Install Modals - PWA 安装引导弹框
   ========================================================================== */

/* 遮罩层（复用客服弹框样式） */
.pwa-install-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 9999;
  display: flex !important;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--transition-base) ease-out,
              pointer-events 0s var(--transition-base);
}

.pwa-install-overlay.show {
  opacity: 1;
  pointer-events: auto;
  transition: opacity var(--transition-base) ease-out,
              pointer-events 0s 0s;
}

/* 弹框容器 */
.pwa-install-modal {
  background: var(--card-bg);
  border-radius: 20px;
  width: calc(100% - 32px);
  max-width: 500px;
  max-height: 90vh;
  padding: 24px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  transform: scale(0.9);
  opacity: 0;
  transition: all var(--transition-base) ease-out;
  overflow-y: auto;
}

.pwa-install-overlay.show .pwa-install-modal {
  transform: scale(1);
  opacity: 1;
}

/* 标题区 */
.pwa-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.pwa-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.pwa-close {
  background: transparent;
  border: none;
  padding: 4px;
  cursor: pointer;
  color: var(--text-secondary);
  transition: color var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.pwa-close:active {
  transform: scale(0.95);
}

/* 内容区 */
.pwa-content {
  color: var(--text-secondary);
}

.pwa-content-center {
  text-align: center;
}

.pwa-description {
  font-size: 14px;
  line-height: 1.6;
  margin-bottom: 20px;
  color: var(--text-secondary);
}

.pwa-hint {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 12px;
}

/* iOS 步骤列表 */
.pwa-steps {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.pwa-step {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 16px;
  background: var(--bg-color);
  border-radius: var(--radius-lg);
}

.pwa-step-icon {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
  border-radius: var(--radius-md);
  color: #fff;
}

.pwa-step-text {
  flex: 1;
}

.pwa-step-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  background: var(--primary-color);
  color: #fff;
  border-radius: 50%;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 8px;
}

.pwa-step-desc {
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-primary);
}

/* Android 大图标 */
.pwa-icon-large {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 20px 0;
  color: var(--primary-color);
}

/* Android 优点列表 */
.pwa-benefits {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 20px 0;
}

.pwa-benefit {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--bg-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 14px;
}

.pwa-benefit svg {
  flex-shrink: 0;
  color: var(--primary-color);
}

/* 按钮区域 */
.pwa-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 24px;
}

.pwa-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 20px;
  border-radius: var(--radius-lg);
  font-size: 15px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.pwa-btn:active {
  transform: translateY(2px);
}

.pwa-btn-primary {
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
  color: #fff;
  box-shadow: 0 2px 8px rgba(76, 175, 80, 0.3);
}

.pwa-btn-primary:hover {
  box-shadow: 0 4px 12px rgba(76, 175, 80, 0.4);
}

.pwa-btn-secondary {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}

.pwa-btn-secondary:hover {
  background: var(--bg-color);
}

/* 响应式调整 */
@media (max-width: 375px) {
  .pwa-install-modal {
    padding: 20px;
  }
  
  .pwa-step {
    padding: 12px;
    gap: 12px;
  }
  
  .pwa-step-icon {
    width: 44px;
    height: 44px;
  }
  
  .pwa-btn {
    padding: 12px 16px;
    font-size: 14px;
  }
}

