/*
 * 文件作用：
 * WooCommerce 产品详情页专属样式，包含两大部分：
 *
 *   Part A — pd-wrap 产品描述模板（黑底红白主题）
 *     来源：wp-customizer-css/iwamed-product-description.css
 *     作用：apply_template.py 生成的 HTML 模板需要这套样式渲染才有效果。
 *
 *   Part B — 产品详情页整体视觉修正
 *     来源：wp-customizer-css/iwamed-single-product.css
 *     作用：Tabs 红色下划线、Related products 标题、手机端 gallery 全宽修复。
 *
 *   Part C — WC 容器展开（Fix 3）
 *     防止 Blocksy/WC 给 tab 面板加 max-height 截断长描述内容。
 *
 * 这些 CSS 原本在 Customizer Additional CSS，WordPress 会把 > 转义为 &gt;
 * 破坏子选择器。迁移到此文件后通过 wp_enqueue_style 作为静态文件加载，不经过转义。
 *
 * 作用范围：body.single-product（WooCommerce 产品详情页）
 */

/* ══════════════════════════════════════════════════════════════
   PART A — pd-wrap 产品描述模板样式
   ══════════════════════════════════════════════════════════════ */

/* 整个描述区：黑色大容器 */
.pd-wrap {
  background: #0b0b0c;
  color: #e8e8e8;
  padding: 40px 32px;
  border-radius: 12px;
  margin: 32px 0;
  line-height: 1.65;
}

/* Tagline：白色粗体 + 红色左边条 */
.pd-wrap .pd-tagline {
  font-size: 22px;
  font-weight: 700;
  color: #ffffff;
  border-left: 4px solid #C8102E;
  padding-left: 16px;
  margin: 0 0 28px;
  line-height: 1.35;
}

/* 每张卡片 */
.pd-wrap .pd-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 24px 28px;
  margin: 0 0 16px;
  color: #e5e5e5;
}

.pd-wrap .pd-card:last-child {
  margin-bottom: 0;
}

/* 卡片标题：白色 + 红色下划线 */
.pd-wrap .pd-card h3 {
  color: #ffffff;
  font-size: 18px;
  font-weight: 700;
  margin: 0 0 16px;
  padding-bottom: 8px;
  border-bottom: 2px solid #C8102E;
  display: inline-block;
  letter-spacing: 0.02em;
}

.pd-wrap .pd-card > *:last-child {
  margin-bottom: 0;
}

.pd-wrap .pd-card p,
.pd-wrap .pd-card li,
.pd-wrap .pd-card td {
  color: #d5d5d5;
}

.pd-wrap .pd-card strong {
  color: #ffffff;
}

/* 图片卡片居中 */
.pd-wrap .pd-card--image {
  text-align: center;
}

.pd-wrap .pd-card--image img {
  max-width: 480px;
  width: 100%;
  height: auto;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  display: inline-block;
  margin: 0;
}

.pd-wrap .pd-card--image h3 {
  text-align: left;
  margin-bottom: 16px;
}

/* 通用表格（3+ 列） */
.pd-wrap .pd-table {
  max-width: 720px !important;
  width: 100% !important;
  border-collapse: collapse !important;
  margin: 0 !important;
  font-size: 0.9em;
  line-height: 1.5;
}

.pd-wrap .pd-table td,
.pd-wrap .pd-table th {
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  vertical-align: middle;
  text-align: left;
  background: transparent;
  color: #e5e5e5;
}

.pd-wrap .pd-table th {
  background: rgba(200, 16, 46, 0.15);
  font-weight: 600;
  color: #ffffff;
  border-color: rgba(200, 16, 46, 0.35);
}

/* Specifications 表格（2 列，简洁风） */
.pd-wrap .pd-specs {
  max-width: 560px !important;
  width: 100% !important;
  border-collapse: collapse !important;
  margin: 0 !important;
}

.pd-wrap .pd-specs td {
  padding: 10px 0 !important;
  border: 0 !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
  vertical-align: top;
  font-size: 0.92em;
  line-height: 1.5;
  background: transparent !important;
  color: #e5e5e5 !important;
}

.pd-wrap .pd-specs tr:last-child td {
  border-bottom: 0 !important;
}

.pd-wrap .pd-specs td:first-child {
  width: 180px;
  padding-right: 14px !important;
  color: rgba(255, 255, 255, 0.55) !important;
  font-weight: 400;
}

.pd-wrap .pd-specs td:last-child {
  font-weight: 500;
  color: #ffffff !important;
}

