/* Product Detail Page (PDP)
   Keep layout responsive and consistent across wildly different CJ content.
*/

.p-pdp {
  padding: 24px 0;
}

.p-pdp__container {
  width: min(1100px, 92vw);
  margin: 0 auto;
}

.p-pdp__topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

/* breadcrumb module */
.c-breadcrumb {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 0.9rem;
  color: #6b7280;
}

.c-breadcrumb__link {
  color: inherit;
  text-decoration: none;
}

.c-breadcrumb__link:hover {
  text-decoration: underline;
}

.c-breadcrumb__sep {
  opacity: 0.6;
}

/* rating placeholder module */
.c-rating {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #6b7280;
  font-size: 0.9rem;
  white-space: nowrap;
}

.c-rating__stars {
  letter-spacing: 1px;
  opacity: 0.75;
}

.p-pdp__grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 26px;
}

@media (max-width: 900px) {
  .p-pdp__grid {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .p-pdp__topbar {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ---- Gallery ---- */
.c-gallery {
  display: grid;
  gap: 12px;
}

.c-gallery__primary {
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  overflow: hidden;
  background: #fff;
  padding: 0;
  cursor: zoom-in;
}

.c-gallery__primaryImg {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  display: block;
}

.c-gallery__primaryPlaceholder {
  width: 100%;
  aspect-ratio: 1 / 1;
  background: #f3f4f6;
}

.c-gallery__thumbRow {
  display: grid;
  grid-template-columns: 34px 1fr 34px;
  gap: 10px;
  align-items: center;
}

.c-gallery__thumbNav {
  height: 34px;
  width: 34px;
  border-radius: 10px;
  border: 1px solid #e5e7eb;
  background: #fff;
  cursor: pointer;
  line-height: 1;
}

.c-gallery__thumbNav:focus-visible {
  outline: 3px solid rgba(59, 130, 246, 0.35);
  outline-offset: 2px;
}

.c-gallery__thumbs {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 2px 2px;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.c-gallery__thumbs::-webkit-scrollbar {
  display: none;
}

.c-thumb {
  flex: 0 0 auto;
  width: 66px;
  height: 66px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #fff;
  overflow: hidden;
  cursor: pointer;
  padding: 0;
  scroll-snap-align: center;
}

.c-thumb__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.c-thumb.is-active {
  border-color: #111827;
  box-shadow: 0 0 0 2px rgba(17, 24, 39, 0.15);
}

.c-thumb:focus-visible {
  outline: 3px solid rgba(59, 130, 246, 0.35);
  outline-offset: 2px;
}

@media (max-width: 480px) {
  .c-gallery__thumbRow {
    grid-template-columns: 32px 1fr 32px;
  }

  .c-thumb {
    width: 58px;
    height: 58px;
  }
}

/* ---- Info ---- */
.p-pdp__title {
  font-size: 1.35rem;
  line-height: 1.25;
  margin: 0 0 10px;
}

.p-pdp__metaRow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.p-pdp__price {
  font-size: 1.25rem;
  font-weight: 700;
}

.p-pdp__ctas {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.p-pdp__ctaForm {
  margin: 0;
}

.p-pdp__ctaPrimary,
.p-pdp__ctaSecondary {
  width: 100%;
}

/* ---- Quantity ---- */
.c-qty {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.c-qty__label {
  font-weight: 600;
}

.c-qty__controls {
  display: grid;
  grid-template-columns: 40px 1fr 40px;
  gap: 10px;
  align-items: center;
}

.c-qty__btn {
  height: 38px;
  border-radius: 12px;
  border: 1px solid #e5e7eb;
  background: #fff;
  cursor: pointer;
}

.c-qty__input {
  height: 38px;
  border-radius: 12px;
  border: 1px solid #e5e7eb;
  text-align: center;
}

/* ---- Accordion / description ---- */
.p-pdp__accordion {
  margin-top: 16px;
  display: grid;
  gap: 10px;
}

.c-accordion {
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  overflow: hidden;
  background: #fff;
}

.c-accordion__summary {
  padding: 12px 14px;
  cursor: pointer;
  font-weight: 700;
}

.c-accordion__body {
  padding: 12px 14px 16px;
  border-top: 1px solid #e5e7eb;
}

.p-pdp__descBody {
  color: #374151;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

/* Make arbitrary CJ HTML safe on mobile */
.p-pdp__descBody img,
.p-pdp__descBody video,
.p-pdp__descBody iframe {
  max-width: 100% !important;
  height: auto !important;
}

.p-pdp__descBody table {
  display: block;
  max-width: 100%;
  overflow-x: auto;
}

.p-pdp__muted {
  color: #6b7280;
}

/* ---- Toast (debug / add-to-cart feedback) ---- */
.c-toast {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  background: rgba(17, 24, 39, 0.92);
  color: #fff;
  padding: 10px 12px;
  border-radius: 12px;
  max-width: min(520px, 92vw);
  z-index: 9999;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.18);
}

.c-toast__body {
  white-space: pre-line;
  font-size: 0.95rem;
}

/* ---- Lightbox ---- */
.c-lightbox {
  position: fixed;
  inset: 0;
  z-index: 10000;
}

.c-lightbox__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.66);
}

.c-lightbox__dialog {
  position: absolute;
  inset: 18px;
  display: grid;
  place-items: center;
}

.c-lightbox__img {
  max-width: min(100%, 1100px);
  max-height: min(100%, 82vh);
  width: auto;
  height: auto;
  border-radius: 14px;
  background: #111;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
}

.c-lightbox__close {
  position: fixed;
  top: 14px;
  right: 14px;
  height: 44px;
  width: 44px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(17, 24, 39, 0.85);
  color: #fff;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
}

.c-lightbox__close:focus-visible {
  outline: 3px solid rgba(255, 255, 255, 0.45);
  outline-offset: 2px;
}
