/* =====================================================
   MEI BEDDING — product.css
   Single product page: gallery, info, variation, add-on, sticky CTA, description, tabs, related, lightbox, modal Zalo.
   Extracted from hifi-v2.css sections 25, 26, 26b, 27 (related), 28 (lightbox), 29 (modal Zalo).
   ===================================================== */

/* =====================================================
   PRODUCT DETAIL PAGE
   ===================================================== */

/* ---------- 25. Product detail grid ---------- */
.pd-wrap {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--sp-5);
  padding-bottom: var(--sp-7);
}
@media (min-width: 1024px) {
  .pd-wrap { grid-template-columns: 1.1fr 1fr; gap: var(--sp-7); }
}

/* Gallery */
.pd-gallery { display: flex; flex-direction: column; gap: var(--sp-3); }
@media (min-width: 1024px) {
  .pd-gallery {
    position: sticky;
    top: calc(var(--header-h) + var(--sp-4));
    align-self: start;
    max-height: calc(100vh - var(--header-h) - var(--sp-5));
  }
}
.pd-gallery-main {
  position: relative;
  aspect-ratio: 1 / 1;
  background: var(--bone-soft);
  overflow: hidden;
  cursor: zoom-in;
}
.pd-gallery-main img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
@media (max-width: 1023px) {
  .pd-gallery-main { border-radius: 8px; }
}
.pd-gallery-main-zoom {
  position: absolute;
  top: var(--sp-3);
  right: var(--sp-3);
  background: rgba(0,0,0,0.5);
  color: var(--white);
  width: 36px; height: 36px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  pointer-events: none;
}
.pd-gallery-thumbs-wrap {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: var(--sp-3);
}
.pd-gallery-thumbs {
  flex: 1;
  display: flex;
  gap: var(--sp-2);
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
@media (max-width: 1023px) {
  .pd-gallery-thumbs { gap: 6px; }
}
.pd-gallery-thumbs::-webkit-scrollbar { display: none; }
.pd-gallery-thumb {
  flex: 0 0 calc((100% - var(--sp-2) * 3) / 4);
  aspect-ratio: 1;
  background: var(--bone-soft);
  overflow: hidden;
  cursor: pointer;
  border: 2px solid transparent;
  border-radius: 6px;
  transition: border-color var(--t-fast) var(--ease);
  scroll-snap-align: start;
  padding: 0;
}
@media (max-width: 1023px) {
  .pd-gallery-thumb { flex: 0 0 calc((100% - 6px * 3) / 4); }
}
.pd-gallery-thumb img { width: 100%; height: 100%; object-fit: cover; }
.pd-gallery-thumb.active { border-color: var(--ink); }
.pd-gallery-thumb:hover { border-color: var(--ink-soft); }

/* Thumb slider nav arrows */
.pd-thumb-nav {
  flex: 0 0 22px;
  height: 60px;
  border: 0;
  background: transparent;
  color: var(--ink-soft);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  transition: color var(--t-fast) var(--ease), transform var(--t-fast) var(--ease);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.pd-thumb-nav:hover {
  color: var(--ink);
  transform: scale(1.2);
}
.pd-thumb-nav:disabled {
  opacity: 0.25;
  cursor: not-allowed;
}
.pd-thumb-nav:disabled:hover {
  color: var(--ink-soft);
  transform: none;
}

/* Counter overlay on main image (vuanem-style) */
.pd-gallery-counter {
  position: absolute;
  bottom: var(--sp-3);
  right: var(--sp-3);
  background: rgba(0, 0, 0, 0.55);
  color: var(--white);
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.3px;
  pointer-events: none;
}

/* Info column */
.pd-info { display: flex; flex-direction: column; gap: var(--sp-4); }
/* Form wrapper (WP) — inherit gap pattern từ .pd-info parent. */
.pd-variation-form { display: flex; flex-direction: column; gap: var(--sp-4); }
.pd-info-eyebrow {
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.5px;
}
.pd-info-eyebrow strong { color: var(--ink-soft); font-weight: 600; }
.pd-name {
  font-family: var(--font-serif);
  font-size: 28px;
  font-weight: 400;
  line-height: 1.2;
  color: var(--ink);
  margin-bottom: 0;
}
@media (min-width: 1024px) { .pd-name { font-size: 32px; } }
.pd-info-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  color: var(--muted);
  margin-top: -4px;
}
.pd-meta-link {
  color: var(--ink-soft);
  font-weight: 500;
  text-decoration: none;
  transition: color var(--t-fast) var(--ease);
}
.pd-meta-link:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.pd-meta-sep { color: var(--muted); }

.pd-price-row {
  display: flex;
  align-items: baseline;
  gap: var(--sp-3);
  flex-wrap: wrap;
}
.pd-price-current {
  font-size: 26px;
  font-weight: 700;
  color: var(--cta-red);
}
.pd-price-current--normal { color: var(--cta-red); }
.pd-price-old {
  font-size: 16px;
  color: var(--muted);
  text-decoration: line-through;
}
.pd-price-badge {
  font-size: 11px;
  background: var(--sale);
  color: var(--white);
  padding: 4px 8px;
  border-radius: 2px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

/* Rating placeholder — reserved for CusRev plugin (Phase 6) */
.pd-rating {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: 13px;
  color: var(--ink-soft);
  flex-wrap: wrap;
}
.pd-stars {
  color: #c5871a;
  letter-spacing: 1px;
  font-size: 14px;
  line-height: 1;
}
.pd-stars--empty { color: var(--line); }
.pd-rating-num { font-weight: 700; color: var(--ink); }
.pd-rating-link {
  color: var(--ink-soft);
  border-bottom: 1px solid var(--line);
  padding-bottom: 1px;
  transition: all var(--t-fast) var(--ease);
}
.pd-rating-link:hover { color: var(--ink); border-color: var(--ink); }
.pd-rating-dot { color: var(--muted); }

/* Trust badges row (under hero/CTA) */
.pd-trust {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--sp-3);
  margin-top: var(--sp-6);
  padding: var(--sp-5);
  background: var(--bone-soft);
  border-radius: var(--radius);
  border: 1px solid var(--line);
}
@media (min-width: 768px) {
  .pd-trust { grid-template-columns: repeat(4, 1fr); gap: var(--sp-4); }
}
.pd-trust-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}
.pd-trust-icon {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.pd-trust-icon svg {
  width: 28px;
  height: 28px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.4;
}
.pd-trust-text { display: flex; flex-direction: column; }
.pd-trust-label {
  font-size: 12px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--ink);
}
.pd-trust-sub {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}