/* 图片网格 */
.pd-wrap .pd-gallery {
  display: grid !important;
  grid-template-columns: repeat(2, 1fr) !important;
  gap: 12px !important;
  margin: 0 !important;
}

.pd-wrap .pd-gallery img {
  width: 100% !important;
  height: auto !important;
  border: 1px solid rgba(255, 255, 255, 0.15) !important;
  border-radius: 8px !important;
  display: block !important;
  margin: 0 !important;
  max-width: 100% !important;
  background: rgba(255, 255, 255, 0.03);
}

@media (min-width: 900px) {
  .pd-wrap .pd-gallery--3col {
    grid-template-columns: repeat(3, 1fr) !important;
  }
}

@media (max-width: 640px) {
  .pd-wrap .pd-gallery {
    grid-template-columns: 1fr !important;
  }
}

/* Key Features 列表：红色 checkmark */
.pd-wrap .pd-feat-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.pd-wrap .pd-feat-list li {
  position: relative;
  padding: 5px 0 5px 28px;
  margin: 0;
  line-height: 1.6;
  color: #d5d5d5;
}

.pd-wrap .pd-feat-list li::before {
  content: "\2713";
  position: absolute;
  left: 4px;
  top: 5px;
  font-weight: 700;
  font-size: 1.05em;
  line-height: 1.6;
  color: #C8102E;
}

/* Package Includes 列表：红色小点 */
.pd-wrap .pd-pkg-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.pd-wrap .pd-pkg-list li {
  padding: 4px 0 4px 18px;
  margin: 0;
  position: relative;
  line-height: 1.6;
  font-size: 0.95em;
  color: #d5d5d5;
}

.pd-wrap .pd-pkg-list li::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 12px;
  width: 6px;
  height: 6px;
  background: #C8102E;
  border-radius: 50%;
}

/* 描述区内的链接 */
.pd-wrap a {
  color: #ff6b7f;
  text-decoration: none;
  border-bottom: 1px solid rgba(255, 107, 127, 0.35);
  transition: color 0.2s, border-color 0.2s;
}

.pd-wrap a:hover {
  color: #ff8fa0;
  border-bottom-color: #ff8fa0;
}

/* 描述区内的普通图片 */
.pd-wrap .pd-card > p > img,
.pd-wrap .pd-card > img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  display: block;
  margin: 0 auto;
}

/* 高特异性覆盖 Blocksy 对 pd-wrap 内部元素的干扰 */
.single-product .pd-wrap,
.single-product div.pd-wrap,
.woocommerce-Tabs-panel .pd-wrap,
.woocommerce-Tabs-panel--description .pd-wrap,
#tab-description .pd-wrap,
.entry-content .pd-wrap {
  background: #0b0b0c !important;
  color: #e8e8e8 !important;
  padding: 40px 32px !important;
  border-radius: 12px !important;
  margin: 32px 0 !important;
  line-height: 1.65 !important;
  display: block !important;
  max-height: none !important;
  overflow: visible !important;
}

.single-product .pd-wrap .pd-tagline,
.woocommerce-Tabs-panel .pd-wrap .pd-tagline,
.entry-content .pd-wrap .pd-tagline {
  font-size: 22px !important;
  font-weight: 700 !important;
  color: #ffffff !important;
  border-left: 4px solid #C8102E !important;
  padding-left: 16px !important;
  margin: 0 0 28px !important;
}

.single-product .pd-wrap .pd-card,
.woocommerce-Tabs-panel .pd-wrap .pd-card,
.entry-content .pd-wrap .pd-card {
  background: #18181c !important;
  border: 1px solid #2d2d32 !important;
  border-left: 3px solid #C8102E !important;
  border-radius: 8px !important;
  padding: 28px 32px !important;
  margin: 0 0 20px !important;
  color: #e5e5e5 !important;
  display: block !important;
  max-height: none !important;
  overflow: visible !important;
}

.single-product .pd-wrap .pd-card h3,
.woocommerce-Tabs-panel .pd-wrap .pd-card h3,
.entry-content .pd-wrap .pd-card h3 {
  color: #ffffff !important;
  font-size: 18px !important;
  font-weight: 700 !important;
  margin: 0 0 16px !important;
  padding-bottom: 8px !important;
  border-bottom: 2px solid #C8102E !important;
  display: inline-block !important;
}

