﻿/* ============================================================
   Product Detail Page  –  Modern Full-Page Layout
   ============================================================ */

/* --- Back Bar --- */
.pd-back-bar {
  padding: 10px 0 14px;
  margin-bottom: 4px;
}
.pd-back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--pl-accent, var(--c-primary));
  text-decoration: none;
  font-weight: 500;
}
.pd-back-link:hover {   
  color: var(--pl-accent, var(--c-primary));
  text-decoration: underline; 
}

.pd-back-link:visited {   
  color: var(--pl-accent, var(--c-primary));
  text-decoration: none; 
}
.pd-back-link i:hover { text-decoration: none!important;}
/* --- Page Layout --- */
.pd-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  align-items: start;
  margin-bottom: 32px;
}

/* --- Image Gallery Panel --- */
.pd-gallery {
  position: sticky;
  top: 16px;
  border: 1px solid #0000004e;
  border-radius: 8px;
  padding: 5px;
}
/* ---- Product Image Gallery (pdg) ---- */
.pdg-viewer {
  position: relative;
  cursor: zoom-in;
  border-radius: 8px;
  overflow: hidden;
  background: var(--c-bg-subtle);
  border: 1px solid var(--c-border-mid);
  user-select: none;
}
#pdg-main-img {
  width: 100%;
  height: 340px;
  object-fit: contain;
  display: block;
  transition: opacity .11s ease;
}
.pdg-zoom-hint {
  position: absolute;
  bottom: 10px;
  right: 10px;
  background: rgba(0,0,0,.38);
  color: #fff;
  border-radius: 5px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  pointer-events: none;
  opacity: .72;
  transition: opacity .15s;
}
.pdg-viewer:hover .pdg-zoom-hint { opacity: 1; }
.pdg-main-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255,255,255,.88);
  border: 1px solid var(--c-border-mid);
  border-radius: 50%;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #212b36;
  font-size: 12px;
  z-index: 2;
  opacity: .72;
  transition: opacity .15s, background .15s;
}
.pdg-viewer:hover .pdg-main-arrow { opacity: 1; }
.pdg-main-arrow:hover { background: #fff; box-shadow: 0 2px 8px rgba(0,0,0,.12); }
.pdg-main-prev { left: 8px; }
.pdg-main-next { right: 8px; }

/* ---- Thumbnail Strip ---- */
.pdg-thumbstrip {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
}
.pdg-th-btn {
  flex: 0 0 26px;
  width: 26px;
  height: 60px;
  background: var(--c-bg-subtle);
  border: 1px solid var(--c-border-mid);
  border-radius: 6px;
  color: var(--c-text-muted);
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  transition: background .15s;
}
.pdg-th-btn:hover { background: var(--c-border); color: #212b36; }
.pdg-thumbstrip.has-arrows .pdg-th-btn { display: flex; }
.pdg-thumbscroll {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  flex: 1;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.pdg-thumbscroll::-webkit-scrollbar { display: none; }
.pdg-thumb {
  flex: 0 0 64px;
  width: 64px;
  height: 64px;
  border: 2px solid var(--c-border-mid);
  border-radius: 6px;
  overflow: hidden;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
  background: var(--c-bg-subtle);
}
.pdg-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
.pdg-thumb:hover { border-color: var(--c-primary-border); }
.pdg-thumb.pdg-sel {
  border-color: var(--c-primary);
  box-shadow: 0 0 0 2px rgba(92,106,196,.22);
}

/* ---- Magnific Popup overrides ---- */
.mfp-bg { background: #000; opacity: .88; }
.mfp-fade.mfp-bg { opacity: 0; transition: opacity .25s ease; }
.mfp-fade.mfp-bg.mfp-ready { opacity: .88; }
.mfp-fade.mfp-bg.mfp-removing { opacity: 0; }
.mfp-fade.mfp-wrap .mfp-content { opacity: 0; transition: opacity .25s ease; }
.mfp-fade.mfp-wrap.mfp-ready .mfp-content { opacity: 1; }
.mfp-fade.mfp-wrap.mfp-removing .mfp-content { opacity: 0; }
.mfp-image-holder .mfp-content { max-width: 90vw; }
.mfp-arrow { opacity: .75; }
.mfp-arrow:hover { opacity: 1; }
.mfp-counter {
  color: rgba(255,255,255,.75);
  font-size: 13px;
  font-weight: 500;
  right: 8px;
  top: 8px;
}
.pd-no-image {
  width: 100%;
  height: 280px;
  background: var(--c-bg-subtle);
  border: 1px solid var(--c-border-mid);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #aaa;
  font-size: 14px;
}
.pd-no-image i { font-size: 42px; opacity: .4; }

/* --- Product Info Panel --- */
.pd-info { }

.pd-product-name {
  font-size: 1.4rem;
  font-weight: 700;
  color: #212b36;
  line-height: 1.3;
  margin: 0 0 12px;
}

.pd-meta-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin-bottom: 16px;
}
.pd-meta-table td {
  padding: 5px 0;
  border-bottom: 1px solid var(--c-bg-subtle);
  vertical-align: top;
}
.pd-meta-table td.pd-label {
  font-weight: 700;
  color: var(--c-text-muted);
  width: 130px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .04em;
  padding-right: 12px;
  white-space: nowrap;
}
.pd-meta-table td.pd-value {
  color: #212b36;
}
.pd-meta-table tr:last-child td { border-bottom: none; }

/* --- Pricing Block --- */
.pd-pricing {
  margin: 16px 0;
  padding: 16px;
  background: var(--c-bg-subtle);
  border-radius: 8px;
  border: 1px solid var(--c-border-mid);
}
.pd-price-main {
  font-size: 1.6rem;
  font-weight: 800;
  color: #212b36;
  line-height: 1;
  margin-bottom: 4px;
}
.pd-price-status {
  font-size: 12px;
  font-weight: 400;
  color: var(--c-text-muted);
  margin-left: 4px;
}
.pd-promo-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  padding: 6px 14px;
  background: var(--c-green-lt);
  color: var(--c-green-dark);
  border: 1px solid #a3cfbb;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  cursor: default;
  transition: background .15s;
}
.pd-promo-badge:hover { background: #a3cfbb; }

/* --- Cart Controls --- */
.pd-cart-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin: 16px 0;
}
.pd-qty-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--c-text-muted);
  text-transform: uppercase;
}
.pd-qty-wrap {
  display: flex;
  align-items: center;
  border: 1px solid var(--c-border-mid);
  border-radius: 6px;
  overflow: hidden;
  background: #fff;
}
.pd-qty-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 38px;
  background: var(--c-bg-subtle);
  border: none;
  cursor: pointer;
  font-size: 14px;
  color: var(--c-text-muted);
  transition: background .1s;
  outline: none;
}
.pd-qty-btn:hover { background: var(--c-border); color: #212b36; }
.pd-qty-field {
  width: 56px;
  height: 38px;
  border: none;
  border-left: 1px solid var(--c-border-mid);
  border-right: 1px solid var(--c-border-mid);
  text-align: center;
  font-size: 15px;
  font-weight: 600;
  color: #212b36;
  -moz-appearance: textfield;
  outline: none;
}
.pd-qty-field::-webkit-outer-spin-button,
.pd-qty-field::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.pd-btn-cart {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 22px;
  height: 40px;
  background: #ddd;
  color: #888;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 700;
  cursor: not-allowed;
  text-decoration: none !important;
  transition: background .15s, color .15s;
}
.pd-btn-cart:hover,.pd-btn-cart:visited,.pd-btn-cart:focus,.pd-btn-cart:active { text-decoration: none !important; }
.pd-btn-cart.pd-cart-ready {
  background: var(--c-green-vivid);
  color: #fff;
  cursor: pointer;
}
.pd-btn-cart.pd-cart-ready:hover { background: var(--c-green-dark); }

.pd-btn-fav {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: none;
  border: 1px solid var(--c-border-mid);
  border-radius: 6px;
  color: #aaa;
  font-size: 16px;
  cursor: pointer;
  transition: color .15s, border-color .15s, background .15s;
  text-decoration: none !important;
}
.pd-btn-fav:hover,.pd-btn-fav:visited,.pd-btn-fav:focus,.pd-btn-fav:active { text-decoration: none !important; }
.pd-btn-fav:hover { color: var(--c-danger); border-color: var(--c-danger); background: var(--c-red-lt); }
.pd-btn-fav.pd-fav-active { color: var(--c-danger); border-color: var(--c-danger); }

/* --- Tabs --- */
.pd-tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--c-border-mid);
  margin-bottom: 0;
}
.pd-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  font-size: 13px;
  font-weight: 600;
  color: var(--c-text-muted);
  cursor: pointer;
  transition: color .15s, border-color .15s;
}
.pd-tab-btn:hover { color: var(--c-primary); }
.pd-tab-btn.active {
  color: var(--c-primary);
}

