/**
 * PreBuild v3 – Enhanced UI
 * Metal options cards, product detail layout, performance-friendly styles.
 * Load after prebuild-v3.css.
 */

/* ========== Customizing section ========== */
.customizing--enhanced {
  margin: 2rem 0;
  padding: 1.5rem 0;
  border-top: 1px solid #e5e5e5;
}

.customizing-title {
  font-size: 1.35rem;
  margin: 0 0 1rem;
  font-weight: 600;
  color: #1a1a1a;
}

.customizing-holder {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  align-items: flex-start;
}

/* ========== Metal options (cards) ========== */
.metal-column,
.side-diamond-column {
  flex: 1 1 280px;
  max-width: 100%;
}

.metal-options-head {
  margin-bottom: 1rem;
}

.metal-options-title {
  font-size: 1.15rem;
  font-weight: 600;
  margin: 0 0 0.25rem;
  color: #1a1a1a;
}

.metal-options-desc {
  font-size: 0.9rem;
  color: #555;
  margin: 0;
}

.metal-options {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.metal-option {
  position: relative;
  border: 2px solid #e0e0e0;
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s;
  overflow: hidden;
}

.metal-option:hover {
  border-color: #b8a99a;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.metal-option--selected {
  border-color: #8b7355;
  box-shadow: 0 0 0 1px #8b7355, 0 2px 10px rgba(139,115,85,0.2);
  background: #faf8f6;
}

.metal-option-input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 0;
  height: 0;
}

.metal-option-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1rem 0.75rem;
  min-height: 100%;
  box-sizing: border-box;
}

.metal-option-image {
  width: 100%;
  max-width: 80px;
  margin-bottom: 0.5rem;
  line-height: 0;
}

.metal-option-image img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: contain;
}

.metal-option-title {
  font-size: 0.85rem;
  font-weight: 500;
  color: #333;
  text-align: center;
  margin-bottom: 0.35rem;
  line-height: 1.25;
}

.metal-option-price {
  font-size: 0.8rem;
  text-align: center;
}

/* Price badges */
.metal-option-price-badge {
  display: inline-block;
  padding: 0.2em 0.5em;
  border-radius: 6px;
  font-weight: 600;
  white-space: nowrap;
}

.metal-option-price-badge--included {
  background: #e8f5e9;
  color: #2e7d32;
}

.metal-option-price-badge--add {
  background: #e3f2fd;
  color: #1565c0;
}

.metal-option-price-badge--subtract {
  background: #ffebee;
  color: #c62828;
}

.metal-option-price-badge--gold {
  background: #fff8e1;
  color: #f57f17;
}