.single-product .pd-wrap .pd-card p,
.single-product .pd-wrap .pd-card li,
.single-product .pd-wrap .pd-card td,
.woocommerce-Tabs-panel .pd-wrap .pd-card p,
.woocommerce-Tabs-panel .pd-wrap .pd-card li,
.woocommerce-Tabs-panel .pd-wrap .pd-card td,
.entry-content .pd-wrap .pd-card p,
.entry-content .pd-wrap .pd-card li,
.entry-content .pd-wrap .pd-card td {
  color: #d5d5d5 !important;
  background: transparent !important;
}

.single-product .pd-wrap .pd-card strong,
.entry-content .pd-wrap .pd-card strong {
  color: #ffffff !important;
}

/* pd-specs 表格 */
.single-product .pd-wrap .pd-specs td,
.woocommerce-Tabs-panel .pd-wrap .pd-specs td,
.entry-content .pd-wrap .pd-specs td {
  padding: 10px 0 !important;
  border: 0 !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
  background: transparent !important;
  color: #e5e5e5 !important;
  font-size: 0.92em !important;
}

.single-product .pd-wrap .pd-specs td:first-child,
.entry-content .pd-wrap .pd-specs td:first-child {
  color: rgba(255, 255, 255, 0.55) !important;
  width: 180px !important;
  font-weight: 400 !important;
}

.single-product .pd-wrap .pd-specs td:last-child,
.entry-content .pd-wrap .pd-specs td:last-child {
  color: #ffffff !important;
  font-weight: 500 !important;
}

/* pd-gallery */
.single-product .pd-wrap .pd-gallery img,
.entry-content .pd-wrap .pd-gallery img {
  border: 1px solid rgba(255, 255, 255, 0.15) !important;
}

/* pd-feat-list checkmark */
.single-product .pd-wrap .pd-feat-list li::before,
.entry-content .pd-wrap .pd-feat-list li::before {
  color: #C8102E !important;
  opacity: 1 !important;
}

/* pd-pkg-list 圆点 */
.single-product .pd-wrap .pd-pkg-list li::before,
.entry-content .pd-wrap .pd-pkg-list li::before {
  background: #C8102E !important;
}

/* ══════════════════════════════════════════════════════════════
   PART B — 单品页整体视觉：Tabs / Related products / Gallery
   ══════════════════════════════════════════════════════════════ */

/* Tabs 栏下边框样式 */
body.single-product .woocommerce-tabs .tabs.wc-tabs,
body.single-product .woocommerce-tabs ul.tabs {
  border: 0 !important;
  border-bottom: 2px solid #e5e6ea !important;
  padding: 0 !important;
  margin: 0 0 32px !important;
  list-style: none !important;
  display: flex !important;
  gap: 0 !important;
  background: transparent !important;
}

body.single-product .woocommerce-tabs ul.tabs::before,
body.single-product .woocommerce-tabs ul.tabs::after {
  display: none !important;
  content: none !important;
}

body.single-product .woocommerce-tabs ul.tabs > li {
  background: transparent !important;
  border: 0 !important;
  border-radius: 0 !important;
  padding: 0 !important;
  margin: 0 !important;
  box-shadow: none !important;
  list-style: none !important;
}

body.single-product .woocommerce-tabs ul.tabs > li::before,
body.single-product .woocommerce-tabs ul.tabs > li::after {
  display: none !important;
  content: none !important;
}

body.single-product .woocommerce-tabs ul.tabs > li > a {
  padding: 14px 24px !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  color: #7a7a80 !important;
  letter-spacing: 0.8px !important;
  text-transform: uppercase !important;
  border-bottom: 3px solid transparent !important;
  margin-bottom: -2px !important;
  display: block !important;
  text-decoration: none !important;
  transition: color 0.15s, border-color 0.15s !important;
  background: transparent !important;
}

body.single-product .woocommerce-tabs ul.tabs > li:hover > a {
  color: #C8102E !important;
}

body.single-product .woocommerce-tabs ul.tabs > li.active > a {
  color: #C8102E !important;
  border-bottom-color: #C8102E !important;
}

/* 隐藏 Description 面板里 Blocksy 输出的冗余 h2 */
body.single-product .woocommerce-Tabs-panel--description > h2:first-child {
  display: none !important;
}

/* 隐藏 Additional Information tab（与 Specifications 卡片重复） */
body.single-product li.additional_information_tab,
body.single-product .woocommerce-tabs ul.tabs > li.additional_information_tab {
  display: none !important;
}

