/* ==========================================================================
   theme-fix-product-info.css
   Agent C (Antigravity): Đợt 4 (Khối chính sách pd3-trust) & Đợt 5 (Mô tả pd3-desc)
   Áp dụng riêng cho trang sản phẩm v3 (.template-product).
   Tuân thủ WCAG 2.1 AA (touch targets >= 44px, contrast >= 4.5:1, focus rings).
   Hỗ trợ Dark mode mobile qua html[data-mobile-theme="dark"].
   ========================================================================== */

/* --------------------------------------------------------------------------
   0. Dọn dẹp kế thừa & Khung đánh giá rỗng
   -------------------------------------------------------------------------- */
.template-product .product-tabs.pd3-desc {
  border-top: none !important;
  padding: 0;
}

.template-product .tab-content {
  border: none;
  padding: 0 !important;
}

/* Ẩn các khung đánh giá rỗng (cao 0px hoặc không có nội dung) */
.template-product #doke_product_reviews:empty,
.template-product #doke_product_reviews[style*="height: 0"],
.template-product .doke-review-widget:empty,
.template-product .hrv-product-reviews:empty,
.template-product #haravan-product-reviews:empty,
.template-product .product-single-review:empty,
.template-product .doke-badge:empty {
  display: none !important;
}

/* --------------------------------------------------------------------------
   1. Đợt 4: Khối chính sách (pd3-trust)
   -------------------------------------------------------------------------- */
.template-product .pd3-trust {
  box-sizing: border-box;
  margin-top: 0;
  margin-bottom: 24px;
}

.template-product .pd3-trust__card {
  background: #FFFFFF;
  border: 1px solid #DCE4E8;
  border-radius: 16px;
  padding: 16px;
  box-sizing: border-box;
  box-shadow: 0 1px 3px rgba(11, 17, 24, 0.04);
}

.template-product .pd3-trust__header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid #EAF0F3;
}

.template-product .pd3-trust__header-badge {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #007FAE;
  background: #EBF6FB;
  border-radius: 4px;
  padding: 2px 6px;
  line-height: 16px;
}

.template-product .pd3-trust__header-text {
  font-size: 12.5px;
  font-weight: 600;
  color: #66727D;
}

.template-product .pd3-trust__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.template-product .pd3-trust__item {
  margin: 0;
  padding: 0;
  list-style: none;
}

.template-product .pd3-trust__link {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-height: 44px;
  padding: 8px 10px;
  border-radius: 10px;
  text-decoration: none;
  color: #0B1118;
  box-sizing: border-box;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.template-product .pd3-trust__link:hover {
  background-color: #F0F4F7;
  color: #007FAE;
  text-decoration: none;
}

.template-product .pd3-trust__link:focus-visible {
  outline: 3px solid #007FAE;
  outline-offset: 2px;
}

.template-product .pd3-trust__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 24px;
  width: 24px;
  height: 24px;
  margin-top: 1px;
  color: #007FAE;
}

.template-product .pd3-trust__svg {
  width: 20px;
  height: 20px;
  display: block;
}

.template-product .pd3-trust__text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.35;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.template-product .pd3-trust__title {
  font-size: 13.5px;
  font-weight: 600;
  color: #0B1118;
  word-break: break-word;
}

.template-product .pd3-trust__link:hover .pd3-trust__title {
  color: #007FAE;
}

.template-product .pd3-trust__sub {
  font-size: 11.5px;
  color: #66727D;
  margin-top: 2px;
}

.template-product .pd3-trust__link--hotline .pd3-trust__title {
  color: #007FAE;
  font-weight: 700;
}

/* --------------------------------------------------------------------------
   2. Đợt 5: Khối mô tả sản phẩm (pd3-desc)
   -------------------------------------------------------------------------- */
.template-product .pd3-desc {
  margin-top: 28px;
  margin-bottom: 40px;
  box-sizing: border-box;
}

.template-product .pd3-desc__card {
  background: #FFFFFF;
  border: 1px solid #DCE4E8;
  border-radius: 16px;
  padding: 24px;
  box-sizing: border-box;
  box-shadow: 0 1px 3px rgba(11, 17, 24, 0.04);
}

.template-product .pd3-desc__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding-bottom: 16px;
  margin-bottom: 20px;
  border-bottom: 1px solid #EAF0F3;
}

.template-product .pd3-desc__heading {
  font-size: 22px;
  line-height: 28px;
  font-weight: 700;
  color: #0B1118;
  margin: 0;
  letter-spacing: -0.02em;
}

