/*
 * WGACA Frontend - Products Page Styles
 * 产品列表 + 详情页样式
 */

/* ================== 面包屑 ================== */
.breadcrumb-div {
  padding: 15px 0;
  border-bottom: 1px solid #f0f0f0;
  background: #fafafa;
  margin-top: 70px;
}

@media (min-width: 768px) {
  .breadcrumb-div {
    margin-top: 80px;
  }
}



.breadcrumb li {
  display: flex;
  align-items: center;
  color: #666;
}

.breadcrumb li a:hover {
  color: #000;
}

.breadcrumb li:not(:first-child)::before {
  content: '•';
  margin: 0 10px;
  color: #999;
}

.breadcrumb li:last-child {
  color: #000;
  font-weight: 600;
}

/* ================== 列表页主区 ================== */
.products-section {
  padding: 40px 0 60px;
}

.products-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 30px;
}

/* ---------- 筛选侧栏 ---------- */
.products-filter {
  background: #fafafa;
  border-radius: 12px;
  padding: 25px;
  margin-bottom: 30px;
}

.filter-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 1px solid #e5e5e5;
}

.filter-header h3 {
  font-size: 18px;
  margin: 0;
}

.filter-header .filter-toggle {
  background: none;
  border: none;
  font-size: 18px;
  color: #333;
  cursor: pointer;
  display: block;
}

.filter-block {
  margin-bottom: 25px;
  padding-bottom: 20px;
  border-bottom: 1px solid #e5e5e5;
}

.filter-block:last-child {
  border-bottom: none;
  margin-bottom: 0;
}

.filter-block .filter-title {
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 15px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
}

.filter-block .filter-title i {
  font-size: 12px;
  transition: transform 0.3s;
}

.filter-block.collapsed .filter-title i {
  transform: rotate(-90deg);
}

.filter-block.collapsed .filter-list {
  display: none;
}

.filter-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.filter-list li {
  margin-bottom: 8px;
  font-size: 14px;
  color: #555;
}

.filter-list li a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #555;
  transition: color 0.2s;
  padding: 4px 0;
}

.filter-list li a:hover,
.filter-list li.active a {
  color: #000;
  font-weight: 600;
}

.filter-list li a .count {
  color: #999;
  font-size: 12px;
}

.filter-list li.active a .count {
  color: #000;
}

.filter-block input[type="checkbox"] {
  margin-right: 8px;
  vertical-align: middle;
}

/* checkbox 样式 */
.filter-checkboxes li {
  margin-bottom: 0;
}

.filter-checkboxes li label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 5px 0;
  color: #555;
  font-size: 14px;
  transition: color 0.2s;
}

.filter-checkboxes li label:hover {
  color: #000;
}

.filter-checkboxes li input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: #000;
  cursor: pointer;
  flex-shrink: 0;
}

.filter-checkboxes li.active label {
  color: #000;
  font-weight: 600;
}

.filter-checkboxes li input[type="checkbox"]:checked + * {
  color: #000;
  font-weight: 600;
}

.reset-filter {
  display: none;
  margin-bottom: 20px;
  padding: 8px 16px;
  background: #000;
  color: #fff;
  border-radius: 4px;
  font-size: 13px;
  cursor: pointer;
  border: none;
  transition: background 0.2s;
}

.reset-filter:hover {
  background: #333;
}

/* 价格区间 */
.price-range {
  display: flex;
  gap: 10px;
  align-items: center;
}

.price-range input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 13px;
}

.price-range input:focus {
  outline: none;
  border-color: #000;
}

/* ---------- 列表头部 ---------- */
.products-main .list-header {
  display: flex;
  flex-direction: column;
  gap: 15px;
  margin-bottom: 25px;
  padding-bottom: 20px;
  border-bottom: 1px solid #eee;
}

.products-main .list-header h2 {
  font-size: 22px;
  margin: 0;
}

.products-main .list-header .meta {
  font-size: 13px;
  color: #666;
}

.products-main .list-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.products-main .sort-select {
  padding: 8px 30px 8px 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 13px;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23333' d='M6 9L1 4h10z'/%3E%3C/svg%3E") no-repeat right 10px center;
  background-size: 10px;
  appearance: none;
  cursor: pointer;
}

.products-main .view-mode {
  display: flex;
  gap: 5px;
}

.products-main .view-mode button {
  background: transparent;
  border: 1px solid #ddd;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  cursor: pointer;
  color: #666;
  transition: all 0.2s;
}

.products-main .view-mode button.active,
.products-main .view-mode button:hover {
  background: #000;
  border-color: #000;
  color: #fff;
}

/* ---------- 产品网格 ---------- */
.products-grid {
  display: grid !important;
  grid-template-columns: repeat(2, 1fr);
  gap: 15px;
}

/* 覆盖 WooCommerce 输出的 ul.products 样式（WC 核心 frontend.css 默认 display:block） */
.products-grid ul.products,
.products-grid .product-list {
  display: grid !important;
  grid-template-columns: repeat(2, 1fr);
  gap: 15px;
  list-style: none !important;
  margin: 0 !important;
  padding: 0 !important;
  width: 100% !important;
}

