/**
 * woocommerce-product.css
 *
 * Style cho trang chi tiết sản phẩm + trang danh sách sản phẩm dựng theo
 * template chuẩn WooCommerce (thư mục woocommerce/ của theme).
 *
 * Phần lớn là "dịch" các class THẬT mà WooCommerce xuất ra (gallery, tab,
 * form chọn quy cách, phân trang...) về đúng giao diện đã thiết kế, và vô
 * hiệu các quy tắc mặc định của plugin (float 48%, tab viền xám...) vốn chỉ
 * có tác dụng khi trang có khối bọc div.product.
 *
 * Chỉ nạp ở 2 loại trang này (xem inc/woocommerce-product-page.php).
 */

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

.xtpr-wc-notices:empty,
.xtpr-wc-notices .woocommerce-notices-wrapper:empty { display: none; }
.xtpr-wc-notices { margin-top: 18px; }

.woocommerce div.product.xtpr-product { position: static; }
.woocommerce div.product.xtpr-product::after { content: none; }

/* ---------- Cột ảnh: gallery chuẩn WooCommerce ---------- */
.xtpr-product .pd-gallery-col { position: relative; min-width: 0; }

.xtpr-product .pd-gallery-col .product-group-badge { top: 14px; left: 14px; z-index: 6; }

.woocommerce div.product.xtpr-product div.images,
.woocommerce-page div.product.xtpr-product div.images {
  float: none; width: 100%; margin: 0;
}

.xtpr-product .woocommerce-product-gallery { position: relative; opacity: 1 !important; }

.xtpr-product .woocommerce-product-gallery .flex-viewport,
.xtpr-product .woocommerce-product-gallery__wrapper {
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--line);
  background: linear-gradient(150deg, var(--sage-100), #fff);
}
/* Khi có slider (nhiều ảnh), viền nằm ở .flex-viewport — bỏ viền lồng nhau */
.xtpr-product .woocommerce-product-gallery .flex-viewport .woocommerce-product-gallery__wrapper {
  border: 0; border-radius: 0;
}

.xtpr-product .woocommerce-product-gallery__image img,
.xtpr-product .woocommerce-product-gallery__image--placeholder img {
  display: block; width: 100%; height: auto;
  aspect-ratio: 1 / 1; object-fit: cover;
}

/* Nút phóng to (lightbox) */
.xtpr-product .woocommerce-product-gallery__trigger {
  position: absolute; top: 14px; right: 14px; z-index: 6;
  width: 38px; height: 38px; border-radius: 50%;
  background: #fff; border: 1px solid var(--line);
  font-size: 0; text-indent: 0; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
}
.xtpr-product .woocommerce-product-gallery__trigger::before,
.xtpr-product .woocommerce-product-gallery__trigger::after { content: none; }
.xtpr-product .woocommerce-product-gallery__trigger span { display: none; }
.xtpr-product .woocommerce-product-gallery__trigger {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231B4332' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M21 21l-4.3-4.3M11 8v6M8 11h6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: center; background-size: 18px;
}

/* Dãy ảnh nhỏ */
.woocommerce div.product.xtpr-product div.images .flex-control-thumbs {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px;
  margin: 12px 0 0; padding: 0; list-style: none; overflow: visible;
}
.woocommerce div.product.xtpr-product div.images .flex-control-thumbs li {
  float: none; width: auto; margin: 0; padding: 0;
}
.woocommerce div.product.xtpr-product div.images .flex-control-thumbs li::before { content: none; }
.woocommerce div.product.xtpr-product div.images .flex-control-thumbs li img {
  display: block; width: 100%; aspect-ratio: 1 / 1; object-fit: cover;
  border-radius: 9px; border: 2px solid transparent;
  opacity: 0.6; cursor: pointer; transition: opacity .2s, border-color .2s;
}
.woocommerce div.product.xtpr-product div.images .flex-control-thumbs li img.flex-active,
.woocommerce div.product.xtpr-product div.images .flex-control-thumbs li img:hover {
  opacity: 1; border-color: var(--gold-500);
}

/* Nhãn giảm giá */
.woocommerce .xtpr-product span.onsale {
  position: absolute; top: 14px; left: auto; right: 62px; z-index: 6;
  min-height: 0; min-width: 0; line-height: 1.2; margin: 0;
  padding: 6px 10px; border-radius: 6px;
  background: #E8631C; color: #fff;
  font-family: 'JetBrains Mono', monospace; font-size: 10.5px; font-weight: 600;
}

/* ---------- Cột thông tin ---------- */
.woocommerce div.product.xtpr-product div.summary,
.woocommerce-page div.product.xtpr-product div.summary {
  float: none; width: auto; margin: 0; min-width: 0;
}

.woocommerce div.product.xtpr-product .product_title {
  font-size: clamp(24px, 2.8vw, 32px); line-height: 1.2; margin: 0 0 10px; padding: 0;
}

.xtpr-product .pd-desc p { margin: 0 0 10px; }
.xtpr-product .pd-desc p:last-child { margin-bottom: 0; }

