/* =========================================
   PRODUCT PAGE LAYOUT
========================================= */

.product-page-container {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  max-width: 1280px;
  margin: 0 auto;
  min-height: 100vh;
  padding: 0 20px;
  background: #fff;
}

/* =========================================
   IMAGE GALLERY (LEFT SIDE)
========================================= */
.product-gallery {
  display: flex;
  flex-direction: column;
  background-color: #fff;
  padding: 40px 20px 20px 0;
  /* Remove left padding, add gap to the right */
  overflow-x: hidden;
  /* prevent any child overflow from causing page-level scroll */
  min-width: 0;
}

.main-image {
  position: relative;
  /* Fix for absolute positioned nav arrows */
  width: 100%;
  max-width: 540px;
  max-height: 720px;
  margin-left: 0;
  /* Align left within the column */
  margin-right: auto;
  margin-bottom: 16px;
  background-color: #f0f0f0;
  overflow: hidden;
  cursor: zoom-in;
  /* Fixed aspect ratio — prevents height jump when switching images */
  aspect-ratio: 3 / 4;
  /* background-image/size/position set by JS hover zoom */
  background-repeat: no-repeat;
  background-size: 200%;
  /* Reduced from 220% — less aggressive zoom, less blur */
  transition: background-image 0s;
}

.main-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  /* fills fixed box — no layout shift */
  display: block;
  object-position: center top;
}

.thumbnail-list {
  display: flex;
  justify-content: flex-start;
  /* Align thumbnails to the left with main image */
  gap: 10px;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 4px 0 4px 2px;
  /* minimal breathing room — no longer needs outline-offset hacks */
  width: 100%;
  /* constrain to parent — overflow-x:auto only works when width is bounded */
  max-width: 540px;
  /* Matches main-image width */
  margin-left: 0;
  margin-right: auto;
  min-width: 0;
  /* allow shrinking as flex child */
  box-sizing: border-box;
  /* Firefox */
}

.thumbnail-list::-webkit-scrollbar {
  display: none;
  /* Chrome/Safari */
}

.thumbnail {
  width: 88px;
  height: 116px;
  object-fit: cover;
  object-position: center top;
  /* show face/upper body, not waist */
  cursor: pointer;
  opacity: 0.55;
  transition: opacity 0.2s ease, border-color 0.2s ease;
  border-radius: 6px;
  /* border always occupies box space — never overflows parent, never gets clipped */
  border: 2px solid transparent;
  box-sizing: border-box;
  /* border included in 88×116 — no layout shift */
  flex-shrink: 0;
  display: block;
}

.thumbnail:hover {
  opacity: 0.85;
}

.thumbnail.active {
  opacity: 1;
  border-color: #111;
  /* crisp, premium black border — all 4 sides, always visible */
}

/* =========================================
   MAIN IMAGE NAVIGATION ARROWS (Desktop)
   Injected by initZoom() in product.js
========================================= */
.main-img-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.82);
  border: none;
  width: 36px;
  height: 72px;
  cursor: pointer;
  font-size: 2rem;
  color: #222;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s ease, background 0.2s ease;
  z-index: 10;
  border-radius: 0 4px 4px 0;
  line-height: 1;
  user-select: none;
  /* Don't trigger hover zoom */
  pointer-events: auto;
}

.main-img-nav.main-img-next {
  right: 0;
  border-radius: 4px 0 0 4px;
}

.main-img-nav.main-img-prev {
  left: 0;
}

/* Show on hover over main image (desktop only) */
.main-image:hover .main-img-nav {
  opacity: 1;
}

/* Mobile: never show arrows (swipe handles navigation) */
@media (max-width: 768px) {
  .main-img-nav {
    display: none !important;
  }
}