/* 产品卡片：取消 li 默认样式，让 grid 直接作用在 article 上 */
.products-grid ul.products li,
.products-grid .product-list li {
  display: contents;
}

.product-card {
  position: relative;
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
  transition: all 0.3s;
  display: flex;
  flex-direction: column;
  width: 100%;
}

.product-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(0,0,0,0.08);
}

.product-card .card-img-wrap {
  position: relative;
  overflow: hidden;
  aspect-ratio: 1/1;
  background: #f5f5f5;
  flex-shrink: 0;
  width: 100%;
}

.product-card .card-img-wrap img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  transition: transform 0.5s;
}

.product-card:hover .card-img-wrap img {
  transform: scale(1.05);
}

.product-card .badge {
  position: absolute;
  top: 10px;
  left: 10px;
  background: #000;
  color: #fff;
  padding: 4px 10px;
  font-size: 10px;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-radius: 3px;
  z-index: 2;
}

.product-card .badge.sale {
  background: #e74c3c;
}

.product-card .wishlist-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 32px;
  height: 32px;
  background: rgba(255,255,255,0.9);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #333;
  cursor: pointer;
  transition: all 0.2s;
  z-index: 2;
  font-size: 14px;
}

.product-card .wishlist-btn:hover {
  background: #e74c3c;
  color: #fff;
}

.product-card .card-info {
  padding: 12px 8px;
  flex: 1;
  min-width: 0;
}

.product-card .card-info .brand {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #666;
  margin-bottom: 5px;
}

.product-card .card-info .name {
  font-size: 13px;
  font-weight: 500;
  color: #222;
  margin-bottom: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.4;
  min-height: 36px;
}

.product-card .card-info .price {
  font-size: 14px;
  font-weight: 600;
  color: #000;
}

.product-card .card-info .condition {
  font-size: 11px;
  color: #999;
  margin-top: 4px;
}

.product-card .card-info .excerpt {
  font-size: 12px;
  color: #666;
  line-height: 1.5;
  margin-top: 6px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* 分页 */
.products-pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 5px;
  margin-top: 40px;
}

.products-pagination a,
.products-pagination span {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 40px;
  padding: 0 10px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 13px;
  color: #555;
  transition: all 0.2s;
}

.products-pagination a:hover,
.products-pagination .active {
  background: #000;
  border-color: #000;
  color: #fff;
}

/* ================== 详情页样式 ================== */
.product-detail-section {
  padding: 40px 0 60px;
}

.product-detail-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 30px;
}

/* 产品图集 */
.product-gallery {
  position: relative;
}

.gallery-main {
  position: relative;
  width: 100%;
  background: #f5f5f5;
  border-radius: 8px;
  overflow: hidden;
  aspect-ratio: 1/1;
  margin-bottom: 15px;
}

.gallery-main img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gallery-zoom-btn {
  position: absolute;
  top: 15px;
  right: 15px;
  width: 40px;
  height: 40px;
  background: rgba(255,255,255,0.9);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
}

.gallery-zoom-btn:hover {
  background: #fff;
  transform: scale(1.1);
}

.gallery-thumbs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.gallery-thumbs .thumb {
  position: relative;
  background: #f5f5f5;
  border-radius: 6px;
  overflow: hidden;
  cursor: pointer;
  aspect-ratio: 1/1;
  border: 2px solid transparent;
  transition: border-color 0.2s;
}

.gallery-thumbs .thumb.active {
  border-color: #000;
}

.gallery-thumbs .thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* 产品信息 */
.product-info {
  padding: 10px 0;
}

.product-info .brand-name {
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #666;
  margin-bottom: 8px;
}

.product-info .product-title {
  font-size: 28px;
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 15px;
}

.product-info .product-price {
  font-size: 28px;
  font-weight: 600;
  color: #000;
  margin-bottom: 20px;
}

.product-info .condition-block {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 15px 20px;
  background: #f5f5f5;
  border-radius: 8px;
  margin-bottom: 25px;
}

.product-info .condition-block .label {
  font-size: 11px;
  text-transform: uppercase;
  color: #666;
  letter-spacing: 1px;
}

.product-info .condition-block .badge-cond {
  padding: 5px 12px;
  background: #000;
  color: #fff;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

.product-info .detail-list {
  margin-bottom: 25px;
}

.product-info .detail-list li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  font-size: 14px;
  color: #555;
  border-bottom: 1px solid #f0f0f0;
}

.product-info .detail-list li i {
  width: 18px;
  color: #000;
  flex-shrink: 0;
}