.pd-divider {
  height: 1px;
  background: var(--line);
  margin: var(--sp-2) 0;
}

/* Variation group */
.pd-var-group { display: flex; flex-direction: column; gap: var(--sp-3); }
.pd-var-label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--ink);
}
.pd-var-current { color: var(--ink-soft); font-weight: 500; text-transform: none; letter-spacing: 0; }
.pd-var-options { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.pd-var-btn {
  min-width: 72px;
  padding: 10px 16px;
  border: 1.5px solid var(--line);
  background: var(--white);
  font-size: 13px;
  color: var(--ink-soft);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--t-fast) var(--ease);
  white-space: nowrap;
  text-align: center;
  line-height: 1.2;
}
.pd-var-btn:hover { border-color: var(--ink-soft); color: var(--ink); }
.pd-var-btn.active {
  border-color: var(--ink);
  color: var(--ink);
  font-weight: 600;
  background: var(--bone-soft);
}
.pd-var-btn--other { font-style: normal; color: var(--ink); }

/* Color chip (dot + name) — giống sidebar filter */
.pd-var-colors { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.pd-color-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px 8px 10px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
}
.pd-color-chip:hover { border-color: var(--ink); }
.pd-color-chip.active {
  border-color: var(--ink);
  background: var(--bone-soft);
}
.pd-color-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1px solid rgba(0,0,0,0.1);
  display: inline-block;
  flex-shrink: 0;
}
.pd-color-name { white-space: nowrap; }

