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

.p-pdp {
  padding: var(--s-6) 0;
}

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

.p-pdp__topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-4);
  margin-bottom: var(--s-3);
}

/* breadcrumb module */
.c-breadcrumb {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 0.9rem;
  color: var(--n-600);
}

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

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

.c-breadcrumb__sep {
  opacity: 0.6;
}

/* rating summary link (topbar) */
.c-rating {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  color: var(--n-600);
  font-size: 0.9rem;
  white-space: nowrap;
  text-decoration: none;
}

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

.c-rating__stars {
  letter-spacing: 1px;
  color: var(--accent-600);
}

.p-pdp__grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: var(--s-6);
}

@media (max-width: 991.98px) {
  .p-pdp__grid {
    grid-template-columns: 1fr;
    gap: var(--s-5);
  }

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

/* ---- Gallery ---- */
.c-gallery {
  display: grid;
  gap: var(--s-3);
}

.c-gallery__primary {
  border: 1px solid var(--n-200);
  border-radius: var(--r-lg);
  overflow: hidden;
  background: var(--bg-0);
  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: var(--bg-100);
}

.c-gallery__thumbRow {
  display: grid;
  grid-template-columns: 34px 1fr 34px;
  gap: var(--s-3);
  align-items: center;
}

.c-gallery__thumbNav {
  height: 34px;
  width: 34px;
  border-radius: var(--r-sm);
  border: 1px solid var(--n-200);
  background: var(--bg-0);
  cursor: pointer;
  line-height: 1;
}

.c-gallery__thumbNav:focus-visible {
  outline: 3px solid rgba(17, 102, 214, 0.35);
  outline-offset: 2px;
}

.c-gallery__thumbs {
  display: flex;
  gap: var(--s-3);
  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 var(--n-200);
  border-radius: var(--r-md);
  background: var(--bg-0);
  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: var(--n-800);
  box-shadow: 0 0 0 2px rgba(32, 42, 60, 0.15);
}

.c-thumb:focus-visible {
  outline: 3px solid rgba(17, 102, 214, 0.35);
  outline-offset: 2px;
}

@media (max-width: 575.98px) {
  .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 var(--s-3);
  color: var(--n-900);
}

.p-pdp__metaRow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  margin-bottom: var(--s-3);
}

.p-pdp__price {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--n-900);
}

.p-pdp__ctas {
  display: grid;
  gap: var(--s-3);
  margin-top: var(--s-4);
}

.p-pdp__ctaForm {
  margin: 0;
}

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

.p-pdp__ctaSecondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
}

/* ---- Quantity ---- */
.c-qty {
  display: grid;
  gap: var(--s-2);
  margin-top: var(--s-3);
}

.c-qty__label {
  font-weight: 600;
  color: var(--n-900);
}

.c-qty__controls {
  display: grid;
  grid-template-columns: 40px 1fr 40px;
  gap: var(--s-3);
  align-items: center;
}

.c-qty__btn {
  height: 38px;
  border-radius: var(--r-md);
  border: 1px solid var(--n-200);
  background: var(--bg-0);
  cursor: pointer;
}

.c-qty__input {
  height: 38px;
  border-radius: var(--r-md);
  border: 1px solid var(--n-200);
  text-align: center;
}

/* ---- Accordion / description ---- */
.p-pdp__accordion {
  margin-top: var(--s-4);
  display: grid;
  gap: var(--s-3);
}

.c-accordion {
  border: 1px solid var(--n-200);
  border-radius: var(--r-lg);
  overflow: hidden;
  background: var(--bg-0);
}

.c-accordion__summary {
  padding: var(--s-3) var(--s-4);
  cursor: pointer;
  font-weight: 700;
  color: var(--n-900);
}

.c-accordion__body {
  padding: var(--s-3) var(--s-4) var(--s-4);
  border-top: 1px solid var(--n-200);
}

.p-pdp__descBody {
  color: var(--n-700);
  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: var(--n-600);
}

/* ---- Toast (debug / add-to-cart feedback) ---- */
.c-toast {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  background: rgba(32, 42, 60, 0.94);
  color: #fff;
  padding: var(--s-3);
  border-radius: var(--r-md);
  max-width: min(520px, 92vw);
  z-index: 9999;
  box-shadow: var(--shadow-2);
}

.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(11, 18, 32, 0.7);
}

.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: var(--r-lg);
  background: var(--n-900);
  box-shadow: var(--shadow-2);
}

.c-lightbox__close {
  position: fixed;
  top: var(--s-4);
  right: var(--s-4);
  height: 44px;
  width: 44px;
  border-radius: var(--r-pill);
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(32, 42, 60, 0.9);
  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;
}