/* =========================================
   SIZE GUIDE PANEL
========================================= */
.size-guide-panel {
  position: fixed;
  top: 0;
  right: -100%;
  width: 90vw;
  max-width: 400px;
  height: 100vh;
  background: var(--bg-color, #fff);
  z-index: 2000;
  transition: right 0.4s cubic-bezier(0.77, 0, 0.175, 1);
  display: flex;
  flex-direction: column;
  box-shadow: -5px 0 15px rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

.size-guide-panel.active {
  right: 0;
}

.size-guide-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

.size-guide-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.size-guide-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 25px;
  border-bottom: 1px solid var(--border-light, #eaeaea);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 1px;
}

.close-panel-btn {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: #333;
}

.size-guide-content {
  flex: 1;
  overflow-y: auto;
  padding: 25px;
}

.size-chart-image {
  width: 100%;
  height: auto;
  display: block;
}

.size-chart-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.size-chart-table th,
.size-chart-table td {
  border: 1px solid #eaeaea;
  padding: 10px;
  text-align: center;
}

.size-chart-table th {
  background: #f9f9f9;
  font-weight: 600;
}


/* =========================================
   PRODUCT INFO (RIGHT SIDE STICKY)
========================================= */
.product-info-wrapper {
  padding: 40px 0 40px 20px;
  background: #fff;
}

.product-info {
  position: sticky;
  top: 100px;
  /* Offset for topbar */
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-width: 500px;
  margin: 0 auto;
}

.product-breadcrumbs {
  font-size: 0.75rem;
  color: #888;
  text-transform: none;
  letter-spacing: 1px;
  margin-bottom: 8px;
}

.product-breadcrumbs a {
  color: inherit;
  text-decoration: none;
  transition: color 0.2s;
}

.product-breadcrumbs a:hover {
  color: #000;
}

.product-page-title {
  font-size: 1.8rem;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 1px;
  margin: 0;
  line-height: 1.1;
  color: #000;
}

.product-title-tags-wrapper {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 4px;
}

.product-price-badge-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.product-page-price {
  font-size: 1.25rem;
  font-weight: 500;
  color: #000;
  margin: 0;
}

.product-badge {
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 0;
}

/* Promotion Badge */
.promo-badge-label {
  display: inline-block;
  background: #111;
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 1.5px;
  padding: 3px 8px;
  text-transform: uppercase;
  margin: 0;
}

.promo-badge-text {
  display: inline-block;
  background: #f0f0f0;
  color: #333;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 1px;
  padding: 3px 8px;
  margin: 0;
}

.product-gender-label {
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 1px;
  color: #888;
  text-transform: uppercase;
  margin-top: 2px;
  margin-bottom: 8px;
}

/* Tags - chip style near title */
.product-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
}

.tag-chip {
  display: inline-block;
  background: #fff;
  color: #111;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 1px;
  padding: 3px 8px;
  text-transform: uppercase;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.product-description {
  font-size: 0.9rem;
  color: #444;
  line-height: 1.6;
  font-weight: 400;
  margin-bottom: 12px;
}

/* Rich text content from Quill editor */
#product-description-content h2 {
  font-size: 1rem;
  font-weight: 700;
  color: #111;
  margin: 14px 0 6px;
}

#product-description-content h3 {
  font-size: 0.92rem;
  font-weight: 600;
  color: #222;
  margin: 12px 0 4px;
}

#product-description-content p {
  margin-bottom: 8px;
  color: #444;
  line-height: 1.65;
}

#product-description-content ul,
#product-description-content ol {
  padding-left: 1.4rem;
  margin: 6px 0 10px;
}

#product-description-content li {
  margin-bottom: 4px;
  color: #444;
  font-size: 0.88rem;
}

#product-description-content strong {
  font-weight: 700;
}

#product-description-content em {
  font-style: italic;
}

#product-description-content a {
  color: #111;
  text-decoration: underline;
  text-underline-offset: 2px;
}

#product-description-content a:hover {
  color: #555;
}

/* =========================================
   COLOR SELECTOR
========================================= */
.product-color-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.color-selector-label {
  font-size: 0.78rem;
  color: #666;
  font-weight: 400;
}