/* --- Tab Panels --- */
.pd-tab-panel {
  display: none;
  padding: 16px 0;
}
.pd-tab-panel.active { display: block; }

/* Product notes */
.pd-note-box {
  font-size: 13px;
  color: #444;
  line-height: 1.7;
  background: var(--c-bg-subtle);
  border: 1px solid var(--c-border-mid);
  border-radius: 6px;
  padding: 14px 16px;
  min-height: 60px;
}

/* Promo table in product detail */
.pd-promo-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.pd-promo-table th,
.pd-promo-table td {
  padding: 9px 14px;
  border-bottom: 1px solid var(--c-border-mid);
  text-align: center;
}
.pd-promo-table thead tr {
  background: var(--c-bg-subtle);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--c-text-muted);
  font-weight: 700;
}
.pd-promo-table tbody tr:hover { background: var(--c-bg-subtle); }
.pd-promo-table td:last-child { padding: 6px 14px; }
.pd-select-qty-btn {
  display: inline-flex;
  align-items: center;
  padding: 5px 14px;
  background: var(--c-primary);
  color: #fff;
  border: none;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
}
.pd-select-qty-btn:hover { background: var(--c-primary-hover); }

/* ============================================================
   Purchase History Timeline
   ============================================================ */
.ph-section {
  margin: 32px 0;
}
.ph-heading {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--c-primary);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 20px;
}
.ph-heading i { font-size: 13px; }
.ph-timeline {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 8px;
  height: 140px;
  padding: 10px 0;
  overflow-x: auto;
}
.ph-item {
  flex: 1;
  min-width: 50px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}