.template-product .pd3-desc__spec-anchor {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13.5px;
  font-weight: 600;
  color: #007FAE;
  background: #F0F9FD;
  border: 1px solid #B8E4F7;
  border-radius: 20px;
  padding: 6px 14px;
  min-height: 38px;
  text-decoration: none;
  box-sizing: border-box;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.template-product .pd3-desc__spec-anchor:hover {
  background: #007FAE;
  border-color: #007FAE;
  color: #FFFFFF;
  text-decoration: none;
}

.template-product .pd3-desc__spec-anchor:focus-visible {
  outline: 3px solid #007FAE;
  outline-offset: 2px;
}

.template-product .pd3-desc__wrap {
  position: relative;
  transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.template-product .pd3-desc__wrap.is-collapsed {
  max-height: 1200px;
  overflow: hidden;
}

.template-product .pd3-desc__wrap.is-expanded {
  max-height: none;
  overflow: visible;
}

.template-product .pd3-desc__fade {
  display: none;
}

.template-product .pd3-desc__wrap.is-collapsed .pd3-desc__fade {
  display: block;
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 180px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.92) 65%, #FFFFFF 100%);
  pointer-events: none;
  z-index: 1;
}

.template-product .pd3-desc__action {
  margin-top: 16px;
  display: flex;
  justify-content: center;
  position: relative;
  z-index: 2;
}

.template-product .pd3-desc__toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  min-width: 180px;
  padding: 10px 24px;
  border-radius: 24px;
  background: #FFFFFF;
  color: #007FAE;
  border: 1.5px solid #007FAE;
  font-size: 14.5px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 127, 174, 0.08);
  transition: all 0.2s ease;
  box-sizing: border-box;
}

.template-product .pd3-desc__toggle:hover {
  background: #007FAE;
  color: #FFFFFF;
  box-shadow: 0 4px 12px rgba(0, 127, 174, 0.25);
}

.template-product .pd3-desc__toggle:focus-visible {
  outline: 3px solid #007FAE;
  outline-offset: 3px;
}

.template-product .pd3-desc__toggle-icon {
  display: block;
  transition: transform 0.25s ease;
}

.template-product .pd3-desc__wrap.is-expanded + .pd3-desc__action .pd3-desc__toggle-icon {
  transform: rotate(180deg);
}

/* --------------------------------------------------------------------------
   3. RTE Typography & Media bên trong mô tả
   -------------------------------------------------------------------------- */
.template-product .pd3-desc__body {
  font-size: 15px;
  line-height: 1.7;
  color: #2D3748;
  word-break: break-word;
}

.template-product .pd3-desc__body p {
  margin-top: 0;
  margin-bottom: 16px;
}

.template-product .pd3-desc__body h2,
.template-product .pd3-desc__body h3,
.template-product .pd3-desc__body h4 {
  color: #0B1118;
  font-weight: 700;
  margin-top: 24px;
  margin-bottom: 12px;
  letter-spacing: -0.015em;
}

.template-product .pd3-desc__body img {
  max-width: 100% !important;
  height: auto !important;
  margin: 16px auto;
  display: block;
  border-radius: 8px;
  object-fit: contain;
}

.template-product .pd3-desc__body iframe {
  max-width: 100% !important;
  width: 100% !important;
  aspect-ratio: 16 / 9;
  border-radius: 8px;
  margin: 16px auto;
  display: block;
  border: 0;
}

.template-product .pd3-desc__body table {
  width: 100% !important;
  max-width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
  overflow-x: auto;
  display: block;
  -webkit-overflow-scrolling: touch;
}

.template-product .pd3-desc__body th,
.template-product .pd3-desc__body td {
  padding: 10px 14px;
  border: 1px solid #DCE4E8;
  font-size: 14px;
}

.template-product .pd3-desc__body th {
  background: #F7F9FA;
  font-weight: 600;
  color: #0B1118;
}

.template-product #pd3-specs,
.template-product [id="pd3-specs"] {
  scroll-margin-top: 80px;
}

.template-product .pd3-desc__extra {
  margin-top: 20px;
}

.template-product .pd3-desc__extra-title {
  font-size: 18px;
  font-weight: 700;
  color: #0B1118;
  margin: 0 0 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid #EAF0F3;
}

/* --------------------------------------------------------------------------
   4. Tối ưu Mobile (<= 768px)
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
  .template-product .pd3-trust {
    width: 100% !important;
    margin-top: 14px;
    margin-bottom: 20px;
    clear: both;
  }

  .template-product .pd3-trust__card {
    padding: 14px;
    border-radius: 14px;
  }

  .template-product .pd3-trust__link {
    min-height: 44px;
    padding: 8px;
  }

  .template-product .pd3-desc {
    width: 100% !important;
    margin-top: 20px;
    margin-bottom: 32px;
  }

  .template-product .pd3-desc__card {
    padding: 16px;
    border-radius: 14px;
  }

  .template-product .pd3-desc__header {
    flex-direction: row;
    align-items: center;
    gap: 8px;
  }

  .template-product .pd3-desc__heading {
    font-size: 20px;
    line-height: 26px;
  }

  .template-product .pd3-desc__spec-anchor {
    min-height: 44px;
    padding: 8px 14px;
    font-size: 13px;
  }

  .template-product .pd3-desc__toggle {
    width: 100%;
    max-width: 320px;
  }
}

/* --------------------------------------------------------------------------
   5. Dark mode mobile (html[data-mobile-theme="dark"])
   -------------------------------------------------------------------------- */