/* Add-on group */
.pd-addons {
  background: var(--bone-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--sp-4);
}
.pd-addons-title {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--ink);
  margin-bottom: var(--sp-3);
}
.pd-addons-list { display: flex; flex-direction: column; gap: var(--sp-3); }
.pd-addon-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  padding: var(--sp-2) 0;
  cursor: pointer;
}
.pd-addon-item label {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  cursor: pointer;
  flex: 1;
}
.pd-addon-item input[type="checkbox"] { accent-color: var(--ink); width: 18px; height: 18px; }
.pd-addon-name { font-size: 13px; color: var(--ink); font-weight: 500; }
.pd-addon-desc { font-size: 11px; color: var(--muted); margin-top: 2px; }
.pd-addon-price { font-size: 13px; color: var(--sale); font-weight: 600; }

/* Quantity stepper */
.pd-qty-row {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
}
.pd-qty-row > label {
  font-size: 13px;
  color: var(--ink-soft);
  font-weight: 500;
}
.pd-qty-stepper {
  display: inline-flex;
  align-items: stretch;
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.pd-qty-stepper button {
  width: 36px; height: 36px;
  background: var(--white);
  color: var(--ink);
  font-size: 16px;
  transition: background var(--t-fast) var(--ease);
}
.pd-qty-stepper button:hover { background: var(--bone-soft); }
.pd-qty-stepper input {
  width: 48px;
  height: 36px;
  padding: 0;
  text-align: center;
  border: none;
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
  font-size: 14px;
  font-weight: 600;
  -moz-appearance: textfield;
  background: var(--white);
  line-height: 1;
}
.pd-qty-stepper input::-webkit-outer-spin-button,
.pd-qty-stepper input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* CTA */
.pd-cta-group {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}
.pd-cta-group .btn { padding: 14px; font-size: 15px; font-weight: 600; }

.pd-cta-group--row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-2);
}
.pd-cta-group--row .btn { padding: 14px 12px; font-size: 14px; font-weight: 600; width: 100%; }

.pd-zalo-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 13px 16px;
  background: #0068ff;
  color: #ffffff;
  font-size: 14px;
  font-weight: 600;
  border-radius: var(--radius);
  text-decoration: none;
  transition: background var(--t-fast) var(--ease), transform var(--t-fast) var(--ease);
}
.pd-zalo-btn:hover {
  background: #0055d4;
  color: #ffffff;
  transform: translateY(-1px);
}
.pd-zalo-btn svg { flex-shrink: 0; }

/* Legacy link kept for back-compat */
.pd-zalo-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--info);
  text-decoration: underline;
  align-self: flex-start;
}

/* Sticky CTA mobile bottom */
.pd-sticky-cta {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--white);
  border-top: 1px solid var(--line);
  padding: 10px var(--gutter);
  padding-bottom: calc(10px + env(safe-area-inset-bottom));
  z-index: var(--z-sticky-cta);
  box-shadow: 0 -4px 12px rgba(0,0,0,0.04);
  gap: var(--sp-3);
  align-items: center;
}
@media (max-width: 1023px) {
  .pd-sticky-cta { display: flex; }
  .pd-content-bottom { padding-bottom: 80px; } /* offset for sticky bar */
}
.pd-sticky-price {
  display: flex;
  flex-direction: column;
  flex: 0 0 auto;
}
.pd-sticky-price-cur {
  font-size: 16px;
  font-weight: 700;
  color: var(--sale);
}
.pd-sticky-price-old {
  font-size: 11px;
  color: var(--muted);
  text-decoration: line-through;
}
.pd-sticky-cta .btn {
  flex: 1;
  padding: 12px;
  font-size: 14px;
  font-weight: 600;
}

/* ---------- 26. Description (article-style) ---------- */
.pd-section {
  margin-top: var(--sp-7);
  padding-top: var(--sp-6);
  border-top: 1px solid var(--line);
}
.pd-section-title {
  font-family: var(--font-serif);
  font-size: 22px;
  font-weight: 400;
  margin-bottom: var(--sp-5);
}
@media (min-width: 1024px) { .pd-section-title { font-size: 26px; } }

