/* ============================================
   产品相关样式
   ============================================ */

/* Products Section */
.products {
  padding: 60px 0;
}

.filter-controls {
  position: sticky;
  width: 100%;
  top: 64px;
  background-color: var(--bg-light);
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 15px;
  z-index: 100;
  padding: 20px 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

/* WordPress管理栏适配 - 筛选控件 */
body.admin-bar .filter-controls {
  top: 102px; /* header高度(70px) + 管理栏高度(32px) */
}

@media screen and (max-width: 782px) {
  body.admin-bar .filter-controls {
    top: 116px; /* header高度(70px) + 管理栏高度(46px) */
  }
}

.filter-btn {
  padding: 8px 20px;
  background-color: transparent;
  color: var(--text-color);
  border: 1px solid var(--border-color);
  border-radius: 30px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.filter-btn.active,
.filter-btn:hover {
  background-color: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
}

/* 子分类筛选 */
.subcategory-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 16px 0 40px 0;
}
.subcategory-controls.hidden-gap-placeholder {
  display: block;
  height: 1px; /* 占位，避免列表紧贴分类按钮 */
}
.subcategory-btn {
  padding: 6px 14px;
  border: 1px solid var(--border-color);
  border-radius: 999px;
  /* background: #f7f7f7; */
  background-color: transparent;
  color: var(--text-color);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
}

[data-theme="dark"] .subcategory-btn {
  background: #2a2a2a;
  color: var(--text-color);
  border-color: var(--border-color);
}

.subcategory-btn:hover {
  border-color: var(--primary-color);
  color: var(--primary-color);
  background: #fff;
}

[data-theme="dark"] .subcategory-btn:hover {
  background: #3a3a3a;
  color: var(--primary-color);
}

.subcategory-btn.active {
  background: var(--primary-color);
  color: #fff;
  border-color: var(--primary-color);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
}

[data-theme="dark"] .subcategory-btn.active {
  background: var(--primary-color);
  color: #fff;
  border-color: var(--primary-color);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
}

.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 30px;
}

/* Recommended products special layout - first product spans 2 columns */
.products-grid-recommended .product-card:first-child {
  grid-column: span 2;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.products-grid-recommended .product-card:first-child .product-image {
  order: -1;
  flex: none;
}

.products-grid-recommended .product-card:first-child .product-content {
  text-align: center;
  flex: none;
}

.products-grid-recommended .product-card:first-child .product-actions {
  width: 100%;
  max-width: 193px;
}

/* 产品分类和子分类样式 */
.product-category-section {
  margin-bottom: 60px;
}

.category-title {
  font-size: 32px;
  font-weight: 600;
  margin-bottom: 30px;
  color: var(--text-color);
  padding-bottom: 15px;
  border-bottom: 2px solid var(--primary-color);
}

.category-products-container {
  margin-top: 20px;
}

.product-subcategory-section {
  margin-bottom: 40px;
}

.subcategory-title {
  font-size: 24px;
  font-weight: 500;
  margin-bottom: 20px;
  color: var(--text-color);
  opacity: 0.9;
  padding-left: 15px;
  border-left: 4px solid var(--primary-color);
}

.product-card {
  background-color: var(--card-bg);
  border-radius: 15px;
  overflow: hidden;
  transition:
    transform 0.3s ease,
    box-shadow 0.3s ease;
  border: 1px solid var(--border-color);
}

.product-card:hover {
  transform: translateY(-10px);
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.2);
}

.product-image {
  height: 200px;
  background-color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

[data-theme="dark"] .product-image {
  background-color: #1a1a1a;
}

.product-image img {
  max-width: 80%;
  max-height: 80%;
  transition: transform 0.5s ease;
}

.product-card:hover .product-image img {
  transform: scale(1.1);
}

.product-badge {
  position: absolute;
  top: 15px;
  right: 15px;
  background-color: var(--primary-color);
  color: white;
  padding: 5px 10px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  z-index: 99;
}

.product-content {
  padding: 20px;
}

.product-title {
  font-size: 1.3rem;
  margin-bottom: 10px;
  font-weight: 700;
  text-align: center;
  font-family: var(--font-barlow);
}

.product-price {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary-color);
  margin-bottom: 15px;
}

.product-price del {
  font-size: 1rem;
  color: #999;
  margin-left: 10px;
}

.product-specs {
  margin-bottom: 20px;
  font-size: 0.9rem;
}

.product-specs li {
  margin-bottom: 5px;
  display: flex;
  align-items: center;
}

.product-specs i {
  margin-right: 8px;
  color: var(--primary-color);
  font-size: 0.8rem;
}

.product-actions {
  display: flex;
  gap: 10px;
  width: 80%;
  margin: 0 auto;
}

.product-actions .btn {
  flex: 1;
  padding: 10px;
  font-size: 0.8rem;
}

.load-more {
  text-align: center;
  margin-top: 50px;
}

/* Newsletter Section */
.newsletter {
  padding: 80px 0;
  background: linear-gradient(135deg, var(--primary-dark), var(--primary-color));
  color: white;
  text-align: center;
}

.newsletter h2 {
  color: white;
  margin-bottom: 1rem;
}

.newsletter p {
  max-width: 600px;
  margin: 0 auto 2rem;
  opacity: 0.9;
}

.newsletter-form {
  display: flex;
  max-width: 500px;
  margin: 0 auto;
}