.ph-bar-wrap {
  width: 100%;
  max-width: 40px;
  height: 100px;
  background: var(--c-bg-subtle);
  border-radius: 4px 4px 0 0;
  position: relative;
  display: flex;
  align-items: flex-end;
  overflow: hidden;
}
.ph-bar {
  width: 100%;
  background: linear-gradient(180deg, var(--c-primary) 0%, var(--c-primary) 100%);
  border-radius: 4px 4px 0 0;
  transition: height .3s ease, background .3s ease;
  min-height: 5%;
}
.ph-item:hover .ph-bar {
  background: linear-gradient(180deg, var(--c-primary) 0%, var(--c-primary) 100%);
}
.ph-count {
  font-size: 12px;
  font-weight: 700;
  color: var(--c-primary);
  text-align: center;
}
.ph-month {
  font-size: 10px;
  color: var(--c-text-muted);
  text-align: center;
  white-space: nowrap;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .03em;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 900px) {
  .pd-layout {
    grid-template-columns: 1fr;
    gap: 24px;
  }
  .pd-gallery { position: static; }
}
@media (max-width: 600px) {
  .pd-product-name { font-size: 1.15rem; }
  .pd-price-main   { font-size: 1.3rem; }
  .pd-btn-cart { min-width: 100px; font-size: 11px; }
}

/* ============================================================
   Related Products Carousel
   ============================================================ */