.pd-desc { max-width: 100%; }
.pd-desc p {
  font-size: 15px;
  line-height: 1.75;
  color: var(--ink-soft);
  margin-bottom: var(--sp-4);
}
.pd-desc img {
  width: 100%;
  border-radius: var(--radius);
  margin: var(--sp-5) 0;
}
.pd-desc-row-2col {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--sp-3);
  margin: var(--sp-5) 0;
}
@media (min-width: 768px) {
  .pd-desc-row-2col { grid-template-columns: 1fr 1fr; gap: var(--sp-4); }
}
.pd-desc-row-2col img { margin: 0; aspect-ratio: 4/5; object-fit: cover; }

.pd-material-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--sp-3);
  margin: var(--sp-5) 0;
}
@media (min-width: 768px) {
  .pd-material-grid { grid-template-columns: repeat(2, 1fr); gap: var(--sp-4); }
}
@media (min-width: 1024px) {
  .pd-material-grid:has(img:nth-child(3)) { grid-template-columns: repeat(3, 1fr); }
}
.pd-material-grid img { margin: 0; width: 100%; aspect-ratio: 4/5; object-fit: cover; border-radius: var(--radius); }

/* Info table */
.pd-info-table {
  width: 100%;
  border-collapse: collapse;
}
.pd-info-table th, .pd-info-table td {
  text-align: left;
  padding: 12px 16px;
  font-size: 14px;
  border-bottom: 1px solid var(--line);
}
.pd-info-table th {
  width: 30%;
  background: var(--bone-soft);
  font-weight: 600;
  color: var(--ink);
}
.pd-info-table td { color: var(--ink-soft); }

/* Care list — text-only cards */
.pd-care-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--sp-3);
}
@media (min-width: 640px) { .pd-care-list { grid-template-columns: repeat(4, 1fr); } }
.pd-care-item {
  text-align: center;
  padding: var(--sp-5) var(--sp-3);
  background: var(--bone-soft);
  border-radius: var(--radius);
  border: 1px solid var(--line);
}
.pd-care-label {
  font-size: 13px;
  color: var(--ink);
  line-height: 1.5;
  font-weight: 500;
}

/* ---------- 26b. Product detail TABS (vuanem style) ---------- */
.pd-tabs-wrap {
  margin-top: var(--sp-7);
}
.pd-tabs-nav {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin-bottom: -1px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.pd-tabs-nav::-webkit-scrollbar { display: none; }

.pd-tab {
  flex-shrink: 0;
  padding: 12px 20px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--ink-soft);
  background: var(--white);
  border: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  border-radius: var(--radius) var(--radius) 0 0;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--t-fast) var(--ease);
  margin-right: -1px;
}
.pd-tab:hover {
  color: var(--ink);
  background: var(--bone-soft);
}
.pd-tab.active {
  color: var(--ink);
  background: var(--bone-soft);
  border-color: var(--ink);
  border-bottom-color: var(--bone-soft);
  position: relative;
  z-index: 2;
}
@media (max-width: 768px) {
  .pd-tab { padding: 10px 14px; font-size: 12px; }
}

.pd-tab-panel {
  display: none;
  background: var(--white);
  border: 1px solid var(--line);
  border-top: none;
  border-radius: 0 var(--radius) var(--radius) var(--radius);
  padding: var(--sp-6) var(--sp-5);
}
@media (min-width: 1024px) {
  .pd-tab-panel { padding: var(--sp-7) var(--sp-6); }
}
.pd-tab-panel.active { display: block; }
.pd-tab-panel > *:first-child { margin-top: 0; }
.pd-tab-panel > *:last-child { margin-bottom: 0; }
.pd-tab-panel h3 {
  font-family: var(--font-serif);
  font-size: 20px;
  font-weight: 400;
  margin-bottom: var(--sp-3);
  margin-top: var(--sp-5);
}
.pd-tab-panel h3:first-child { margin-top: 0; }
.pd-tab-panel ul, .pd-tab-panel ol {
  padding-left: 1.5em;
  margin-bottom: var(--sp-4);
}
.pd-tab-panel li {
  font-size: 14px;
  line-height: 1.7;
  color: var(--ink-soft);
  margin-bottom: 6px;
}