html[data-mobile-theme="dark"] .template-product .pd3-trust__card {
  background: #121C25;
  border-color: #2C3A45;
  box-shadow: none;
}

html[data-mobile-theme="dark"] .template-product .pd3-trust__header {
  border-bottom-color: #2C3A45;
}

html[data-mobile-theme="dark"] .template-product .pd3-trust__header-badge {
  background: #1A2C3A;
  color: #7DD3F5;
}

html[data-mobile-theme="dark"] .template-product .pd3-trust__header-text {
  color: #9BAAB4;
}

html[data-mobile-theme="dark"] .template-product .pd3-trust__link {
  color: #F1F6F8;
}

html[data-mobile-theme="dark"] .template-product .pd3-trust__link:hover {
  background-color: #1A2731;
  color: #7DD3F5;
}

html[data-mobile-theme="dark"] .template-product .pd3-trust__icon {
  color: #00A7E1;
}

html[data-mobile-theme="dark"] .template-product .pd3-trust__title {
  color: #F1F6F8;
}

html[data-mobile-theme="dark"] .template-product .pd3-trust__link:hover .pd3-trust__title {
  color: #7DD3F5;
}

html[data-mobile-theme="dark"] .template-product .pd3-trust__sub {
  color: #9BAAB4;
}

html[data-mobile-theme="dark"] .template-product .pd3-trust__link--hotline .pd3-trust__title {
  color: #7DD3F5;
}

html[data-mobile-theme="dark"] .template-product .pd3-trust__link:focus-visible {
  outline-color: #7DD3F5;
}

html[data-mobile-theme="dark"] .template-product .pd3-desc__card {
  background: #121C25;
  border-color: #2C3A45;
  box-shadow: none;
}

html[data-mobile-theme="dark"] .template-product .pd3-desc__header {
  border-bottom-color: #2C3A45;
}

html[data-mobile-theme="dark"] .template-product .pd3-desc__heading {
  color: #F1F6F8;
}

html[data-mobile-theme="dark"] .template-product .pd3-desc__spec-anchor {
  background: #152736;
  border-color: #1F3F56;
  color: #7DD3F5;
}

html[data-mobile-theme="dark"] .template-product .pd3-desc__spec-anchor:hover {
  background: #007FAE;
  border-color: #007FAE;
  color: #FFFFFF;
}

html[data-mobile-theme="dark"] .template-product .pd3-desc__spec-anchor:focus-visible {
  outline-color: #7DD3F5;
}

html[data-mobile-theme="dark"] .template-product .pd3-desc__wrap.is-collapsed .pd3-desc__fade {
  background: linear-gradient(180deg, rgba(18, 28, 37, 0) 0%, rgba(18, 28, 37, 0.92) 65%, #121C25 100%);
}

html[data-mobile-theme="dark"] .template-product .pd3-desc__body {
  color: #D2DCE2;
}

html[data-mobile-theme="dark"] .template-product .pd3-desc__body h2,
html[data-mobile-theme="dark"] .template-product .pd3-desc__body h3,
html[data-mobile-theme="dark"] .template-product .pd3-desc__body h4 {
  color: #F1F6F8;
}

html[data-mobile-theme="dark"] .template-product .pd3-desc__body th {
  background: #1A2731;
  color: #F1F6F8;
}

html[data-mobile-theme="dark"] .template-product .pd3-desc__body th,
html[data-mobile-theme="dark"] .template-product .pd3-desc__body td {
  border-color: #2C3A45;
  color: #D2DCE2;
}

html[data-mobile-theme="dark"] .template-product .pd3-desc__toggle {
  background: #15212C;
  border-color: #007FAE;
  color: #7DD3F5;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

html[data-mobile-theme="dark"] .template-product .pd3-desc__toggle:hover {
  background: #007FAE;
  color: #FFFFFF;
}

html[data-mobile-theme="dark"] .template-product .pd3-desc__toggle:focus-visible {
  outline-color: #7DD3F5;
}

html[data-mobile-theme="dark"] .template-product .pd3-desc__extra-title {
  color: #F1F6F8;
  border-bottom-color: #2C3A45;
}
