<?php
/**
 * Vape101 — redesigned product detail sections.
 * Loaded only on single-product pages, after product.css.
 *
 * Layout reference (three screenshots):
 *   1. [ About this item | Specifications ] two-column card
 *   2. FAQ accordion (centred heading, amber rows) + Related products carousel
 *   3. Review summary + distribution + toolbar + review list
 *
 * @package Vape101
 */

/* The WooCommerce tab strip is removed entirely — content is laid out flat. */
body.single-product .woocommerce-tabs.hp-tabs-retired,
body.single-product .woocommerce-tabs .tabs.wc-tabs {
  display: none !important;
}

/* .product is a two-column grid (gallery + summary). The detail sections are
   its later children, so without this they only occupy the first column and
   leave the right half empty. Make every flat section span the full row. */
body.single-product .hp-entry .product > .hp-detail-grid,
body.single-product .hp-entry .product > .woocommerce-tabs,
body.single-product .hp-entry .product > .woocommerce-Reviews,
body.single-product .hp-entry .product > .woocommerce-Tabs-panel--reviews,
body.single-product .hp-entry .product > .related.products,
body.single-product .hp-entry .product > section.hp-pdp-faq,
body.single-product .hp-entry .product > .hp-pdp-attributes {
  grid-column: 1 / -1;
  width: 100%;
  box-sizing: border-box;
}
/* The reviews tab panel was moved out of the tabs wrapper; give it a clean
   full-width surface with no leftover tab-panel chrome. */
