/* =============================================================================
   SHOP – danh mục sản phẩm, thẻ sản phẩm, trang chi tiết (WooCommerce, chế độ catalog)
   Thay cho CSS mặc định của WooCommerce (đã tắt trong inc/enqueue.php).
   ============================================================================= */

.wb-shop { padding-block: 20px 56px; }

/* ----- Đường dẫn ----- */
.wb-breadcrumb { margin-bottom: 18px; font-size: 0.85rem; color: var(--wb-muted); }
.wb-breadcrumb a { color: var(--wb-muted); }
.wb-breadcrumb a:hover { color: var(--wb-primary); }
.wb-crumb-sep { margin: 0 8px; opacity: 0.5; }

/* ----- Khung có / không có cột lọc ----- */
@media (min-width: 900px) {
  .wb-shop--filters { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 32px; }
  .wb-shop--filters .wb-breadcrumb { grid-column: 1 / -1; margin-bottom: 0; }
}
.wb-shop__filters { margin-bottom: 24px; }
.wb-widget { margin-bottom: 20px; padding: 18px; background: var(--wb-cream); border-radius: var(--wb-radius); }
.wb-widget__title { margin: 0 0 12px; font-size: 1rem; }
.wb-widget ul { margin: 0; padding: 0; list-style: none; }
.wb-widget li { padding: 6px 0; }

/* ----- Tiêu đề danh mục ----- */
.wb-shop .woocommerce-products-header__title,
.wb-shop .page-title { margin-bottom: 14px; }