/* ==================================================================
   Wishlist toggle button states
   ================================================================== */
.js-wishlist-toggle .js-wishlist-icon {
  font-size: 16px;
  line-height: 1;
}

.js-wishlist-toggle.is-active {
  border-color: var(--accent-600);
  background: rgba(255, 193, 7, 0.14);
  color: var(--n-900);
}

.js-wishlist-toggle.is-active .js-wishlist-icon {
  color: var(--accent-600);
}

/* ==================================================================
   Reviews section
   ================================================================== */
.p-pdp__reviews {
  margin-top: var(--s-8);
  padding-top: var(--s-6);
  border-top: 1px solid var(--n-200);
}

.p-pdp__reviewsTitle {
  font-size: 1.15rem;
  margin: 0 0 var(--s-5);
  color: var(--n-900);
}

.c-reviewsSummary {
  display: flex;
  align-items: center;
  gap: var(--s-5);
  margin-bottom: var(--s-6);
}

.c-reviewsSummary__score {
  font-size: 2.5rem;
  font-weight: 800;
  line-height: 1;
  color: var(--n-900);
}

.c-reviewsSummary__stars {
  color: var(--accent-600);
  letter-spacing: 2px;
  font-size: 1.1rem;
}

.c-reviewsSummary__count {
  color: var(--n-600);
  font-size: 0.9rem;
  margin-top: 4px;
}

.c-reviewForm {
  display: grid;
  gap: var(--s-3);
  max-width: 520px;
  margin-bottom: var(--s-7);
  padding: var(--s-5);
  border: 1px solid var(--n-200);
  border-radius: var(--r-lg);
  background: var(--bg-50);
}

.c-reviewForm__title,
.c-reviewForm__body {
  width: 100%;
  border: 1px solid var(--n-200);
  border-radius: var(--r-md);
  padding: var(--s-2) var(--s-3);
  font: inherit;
  background: var(--bg-0);
  color: var(--n-900);
}

.c-reviewForm__body {
  resize: vertical;
  min-height: 90px;
}

.c-reviewForm .c-btn {
  justify-self: start;
}

/* Star rating input: radios in reverse DOM order, styled right-to-left via
   the general sibling combinator so hover/checked light up all stars up to
   the current one despite the visual order matching source order. */
.c-ratingInput {
  display: flex;
  flex-direction: row-reverse;
  justify-content: flex-end;
  gap: 4px;
  border: 0;
  padding: 0;
  margin: 0;
}

.c-ratingInput legend {
  font-weight: 600;
  color: var(--n-900);
  margin-bottom: var(--s-2);
  width: 100%;
}

.c-ratingInput input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.c-ratingInput label {
  font-size: 1.5rem;
  line-height: 1;
  color: var(--n-300);
  cursor: pointer;
  transition: color 120ms ease;
}

.c-ratingInput input[type="radio"]:checked ~ label,
.c-ratingInput label:hover,
.c-ratingInput label:hover ~ label {
  color: var(--accent-600);
}

.c-ratingInput input[type="radio"]:focus-visible + label {
  outline: 3px solid rgba(17, 102, 214, 0.35);
  outline-offset: 2px;
}

.c-reviewList {
  display: grid;
  gap: var(--s-5);
}

.c-reviewCard {
  padding-bottom: var(--s-5);
  border-bottom: 1px solid var(--n-200);
}

.c-reviewCard:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.c-reviewCard__top {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  margin-bottom: var(--s-2);
}

.c-reviewCard__stars {
  color: var(--accent-600);
  letter-spacing: 1px;
}

.c-reviewCard__title {
  font-size: 1rem;
  font-weight: 700;
  margin: 0 0 var(--s-2);
  color: var(--n-900);
}

.c-reviewCard__body {
  color: var(--n-700);
  line-height: 1.5;
  margin: 0 0 var(--s-2);
  overflow-wrap: anywhere;
}

.c-reviewCard__meta {
  color: var(--n-600);
  font-size: 0.85rem;
}

.c-reviewsPagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-4);
  margin-top: var(--s-6);
  color: var(--n-600);
  font-size: 0.9rem;
}

.c-reviewsPagination a {
  color: var(--secondary-600);
  text-decoration: none;
  font-weight: 600;
}

.c-reviewsPagination a:hover {
  text-decoration: underline;
}

@media (max-width: 575.98px) {
  .c-reviewsSummary {
    gap: var(--s-4);
  }

  .c-reviewsSummary__score {
    font-size: 2rem;
  }

  .c-reviewForm {
    padding: var(--s-4);
  }
}
