/* WooCommerce Shop/Archive/Category/Tag pages */
/* 从 style.css 中拆分商店列表页网格与筛选等样式 */
/* 页面框架 */
.shop-page-wrapper {
    background: var(--color-bg);
    padding: var(--spacing-3xl) 0;
    min-height: 70vh;
}

.shop-container {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 var(--container-padding);
    display: grid;
    grid-template-columns: 340px 1fr;
    gap: 2.5rem;
}

/* 明确网格列位置，避免元素自动流导致换行 */
.shop-sidebar { grid-column: 1; }
.shop-main-content { grid-column: 2; }
/* 桌面与平板下，遮罩不占位 */
.shop-sidebar-overlay { display: none; }

/* WooCommerce默认头部覆盖 */
.woocommerce .woocommerce-products-header {
    margin-bottom: var(--spacing-xl);
    padding-bottom: var(--spacing-lg);
    border-bottom: 2px solid var(--color-border);
}

.woocommerce .woocommerce-products-header__title {
    font-family: var(--font-heading);
    font-size: var(--font-4xl);
    font-weight: 900;
    color: var(--color-primary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.woocommerce .woocommerce-result-count {
    font-size: var(--font-base);
    color: var(--color-text-light);
    font-weight: 500;
    float: none;
    margin: 0 0 1rem 0;
}

/* 左侧边栏 */
.shop-sidebar {
    position: sticky;
    top: 80px;
    height: fit-content;
}

.sidebar-widget {
    background: white;
    border: 1px solid #e5e5e5;
    padding: 2rem 1.75rem;
    margin-bottom: 2rem;
}

.widget-title {
    font-family: var(--font-primary);
    font-size: 1rem;
    font-weight: 700;
    color: var(--color-primary);
    margin: 0 0 1.5rem 0;
    padding: 0 0 1rem 0;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    border-bottom: 2px solid #e5e5e5;
}

/* 分类列表 */
.category-list { list-style: none; padding: 0; margin: 0; }

.category-item { margin-bottom: 0; border-left: 3px solid transparent; transition: border-color 0.2s ease; }
.category-item:not(:last-child) { margin-bottom: 0.875rem; }
.category-item a {
    display: flex; justify-content: space-between; align-items: center;
    padding: 0.875rem 1rem; color: #6c757d; font-size: 1.25rem; font-weight: 700;
    transition: color 0.2s ease; text-decoration: none; line-height: 1.5; text-transform: uppercase; letter-spacing: 0.5px;
}
.category-item a:hover { color: var(--color-accent); }
.category-item.active { border-left-color: var(--color-primary); }
.category-item.active a { color: var(--color-primary); font-weight: 800; }
.category-count { font-size: 1.125rem; color: #999; font-weight: 600; margin-left: auto; flex-shrink: 0; }
.category-item.active .category-count { color: rgba(255, 255, 255, 0.8); }
.category-item a:hover .category-count { color: rgba(255, 68, 68, 0.8); }

/* 子分类 */
.category-item.child-category { margin-left: 0; border-left: none; }
.category-item.child-category a { padding-left: 1.5rem; color: #007bff; font-size: 0.875rem; }
.category-item.child-category a:hover { color: #0056b3; }

/* 价格列表 */
.price-list { list-style: none; padding: 0; margin: 0; }
.price-list li { margin-bottom: 0.875rem; }
.price-list li:last-child { margin-bottom: 0; }
.price-list li a { display: block; padding: 0.5rem 0.75rem; color: #6c757d; font-size: 0.9375rem; font-weight: 400; transition: color 0.2s ease; text-decoration: none; }
.price-list li a:hover { color: var(--color-primary); }

/* 排序下拉 */
.orderby-select {
    width: 100%; padding: 0.875rem 1rem; border: 1px solid #e5e5e5; border-radius: 0; font-size: 1rem; color: var(--color-primary);
    background: white; cursor: pointer; transition: border-color 0.2s ease; outline: none; appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 12 12'%3E%3Cpath fill='%236c757d' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 1rem center; padding-right: 2.75rem; font-weight: 600;
}
.orderby-select:hover { border-color: #999; }
.orderby-select:focus { border-color: #007bff; box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25); }
.orderby-select option { padding: 0.5rem; color: var(--color-text); }
.orderby-select option:hover, .orderby-select option:checked { background: #007bff; color: white; }

/* 主内容区与分类头 */
.shop-main-content { width: 100%; }
.category-header { margin-bottom: var(--spacing-xl); padding-bottom: var(--spacing-lg); border-bottom: 2px solid var(--color-border); }
.category-title { font-family: var(--font-heading); font-size: var(--font-4xl); font-weight: 900; color: var(--color-primary); margin-bottom: var(--spacing-sm); text-transform: uppercase; letter-spacing: 1px; }
.category-description { font-size: var(--font-lg); color: var(--color-text-light); line-height: 1.8; }

/* 店铺头 */
.shop-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: var(--spacing-xl); padding: var(--spacing-md); background: var(--color-bg-light); border-radius: var(--radius-md); }
.shop-header-actions { display: flex; align-items: center; gap: var(--spacing-sm); }
.filter-toggle { display: none; align-items: center; gap: 0.5rem; padding: 0.5rem 0.75rem; border-radius: var(--radius-sm); border: 1px solid var(--color-border); background: var(--color-primary); color: #fff; font-weight: 700; cursor: pointer; transition: var(--transition-base); }
.filter-toggle:hover { filter: brightness(0.95); }
.filter-toggle-icon { line-height: 1; }
.shop-results-info, .shop-page-info { font-size: var(--font-base); color: var(--color-text-light); font-weight: 500; }

/* 产品网格覆盖Woo默认 */
.woocommerce ul.products,
.products-grid-shop,
.shop-main-content .products {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr) !important;
    gap: var(--spacing-lg) !important;
    margin-bottom: var(--spacing-2xl) !important;
    list-style: none !important;
    padding: 0 !important;
    width: 100% !important;
}
.woocommerce ul.products::before, .woocommerce ul.products::after, .shop-main-content .products::before, .shop-main-content .products::after { display: none !important; }
.product-card-shop-wrapper, .woocommerce ul.products li.product, .shop-main-content .products li.product { grid-column: span 1 !important; list-style: none !important; width: 100% !important; float: none !important; margin: 0 !important; }
.woocommerce ul.products li.product, .shop-main-content .products li.product { background: white !important; border-radius: var(--radius-md) !important; overflow: hidden !important; transition: all var(--transition-base) !important; border: 1px solid #f0f0f0 !important; display: flex !important; flex-direction: column !important; height: 100% !important; box-shadow: 0 2px 10px rgba(0,0,0,0.06) !important; position: relative !important; }
.woocommerce ul.products li.product:hover, .shop-main-content .products li.product:hover { transform: translateY(-6px) !important; box-shadow: 0 8px 24px rgba(0,0,0,0.15) !important; border-color: var(--color-border) !important; }

/* 产品卡片 */
.product-card-shop { background: white; border-radius: var(--radius-md); overflow: hidden; transition: all var(--transition-base); border: 1px solid #f0f0f0; display: flex; flex-direction: column; height: 100%; box-shadow: 0 2px 10px rgba(0,0,0,0.06); position: relative; min-width: 0; }
.product-card-shop:hover { transform: translateY(-6px); box-shadow: 0 8px 24px rgba(0,0,0,0.15); border-color: var(--color-border); }

/* 标签 */
.badge-new, .badge-sale { position: absolute; top: 0.8rem; left: 0.8rem; padding: 0.3rem 0.8rem; font-size: 0.7rem; font-weight: 700; letter-spacing: 0.3px; text-transform: uppercase; border-radius: var(--radius-sm); z-index: 2; box-shadow: 0 2px 6px rgba(0,0,0,0.2); }
.badge-new { background: #ff4444; color: white; }
.badge-sale { background: #2ed573; color: white; left: auto; right: 0.8rem; }

/* 产品图片 */
.woocommerce ul.products li.product .woocommerce-loop-product__link,
.woocommerce ul.products li.product a.woocommerce-LoopProduct-link,
.product-image-shop { position: relative; overflow: hidden; background: var(--color-bg-light); aspect-ratio: 1 !important; -webkit-backface-visibility: hidden; backface-visibility: hidden; display: block !important; text-decoration: none !important; }
.woocommerce ul.products li.product .woocommerce-loop-product__link img,
.woocommerce ul.products li.product a.woocommerce-LoopProduct-link img,
.woocommerce ul.products li.product img,
.product-image-shop img { width: 100% !important; height: 100% !important; object-fit: cover !important; transition: transform var(--transition-slow) !important; margin: 0 !important; }
.woocommerce ul.products li.product:hover img,
.product-card-shop:hover .product-image-shop img { transform: scale(1.08) !important; }

/* 产品信息 */
.product-info-shop { padding: 1rem; display: flex; flex-direction: column; gap: 0; flex: 1; min-height: 180px; min-width: 0; }
.product-category-shop { font-size: 0.75rem; color: var(--color-text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 0.5rem; font-weight: 600; }
.woocommerce ul.products li.product .woocommerce-loop-product__title,
.woocommerce ul.products li.product h2,
.woocommerce ul.products li.product h3,
.product-title-shop { font-size: var(--font-sm) !important; font-weight: 700 !important; line-height: 1.35 !important; overflow-wrap: anywhere; margin: 0 0 0.75rem 0 !important; text-transform: uppercase !important; letter-spacing: 0.3px !important; height: 40px !important; display: -webkit-box !important; -webkit-line-clamp: 2 !important; -webkit-box-orient: vertical !important; overflow: hidden !important; padding: 0 !important; }
.woocommerce ul.products li.product .woocommerce-loop-product__title a,
.woocommerce ul.products li.product h2 a,
.woocommerce ul.products li.product h3 a,
.product-title-shop a { color: var(--color-text) !important; transition: color var(--transition-fast) !important; text-decoration: none !important; }
.woocommerce ul.products li.product:hover .woocommerce-loop-product__title a,
.woocommerce ul.products li.product:hover h2 a,
.woocommerce ul.products li.product:hover h3 a,
.product-title-shop a:hover { color: var(--color-primary) !important; }
.product-meta-shop { font-size: 0.75rem; color: var(--color-text-muted); margin-bottom: 0.5rem; }
.woocommerce ul.products li.product .price,
.product-price-shop { font-size: var(--font-2xl) !important; font-weight: 800 !important; color: var(--color-accent) !important; margin: auto 0 1rem 0 !important; text-align: center !important; line-height: 1.2 !important; display: block !important; }
.woocommerce ul.products li.product .price ins,
.woocommerce ul.products li.product .price .woocommerce-Price-amount { color: var(--color-accent) !important; text-decoration: none !important; font-weight: 800 !important; }
.woocommerce ul.products li.product .price del,
.product-price-shop del { font-size: var(--font-base) !important; font-weight: 500 !important; color: var(--color-text-muted) !important; margin-right: 0 !important; display: inline-block !important; text-decoration: line-through !important; opacity: 0.7 !important; }
.product-stock-shop { text-align: center; margin-bottom: 0.75rem; }
.product-stock-shop .in-stock { color: #2ed573; font-size: var(--font-sm); font-weight: 600; }
.product-stock-shop .out-of-stock { color: #ff4757; font-size: var(--font-sm); font-weight: 600; }

/* 添加到购物车按钮 */
.product-actions-shop { margin-top: 0; }
.add-to-cart-btn-shop { display: block; width: 100%; padding: 0.75rem 1rem; background: transparent; color: var(--color-primary); text-align: center; font-size: var(--font-sm); font-weight: 700; letter-spacing: 0.8px; text-transform: uppercase; border-radius: var(--radius-sm); transition: all var(--transition-base); border: 2px solid var(--color-primary); }
.add-to-cart-btn-shop:hover { background: var(--color-accent); color: white; border-color: var(--color-accent); transform: translateY(-2px); box-shadow: 0 4px 12px rgba(255, 68, 68, 0.3); }
.add-to-cart-btn-shop:active { background: #e03e3e; transform: translateY(0); }

/* 覆盖Woo默认按钮 */
.woocommerce ul.products li.product .button,
.woocommerce ul.products li.product .add_to_cart_button,
.woocommerce ul.products li.product .product_type_simple,
.shop-main-content .button.product_type_simple,
.shop-main-content .button.add_to_cart_button,
.shop-main-content .added_to_cart {
    display: block !important; width: 100% !important; padding: 0.75rem 1rem !important; background: transparent !important; color: var(--color-primary) !important; text-align: center !important; font-size: var(--font-sm) !important; font-weight: 700 !important; letter-spacing: 0.8px !important; text-transform: uppercase !important; border-radius: var(--radius-sm) !important; transition: all var(--transition-base) !important; border: 2px solid var(--color-primary) !important; text-decoration: none !important; margin: 0 !important; float: none !important;
}
.woocommerce ul.products li.product .button:hover,
.woocommerce ul.products li.product .add_to_cart_button:hover,
.woocommerce ul.products li.product .product_type_simple:hover,
.shop-main-content .button.product_type_simple:hover,
.shop-main-content .button.add_to_cart_button:hover,
.shop-main-content .added_to_cart:hover { background: var(--color-accent) !important; color: white !important; border-color: var(--color-accent) !important; transform: translateY(-2px) !important; box-shadow: 0 4px 12px rgba(255, 68, 68, 0.3) !important; }

/* 无产品提示 */
.no-products-found { text-align: center; padding: var(--spacing-3xl); background: white; border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.no-products-found p { font-size: var(--font-xl); color: var(--color-text-light); }

/* 分页 */
.shop-pagination, .woocommerce-pagination { margin-top: 3.5rem; padding-top: 2.5rem; border-top: 1px solid #e5e5e5; display: flex; justify-content: center; }
.shop-pagination .page-numbers, .woocommerce-pagination .page-numbers { list-style: none; display: flex; gap: 0.5rem; padding: 0; margin: 0; align-items: center; }
.shop-pagination .page-numbers li, .woocommerce-pagination .page-numbers li { display: inline-block; }
.shop-pagination .page-numbers a, .shop-pagination .page-numbers span, .woocommerce-pagination .page-numbers a, .woocommerce-pagination .page-numbers span { display: inline-flex; align-items: center; justify-content: center; min-width: 52px; height: 52px; padding: 0 0.875rem; background: transparent; color: #2c3e50; border: 1px solid #e5e5e5; border-radius: 0; font-weight: 700; font-size: 1.125rem; transition: all 0.2s ease; text-decoration: none; }
.shop-pagination .page-numbers a:hover, .woocommerce-pagination .page-numbers a:hover { background: var(--color-accent); color: white; border-color: var(--color-accent); transform: translateY(-1px); }
.shop-pagination .page-numbers .current, .woocommerce-pagination .page-numbers .current { background: var(--color-primary); color: white; border-color: var(--color-primary); cursor: default; font-weight: 800; }
.shop-pagination .page-numbers .prev, .shop-pagination .page-numbers .next, .woocommerce-pagination .page-numbers .prev, .woocommerce-pagination .page-numbers .next { font-weight: 700; padding: 0 1.5rem; min-width: auto; font-size: 1rem; letter-spacing: 0.3px; }
.shop-pagination .page-numbers .prev:hover, .shop-pagination .page-numbers .next:hover, .woocommerce-pagination .page-numbers .prev:hover, .woocommerce-pagination .page-numbers .next:hover { background: var(--color-accent); color: white; border-color: var(--color-accent); }
.shop-pagination .page-numbers .dots, .woocommerce-pagination .page-numbers .dots { border: none; background: transparent; cursor: default; padding: 0 0.25rem; color: #999; font-weight: 700; min-width: 32px; }
.shop-pagination .page-numbers .dots:hover, .woocommerce-pagination .page-numbers .dots:hover { background: transparent; transform: none; border: none; }

/* Woo Notices */
.woocommerce-info, .woocommerce-message { background: #e7f5ff; border-left: 4px solid #1c7ed6; padding: 1rem; margin-bottom: 1rem; border-radius: var(--radius-sm); }
.woocommerce-error { background: #ffe5e5; border-left: 4px solid #ff4444; padding: 1rem; margin-bottom: 1rem; border-radius: var(--radius-sm); }

/* 响应式 - 平板 */
@media (max-width: 1024px) {
  .filter-toggle { display: inline-flex; }
  /* 平板竖屏改为单列并居中，避免右侧空白 */
  .shop-container { display: grid !important; grid-template-columns: 1fr !important; grid-auto-flow: row !important; max-width: 100% !important; gap: 1.5rem; padding: 0 var(--container-padding); }
  /* 提升选择器优先级，覆盖 style.css 的强制双列 */
  .woocommerce-shop .shop-container,
  .woocommerce-page .shop-container,
  .post-type-archive-product .shop-container,
  .custom-shop-template .shop-container,
  body[class*="woocommerce"] .shop-container { display: grid !important; grid-template-columns: 1fr !important; grid-auto-flow: row !important; max-width: 100% !important; }
  .shop-sidebar { position: static; grid-column: 1; width: 100%; }
  .shop-main-content { grid-column: 1; }
  /* 对齐主页：平板产品网格三列 */
  .woocommerce ul.products, .products-grid-shop, .shop-main-content .products { grid-template-columns: repeat(3, 1fr) !important; gap: var(--spacing-md) !important; }
}

/* 响应式 - 手机 */
@media (max-width: 768px) {
  .shop-page-wrapper { padding: var(--spacing-xl) 0; }
  .shop-container { grid-template-columns: 1fr !important; gap: var(--spacing-lg); padding: 0 var(--container-padding) !important; }
  /* 同样提升优先级，防止双列栅格在手机上生效 */
  .woocommerce-shop .shop-container,
  .woocommerce-page .shop-container,
  .post-type-archive-product .shop-container,
  .custom-shop-template .shop-container,
  body[class*="woocommerce"] .shop-container { grid-template-columns: 1fr !important; max-width: 100% !important; }
  /* 移动端改为一列堆叠，侧栏置于产品区上方 */
  .shop-sidebar { position: static !important; order: 1; grid-column: 1; width: 100% !important; max-width: none !important; height: auto !important; top: auto !important; left: auto !important; transform: none !important; }
  .sidebar-widget { padding: 1.25rem; margin-bottom: 1.25rem; }
  .widget-title { font-size: 0.8125rem; margin-bottom: 1rem; letter-spacing: 1.2px; }
  .category-item a, .price-list li a { padding: 0.625rem 0.75rem; font-size: 1rem; font-weight: 700; }
  .category-count { font-size: 0.9375rem; font-weight: 600; margin-left: auto; }
  .orderby-select { font-size: 0.875rem; padding: 0.5rem 0.75rem; padding-right: 2rem; }
  .shop-main-content { order: 2; grid-column: 1; }
  .category-title { font-size: var(--font-2xl); }
  .shop-header { flex-direction: column; gap: var(--spacing-sm); text-align: center; }
  .shop-header-actions { order: 2; display: flex; justify-content: center; }
  .filter-toggle { display: inline-flex; }
  /* 移动端采用单列堆叠，不使用抽屉与遮罩 */
  .shop-sidebar.open { transform: none !important; }
  .shop-sidebar-overlay { display: none !important; }
  .shop-sidebar.open ~ .shop-sidebar-overlay { display: none !important; }
  .woocommerce ul.products, .products-grid-shop, .shop-main-content .products { grid-template-columns: repeat(2, 1fr) !important; gap: 0.8rem !important; }
  .product-info-shop { padding: 0.75rem; min-height: 150px; }
  .product-title-shop { font-size: 0.75rem; height: 36px; margin-bottom: 0.5rem; }
  .product-price-shop { font-size: var(--font-xl); margin: auto 0 0.75rem 0; }
  .add-to-cart-btn-shop { padding: 0.7rem 0.75rem; font-size: 0.75rem; }
}

/* 响应式 - 小手机 */
@media (max-width: 480px) {
  .woocommerce ul.products, .products-grid-shop, .shop-main-content .products { grid-template-columns: 1fr !important; gap: 0.8rem !important; }
  .product-info-shop { padding: 1rem; min-height: 140px; }
  .product-title-shop { font-size: var(--font-sm); height: auto; min-height: 36px; margin-bottom: 0.75rem; }
  .product-price-shop { font-size: var(--font-2xl); margin: auto 0 0.85rem 0; }
  .add-to-cart-btn-shop { padding: 0.85rem 1rem; font-size: var(--font-sm); }
  .shop-pagination, .woocommerce-pagination { margin-top: 2.5rem; padding-top: 2rem; }
  .shop-pagination .page-numbers, .woocommerce-pagination .page-numbers { gap: 0.375rem; }
  .shop-pagination .page-numbers a, .shop-pagination .page-numbers span, .woocommerce-pagination .page-numbers a, .woocommerce-pagination .page-numbers span { min-width: 46px; height: 46px; padding: 0 0.75rem; font-size: 1rem; font-weight: 700; }
  .shop-pagination .page-numbers .prev, .shop-pagination .page-numbers .next, .woocommerce-pagination .page-numbers .prev, .woocommerce-pagination .page-numbers .next { padding: 0 1.25rem; font-size: 0.9375rem; font-weight: 700; }
  .shop-pagination .page-numbers a:hover, .woocommerce-pagination .page-numbers a:hover { background: var(--color-accent); color: white; border-color: var(--color-accent); transform: translateY(-1px); }
  .sidebar-widget { margin-bottom: 1rem; padding: 1rem; }
  .widget-title { font-size: 0.75rem; margin-bottom: 0.875rem; letter-spacing: 1px; }
  .category-item:not(:last-child) { margin-bottom: 0.625rem; }
  .price-list li { margin-bottom: 0.625rem; }
  .category-item a, .price-list li a { padding: 0.5rem 0.625rem; font-size: 0.9375rem; font-weight: 700; }
  .category-count { font-size: 0.875rem; font-weight: 600; margin-left: auto; }
  .category-item { border-left-width: 2px; }
  .orderby-select { font-size: 0.8125rem; padding: 0.5rem 0.625rem; padding-right: 2rem; }
}