/* ----- Nút lọc nhanh theo danh mục con ----- */
.wb-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 20px; }
.wb-chip {
  padding: 7px 16px; font-size: 0.88rem; font-weight: 500; color: var(--wb-ink);
  background: var(--wb-cream); border: 1.5px solid transparent; border-radius: 999px;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.wb-chip:hover { color: var(--wb-primary); border-color: var(--wb-primary); background: #fff; }
.wb-chip.is-active { color: #fff; background: var(--wb-primary); }

/* ----- Thanh số kết quả + sắp xếp ----- */
.wb-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.wb-toolbar .woocommerce-result-count { margin: 0; font-size: 0.9rem; color: var(--wb-muted); }
.wb-toolbar .woocommerce-ordering { margin: 0; }
.wb-toolbar select { width: auto; min-width: 200px; padding-block: 9px; }

/* ----- Lưới sản phẩm ----- */
ul.products, .wb-grid {
  display: grid; gap: 16px; margin: 0 0 32px; padding: 0; list-style: none;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
@media (min-width: 720px) { ul.products, .wb-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; } }
@media (min-width: 1000px) { ul.products, .wb-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (min-width: 1200px) { ul.products.wb-grid--5, .wb-shop:not(.wb-shop--filters) ul.products { grid-template-columns: repeat(5, minmax(0, 1fr)); } }

/* ----- Thẻ sản phẩm ----- */
.wb-card {
  position: relative; display: flex; flex-direction: column; overflow: hidden; margin: 0;
  background: #fff; border: 1.5px solid var(--wb-line); border-radius: var(--wb-radius);
  transition: box-shadow 0.25s, transform 0.25s, border-color 0.25s;
}
.wb-card:hover { transform: translateY(-4px); box-shadow: var(--wb-shadow-lg); border-color: transparent; }

.wb-card__media {
  position: relative; display: block; padding: 14px;
  background: linear-gradient(180deg, #fff 0%, var(--wb-cream) 100%);
}
.wb-card__media img { width: 100%; aspect-ratio: 1 / 1; object-fit: contain; transition: transform 0.4s; }
.wb-card:hover .wb-card__media img { transform: scale(1.05); }
.wb-card__media .wb-badge, .wb-card__media .onsale { position: absolute; top: 12px; left: 12px; z-index: 2; }

.wb-card__body { display: flex; flex: 1; flex-direction: column; gap: 6px; padding: 14px 16px 16px; }
.wb-card__tags { margin: 0; font-size: 0.75rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--wb-muted); }
.wb-card__title { margin: 0; font-size: 0.98rem; font-weight: 600; line-height: 1.35; }
.wb-card__title a { color: var(--wb-ink); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.wb-card__title a:hover { color: var(--wb-primary); }
.wb-card__price { margin-top: auto; padding-top: 6px; font-size: 1.1rem; font-weight: 700; color: var(--wb-primary); }
.wb-card__price del { margin-right: 6px; font-size: 0.85rem; font-weight: 400; color: var(--wb-muted); }
.wb-card__price ins { text-decoration: none; }
.wb-card__ask { font-size: 0.92rem; font-weight: 600; color: var(--wb-muted); }
.wb-card__cta {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 4px;
  font-size: 0.88rem; font-weight: 600;
}
.wb-card__cta:hover .wb-icon { transform: translateX(3px); }

/* ----- Phân trang ----- */
.woocommerce-pagination, .navigation.pagination, .wb-pages { margin: 8px 0 32px; text-align: center; }
.woocommerce-pagination ul { display: inline-flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin: 0; padding: 0; list-style: none; }
.woocommerce-pagination a, .woocommerce-pagination span,
.navigation.pagination .page-numbers {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 42px; height: 42px; padding: 0 12px; font-weight: 600; color: var(--wb-ink);
  background: var(--wb-cream); border-radius: 12px;
}
.woocommerce-pagination a:hover, .navigation.pagination a.page-numbers:hover { color: #fff; background: var(--wb-primary); }
.woocommerce-pagination .current, .navigation.pagination .current { color: #fff; background: var(--wb-primary); }
.navigation.pagination .nav-links { display: inline-flex; flex-wrap: wrap; gap: 6px; justify-content: center; }

/* ----- Bài mô tả SEO cuối danh mục (gập gọn, có nút Xem thêm) ----- */
.wb-seo { position: relative; margin-top: 16px; padding: 28px clamp(18px, 3vw, 36px); background: var(--wb-cream); border-radius: var(--wb-radius); }
.wb-seo__inner { line-height: 1.75; }
.wb-seo__inner h2, .wb-seo__inner h3 { margin-top: 1.4em; color: var(--wb-primary); }
.wb-seo__inner table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.wb-seo__inner th, .wb-seo__inner td { padding: 8px 10px; text-align: left; border: 1px solid var(--wb-line); }
.wb-seo.is-collapsible:not(.is-open) .wb-seo__inner { max-height: 260px; overflow: hidden; }
.wb-seo.is-collapsible:not(.is-open)::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 64px; height: 110px; pointer-events: none;
  background: linear-gradient(to bottom, rgba(249, 245, 240, 0), var(--wb-cream));
}
.wb-seo__toggle {
  display: block; margin: 18px auto 0; padding: 10px 26px; font-weight: 600; color: var(--wb-primary);
  background: #fff; border: 1.5px solid var(--wb-primary); border-radius: 999px; cursor: pointer;
}
.wb-seo__toggle:hover { color: #fff; background: var(--wb-primary); }

/* ----- Thông báo của WooCommerce ----- */
.woocommerce-message, .woocommerce-info, .woocommerce-error {
  margin: 0 0 20px; padding: 14px 18px; list-style: none;
  background: var(--wb-cream); border-left: 4px solid var(--wb-primary); border-radius: 10px;
}
.woocommerce-error { border-left-color: #c62828; }

/* =============================================================================
   TRANG CHI TIẾT SẢN PHẨM
   ============================================================================= */

.wb-shop div.product {
  display: grid; gap: 28px; grid-template-columns: minmax(0, 1fr);
}
@media (min-width: 900px) {
  .wb-shop div.product { grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr); gap: 48px; align-items: start; }
}
.wb-shop div.product .woocommerce-tabs,
.wb-shop div.product .related,
.wb-shop div.product .upsells,
.wb-shop div.product .woocommerce-notices-wrapper { grid-column: 1 / -1; }

/* Thư viện ảnh */
.woocommerce-product-gallery {
  position: relative; padding: 20px; background: linear-gradient(180deg, #fff, var(--wb-cream));
  border: 1.5px solid var(--wb-line); border-radius: 24px;
}
.woocommerce-product-gallery__wrapper { margin: 0; padding: 0; }
.woocommerce-product-gallery__image img { width: 100%; height: auto; margin-inline: auto; }
.woocommerce-product-gallery .flex-viewport { overflow: hidden; border-radius: 12px; }
.woocommerce-product-gallery .flex-control-thumbs {
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px;
  margin: 14px 0 0; padding: 0; list-style: none;
}
.woocommerce-product-gallery .flex-control-thumbs img {
  border: 2px solid transparent; border-radius: 10px; opacity: 0.6; cursor: pointer; background: #fff;
  transition: opacity 0.2s, border-color 0.2s;
}
.woocommerce-product-gallery .flex-control-thumbs img:hover,
.woocommerce-product-gallery .flex-control-thumbs img.flex-active { opacity: 1; border-color: var(--wb-primary); }
.woocommerce-product-gallery__trigger {
  position: absolute; top: 16px; right: 16px; z-index: 9;
  display: flex; align-items: center; justify-content: center;
  width: 42px; height: 42px; font-size: 0; text-indent: -9999px; overflow: hidden;
  background: #fff; border-radius: 50%; box-shadow: var(--wb-shadow);
}
.woocommerce-product-gallery__trigger::before {
  content: "+"; text-indent: 0; font-size: 1.6rem; line-height: 1; color: var(--wb-primary);
}

/* Cột thông tin */
.wb-shop .summary.entry-summary { min-width: 0; }
.wb-shop .product_title { margin-bottom: 10px; font-size: clamp(1.5rem, 2.6vw, 2.1rem); }
.wb-shop .summary .price { display: block; margin: 0 0 16px; font-size: 1.7rem; font-weight: 800; color: var(--wb-primary); }
.wb-shop .summary .price del { margin-right: 8px; font-size: 1.1rem; font-weight: 400; color: var(--wb-muted); }
.wb-shop .summary .price ins { text-decoration: none; }
.wb-shop .woocommerce-product-details__short-description { margin-bottom: 18px; color: var(--wb-muted); }

/* Khung liên hệ đặt hàng */
.wb-contact-box { margin: 0 0 22px; padding: 20px; background: var(--wb-cream); border-radius: var(--wb-radius); }
.wb-contact-box__title { margin: 0 0 12px; font-weight: 700; }
.wb-contact-box__actions { display: flex; flex-wrap: wrap; gap: 10px; }
.wb-contact-box__addr { display: flex; gap: 8px; margin: 14px 0 0; font-size: 0.86rem; color: var(--wb-muted); }
.wb-contact-box__addr .wb-icon { margin-top: 3px; color: var(--wb-primary); }

/* Bảng thông số */
.wb-specs { width: 100%; margin: 0 0 18px; border-collapse: separate; border-spacing: 0; overflow: hidden; border: 1.5px solid var(--wb-line); border-radius: var(--wb-radius-sm); }
.wb-specs th, .wb-specs td { padding: 11px 16px; text-align: left; vertical-align: top; }
.wb-specs th { width: 38%; font-weight: 600; color: var(--wb-muted); background: var(--wb-cream); }
.wb-specs tr + tr th, .wb-specs tr + tr td { border-top: 1px solid var(--wb-line); }
.wb-note { font-size: 0.82rem; font-style: italic; color: var(--wb-muted); }

.product_meta { margin: 0 0 14px; font-size: 0.88rem; color: var(--wb-muted); }
.product_meta > span { display: block; margin-bottom: 4px; }
.product_meta a { font-weight: 500; }

/* Tab mô tả */
.woocommerce-tabs ul.tabs { display: flex; gap: 8px; margin: 0 0 20px; padding: 0; list-style: none; border-bottom: 2px solid var(--wb-line); }
.woocommerce-tabs ul.tabs li { margin: 0 0 -2px; }
.woocommerce-tabs ul.tabs a { display: block; padding: 10px 20px; font-weight: 700; color: var(--wb-muted); border-bottom: 3px solid transparent; }
.woocommerce-tabs ul.tabs .active a { color: var(--wb-primary); border-bottom-color: var(--wb-primary); }
.woocommerce-Tabs-panel { line-height: 1.75; }
.woocommerce-Tabs-panel > h2:first-child { display: none; }

/* Sản phẩm tương tự */
.wb-shop .related > h2, .wb-shop .upsells > h2 { margin-bottom: 20px; position: relative; padding-bottom: 12px; }
.wb-shop .related > h2::after, .wb-shop .upsells > h2::after {
  content: ""; position: absolute; left: 0; bottom: 0; width: 48px; height: 4px; border-radius: 4px; background: var(--wb-primary);
}

/* Tài khoản / đăng nhập */
.woocommerce-account .woocommerce { max-width: 720px; margin: 0 auto; padding-block: 12px; }
.woocommerce form .form-row { margin: 0 0 16px; }
.woocommerce form label { display: block; margin-bottom: 6px; font-weight: 600; }
.woocommerce form .required { color: var(--wb-primary); text-decoration: none; }

.wb-empty, .woocommerce-no-products-found { padding: 24px; text-align: center; color: var(--wb-muted); background: var(--wb-cream); border-radius: var(--wb-radius); }