/* Giá */
.woocommerce div.product.xtpr-product .pd-price-block p.price,
.woocommerce div.product.xtpr-product .pd-price-block span.price {
  font-family: 'Fraunces', serif; font-weight: 700; font-size: 30px;
  color: var(--gold-500); margin: 0; line-height: 1.25;
}
.woocommerce div.product.xtpr-product .price ins { text-decoration: none; font-weight: 700; }
.woocommerce div.product.xtpr-product .price del {
  color: var(--ink-500); font-weight: 400; font-size: 0.6em; opacity: 1; margin-right: 6px;
}

/* ---------- Khối hành động: form WooCommerce + Mua ngay + Dùng thử ---------- */
.woocommerce div.product.xtpr-product form.cart {
  margin: 0; flex: 1 1 100%; min-width: 0;
}
.woocommerce div.product.xtpr-product form.cart::before,
.woocommerce div.product.xtpr-product form.cart::after { content: none; }

.woocommerce div.product.xtpr-product form.cart .variations {
  margin: 0 0 16px; border: 0; width: 100%;
}
.woocommerce div.product.xtpr-product form.cart .variations td,
.woocommerce div.product.xtpr-product form.cart .variations th { border: 0; padding: 0; background: none; }
.woocommerce div.product.xtpr-product form.cart .reset_variations {
  display: inline-block; margin-top: 10px; font-size: 12.5px; color: var(--ink-500);
}