body.single-product .hp-entry .product > .woocommerce-Tabs-panel--reviews {
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

/* ==========================================================================
   1. About this item (left) + Specifications (right) — two columns
   ========================================================================== */
body.single-product .hp-detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  gap: 28px;
  align-items: start;
  margin: 8px 0 40px;
  padding: 30px 34px;
  background: #fff;
  border: 1px solid var(--hp-line, #e7ebef);
  border-radius: 14px;
}
body.single-product .hp-detail-col { min-width: 0; }
/* Thin vertical rule between the two columns, like the reference. */
body.single-product .hp-detail-specs {
  border-left: 1px solid var(--hp-line, #e7ebef);
  padding-left: 30px;
}

body.single-product .hp-detail-title {
  font-size: 18px;
  font-weight: 700;
  line-height: 1.3;
  color: var(--hp-ink, #16202a);
  margin: 0 0 18px;
}
body.single-product .hp-detail-title--underline { text-decoration: underline; text-underline-offset: 3px; }

/* Left column: feature groups styled as heading + indented body paragraphs. */
body.single-product .hp-detail-about h2,
body.single-product .hp-detail-about h3 {
  font-size: 15px;
  font-weight: 700;
  color: var(--hp-ink, #16202a);
  margin: 22px 0 8px;
}
body.single-product .hp-detail-about h2:first-of-type { margin-top: 0; }
body.single-product .hp-detail-about p {
  font-size: 14px;
  line-height: 1.75;
  color: var(--hp-gray, #454e57);
  margin: 0 0 14px;
}
body.single-product .hp-detail-about ul,
body.single-product .hp-detail-about ol {
  list-style: disc;
  margin: 0 0 18px;
  padding-left: 22px;
}
body.single-product .hp-detail-about li {
  font-size: 14px;
  line-height: 1.75;
  color: var(--hp-gray, #454e57);
  margin-bottom: 12px;
}
/* Bold lead-in ("Big Power, Even Bigger Flavor:") on its own line. */
body.single-product .hp-detail-about li > strong:first-child {
  display: block;
  color: var(--hp-ink, #16202a);
  font-weight: 700;
  margin-bottom: 3px;
}

/* Right column: specification table — label left, value right, dashed rows. */
body.single-product .hp-detail-spec-table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 20px;
}
body.single-product .hp-detail-spec-table tr {
  border-bottom: 1px dashed var(--hp-line-strong, #d5dce2);
}
body.single-product .hp-detail-spec-table tr:first-child { border-top: 1px dashed var(--hp-line-strong, #d5dce2); }
body.single-product .hp-detail-spec-table th,
body.single-product .hp-detail-spec-table td {
  padding: 11px 2px;
  font-size: 13px;
  line-height: 1.5;
  text-align: left;
  vertical-align: top;
  border: 0;
  background: transparent !important;
}
body.single-product .hp-detail-spec-table th {
  width: 46%;
  font-weight: 600;
  color: var(--hp-gray, #454e57);
}
body.single-product .hp-detail-spec-table td {
  text-align: right;
  color: var(--hp-blue, #1b6f9a);
  font-weight: 600;
}
body.single-product .hp-detail-spec-table td a { color: var(--hp-blue, #1b6f9a); }
body.single-product .hp-detail-spec-table td p { margin: 0; }

/* Product hero image under the spec table. */
body.single-product .hp-detail-spec-media {
  margin-top: 6px;
  border-radius: 12px;
  overflow: hidden;
  background: #0f1115;
}
body.single-product .hp-detail-spec-media img {
  display: block;
  width: 100%;
  height: auto;
  object-fit: cover;
}

/* Trust hints moved into the About column keep their compact look. */
body.single-product .hp-detail-about .hp-pdp-trust {
  margin-top: 22px;
  border: 1px solid var(--hp-line, #e7ebef);
  background: var(--hp-soft, #f7f9fa);
  padding: 16px 20px;
  border-radius: 12px;
}

/* ==========================================================================
   2. FAQ accordion — centred heading, amber rows, right-side +/-
   ========================================================================== */
body.single-product .hp-pdp-faq {
  margin: 0 0 40px !important;
  padding: 8px 0 0 !important;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
}
body.single-product .hp-pdp-faq h2 {
  text-align: center;
  font-size: 18px;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
  color: var(--hp-ink, #16202a);
  margin: 0 0 20px !important;
}
body.single-product .hp-pdp-faq details {
  border: 0 !important;
  border-radius: 10px !important;
  background: #f6e1ad !important;
  margin-bottom: 12px;
  overflow: hidden;
}
body.single-product .hp-pdp-faq summary {
  padding: 16px 22px !important;
  font-size: 14px;
  font-weight: 600;
  color: var(--hp-ink, #16202a);
}
body.single-product .hp-pdp-faq summary::after {
  font-size: 20px;
  font-weight: 400;
  color: var(--hp-ink, #16202a);
}
body.single-product .hp-pdp-faq details p { padding: 0 22px 16px; }

/* ==========================================================================
   2b. Related products — horizontal carousel with side arrows
   ========================================================================== */
body.single-product .related.products { position: relative; margin: 0 0 48px !important; }
body.single-product .related.products > h2,
body.single-product .related.products > .woocommerce-loop-heading {
  text-align: left;
  font-size: 22px;
  font-weight: 700;
  text-transform: capitalize !important;
  color: var(--hp-ink, #16202a);
  margin: 0 0 20px;
}
/* Reference cards align the title and price to the left, not centred. */
body.single-product .related.products ul.products.hp-rel-track > li.product .hp-card-body {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  text-align: left;
  padding: 14px 16px 16px !important;
}
body.single-product .related.products ul.products.hp-rel-track > li.product .hp-card-title {
  text-align: left;
  font-size: 14px;
  min-height: 38px;
  margin: 0 0 6px;
  line-height: 1.35;
}
body.single-product .related.products ul.products.hp-rel-track > li.product .hp-card-price {
  text-align: left;
  font-size: 15px;
  margin-top: auto;
}
/* Square, full-width image — neutralise product.css's fixed 200px height. */
body.single-product .related.products ul.products.hp-rel-track > li.product .hp-card-media {
  display: block !important;
  width: 100% !important;
  aspect-ratio: 1 / 1;
  padding: 14px !important;
  flex: 0 0 auto !important;
  background: var(--hp-surface, #f4f6f8);
}
body.single-product .related.products ul.products.hp-rel-track > li.product .hp-card-media img {
  width: 100% !important;
  height: 100% !important;
  object-fit: contain !important;
  background: #fff;
}
/* WooCommerce default (non-hp-card) card markup: keep left alignment too. */
body.single-product .related.products ul.hp-rel-track > li.product .woocommerce-loop-product__title {
  text-align: left;
  font-size: 13px;
  font-weight: 600;
  padding: 14px 4px 0;
  margin: 0;
  min-height: 34px;
}
body.single-product .related.products ul.hp-rel-track > li.product .price {
  text-align: left;
  padding: 4px 4px 0;
}
body.single-product .hp-rel-carousel {
  position: relative;
  overflow-x: auto;
  scroll-behavior: smooth;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  padding: 2px;
}
body.single-product .hp-rel-carousel::-webkit-scrollbar { display: none; }
body.single-product .related.products ul.products.hp-rel-track {
  display: flex !important;
  flex-wrap: nowrap;
  grid-template-columns: none !important;
  gap: 22px !important;
  margin: 0 !important;
  padding: 0 2px 6px !important;
  list-style: none !important;
}
body.single-product .related.products ul.products.hp-rel-track > li.product {
  /* Full carousel: five across. Force a vertical card regardless of base CSS. */
  display: flex !important;
  flex-direction: column !important;
  align-items: stretch !important;
  width: auto !important;
  float: none !important;
  flex: 0 0 calc((100% - 88px) / 5);
  min-width: 0 !important;
  scroll-snap-align: start;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--hp-line, #e7ebef);
  border-radius: 10px;
}
/* Five or fewer items: no arrows, no scrolling. */
body.single-product .related.products ul.products.hp-rel-track.hp-rel-few {
  display: flex !important;
  flex-wrap: wrap;
  gap: 22px !important;
  overflow: visible;
}
/* 1-4 items: cards grow to a larger, comfortable size (capped). */
body.single-product .related.products ul.products.hp-rel-track.hp-rel-few > li.product {
  flex: 1 1 240px;
  max-width: 340px;
  min-width: 200px !important;
}
/* Exactly five: keep five across on a single row (never overflow). */
body.single-product .related.products ul.products.hp-rel-track.hp-rel-few[data-hp-rel-count="5"] > li.product {
  flex: 1 1 0;
  max-width: none;
  min-width: 0 !important;
}
@media (max-width: 600px) {
  body.single-product .related.products ul.products.hp-rel-track.hp-rel-few[data-hp-rel-count="5"] > li.product {
    flex: 1 1 44%;
    max-width: none;
    min-width: 150px !important;
  }
}
body.single-product .hp-rel-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 4;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid var(--hp-line, #e7ebef);
  border-radius: 50%;
  background: #fff;
  color: #8a929a;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
  transition: opacity .18s ease, border-color .18s ease, color .18s ease;
}
body.single-product .hp-rel-arrow:hover { border-color: var(--hp-ink, #16202a); color: var(--hp-ink, #16202a); }
body.single-product .hp-rel-prev { left: -18px; }
body.single-product .hp-rel-next { right: -18px; }
body.single-product .hp-rel-arrow.is-hidden { opacity: 0; pointer-events: none; }
body.single-product .hp-rel-arrow:focus-visible { outline: 2px solid var(--hp-blue); outline-offset: 2px; }

/* ==========================================================================
   3. Reviews — summary, distribution, toolbar, list
   ========================================================================== */
body.single-product .woocommerce-Reviews { position: relative; }
body.single-product .woocommerce-Reviews-title { display: none; } /* replaced by toolbar label */

body.single-product .hp-review-summary { margin: 0 0 8px; }
body.single-product .hp-review-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 0;
  border-bottom: 1px solid var(--hp-line, #e7ebef);
  flex-wrap: wrap;
}
body.single-product .hp-review-score { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
body.single-product .hp-review-score strong { font-size: 30px; font-weight: 700; color: var(--hp-ink, #16202a); line-height: 1; }
body.single-product .hp-review-stars { color: #f5a623; font-size: 18px; letter-spacing: 1px; }
body.single-product .hp-review-based { font-size: 13px; color: var(--hp-muted, #6b747d); }
body.single-product .hp-review-write {
  border: 1px solid #111318 !important;
  border-radius: 8px !important;
  background: #111318 !important;
  color: #fff !important;
  font-size: 13px;
  font-weight: 700;
  padding: 11px 18px;
  cursor: pointer;
}
body.single-product .hp-review-write:hover { background: #000 !important; }

body.single-product .hp-review-dist {
  background: var(--hp-soft, #f7f9fa);
  border: 1px solid var(--hp-line, #e7ebef);
  border-radius: 12px;
  padding: 20px 24px;
  margin: 18px 0 0;
}
body.single-product .hp-review-dist-title { font-size: 13px; font-weight: 600; color: var(--hp-ink, #16202a); margin-bottom: 14px; }
body.single-product .hp-review-dist-row {
  display: grid;
  grid-template-columns: 34px 1fr 46px;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}
body.single-product .hp-review-dist-label { font-size: 12px; color: var(--hp-gray, #454e57); white-space: nowrap; }
body.single-product .hp-review-dist-bar { height: 6px; background: #e4e8ec; border-radius: 999px; overflow: hidden; }
body.single-product .hp-review-dist-fill { display: block; height: 100%; background: #111318; border-radius: 999px; }
body.single-product .hp-review-dist-num { font-size: 12px; color: var(--hp-muted, #6b747d); text-align: right; }

body.single-product .hp-review-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 0;
  border-bottom: 1px solid var(--hp-line, #e7ebef);
  margin-bottom: 6px;
}
body.single-product .hp-review-sort {
  border: 1px solid var(--hp-line-strong, #d5dce2);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
  color: var(--hp-ink, #16202a);
  background: #fff;
}
body.single-product .hp-review-search {
  border: 1px solid var(--hp-line-strong, #d5dce2);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
  color: var(--hp-ink, #16202a);
  background: #fff;
  width: 160px;
}
body.single-product .hp-review-listlabel { margin-left: auto; font-size: 13px; font-weight: 700; color: var(--hp-ink, #16202a); }

/* Review list: avatar column + content column, like the reference. */
body.single-product .commentlist { list-style: none; margin: 0; padding: 0; }
body.single-product .commentlist li.comment {
  display: grid;
  grid-template-columns: 130px minmax(0, 1fr);
  gap: 24px;
  padding: 24px 0;
  border-bottom: 1px solid var(--hp-line, #e7ebef);
  margin: 0;
}
body.single-product .commentlist li.comment .comment-author { display: block; }
body.single-product .commentlist li.comment .comment-author img,
body.single-product .commentlist li.comment .avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  object-fit: cover;
  margin-bottom: 10px;
}
body.single-product .commentlist li.comment .comment-author .fn { display: block; font-size: 13px; font-weight: 700; color: var(--hp-ink, #16202a); }
body.single-product .commentlist li.comment .verified-badge,
body.single-product .commentlist li.comment .woocommerce-verification-required { display: block; font-size: 11px; color: var(--hp-success, #18794e); margin: 4px 0; }
body.single-product .commentlist li.comment .comment-meta { font-size: 11px; color: var(--hp-muted, #6b747d); }
body.single-product .commentlist li.comment .comment-content { font-size: 14px; line-height: 1.7; color: var(--hp-gray, #454e57); }
body.single-product .commentlist li.comment .star-rating { color: #f5a623; float: none; }
body.single-product .commentlist li.comment .comment-content p { margin: 6px 0 10px; }
body.single-product .woocommerce-noreviews { font-size: 14px; color: var(--hp-muted, #6b747d); padding: 18px 0; }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 900px) {
  body.single-product .hp-detail-grid { grid-template-columns: 1fr; gap: 20px; padding: 24px 20px; }
  body.single-product .hp-detail-specs { border-left: 0; padding-left: 0; border-top: 1px solid var(--hp-line, #e7ebef); padding-top: 22px; }
  body.single-product .related.products ul.hp-rel-track > li.product { flex-basis: calc((100% - 36px) / 3); }
  body.single-product .hp-rel-prev { left: -8px; }
  body.single-product .hp-rel-next { right: -8px; }
}
@media (max-width: 600px) {
  body.single-product .hp-detail-grid { padding: 20px 16px; }
  body.single-product .related.products ul.hp-rel-track > li.product { flex-basis: calc((100% - 18px) / 2); min-width: 150px; }
  body.single-product .commentlist li.comment { grid-template-columns: 1fr; gap: 12px; }
  body.single-product .commentlist li.comment .comment-author { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
  body.single-product .commentlist li.comment .avatar { margin-bottom: 0; }
  body.single-product .hp-review-search { width: 120px; }
  body.single-product .hp-review-head { gap: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  body.single-product .hp-rel-carousel { scroll-behavior: auto; }
}
