/* Fence 3D inline preview — product page */
.fence3d-wrap {
  position: relative;
  width: 100%;
  background: #ffffff;
  border-radius: var(--bs-border-radius, 12px);
  overflow: hidden;
  margin-bottom: 12px;
}

.fence3d-canvas {
  width: 100%;
  aspect-ratio: 1.6 / 1; min-height: 360px;
  position: relative;
  cursor: grab;
  background: #ffffff;
}

.fence3d-canvas:active { cursor: grabbing; }

.fence3d-canvas canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
  position: relative;
  z-index: 2;
}

.fence3d-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  color: var(--bs-secondary-color, #6c757d);
  pointer-events: none;
  z-index: 1;
}

.fence3d-loading.is-hidden { display: none; }

.fence3d-hint {
  position: absolute;
  bottom: 8px;
  right: 12px;
  font-size: 0.72rem;
  color: var(--bs-body-color, #333);
  opacity: 0.55;
  pointer-events: none;
  background: rgba(255,255,255,0.7);
  padding: 4px 8px;
  border-radius: 6px;
  z-index: 2;
}

.fence3d-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 4px 10px;
  background: var(--bs-primary, #1fb15a);
  color: white;
  border-radius: 4px;
  z-index: 3;
  text-transform: uppercase;
}

@media (max-width: 768px) {
  .fence3d-hint { font-size: 0.65rem; bottom: 4px; right: 8px; padding: 3px 6px; }
}


/* Static poster fallback — pokazuje się PRZED 3D load + gdy WebGL fail */
.fence3d-poster {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #ffffff;
  z-index: 1;
  transition: opacity 0.3s;
  pointer-events: none;
}
.fence3d-canvas.is-3d-ready .fence3d-poster {
  opacity: 0;
}


/* ====================================================
 * PANEL VIEWER — 3 widoki przełączane (3D / mini / final)
 * ==================================================== */
.panel-viewer {
  position: relative;
  width: 100%;
}

.product__images .panel-viewer > .panel-view {
  display: none !important;
}

.product__images .panel-viewer > .panel-view.is-active {
  display: block !important;
}

.panel-view-img {
  width: 100%;
  height: auto;
  aspect-ratio: 1.6 / 1;
  min-height: 360px;
  object-fit: contain;
  background: #ffffff;
  border-radius: var(--bs-border-radius, 12px);
  display: block;
}

/* Thumbnails — picker panel-viewer */
.panel-thumbnails {
  margin-top: 12px;
}

.panel-thumbnails .product__thumbnails-list {
  display: flex;
  gap: 8px;
  padding: 0;
  margin: 0;
  list-style: none;
  flex-wrap: wrap;
}

.panel-thumb {
  position: relative;
  width: 80px;
  height: 80px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: var(--bs-border-radius, 8px);
  background: #fff;
  cursor: pointer;
  overflow: hidden;
  transition: border-color 0.15s, transform 0.15s;
}

.panel-thumb:hover {
  border-color: var(--bs-primary, #1fb15a);
  transform: translateY(-1px);
}

.panel-thumb.is-active {
  border-color: var(--bs-primary, #1fb15a);
  box-shadow: 0 0 0 1px var(--bs-primary, #1fb15a);
}

.panel-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.panel-thumb-3d-wrap {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
}

.panel-thumb-badge {
  position: absolute;
  bottom: 4px;
  right: 4px;
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 2px 6px;
  background: var(--bs-primary, #1fb15a);
  color: white;
  border-radius: 3px;
  text-transform: uppercase;
  z-index: 2;
}

@media (max-width: 480px) {
  .panel-thumb { width: 64px; height: 64px; }
}