.rp-section {
  margin-top: 36px;
  padding-top: 24px;
  border-top: 2px solid var(--c-border);
}
.rp-heading {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--c-primary);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 16px;
}
.rp-heading i { font-size: 13px; }
/* Flickity nav arrows */
.rp-carousel .flickity-button {
  background: var(--c-primary);
  width: 30px;
  height: 30px;
  opacity: 1;
  box-shadow: 0 2px 6px rgba(61,61,151,.3);
}
.rp-carousel .flickity-button:hover { background: var(--c-primary-hover); }
.rp-carousel .flickity-button-icon { fill: #fff; }
.rp-carousel .flickity-prev-next-button.previous { left: -10px; }
.rp-carousel .flickity-prev-next-button.next     { right: -10px; }
/* Equal-height cells: make each Flickity cell a flex container */
.rp-carousel .flickity-slider {
  display: flex;
  align-items: stretch;
}
.rp-carousel .flickity-slider > * {
  display: flex;
}
.rp-card {
  width: 175px;
  height: auto;         /* driven by tallest card */
  align-self: stretch;  /* fill the full row height */
  margin-right: 10px;
  background: #fff;
  border: 1px solid var(--c-border);
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
  transition: box-shadow .15s, transform .15s;
}
.rp-card:hover {
  box-shadow: 0 4px 14px rgba(61,61,151,.14);
  transform: translateY(-2px);
}
.rp-img-wrap {
  display: block;
  aspect-ratio: 1 / 1;
  background: var(--c-bg-subtle);
  overflow: hidden;
  padding: 8px;
}
.rp-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: transform .2s;
}
.rp-card:hover .rp-img-wrap img { transform: scale(1.05); }
.rp-body {
  flex: 1;
  padding: 8px 10px 4px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.rp-code {
  font-size: 10px;
  color: var(--c-text-subtle);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.rp-name {
  font-size: 12px;
  color: #212b36;
  font-weight: 600;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-decoration: none;
  margin-top: 2px;
  min-height: 32px;
  /* Must only be two lines, elipses if more */
  max-height: 2.7em;
  height: calc(2.7em);
  text-overflow: ellipsis;
}
.rp-name:hover { color: var(--c-primary); text-decoration: none; }
.rp-price {
  font-size: 13px;
  font-weight: 700;
  color: var(--c-primary);
  margin-top: 6px;
}
.rp-price-status {
  font-size: 10px;
  font-weight: 400;
  color: var(--c-text-muted);
  margin-left: 2px;
}
.rp-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 7px 10px;
  background: var(--c-primary);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  text-decoration: none;
  letter-spacing: .02em;
  border-top: 1px solid rgba(0,0,0,.06);
  transition: background .15s;
}
.rp-btn:hover { background: var(--c-primary-hover); color: #fff; text-decoration: none; }
@media (max-width: 600px) {
  .rp-card { width: 148px; }
}


@media (max-width: 500px) {
  #pd-tab-promo .pd-promo-table {
    width: 100%;
    margin: 0;
    font-size: 12px;
  }

  /* Hide the column header row — labels shown via ::before */
  #pd-tab-promo .pd-promo-table thead { display: none; }

  /* Each row becomes a card */
  #pd-tab-promo .pd-promo-table tbody tr {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    border: 1px solid var(--c-border-mid);
    border-radius: 8px;
    margin-bottom: 10px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,.06);
  }

  /* All data cells share the top row evenly */
  #pd-tab-promo .pd-promo-table tbody tr td {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 8px 4px 6px;
    text-align: center;
    border-bottom: none;
    gap: 3px;
    min-width: 0;
  }

  /* Small uppercase label above each value */
  #pd-tab-promo .pd-promo-table tbody tr td::before {
    display: block;
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--c-text-muted);
    line-height: 1;
    white-space: nowrap;
  }

  #pd-tab-promo .pd-promo-table tbody tr td:nth-child(1)::before { content: "Buy Qty"; }
  #pd-tab-promo .pd-promo-table tbody tr td:nth-child(2)::before { content: "Free Qty"; }
  #pd-tab-promo .pd-promo-table tbody tr td:nth-child(3)::before { content: "Promo"; }
  #pd-tab-promo .pd-promo-table tbody tr td:nth-child(4)::before { content: "List"; }
  #pd-tab-promo .pd-promo-table tbody tr td:nth-child(5)::before { content: "Saving"; }

  /* Value text */
  #pd-tab-promo .pd-promo-table tbody tr td:not(:last-child) {
    font-weight: 600;
    color: #212b36;
    font-size: 12px;
    border-right: 1px solid var(--c-border-mid);
  }

  /* Select button cell: full-width action strip at the bottom */
  #pd-tab-promo .pd-promo-table tbody tr td:last-child {
    flex: 0 0 100%;
    padding: 0;
    border-top: 1px solid var(--c-border-mid);
    border-right: none;
  }
  #pd-tab-promo .pd-promo-table tbody tr td:last-child::before { display: none; }

  #pd-tab-promo .pd-promo-table tbody tr td:last-child .pd-select-qty-btn {
    display: flex;
    width: 100%;
    justify-content: center;
    border-radius: 0;
    padding: 8px;
    font-size: 12px;
  }
}