/******************** Containers Styles ********************/
.base-section-container {
  max-width: 1280px;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-left: auto;
  margin-right: auto;
  padding: 1rem 1.5rem;
  overflow: hidden;
}

/* Product pages - wider container */
.single-product .base-section-container {
  max-width: 1600px;
  padding: 2rem 1rem;
}

.extended-section-container {
  max-width: 1380px;
  gap: 0.25rem;
}

.gift-card-hero-container {
  position: relative;
  width: 100%;
  min-height: 250px;
  /* Allow container to expand when form content grows */
  height: auto;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  overflow: visible;
  padding-top: 2rem;
  padding-bottom: 2rem;
}

.gift-card-hero-container .extended-image-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  margin-bottom: 0;
  z-index: 1;
}

/* Black filter overlay when form is visible */
.gift-card-hero-container:has(
    .bt-gift-card-widget-form:not([style*="display: none"])
  )
  .extended-image-container::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 1;
  pointer-events: none;
}

.gift-card-hero-container .extended-image-container img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}

/* Default: Show Package image (form NOT visible), hide Category image (form visible) */
.gift-card-image-form-visible {
  display: none;
}

.gift-card-image-form-hidden {
  display: block;
}

/* When form IS visible: Show Category image, hide Package image */
.gift-card-hero-container:has(
    .bt-gift-card-widget-form:not([style*="display: none"])
  )
  .gift-card-image-form-visible {
  display: block;
}

.gift-card-hero-container:has(
    .bt-gift-card-widget-form:not([style*="display: none"])
  )
  .gift-card-image-form-hidden {
  display: none;
}

/* Desktop images - show on desktop, hide on mobile */
.gift-card-image-desktop {
  display: block;
}

.gift-card-image-mobile {
  display: none;
}

.gift-card-widget-wrapper {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  box-sizing: border-box;
  align-self: flex-end;
}

.gift-card-widget-wrapper .bt-gift-card-widget-container {
  width: 100%;
  max-width: 600px;
  margin: 0;
  box-sizing: border-box;
}

.gift-card-widget-wrapper .bt-gift-card-widget-form {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  padding: 1rem;
}

.gift-card-widget-wrapper .bt-gift-card-form {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

/* Ensure all form elements use box-sizing and respect boundaries */
.gift-card-widget-wrapper .bt-gift-card-form *,
.gift-card-widget-wrapper .bt-gift-card-form input,
.gift-card-widget-wrapper .bt-gift-card-form textarea,
.gift-card-widget-wrapper .bt-gift-card-form button,
.gift-card-widget-wrapper .bt-gift-card-form label {
  box-sizing: border-box;
}

/* Ensure inputs don't overflow */
.gift-card-widget-wrapper .bt-gift-card-form input[type="text"],
.gift-card-widget-wrapper .bt-gift-card-form input[type="email"],
.gift-card-widget-wrapper .bt-gift-card-form input[type="number"],
.gift-card-widget-wrapper .bt-gift-card-form textarea {
  max-width: 100%;
  width: 100%;
}

/* Gift Card Widget V2 Layout - Fields Left, Buttons Right */
.bt-gift-card-form-fields {
  display: flex;
  gap: 1rem;
  align-items: center;
  box-sizing: border-box;
}

.bt-gift-card-fields-column {
  flex: 1;
  min-width: 0; /* Prevent flex item from overflowing */
  box-sizing: border-box;
  color: white;
}

.bt-gift-card-buttons-column {
  display: flex;
  flex-direction: column;
  gap: 10px;
  justify-content: flex-start;
  min-width: 150px;
  box-sizing: border-box;
}

/* Tablet breakpoint (768px - 1024px) */
@media (min-width: 768px) and (max-width: 1024px) {
  .bt-gift-card-form-fields {
    gap: 1.5rem;
  }

  .gift-card-widget-wrapper .bt-gift-card-widget-form {
    padding: 0.875rem !important;
  }
}

/* Mobile breakpoint (< 768px) */
@media (max-width: 767px) {
  .gift-card-widget-wrapper .bt-gift-card-widget-form {
    padding: 0.75rem !important;
  }

  .bt-gift-card-form-fields {
    flex-direction: column;
    gap: 0.25rem;
  }

  .bt-gift-card-buttons-column {
    min-width: unset;
  }
}

.extended-image-container {
  height: 320px;
  width: 100%;
  margin-bottom: 1rem;
}

.extended-image-container img {
  aspect-ratio: 1344 / 416;
  object-fit: cover;
}

.gift-card-hero-container {
  align-items: center;
}

@media (max-width: 767px) {
  .gift-card-hero-container {
    /* Mobile: Default min-height for Package image aspect ratio (1391 / 416) */
    min-height: calc(100vw * (416 / 1391));
    /* Allow expansion on mobile too */
    height: auto;
    padding: 0.5rem;
  }

  .gift-card-hero-container .extended-image-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
  }

  /* Switch images on mobile */
  .gift-card-image-desktop {
    display: none;
  }

  .gift-card-image-mobile {
    display: block;
  }

  .gift-card-widget-wrapper {
    padding: 0;
  }

  .extended-image-container img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
  }
}

.flex-reverse-row-sts,
.flex-row-to-column-sts {
  display: flex;
  gap: 2rem;
  padding: 0 2rem;
  flex-direction: row-reverse; /* Right side first (images), then left side (details) */
  align-items: flex-start;
}

.flex-row-to-column-sts {
  flex-direction: row !important;
  align-items: start;
  padding: 0 1rem;
}

.flex-row-to-column-sts .product-images-section,
.flex-row-to-column-sts .product-details-section {
  flex: 1;
  min-width: 0;
  align-self: flex-start;
}