.product-info .auth-tag {
  background: #f9f9f9;
  border: 1px solid #000;
  border-radius: 6px;
  padding: 15px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.product-info .auth-tag i {
  color: #000;
  font-size: 20px;
}

.product-info .auth-tag span {
  font-size: 13px;
  font-weight: 600;
}

/* Tabs */
.product-tabs {
  margin-top: 60px;
}

.product-tabs .tab-titles {
  display: flex;
  flex-wrap: wrap;
  border-bottom: 1px solid #ddd;
  margin-bottom: 25px;
}

.product-tabs .tab-titles button {
  padding: 12px 20px;
  background: transparent;
  border: none;
  font-size: 14px;
  font-weight: 500;
  color: #666;
  cursor: pointer;
  position: relative;
  transition: color 0.2s;
}

.product-tabs .tab-titles button.active {
  color: #000;
}

.product-tabs .tab-titles button.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 100%;
  height: 2px;
  background: #000;
}

.product-tabs .tab-content {
  font-size: 14px;
  line-height: 1.8;
  color: #444;
}

.product-tabs .tab-content p {
  margin-bottom: 15px;
}

.product-tabs .tab-content strong {
  color: #000;
}

.product-tabs .tab-content ul {
  padding-left: 0;
  list-style: none;
}

.product-tabs .tab-content ul li {
  padding: 5px 0;
  position: relative;
  padding-left: 18px;
}

.product-tabs .tab-content ul li::before {
  content: '•';
  position: absolute;
  left: 0;
  color: #000;
  font-weight: bold;
}

/* 相关产品 */
.related-products {
  padding: 60px 0;
  background: #fafafa;
}

.related-products .title {
  font-size: 28px;
  text-align: center;
  margin-bottom: 30px;
}

.related-products .grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 15px;
}

/* 响应式 */
@media (min-width: 768px) {
  .breadcrumb-div {
    padding: 18px 0;
  }

  .products-grid {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
  }

  .products-grid ul.products,
  .products-grid .product-list {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
  }

  .products-grid ul.products li,
  .products-grid .product-list li {
    display: contents;
  }

  .product-card .card-info {
    padding: 15px 10px;
  }

  .product-card .card-info .name {
    font-size: 14px;
  }

  .product-card .card-info .price {
    font-size: 15px;
  }

  .products-main .list-header {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }

  .related-products .grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
  }
}

@media (min-width: 992px) {
  .products-layout {
    grid-template-columns: 280px 1fr;
    gap: 30px;
  }

  .products-filter {
    margin-bottom: 0;
    position: sticky;
    top: 100px;
  }

  .filter-header .filter-toggle {
    display: none;
  }

  .products-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .product-detail-layout {
    grid-template-columns: 1fr 1fr;
    gap: 50px;
  }

  .product-info .product-title {
    font-size: 32px;
  }
}

@media (min-width: 1200px) {
  .products-grid {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr);
    gap: 25px;
  }

  .products-grid ul.products,
  .products-grid .product-list {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr);
    gap: 25px;
  }

  .products-grid ul.products li,
  .products-grid .product-list li {
    display: contents;
  }

  .product-card .card-info .name {
    font-size: 15px;
    min-height: 42px;
  }
}

/* ================== LIST VIEW（列表视图） ================== */
.products-grid.list-view {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.products-grid.list-view .product-card {
  display: grid;
  grid-template-columns: 180px 1fr;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #eee;
  transition: box-shadow 0.3s;
  flex-direction: row;
}

.products-grid.list-view .product-card:hover {
  transform: none;
  box-shadow: 0 4px 15px rgba(0,0,0,0.08);
}

.products-grid.list-view .product-card .card-img-wrap {
  width: 180px;
  height: 180px;
  aspect-ratio: auto;
  flex-shrink: 0;
}

.products-grid.list-view .product-card .card-img-wrap img {
  position: absolute;
}

.products-grid.list-view .product-card .card-info {
  padding: 15px 20px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.products-grid.list-view .product-card .card-info .name {
  font-size: 16px;
  -webkit-line-clamp: unset;
  min-height: auto;
  margin-bottom: 8px;
}

.products-grid.list-view .product-card .card-info .brand {
  font-size: 12px;
}

.products-grid.list-view .product-card .card-info .price {
  font-size: 18px;
  margin-bottom: 6px;
}

.products-grid.list-view .product-card .card-info .condition {
  margin-top: 4px;
}

.products-grid.list-view .product-card .card-info .excerpt {
  display: block;
  -webkit-line-clamp: unset;
  margin-top: 8px;
}

.products-grid.list-view .product-card .wishlist-btn {
  top: 10px;
  right: 10px;
}

/* ========== Add to Bag Button ========== */
.btn-add-to-bag {
  display: block;
  width: 100%;
  padding: 10px 16px;
  background: #111;
  color: #fff;
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  margin-top: 10px;
  cursor: pointer;
  transition: background 0.2s;
  border: 1px solid #111;
}

.btn-add-to-bag:hover {
  background: #fff;
  color: #111;
}

.btn-add-to-bag:active {
  background: #eee;
  color: #111;
}

/* wishlist active state on add-to-bag page */
.btn-add-wishlist-active {
  border-color: #111;
  background: #fff;
  color: #111 !important;
}

.btn-add-wishlist-active i::before {
  content: "\f004";
}