body.single-product #tab-additional_information,
body.single-product .woocommerce-Tabs-panel--additional_information {
  display: none !important;
}

body.single-product .woocommerce-product-attributes,
body.single-product table.shop_attributes,
body.single-product table.woocommerce-product-attributes-table {
  display: none !important;
}

/* Reviews 表单 Submit 按钮品牌红 */
body.single-product #commentform .form-submit,
body.single-product .comment-form .form-submit,
body.single-product p.form-submit {
  background: transparent !important;
  padding: 0 !important;
  margin: 20px 0 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
}

body.single-product #commentform input[type="submit"],
body.single-product .comment-form input[type="submit"],
body.single-product #commentform .submit,
body.single-product .comment-form .submit {
  padding: 12px 32px !important;
  background: #C8102E !important;
  color: #ffffff !important;
  border: 0 !important;
  border-radius: 4px !important;
  font-size: 13px !important;
  font-weight: 700 !important;
  letter-spacing: 0.8px !important;
  cursor: pointer !important;
  transition: background 0.15s, transform 0.1s !important;
}

body.single-product #commentform input[type="submit"]:hover,
body.single-product .comment-form input[type="submit"]:hover {
  background: #8a0a1f !important;
  transform: translateY(-1px);
}

/* Related products 标题带红色短线 */
body.single-product .related.products > h2,
body.single-product section.related > h2 {
  position: relative;
  display: inline-block !important;
  padding-bottom: 10px !important;
  border-bottom: 0 !important;
}

body.single-product .related.products > h2::after,
body.single-product section.related > h2::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 48px;
  height: 3px;
  background: #C8102E;
  border-radius: 2px;
}

/* Related products 和 iwa-injected 区域的 Add to Cart 按钮 */
body.single-product section.related ul.products > li.product a.button,
body.single-product section.related ul.products > li.product .add_to_cart_button,
.iwa-injected-related ul.products > li.product a.button,
.iwa-injected-related ul.products > li.product .add_to_cart_button {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  margin-left: auto !important;
  margin-right: auto !important;
  margin-top: 14px !important;
  margin-bottom: 20px !important;
  padding: 12px 28px !important;
  width: fit-content !important;
  min-width: 160px !important;
  min-height: 46px !important;
  font-size: 14px !important;
  font-weight: 700 !important;
  background: #222226 !important;
  color: #ffffff !important;
  border: 0 !important;
  border-radius: 6px !important;
  text-align: center !important;
  text-decoration: none !important;
  white-space: nowrap !important;
  transition: background 0.15s, transform 0.1s !important;
}

body.single-product section.related ul.products > li.product a.button:hover,
.iwa-injected-related ul.products > li.product a.button:hover {
  background: #C8102E !important;
  color: #ffffff !important;
  transform: translateY(-1px);
}

/* iwa-injected-related 标题 */
.iwa-injected-related h2 {
  position: relative;
  display: inline-block !important;
  padding-bottom: 10px !important;
  border-bottom: 0 !important;
}

.iwa-injected-related h2::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 48px;
  height: 3px;
  background: #C8102E;
  border-radius: 2px;
}