.color-selector-label .selected-color-name {
  font-weight: 600;
  color: #000;
}

.color-swatches {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.color-swatch {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  outline: 2px solid transparent;
  outline-offset: 2px;
  transition: outline-color 0.15s, transform 0.15s;
  padding: 0;
}

.color-swatch:hover {
  transform: scale(1.1);
}

.color-swatch.active {
  outline-color: #000;
}

/* Size: out of stock */
.size-box.size-oos {
  opacity: 0.35;
  cursor: not-allowed;
  position: relative;
}

.size-box.size-oos::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom right, transparent 45%, #ccc 45%, #ccc 55%, transparent 55%);
}

/* =========================================
   SIZE SELECTOR
========================================= */
.size-selector-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 12px;
}

.size-label {
  font-size: 0.75rem;
  font-weight: 400;
  text-transform: none;
  color: #666;
}

.size-guide-btn {
  font-size: 0.75rem;
  text-decoration: underline;
  color: #666;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  transition: color 0.2s;
}

.size-guide-btn:hover {
  color: #000;
}

.size-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.size-box {
  border: 1px solid #e0e0e0;
  padding: 10px 0;
  text-align: center;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  color: #000;
  transition: all 0.2s ease;
  user-select: none;
}

.size-box input {
  display: none;
}

.size-box:hover {
  border-color: #999;
}

.size-box:has(input:checked) {
  border-color: #000;
  background-color: #000;
  color: #fff;
}

/* =========================================
   QUANTITY SELECTOR
========================================= */
.quantity-selector {
  display: flex;
  align-items: center;
  border: none;
  background-color: #f5f5f5;
  height: 52px;
  width: 90px;
  flex-shrink: 0;
}

.qty-btn {
  background: none;
  border: none;
  width: 30px;
  height: 100%;
  cursor: pointer;
  font-size: 1.2rem;
  color: #000;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: background 0.2s ease;
}

.qty-btn:hover {
  background: #e0e0e0;
}

.qty-input {
  width: 30px;
  height: 100%;
  border: none;
  text-align: center;
  font-size: 0.9rem;
  font-weight: 600;
  color: #000;
  background: transparent;
}

.qty-input:focus {
  outline: none;
}

/* =========================================
   PRODUCT ACTIONS (BUTTONS)
========================================= */
.product-actions {
  display: flex;
  align-items: stretch;
  gap: 10px;
  margin-top: 24px;
}

.btn-add-to-cart,
.btn-buy-now {
  flex: 1;
  height: 52px;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0;
  text-transform: none;
  font-weight: 700;
  letter-spacing: 1px;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 0.85rem;
  white-space: nowrap;
}

.btn-add-to-cart {
  background-color: #fff;
  color: #000;
  border: 1px solid #000;
}

.btn-add-to-cart:hover {
  background-color: #f5f5f5;
}

.btn-buy-now {
  background-color: #000;
  color: #fff;
  border: 1px solid #000;
}

.btn-buy-now:hover {
  opacity: 0.9;
  background-color: #222;
}

/* =========================================
   ACCORDIONS (PRODUCT DETAILS)
========================================= */
.product-accordion {
  border-top: 1px solid #eaeaea;
  margin-top: 24px;
}

.product-accordion details {
  border-bottom: 1px solid #eaeaea;
}

.product-accordion summary {
  padding: 20px 0;
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: none;
  letter-spacing: 1px;
  color: #000;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  list-style: none;
  /* Removes default arrow in most browsers */
}

.product-accordion summary::-webkit-details-marker {
  display: none;
  /* Removes default arrow in Safari/Chrome */
}

.product-accordion summary::after {
  content: '+';
  font-size: 1.2rem;
  font-weight: 400;
  color: #000;
}

.product-accordion details[open] summary::after {
  content: '−';
}

.accordion-content {
  padding-bottom: 20px;
  font-size: 0.85rem;
  color: #555;
  line-height: 1.6;
  word-break: break-word;
  overflow-wrap: break-word;
  overflow-x: hidden;
}