@media screen and (max-width: 986px) {
  .flex-row-to-column-sts {
    gap: 1rem;
    padding: 0 0.5rem;
  }

  .single-product .base-section-container {
    padding: 2rem 0.75rem;
  }
}

@media screen and (max-width: 767px) {
  .flex-row-to-column-sts {
    flex-direction: column !important;
    align-items: center;
  }
}

/* Responsive triple images container */
.triple-images-container {
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: flex-start;
  gap: 0.25rem;
  width: 100%;
  max-width: 1344px;
  height: auto;
  overflow: hidden;
  margin: 0 auto;
}

@media (max-width: 767px) {
  .base-section-container {
    padding: 0.75rem 0.75rem !important;
  }
}

.base-section-container .relative {
  position: relative;
  touch-action: pan-y pinch-zoom;
}

.product-flex-container {
  display: flex;
  flex-direction: column;
  align-content: center;
  justify-content: center;
  position: relative;
  width: calc(100% - var(--arrow-button-wrapper));
  gap: 1rem;
  margin: 0 var(--arrow-button-wrapper);
  box-sizing: border-box;
  touch-action: pan-y pinch-zoom;
  pointer-events: auto;
}

.product-flex-container .product-container {
  gap: 0.5rem;
  justify-content: space-around;
}

/* Ensure product containers and cards are clickable */
.product-container {
  pointer-events: auto;
}

.product-container .product-card {
  pointer-events: auto;
}

.product-flex-container.dragging {
  cursor: grabbing;
  -webkit-user-select: none;
  user-select: none;
}

.product-flex-container.dragging * {
  pointer-events: none;
  -webkit-user-select: none;
  user-select: none;
}

.product-container,
.triple-images-container {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  width: 100%;
  will-change: transform;
}

/* categories continaer v1 */
/* .categories-container {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
} */

/* categories container v2 */
.categories-container {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr)); /* always 2 columns */
  gap: 0.125rem; /* both column + row gap */
}

@media (max-width: 767px) {
  /* .categories-container {
    gap: 0.125rem;
  } */
}

/******************** End of Container Styles ********************/

/******************** Grid Styles ********************/
.images-gallery-container {
  display: grid;
  grid-template-columns: repeat(3, 288px);
  grid-template-rows: auto;
  gap: 0.6rem;
  justify-content: center;
  max-width: fit-content;
  margin: 0 auto;
}

.only-mobile {
  display: none;
}

.item-completion-image {
  display: none;
}

.products-grid-wrapper {
  width: 100%;
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(min(200px, 100%), 1fr));
  gap: 2rem;
  justify-items: center;
  width: 100%;
}

.gemstone-grid {
  gap: 0rem;
}

.product-container .product-card {
  display: flex;
  flex-direction: column; /* This reverses the order! */
  width: 100%;
  overflow: hidden;
  transition: transform 0.3s ease;
  position: relative;
  max-width: 270px;
}

.product-grid .product-card:hover {
  transform: translateY(-4px);
}

@media (max-width: 1280px) {
  .images-gallery-container {
    grid-template-columns: repeat(3, 288px);
  }
}

@media (max-width: 960px) {
  .images-gallery-container {
    grid-template-columns: repeat(2, 288px);
  }

  .only-mobile {
    display: block;
  }

  .item-completion-image {
    display: block;
  }
}

@media (max-width: 640px) {
  .images-gallery-container {
    grid-template-columns: repeat(2, clamp(140px, 40vw, 288px));
    gap: 0.3rem;
  }

  .images-gallery-container img {
    width: 100%;
    height: 280px !important;
    aspect-ratio: 288 / 420;
  }
}

@media (max-width: 1200px) {
  .products-grid,
  .product-grid {
    grid-template-columns: repeat(3, minmax(min(200px, 100%), 1fr));
    gap: 1.5rem;
  }
}

/* Mobile (2 columns) */
@media (max-width: 767px) {
  .products-grid,
  .product-grid {
    grid-template-columns: repeat(2, minmax(min(120px, 100%), 1fr));
    gap: 0.5rem;
  }

  .products-grid .product-card,
  .product-grid .product-card {
    min-width: 120px;
  }

  .product-image-wrapper {
    width: 100%;
    height: auto;
    aspect-ratio: 285 / 360;
  }

  .product-actions {
    gap: 2px;
    width: 100%;
  }

  .product-actions .add_to_cart_button,
  .product-actions .wishlist-toggle {
    width: 100%;
  }
}

/******************** End of Grid Styles ********************/

/******************** Hero Section ********************/
.hero-section {
  position: relative;
  width: 100%;
  aspect-ratio: 1900 / 1462;
  height: 500px;
  overflow: hidden;
  margin-bottom: 0;
}

.hero-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

@media (max-width: 767px) {
  .hero-section {
    height: 300px;
  }

  .hero-image {
    min-height: 145px;
  }
}
/******************** End of Hero Section ********************/

/******************** Archive Page Styles ********************/
/* Archive page containers */
.custom-shop-page,
.custom-product-category-page {
  margin: 0;
  padding: 0;
  width: 100%;
  display: block;
  clear: both;
}

/* Archive-specific container layout overrides */
.custom-shop-page .ast-separate-container,
.custom-shop-page .site-content .ast-container,
.custom-shop-page .ast-container,
.custom-shop-page .ast-separate-container .ast-container,
.custom-product-category-page .ast-separate-container,
.custom-product-category-page .site-content .ast-container,
.custom-product-category-page .ast-container,
.custom-product-category-page .ast-separate-container .ast-container {
  display: block !important;
  flex-direction: column !important;
  flex-wrap: wrap !important;
}

/* Note: Sidebar hiding and primary full-width are handled globally in base.css */
/******************** End of Archive Page Styles ********************/