.newsletter-form input {
  flex: 1;
  padding: 15px 20px;
  border: none;
  border-radius: 30px 0 0 30px;
  font-size: 1rem;
  outline: none;
}

.newsletter-form button {
  border-radius: 0 30px 30px 0;
  padding: 15px 30px;
}

/* Modal */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.8);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.modal.active {
  opacity: 1;
  visibility: visible;
}

.modal-content {
  background-color: var(--bg-light);
  border-radius: 15px;
  max-width: 900px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
  transform: scale(0.9);
  transition: transform 0.3s ease;
}

.modal.active .modal-content {
  transform: scale(1);
}

.modal-close {
  position: absolute;
  top: 20px;
  right: 20px;
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-color);
  cursor: pointer;
  z-index: 1;
  transition: color 0.3s ease;
}

.modal-close:hover {
  color: var(--primary-color);
}

.modal-body {
  padding: 40px;
}

/* Product Details in Modal */
.product-details {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  margin-bottom: 0;
}

.product-details-image {
  text-align: center;
  position: relative;
}

.product-details-image-container {
  position: relative;
  width: 100%;
  height: 400px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f3f3f3;
  border-radius: 12px;
  margin-bottom: 20px;
  overflow: hidden;
}

[data-theme="dark"] .product-details-image-container {
  background: #1a1a1a;
}

.product-details-img {
  max-width: 90%;
  max-height: 90%;
  width: auto;
  height: auto;
  object-fit: contain;
  transition: opacity 0.4s ease;
  opacity: 1;
  display: block;
}

/* 颜色点样式（放在图片区域下方） */
.product-details-color-dots {
  display: flex;
  justify-content: center;
  gap: 15px;
  margin-top: 15px;
  padding: 0;
}

.product-details-color-dots .color-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: none;
  background: #d1d5db;
  cursor: pointer;
  transition: all 0.3s ease;
  padding: 0;
  margin: 0;
  outline: none;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.1);
}

.product-details-color-dots .color-dot:hover {
  transform: scale(1.15);
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.2);
}

.product-details-color-dots .color-dot.active {
  box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.5);
  transform: scale(1.2);
}

.product-details-content h2 {
  font-size: 2rem;
  margin-bottom: 10px;
}

.product-details-price {
  font-size: 1.8rem;
  color: var(--primary-color);
  margin-bottom: 20px;
  font-weight: 700;
}

.product-details-price del {
  font-size: 1.2rem;
  color: #999;
  margin-left: 10px;
}

.product-details-description {
  margin-bottom: 30px;
  line-height: 1.7;
}

.product-details-specs {
  margin-bottom: 30px;
}

.product-details-specs h4 {
  margin-bottom: 15px;
  font-size: 1.2rem;
}

.product-details-specs ul {
  list-style: none;
  columns: 2;
  column-gap: 30px;
}

.product-details-specs li {
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  break-inside: avoid;
}

.product-details-specs i {
  margin-right: 10px;
  color: var(--primary-color);
}

.product-details-actions {
  display: flex;
  gap: 15px;
  margin-top: 30px;
  flex-wrap: wrap;
  justify-content: center;
  width: 100%;
  padding: 20px 0 0;
  border-top: 1px solid var(--border-color, #e5e7eb);
  grid-column: 1 / -1;
}

[data-theme="dark"] .product-details-actions {
  border-top-color: #1f2937;
}

.product-details-actions .btn {
  flex: none;
  min-width: auto;
  padding: 12px 24px;
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
  border-radius: 8px;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  cursor: pointer;
  white-space: nowrap;
}

.product-details-actions .btn-buy {
  background-color: var(--primary-color, #1a73e8);
  color: #ffffff;
}

.product-details-actions .btn-buy:hover {
  background-color: var(--primary-color-dark, #1557b0);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(26, 115, 232, 0.3);
}

.product-details-actions .btn-buy-noon {
  background-color: #ff6b35;
}

.product-details-actions .btn-buy-noon:hover {
  background-color: #e55a2b;
  box-shadow: 0 4px 12px rgba(255, 107, 53, 0.3);
}

.product-details-actions .btn-buy-jumia {
  background-color: #f68b1e;
}

.product-details-actions .btn-buy-jumia:hover {
  background-color: #d67a1a;
  box-shadow: 0 4px 12px rgba(246, 139, 30, 0.3);
}

.product-details-actions .btn i {
  font-size: 0.9rem;
}

@media (max-width: 768px) {
  .product-details-actions {
    flex-direction: column;
  }

  .product-details-actions .btn {
    width: 100%;
    min-width: auto;
  }
  .products-grid-recommended .product-card:first-child .product-actions {
    max-width: none;
    width: 80%;
  }

  /* Reset recommended layout on mobile */
  .products-grid-recommended .product-card:first-child {
    grid-column: span 1;
    display: flex;
    flex-direction: column;
    gap: 15px;
  }

  .products-grid-recommended .product-card:first-child .product-image,
  .products-grid-recommended .product-card:first-child .product-content {
    flex: none;
  }

  .products-grid-recommended .product-card:first-child .product-image {
    order: 0;
  }

  .products-grid-recommended .product-card:first-child .product-content {
    text-align: center;
  }
}

/* Responsive Styles */
@media (max-width: 992px) {
  .product-details {
    grid-template-columns: 1fr;
  }

  .product-details-image {
    margin-bottom: 30px;
  }
}