.accordion-content * {
  max-width: 100% !important;
  box-sizing: border-box;
  white-space: normal !important;
}

.accordion-content img,
.accordion-content iframe,
.accordion-content video {
  max-width: 100% !important;
  height: auto !important;
}

.accordion-content table {
  width: 100% !important;
  table-layout: fixed;
  overflow-wrap: break-word;
}

.accordion-content ul,
.accordion-content ol {
  padding-left: 20px;
  margin-top: 10px;
  margin-bottom: 10px;
}

.accordion-content ul {
  list-style-type: disc !important;
}

.accordion-content ol {
  list-style-type: decimal !important;
}

.accordion-content li {
  margin-bottom: 6px;
}

/* =========================================
   RESPONSIVE DESIGN (MOBILE)
========================================= */
@media (max-width: 992px) {
  .product-page-container {
    grid-template-columns: 1fr;
    max-width: 100%;
    padding: 50px 0 0 0;
    /* Clear left/right padding on mobile, account for topbar */
    margin: 0;
  }

  .product-info-wrapper {
    padding: 32px 20px 20px 20px;
    /* Bottom padding for sticky cart btn if needed */
  }

  .product-info {
    position: static;
    max-width: 100%;
  }

  .product-page-title {
    font-size: 1.5rem;
  }

  /* Adjust gallery for mobile */
  .product-gallery {
    padding: 0;
    /* Edge to edge on mobile */
  }

  .main-image {
    width: 100%;
    max-height: none;
    max-width: 100%;
    margin: 0 0 8px 0;
    aspect-ratio: 3 / 4;
    border-radius: 0;
  }

  .main-image img {
    /* natural height — full portrait visible on mobile */
  }

  .thumbnail-list {
    padding: 4px 16px 16px 16px;
    justify-content: flex-start;
    /* reset desktop flex-end alignment */
    margin: 0;
    max-width: 100%;
  }


  /* Fix for cramped product actions on mobile */
  .product-actions {
    flex-wrap: wrap;
    gap: 12px;
  }

  .quantity-selector {
    width: 100%;
    justify-content: center;
    background-color: #f9f9f9;
  }

  .btn-add-to-cart,
  .btn-buy-now {
    flex: 1;
    min-width: 45%;
    padding: 0 10px;
  }
}

/* =========================================
   YOU MAY ALSO LIKE (RECOMMENDATIONS)
========================================= */
.recommendations-section {
  width: 100%;
  padding: 60px 0;
  background: #fff;
  border-top: 1px solid #eaeaea;
}

.recommendations-title {
  text-align: center;
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: 2px;
  margin-bottom: 30px;
}

.recommendations-tabs {
  display: flex;
  justify-content: center;
  gap: 30px;
  margin-bottom: 40px;
}

.recommendation-tab {
  background: none;
  border: none;
  font-size: 0.85rem;
  font-weight: 600;
  color: #888;
  padding-bottom: 5px;
  cursor: pointer;
  transition: color 0.2s;
}

.recommendation-tab.active {
  color: #000;
  border-bottom: 2px solid #000;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

.recommendations-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 2px;
  background: #fff;
  /* If you want gap lines, set bg here and card bg to white */
}

@media (max-width: 768px) {
  .recommendations-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Scoped Product Card for Recommendations */
.rec-product-card {
  display: flex;
  flex-direction: column;
  cursor: pointer;
  background: #fff;
  text-decoration: none;
  color: inherit;
}

.rec-product-image {
  position: relative;
  width: 100%;
  aspect-ratio: 4/5;
  overflow: hidden;
  background-color: #e5e5e5;
}

.rec-product-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity 0.4s ease;
}

.rec-product-image .img-hover {
  position: absolute;
  top: 0;
  left: 0;
  opacity: 0;
}

@media (hover: hover) {
  .rec-product-card:hover .img-default {
    opacity: 0;
  }

  .rec-product-card:hover .img-hover {
    opacity: 1;
  }
}