@media (max-width: 1023px) {
  .iwa-injected-related ul.products.columns-4 {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

@media (max-width: 639px) {
  .iwa-injected-related ul.products.columns-4 {
    grid-template-columns: 1fr !important;
  }

  .iwa-injected-related {
    padding: 0 12px !important;
  }
}

/* Add to Cart 按钮（通用，非 related 区） */
body.single-product .single_add_to_cart_button,
body.single-product button[name="add-to-cart"],
body.single-product form.cart button.single_add_to_cart_button {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: auto !important;
  min-width: 200px !important;
  min-height: 52px !important;
  padding: 14px 36px !important;
  font-size: 15px !important;
  font-weight: 700 !important;
  white-space: nowrap !important;
  border-radius: 6px !important;
}

/* ══════════════════════════════════════════════════════════════
   PART C — WC 容器展开（防止 Blocksy 截断 tab 面板内容）
   ══════════════════════════════════════════════════════════════ */

.woocommerce-tabs,
.woocommerce-Tabs-panel,
.woocommerce-Tabs-panel--description,
#tab-description,
.wc-tabs-wrapper .panel {
  max-height: none !important;
  overflow: visible !important;
  height: auto !important;
  display: block !important;
}

.single-product .pd-wrap .pd-card img,
.entry-content .pd-wrap .pd-card img {
  max-width: 100% !important;
  height: auto !important;
  display: block !important;
  margin: 0 auto !important;
}

/* ══════════════════════════════════════════════════════════════
   PART D — 手机端产品详情页 gallery 全宽修复
   ══════════════════════════════════════════════════════════════ */

@media (max-width: 1023px) {
  /* 父链路清零，防止某层容器把 gallery 推到右边 */
  body.single-product main,
  body.single-product #main,
  body.single-product .site-main,
  body.single-product .ct-container-full,
  body.single-product .hero-section,
  body.single-product article,
  body.single-product article.type-product,
  body.single-product .product-entry-wrapper,
  body.single-product div.product,
  body.single-product .woocommerce-tabs,
  body.single-product .woocommerce-Tabs-panel,
  body.single-product section.related,
  body.single-product section.related.products {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    float: none !important;
    grid-template-columns: 1fr !important;
  }

  body.single-product .product.type-product,
  body.single-product div.product {
    padding: 0 16px !important;
    overflow: visible !important;
  }

  body.single-product .woocommerce-product-gallery,
  body.single-product .ct-product-gallery-container {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    float: none !important;
    flex: none !important;
  }

  body.single-product .flexy-container,
  body.single-product .flexy {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  body.single-product .flexy-view {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  body.single-product .flexy-item {
    flex: 0 0 100% !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  body.single-product .flexy-item figure,
  body.single-product .flexy-item .ct-media-container,
  body.single-product figure.ct-media-container {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    aspect-ratio: auto !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  body.single-product .flexy-item img,
  body.single-product .ct-media-container img,
  body.single-product .woocommerce-product-gallery img {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    margin: 0 auto !important;
    object-fit: contain !important;
  }

  body.single-product .summary.entry-summary,
  body.single-product .entry-summary {
    padding: 24px 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    float: none !important;
  }

  /* pd-wrap：position 技巧使其对齐视口 */
  body.single-product .pd-wrap,
  body.single-product .woocommerce-Tabs-panel .pd-wrap,
  body.single-product .entry-content .pd-wrap {
    position: relative !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    width: calc(100vw - 8px) !important;
    max-width: calc(100vw - 8px) !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    padding: 24px 20px !important;
    border-radius: 8px !important;
    box-sizing: border-box !important;
  }

  body.single-product .pd-wrap .pd-card,
  body.single-product div.pd-wrap section.pd-card {
    padding: 20px 16px !important;
  }

  body.single-product .woocommerce-tabs ul.tabs {
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    padding-bottom: 2px !important;
  }

  body.single-product .woocommerce-tabs ul.tabs > li > a {
    white-space: nowrap !important;
  }

  body.single-product .woocommerce-Tabs-panel {
    padding: 20px 0 !important;
  }

  body.single-product .product_title.entry-title {
    font-size: 28px !important;
  }
}

@media (max-width: 639px) {
  body.single-product .product.type-product,
  body.single-product div.product {
    padding: 0 12px !important;
  }

  body.single-product .product_title.entry-title {
    font-size: 22px !important;
    line-height: 1.25 !important;
  }

  body.single-product p.price,
  body.single-product .price {
    font-size: 20px !important;
  }

  body.single-product .single_add_to_cart_button,
  body.single-product button[name="add-to-cart"] {
    min-height: 52px !important;
    font-size: 15px !important;
    padding: 14px 24px !important;
    width: 100% !important;
    min-width: 0 !important;
  }

  body.single-product .woocommerce-tabs ul.tabs > li > a {
    padding: 12px 14px !important;
    font-size: 13px !important;
  }

  /* pd-wrap 手机端负 margin 贴边 */
  body.single-product .pd-wrap,
  body.single-product .woocommerce-Tabs-panel .pd-wrap {
    margin-left: -12px !important;
    margin-right: -12px !important;
    width: calc(100% + 24px) !important;
    max-width: calc(100% + 24px) !important;
    padding: 24px 16px !important;
  }

  body.single-product .pd-wrap .pd-tagline {
    font-size: 17px !important;
  }

  body.single-product .pd-wrap h3 {
    font-size: 16px !important;
  }

  body.single-product .related.products > h2,
  body.single-product section.related > h2 {
    font-size: 18px !important;
  }

  .pd-wrap {
    padding: 28px 20px;
  }

  .pd-wrap .pd-card {
    padding: 18px 20px;
  }

  .pd-wrap .pd-specs td:first-child {
    width: 40%;
  }

  .pd-wrap .pd-tagline {
    font-size: 19px;
  }
}