/* Giá + tồn kho của đúng quy cách đang chọn */
.xtpr-product .woocommerce-variation-price { margin-bottom: 12px; }
.woocommerce div.product.xtpr-product .woocommerce-variation-price .price {
  font-family: 'Fraunces', serif; font-weight: 700; font-size: 24px; color: var(--gold-500);
}
.woocommerce div.product.xtpr-product .stock {
  font-size: 13px; font-weight: 600; margin: 0 0 12px; color: var(--forest-600);
}
.woocommerce div.product.xtpr-product .out-of-stock { color: #B3452C; }

/* Hàng: ô số lượng + nút thêm giỏ */
.xtpr-product .woocommerce-variation-add-to-cart,
.xtpr-product form.cart:not(.variations_form):not(.grouped_form) {
  display: flex; align-items: stretch; gap: 10px; flex-wrap: wrap;
}

.woocommerce div.product.xtpr-product form.cart div.quantity {
  float: none; margin: 0;
}
.woocommerce .xtpr-product .quantity .qty {
  width: 74px; height: 100%; min-height: 48px; padding: 0 10px;
  border: 1px solid var(--line); border-radius: 999px; background: #fff;
  font-family: 'Be Vietnam Pro', sans-serif; font-size: 14.5px; font-weight: 600;
  color: var(--ink-900); text-align: center;
}

.woocommerce div.product.xtpr-product form.cart .button,
.woocommerce div.product.xtpr-product form.cart button.single_add_to_cart_button {
  float: none; margin: 0;
  background: var(--forest-950); color: #fff; border: 0;
  font-family: 'Be Vietnam Pro', sans-serif; font-weight: 600; font-size: 14.5px;
  line-height: 1.2; padding: 14px 26px; border-radius: 999px;
  transition: background .2s, transform .2s; opacity: 1;
}
.woocommerce div.product.xtpr-product form.cart .button:hover {
  background: var(--forest-800); transform: translateY(-1px);
}
.woocommerce div.product.xtpr-product form.cart .button.disabled,
.woocommerce div.product.xtpr-product form.cart .button:disabled {
  background: var(--forest-950); opacity: 0.45; cursor: not-allowed; transform: none;
}

/* ---------- Tab chuẩn WooCommerce -> giao diện tab của theme ---------- */
.woocommerce div.product.xtpr-product .woocommerce-tabs { margin: 0; }

.woocommerce div.product.xtpr-product .woocommerce-tabs ul.tabs {
  display: flex; gap: 6px; flex-wrap: wrap;
  list-style: none; margin: 0 0 30px; padding: 0;
  border-bottom: 1px solid var(--line); overflow: visible;
}
.woocommerce div.product.xtpr-product .woocommerce-tabs ul.tabs::before,
.woocommerce div.product.xtpr-product .woocommerce-tabs ul.tabs::after,
.woocommerce div.product.xtpr-product .woocommerce-tabs ul.tabs li::before,
.woocommerce div.product.xtpr-product .woocommerce-tabs ul.tabs li::after {
  content: none; display: none; border: 0; box-shadow: none;
}
.woocommerce div.product.xtpr-product .woocommerce-tabs ul.tabs li {
  display: block; position: static; margin: 0 0 -1px; padding: 0;
  background: none; border: 0; border-radius: 0;
  border-bottom: 2px solid transparent;
}
.woocommerce div.product.xtpr-product .woocommerce-tabs ul.tabs li a {
  display: block; padding: 13px 20px;
  font-family: 'Be Vietnam Pro', sans-serif; font-size: 13.8px; font-weight: 600;
  color: var(--ink-500); text-decoration: none;
}
.woocommerce div.product.xtpr-product .woocommerce-tabs ul.tabs li a:hover { color: var(--forest-950); }
.woocommerce div.product.xtpr-product .woocommerce-tabs ul.tabs li.active {
  background: none; border-bottom-color: var(--gold-500);
}
.woocommerce div.product.xtpr-product .woocommerce-tabs ul.tabs li.active a { color: var(--forest-950); }

.woocommerce div.product.xtpr-product .woocommerce-tabs .panel {
  margin: 0; padding: 0;
  font-size: 14.5px; color: var(--ink-500); line-height: 1.8;
}
.xtpr-product .woocommerce-tabs .panel h2,
.xtpr-product .woocommerce-tabs .panel h3,
.xtpr-product .woocommerce-tabs .panel h4 {
  font-family: 'Fraunces', serif; color: var(--forest-950); margin: 18px 0 8px;
}
.xtpr-product .woocommerce-tabs .panel h2 { font-size: 20px; }
.xtpr-product .woocommerce-tabs .panel h3 { font-size: 18px; }
.xtpr-product .woocommerce-tabs .panel h4 { font-size: 17px; }
.xtpr-product .woocommerce-tabs .panel > :first-child { margin-top: 0; }
.xtpr-product .woocommerce-tabs .panel p { margin: 0 0 12px; }
.xtpr-product .woocommerce-tabs .panel ul { margin: 8px 0; padding: 0; list-style: none; }
.xtpr-product .woocommerce-tabs .panel ul li { position: relative; padding-left: 18px; margin-bottom: 6px; }
.xtpr-product .woocommerce-tabs .panel ul li::before {
  content: "—"; position: absolute; left: 0; color: var(--gold-500);
}
.xtpr-product .woocommerce-tabs .panel img { max-width: 100%; height: auto; border-radius: 10px; }

.xtpr-product .sidebar-product-list .sp-price .price,
.xtpr-product .sidebar-product-list .sp-price .woocommerce-Price-amount { font-size: inherit; color: inherit; }

@media (max-width: 560px) {
  .woocommerce div.product.xtpr-product .woocommerce-tabs ul.tabs li a { padding: 11px 12px; font-size: 13px; }
  .woocommerce div.product.xtpr-product form.cart .button { flex: 1 1 auto; text-align: center; }
}


/* =========================================================================
 * TRANG DANH SÁCH SẢN PHẨM
 * ========================================================================= */

.xtpr-shop-toolbar {
  display: flex; justify-content: flex-end; align-items: center;
  flex-wrap: wrap; gap: 12px; margin: -14px 0 22px;
}
.xtpr-shop-toolbar .woocommerce-notices-wrapper { flex: 1 1 100%; }
.xtpr-shop-toolbar .woocommerce-notices-wrapper:empty { display: none; }

.woocommerce .xtpr-shop-toolbar .woocommerce-ordering { float: none; margin: 0; }
.xtpr-shop-toolbar .woocommerce-ordering select {
  appearance: auto;
  padding: 9px 14px; border-radius: 999px;
  border: 1px solid var(--line); background: #fff;
  font-family: 'Be Vietnam Pro', sans-serif; font-size: 13px; font-weight: 600;
  color: var(--ink-500); cursor: pointer;
}

/* Thẻ sản phẩm mang class "product" của WooCommerce — chặn các quy tắc
   mặc định (float, width, margin) vốn viết cho <li class="product">. */
.woocommerce .products-grid .product-card.product {
  float: none; width: auto; margin: 0; padding: 0;
}
.products-grid .product-card .product-thumb { position: relative; }
.products-grid .product-card .product-thumb img { display: block; width: 100%; height: auto; }

/* Phân trang */
.products-pagination { margin-top: 40px; text-align: center; }
.woocommerce .products-pagination nav.woocommerce-pagination { text-align: center; }
.woocommerce .products-pagination nav.woocommerce-pagination ul {
  display: inline-flex; gap: 6px; border: 0; margin: 0; padding: 0; list-style: none;
}
.woocommerce .products-pagination nav.woocommerce-pagination ul li {
  border: 0; float: none; margin: 0; padding: 0; overflow: visible;
}
.woocommerce .products-pagination nav.woocommerce-pagination ul li a,
.woocommerce .products-pagination nav.woocommerce-pagination ul li span {
  display: block; min-width: 40px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 9px; background: #fff;
  font-size: 13.5px; font-weight: 600; line-height: 1.2; color: var(--ink-500);
}
.woocommerce .products-pagination nav.woocommerce-pagination ul li a:hover {
  border-color: var(--forest-600); color: var(--forest-950); background: #fff;
}
.woocommerce .products-pagination nav.woocommerce-pagination ul li span.current {
  background: var(--forest-950); border-color: var(--forest-950); color: #fff;
}

.xtpr-no-products { text-align: center; padding: 60px 0; color: var(--ink-500); }