/* Legacy compatibility: .red / .green inside metal-option */
.metal-option .red { color: #c62828; }
.metal-option .green { color: #2e7d32; }

/* Change Metal / Change Side Diamond button */
.btn-change {
  display: inline-block;
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  font-weight: 500;
  color: #8b7355;
  border: 1px solid #8b7355;
  border-radius: 6px;
  text-decoration: none;
  transition: background 0.2s, color 0.2s;
}

.btn-change:hover {
  background: #8b7355;
  color: #fff;
}

/* ========== Product detail section (buy area) ========== */
/* Reduce left white space: wrappers full width, no left gap (scope: PreBuild page only) */
.prebuild-page .container,
.prebuild-page #main,
.prebuild-page .content-holder,
.prebuild-page .tabs-container,
.prebuild-page .tab-content {
  max-width: 100%;
  padding-left: 0;
  margin-left: 0;
}

.prebuild-page .content-holder {
  width: 100%;
}

.product-detail {
  display: grid;
  gap: 1.5rem;
}

.product-detail .column {
  min-width: 0;
}

.product-detail .column:first-child {
  padding-left: 0;
}

.product-detail .info-frame {
  margin-bottom: 1rem;
  width: 100%;
}

/* Left panel media: full width so video/image is large, not small */
.product-detail .info-frame .item,
.product-detail .info-frame .prebuild-media {
  width: 100%;
  max-width: 100%;
}

.product-detail .info-frame .prebuild-media__img,
.product-detail .info-frame img[data-zoom-image] {
  width: 100%;
  max-width: 100%;
  height: auto;
  display: block;
}

.product-detail .info-frame iframe,
.product-detail .info-frame .video iframe {
  width: 100%;
  min-height: 360px;
  max-width: 100%;
}

.gallery-block {
  padding-left: 0;
  margin-left: 0;
}

/* Selection bar: ring size dropdown + checkbox */
.selection-bar {
  margin: 1rem 0;
  padding: 0.75rem 0;
  border-top: 1px solid #eee;
  border-bottom: 1px solid #eee;
}

/* Ring size: dropdown only (no chip grid) */
.ring-selection--dropdown .ring-selection__label {
  display: block;
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 0.35rem;
  color: #1a1a1a;
}

.ring-selection--dropdown .ring-size-select,
.ring-selection--dropdown .selection--native {
  display: block;
  width: 100%;
  max-width: 280px;
  padding: 0.5rem 0.75rem;
  font-size: 1rem;
  border: 1px solid #ccc;
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
}

.ring-selection--dropdown .ring-size-select:focus,
.ring-selection--dropdown .selection--native:focus {
  border-color: #8b7355;
  outline: none;
}

/* Hide legacy size chips if present */
.ring-selection .size-chips {
  display: none;
}

.checkbox-bar {
  margin-top: 0.75rem;
}

.checkbox-bar label {
  cursor: pointer;
  font-size: 0.9rem;
  color: #555;
}

/* Add to cart button area */
.product-detail input[type="image"]#addToCartButton {
  max-width: 100%;
  cursor: pointer;
  margin-top: 0.5rem;
}

/* Shipping info block */
.shipping-info .holder {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem 0;
}

.shipping-info .icon img {
  width: 36px;
  height: auto;
}

.shipping-info .text {
  flex: 1;
  font-size: 0.9rem;
  color: #444;
}

.shipping-time {
  display: block;
  margin-bottom: 0.25rem;
}

/* ========== Side diamond list ========== */
.side-diamond-group .image-frame img {
  max-width: 60px;
}

.selection-list .row {
  margin: 0.35rem 0;
}

.selection-list label {
  cursor: pointer;
  font-size: 0.9rem;
}

/* ========== Responsive ========== */
@media (min-width: 768px) {
  .customizing-holder {
    gap: 2.5rem;
  }

  .metal-options {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1rem;
  }

  .product-detail {
    grid-template-columns: 1fr 1fr;
    align-items: start;
  }
}

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

  .metal-option-inner {
    padding: 0.75rem 0.5rem;
  }

  .metal-option-title {
    font-size: 0.8rem;
  }
}

/* Focus for accessibility */
.metal-option:focus {
  outline: 2px solid #8b7355;
  outline-offset: 2px;
}

.metal-option:focus:not(:focus-visible) {
  outline: none;
}

.metal-option:focus-visible {
  outline: 2px solid #8b7355;
  outline-offset: 2px;
}

/* ========== Gallery (main image + thumb strip) ========== */
.prebuild-gallery {
  margin: 1rem 0;
  padding-left: 0;
  width: 100%;
  max-width: 100%;
}

.prebuild-gallery__main {
  position: relative;
  width: 100%;
  max-width: 100%;
  margin-bottom: 0.75rem;
}

.prebuild-gallery-image {
  width: 100%;
  max-width: 100%;
}

.prebuild-gallery-image img,
#pbMainImg {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
}

/* Video: 16:9 aspect ratio, same size as main image */
.prebuild-gallery-video {
  width: 100%;
  max-width: 100%;
}

.prebuild-gallery-video__aspect {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
}

.prebuild-gallery-video__aspect iframe,
#pbVideoFrame {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
}

.prebuild-gallery__zoom-hint {
  font-size: 0.85rem;
  color: #666;
  margin: 0 0 0.75rem;
}

.prebuild-gallery__thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.prebuild-gallery__thumbs li {
  margin: 0;
}

.prebuild-gallery__thumbs .pb-thumb,
.prebuild-gallery__thumbs .prebuild-gallery-thumb {
  display: block;
  border: 2px solid transparent;
  border-radius: 6px;
  overflow: hidden;
  padding: 0;
  cursor: pointer;
  transition: border-color 0.2s;
}

.prebuild-gallery__thumbs .pb-thumb:hover,
.prebuild-gallery__thumbs .prebuild-gallery-thumb:hover {
  border-color: #b8a99a;
}

.prebuild-gallery__thumbs .pb-thumb.is-active,
.prebuild-gallery__thumbs .prebuild-gallery-thumb.is-active {
  border-color: #8b7355;
}

.prebuild-gallery__thumbs .pb-thumb img,
.prebuild-gallery__thumbs .prebuild-gallery-thumb img {
  display: block;
  width: 56px;
  height: 56px;
  object-fit: cover;
}

.prebuild-gallery__play {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.prebuild-gallery__play-icon {
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 14px 0 14px 24px;
  border-color: transparent transparent transparent #fff;
  margin-left: 4px;
  box-sizing: border-box;
}
