/* Zone3Dplus Phase 2H — staging-only, CSS-only compatibility fix.
   No changes to the model DOM, R2, viewers, conversion, quantities or pricing. */

/* 1) The original reader applies filter:grayscale(1) to EVERY descendant of a
   disabled card. CSS filters create new containing blocks. On toggle-off that
   causes its absolutely positioned switch to anchor to the quantity/actions
   region instead of the outer card. Remove filter from only the two structural
   ancestors; the original rule still dims the visible child controls. */
#m3dreader .m3dreader__model-item.disabled .m3dreader__model-item--wrap .m3dreader__model-content,
#m3dreader .m3dreader__model-item.disabled .m3dreader__model-item--wrap .m3dreader__model-actions {
  filter: none !important;
  opacity: 1 !important;
}
#m3dreader .m3dreader__model-item:not(.loading) .m3dreader__model-toggles {
  position: absolute !important;
  bottom: 14px !important;
  right: 14px !important;
  pointer-events: auto !important;
}
/* Keep the OFF switch clickable and visibly distinct without shifting it. */
#m3dreader .m3dreader__model-item.disabled .m3dreader__model-toggles,
#m3dreader .m3dreader__model-item.disabled .m3dreader__model-switch,
#m3dreader .m3dreader__model-item.disabled .m3dreader__model-switch--knob {
  filter: none !important;
  opacity: 1 !important;
}
#m3dreader .m3dreader__model-item.disabled .m3dreader__model-switch {
  background: #9ca3af !important;
  pointer-events: auto !important;
}

/* 2) Phase 2F/2G creates cropped/contrast images for the existing thumbnail.
   Its position:absolute CSS was scoped to step-0, so at the materials step the
   images entered normal flow and stacked as extra previews. Overlay them
   INSIDE the original thumbnail shell; never hide/remove the model itself. */
#m3dreader .m3dreader__model--uploaded .z3d2c-thumb-shell {
  position: relative !important;
  isolation: isolate;
}
#m3dreader .m3dreader__model--uploaded .z3d2c-thumb-shell .z3d2f-thumbnail-overlay,
#m3dreader .m3dreader__model--uploaded .z3d2c-thumb-shell .z3d2g-contrast-layer {
  display: block;
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  width: 100% !important;
  height: auto !important;
  aspect-ratio: 1 / 1;
  max-height: none;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
  border-radius: 10px;
}
#m3dreader .m3dreader__model--uploaded .z3d2c-thumb-shell .z3d2f-thumbnail-overlay {
  z-index: 1;
}
#m3dreader .m3dreader__model--uploaded .z3d2c-thumb-shell .z3d2g-contrast-layer {
  z-index: 2;
}
#m3dreader .m3dreader__model--uploaded .z3d2c-thumb-shell .z3d2c-viewer-trigger {
  position: relative;
  z-index: 3;
}

/* 3) Original unit select has inline height:20px!important. Match its visual
   height without touching its values, inline style or Scale click handler. */
#m3dreader .m3dreader__model-item:not(.loading) .m3dreader__model-scale-btn {
  box-sizing: border-box !important;
  height: 20px !important;
  min-height: 20px !important;
  max-height: 20px !important;
  padding: 0 6px !important;
  line-height: 18px !important;
  font-size: 12px !important;
  border-radius: 6px;
  vertical-align: middle;
}