.rec-product-info {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  padding: 15px 12px 25px 12px;
}

.rec-product-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: #000;
  margin-bottom: 6px;
  line-height: 1.4;
}

.rec-product-price {
  font-size: 0.9rem;
  font-weight: 500;
  color: #000;
  margin-bottom: 15px;
}

/* Overlay icons on rec-product-image */
.rec-love-icon,
.rec-add-icon {
  position: absolute;
  bottom: 10px;
  width: 36px;
  height: 36px;
  background: rgba(255, 255, 255, 0.92);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.3s ease, transform 0.3s ease, background 0.2s;
  z-index: 5;
  font-size: 0.9rem;
  color: #000;
}

.rec-love-icon {
  right: 52px;
}

.rec-add-icon {
  right: 10px;
}

.rec-product-card:hover .rec-love-icon,
.rec-product-card:hover .rec-add-icon {
  opacity: 1;
  transform: translateY(0);
}

.rec-love-icon:hover,
.rec-add-icon:hover {
  background: #000;
  color: #fff;
}

/* More button */
.ymal-more-wrap {
  width: 100%;
  text-align: center;
  padding: 10px 0 10px;
  display: block;
  clear: both;
}

.ymal-more-btn {
  display: inline-block;
  width: auto;
  margin: 0 auto;
  background: none;
  border: 1px solid #000;
  padding: 10px 30px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.ymal-more-btn:hover {
  background: #000;
  color: #fff;
}

/* Tab content spacing */
.tab-content {
  animation: fadeIn 0.3s ease;
}

/* =========================================
   IMAGE LIGHTBOX
========================================= */
.img-lightbox {
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: rgba(0, 0, 0, 0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
  /* Safe area insets for notched phones (iPhone X+) */
  padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
  overscroll-behavior: contain;
}

.img-lightbox.active {
  opacity: 1;
  pointer-events: auto;
}

.lb-img-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  /* 100vw/100dvh = true full-screen including mobile browser chrome area */
  /* dvh = dynamic viewport height, shrinks when mobile URL bar is visible */
  width: 100vw;
  height: 100dvh;
  /* fallback: 100vh for older browsers */
  height: 100vh;
  height: 100dvh;
  touch-action: none;
  /* we handle all touch events manually */
  overflow: hidden;
  position: relative;
}

.lb-img {
  display: block;
  /* Fill as much of the wrap as possible while keeping aspect ratio */
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
  border-radius: 2px;
  transform-origin: 0 0;
  /* anchor top-left so we control offset precisely */
  cursor: zoom-in;
  will-change: transform;
  /* GPU compositing hint */
  /* Note: do NOT use image-rendering:crisp-edges — that's for pixel art, not photos */
}

/* Applied briefly on double-click toggle for smooth scale animation */
.lb-img.zoom-transition {
  transition: transform 0.22s ease;
}

/* Close button */
.lb-close {
  position: absolute;
  top: 18px;
  right: 22px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fff;
  font-size: 1.2rem;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.75;
  transition: opacity 0.2s, background 0.2s;
  z-index: 9001;
  line-height: 1;
}

.lb-close:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.18);
}

/* Prev / Next arrows */
.lb-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 2rem;
  width: 48px;
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 4px;
  transition: background 0.2s, opacity 0.2s;
  z-index: 9001;
  user-select: none;
  line-height: 1;
  opacity: 0.7;
}

.lb-prev {
  left: 16px;
}

.lb-next {
  right: 16px;
}

.lb-nav:hover {
  background: rgba(255, 255, 255, 0.18);
  opacity: 1;
}

.lb-nav.hidden {
  display: none;
}

/* Counter e.g. "2 / 4" */
.lb-counter {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255, 255, 255, 0.55);
  font-size: 0.75rem;
  letter-spacing: 1.5px;
}

/* Hide nav arrows on mobile (swipe instead) */
@media (max-width: 640px) {
  .lb-nav {
    display: none;
  }
}