/* ---------- 27. Related products carousel ---------- */
.pd-related {
  display: flex;
  gap: var(--sp-4);
  overflow-x: auto;
  padding-bottom: var(--sp-4);
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
}
.pd-related::-webkit-scrollbar { height: 6px; }
.pd-related::-webkit-scrollbar-track { background: var(--bone-soft); }
.pd-related::-webkit-scrollbar-thumb { background: var(--line); border-radius: 3px; }

.pd-related .product-card {
  flex: 0 0 calc(50% - var(--sp-2));
  scroll-snap-align: start;
}
@media (min-width: 768px) {
  .pd-related .product-card { flex: 0 0 calc(33.333% - var(--sp-3)); }
}
@media (min-width: 1024px) {
  .pd-related .product-card { flex: 0 0 calc(20% - var(--sp-3)); }
}

/* ---------- 28. Lightbox ---------- */
.lightbox {
  position: fixed; inset: 0;
  z-index: var(--z-search-overlay);
  background: rgba(0, 0, 0, 0.94);
  display: none;
  align-items: center;
  justify-content: center;
}
.lightbox.open { display: flex; }
.lightbox-img {
  max-width: 92vw;
  max-height: 88vh;
  object-fit: contain;
  user-select: none;
}
.lightbox-close,
.lightbox-nav {
  position: absolute;
  background: rgba(255, 255, 255, .12);
  border: none;
  color: #fff;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background var(--t-fast) var(--ease);
  backdrop-filter: blur(4px);
  border-radius: 50%;
}
.lightbox-close:hover, .lightbox-nav:hover { background: rgba(255, 255, 255, .22); }
.lightbox-close {
  top: 20px; right: 20px;
  width: 44px; height: 44px;
  font-size: 22px;
}
.lightbox-nav {
  top: 50%; transform: translateY(-50%);
  width: 48px; height: 48px;
  font-size: 22px;
}
.lightbox-prev { left: 24px; }
.lightbox-next { right: 24px; }
.lightbox-counter {
  position: absolute;
  bottom: 24px; left: 50%;
  transform: translateX(-50%);
  color: rgba(255, 255, 255, .8);
  font-size: 12px;
  letter-spacing: 2px;
}
@media (max-width: 768px) {
  .lightbox-prev { left: 8px; }
  .lightbox-next { right: 8px; }
  .lightbox-nav { width: 40px; height: 40px; }
}

/* ---------- 29. Modal Zalo ("Khác" popup) ---------- */
.modal-zalo .modal-body { text-align: center; padding: var(--sp-7) var(--sp-5); }
.modal-zalo-icon {
  width: 56px; height: 56px;
  background: #0068ff;
  color: #fff;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  margin: 0 auto var(--sp-4);
}
.modal-zalo h3 {
  font-size: 18px;
  margin-bottom: var(--sp-3);
}
.modal-zalo p {
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.6;
  margin-bottom: var(--sp-5);
}


/* Disabled variation option (combo không tồn tại với selection hiện tại) */
.pd-var-btn.pd-var-disabled,
.pd-color-chip.pd-var-disabled {
  opacity: 0.35;
  cursor: not-allowed;
  position: relative;
  pointer-events: auto; /* keep clickable to prevent click effects; JS blocks action */
}
.pd-var-btn.pd-var-disabled::after,
.pd-color-chip.pd-var-disabled::after {
  content: '';
  position: absolute;
  inset: 50% 0 auto 0;
  height: 1px;
  background: var(--ink-soft);
  transform: rotate(-8deg);
  pointer-events: none;
}
.pd-var-btn.pd-var-disabled:hover,
.pd-color-chip.pd-var-disabled:hover {
  border-color: var(--line);
  background: transparent;
}
