/* Packmage Studio 专属样式隔离模块 */

#page-packmage {
  width: 100vw;
  position: relative;
  left: 50%;
  right: 50%;
  margin-left: -50vw;
  margin-right: -50vw;
  margin-top: -24px;
  margin-bottom: -64px;
  background: #f8fafc;
  min-height: calc(100vh - 65px);
}

.pm-top {
  height: 56px;
  border-bottom: 1px solid #e2e8f0;
  background: #ffffff;
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  position: sticky;
  top: 56px;
  z-index: 20;
}
.pm-brand {
  font-size: 17px;
  font-weight: 700;
  color: #0f172a;
  white-space: nowrap;
}
.pm-nav {
  display: flex;
  height: 100%;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}
.pm-nav button {
  border: 0;
  background: none;
  height: 100%;
  cursor: pointer;
  color: #64748b;
  font-size: 14px;
  font-weight: 600;
  padding: 0 14px;
  transition: all 0.15s;
  border-bottom: 3px solid transparent;
}
.pm-nav button:hover {
  color: #1a73e8;
}
.pm-nav button.active {
  color: #1a73e8;
  border-bottom-color: #1a73e8;
}
.pm-status {
  margin-left: auto;
  color: #64748b;
  font-size: 13px;
  white-space: nowrap;
}
.pm-take-to-quote-btn {
  border: 1px solid #93c5fd;
  background: #eff6ff;
  color: #1d4ed8;
  border-radius: 8px;
  padding: 7px 16px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.pm-take-to-quote-btn:hover {
  background: #3b82f6;
  color: #fff;
  border-color: #3b82f6;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.25);
}

/* 盒型库主界面 */
.pm-library {
  max-width: 1440px;
  margin: 0 auto;
  padding: 24px 20px 48px;
}
.pm-search {
  width: min(620px, 100%);
  height: 46px;
  margin: 0 auto 20px;
  display: flex;
  border: 1.5px solid #93c5fd;
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.06);
}
.pm-search input {
  border: 0;
  outline: 0;
  padding: 0 16px;
  flex: 1;
  font-size: 15px;
}
.pm-search button {
  width: 56px;
  border: 0;
  background: #f8fafc;
  color: #3b82f6;
  font-size: 20px;
  cursor: pointer;
  border-left: 1px solid #e2e8f0;
}
.pm-filter {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 14px 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin-bottom: 16px;
}
.pm-chip {
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  border-radius: 20px;
  padding: 6px 14px;
  color: #475569;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
}
.pm-chip:hover {
  border-color: #93c5fd;
  color: #1d4ed8;
}
.pm-chip.active {
  background: #2563eb;
  border-color: #2563eb;
  color: #fff;
  font-weight: 600;
}
.pm-viewbar {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 10px 18px;
  margin-bottom: 20px;
  color: #64748b;
  font-size: 13px;
}
.pm-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 16px;
}
@media (max-width: 1200px) {
  .pm-grid { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 900px) {
  .pm-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 640px) {
  .pm-grid { grid-template-columns: repeat(2, 1fr); }
}

.pm-box-card {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
  cursor: pointer;
  transition: all 0.18s ease;
  display: flex;
  flex-direction: column;
}
.pm-box-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
  border-color: #93c5fd;
}
.pm-box-card img {
  width: 100%;
  height: 200px;
  object-fit: contain;
  display: block;
  background: #fff;
  padding: 10px;
}
.pm-box-info {
  border-top: 1px solid #f1f5f9;
  padding: 10px 14px;
  background: #f8fafc;
  flex: 1;
}
.pm-box-code {
  font-weight: 700;
  font-size: 14px;
  color: #0f172a;
}
.pm-box-keywords {
  color: #64748b;
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 4px;
}
.pm-more {
  display: block;
  margin: 28px auto 0;
  border: 1px solid #cbd5e1;
  background: #fff;
  border-radius: 8px;
  padding: 10px 36px;
  cursor: pointer;
  font-weight: 600;
  color: #334155;
  transition: all 0.15s;
}
.pm-more:hover {
  border-color: #3b82f6;
  color: #2563eb;
  background: #eff6ff;
}

/* 设计器 3 栏主界面 */
.pm-designer {
  height: calc(100vh - 112px);
  display: grid;
  grid-template-columns: 260px minmax(420px, 1fr) 350px;
  overflow: hidden;
  background: #fff;
}
@media (max-width: 1050px) {
  .pm-designer { grid-template-columns: 220px 1fr 310px; }
}
@media (max-width: 800px) {
  .pm-designer {
    height: auto;
    display: flex;
    flex-direction: column;
  }
}

.pm-side {
  background: #f8fafc;
  border-right: 1px solid #e2e8f0;
  overflow-y: auto;
}
.pm-side-right {
  background: #ffffff;
  border-right: 0;
  border-left: 1px solid #e2e8f0;
}
.pm-side-title {
  height: 48px;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: #1e293b;
  background: #f1f5f9;
}
.pm-info {
  padding: 16px;
  font-size: 13px;
}
.pm-info-row {
  margin-bottom: 10px;
  line-height: 1.4;
}
.pm-info-row b {
  display: inline-block;
  min-width: 65px;
  color: #64748b;
}

.pm-canvas-wrap {
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: #ffffff;
  position: relative;
}
.pm-toolbar {
  height: 48px;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  padding: 0 12px;
  gap: 6px;
  background: #ffffff;
  overflow-x: auto;
  position: relative;
  z-index: 15;
}
.pm-toolbar button, .pm-toolbar a {
  border: 1px solid #cbd5e1;
  background: #fff;
  color: #475569;
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 12.5px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.12s;
}
.pm-toolbar button:hover, .pm-toolbar a:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
}
.pm-toolbar .pm-mode-tab.active {
  background: #334155;
  color: #fff;
  border-color: #334155;
}
.pm-toolbar .pm-primary {
  color: #2563eb;
  border-color: #bfdbfe;
  background: #eff6ff;
  font-weight: 600;
}
.pm-toolbar .pm-primary:hover {
  background: #2563eb;
  color: #fff;
}

.pm-view {
  flex: 1;
  min-height: 0;
  display: flex;
  position: relative;
}
.pm-canvas {
  flex: 1;
  min-height: 0;
  overflow: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  position: relative;
}
.pm-canvas svg {
  width: 90%;
  height: 90%;
  max-width: 100%;
  max-height: 100%;
  overflow: visible;
  user-select: none;
}
.pm-checker {
  background-color: #ffffff;
  background-image: linear-gradient(45deg, #f1f5f9 25%, transparent 25%), linear-gradient(-45deg, #f1f5f9 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #f1f5f9 75%), linear-gradient(-45deg, transparent 75%, #f1f5f9 75%);
  background-size: 20px 20px;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0;
}

/* 3D 舞台与物理折叠面片 */
#pm-view-three.pm-view {
  width: 100%;
  height: 100%;
  flex: 1;
  min-height: 520px;
  display: flex;
}
.pm-three-scene {
  flex: 1;
  min-height: 520px;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  perspective: 900px;
  cursor: grab;
  user-select: none;
  background: #eef1f5;
  position: relative;
  overflow: hidden;
  transition: background 0.25s;
}
.pm-three-scene:active {
  cursor: grabbing;
}
.pm-box3d, #pm-box3d, .box3d {
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.08s;
  flex: none;
  margin: 0 auto;
}
.pm-fold-node, .fold-node, .pm-face3d, .face3d {
  position: relative;
  transform-style: preserve-3d;
}
.pm-fold-node, .fold-node, .pm-face3d, .face3d, .pm-face-side, .face-side {
  position: absolute;
}
.pm-fold-node, .fold-node {
  inset: 0;
  pointer-events: none;
}
.pm-face-side, .face-side {
  inset: 0;
  background-color: #d6c08e;
  background-size: cover;
  background-repeat: no-repeat;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  image-rendering: -webkit-optimize-contrast;
  image-rendering: high-quality;
}
.pm-face-back, .face-back {
  transform: rotateY(180deg) translateZ(0.1px);
}
.pm-face3d svg, .face3d svg, .pm-face-svg, .face-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
  z-index: 2;
}
.pm-face-svg-front, .face-svg-front {
  backface-visibility: hidden;
}
.pm-face-svg-back, .face-svg-back {
  transform: rotateY(180deg) translateZ(0.15px);
  backface-visibility: hidden;
}
.pm-face3d polygon, .face3d polygon, .pm-face-svg polygon, .face-svg polygon {
  fill: none !important;
  stroke: #59616d !important;
  stroke-width: 0.7;
  vector-effect: non-scaling-stroke;
}

/* 浮动工具栏 (兼容 .canvas-floating-toolbar 与 .pm-canvas-floating-toolbar) */
.canvas-floating-toolbar, .pm-canvas-floating-toolbar {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: #ffffff;
  padding: 5px 12px;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12), 0 2px 6px rgba(0,0,0,0.04);
  border: 1px solid #cbd5e1;
  z-index: 25;
  user-select: none;
  white-space: nowrap;
}
.cft-drag-grip, .pm-cft-drag-grip {
  cursor: grab;
  color: #94a3b8;
  font-size: 16px;
  padding: 2px 4px;
  line-height: 1;
}
.cft-btn, .pm-cft-btn {
  background: none;
  border: 1px solid transparent;
  padding: 4px 8px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  color: #374151;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 500;
  transition: all 0.15s ease;
}
.cft-btn:hover, .pm-cft-btn:hover {
  background: #f1f5f9;
  color: #0f172a;
}
.cft-btn.active, .pm-cft-btn.active {
  background: #eff6ff;
  border-color: #93c5fd;
  color: #2563eb;
}
.cft-btn-danger, .pm-cft-btn-danger {
  color: #ef4444 !important;
}
.cft-btn-danger:hover, .pm-cft-btn-danger:hover {
  background: #fef2f2 !important;
}
.cft-select, .cft-number, .pm-cft-select, .pm-cft-number {
  height: 28px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 0 6px;
  font-size: 12px;
  color: #1f2937;
  outline: none;
  background: #fff;
}
.cft-color-swatch, .pm-cft-color-swatch {
  width: 22px;
  height: 22px;
  border-radius: 4px;
  border: 1px solid #94a3b8;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}
.cft-opacity-wrap, .pm-cft-opacity-wrap {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: #64748b;
}
.cft-opacity-range, .pm-cft-opacity-range {
  width: 70px;
  cursor: pointer;
}

/* 图层高亮边框与控制手柄 (SVG 物理图层手柄) */
.layer-outline, .pm-layer-outline {
  fill: none;
  stroke: #2563eb;
  stroke-width: 1.5;
  stroke-dasharray: 4 4;
  pointer-events: none;
}
.layer-handle, .pm-layer-handle {
  fill: #ffffff;
  stroke: #2563eb;
  stroke-width: 1.5;
  cursor: pointer;
}
.layer-handle[data-handle="nw"], .layer-handle[data-handle="se"] {
  cursor: nwse-resize;
}
.layer-handle[data-handle="ne"], .layer-handle[data-handle="sw"] {
  cursor: nesw-resize;
}
.layer-rot-handle, .pm-layer-rot-handle {
  fill: #2563eb;
  stroke: #ffffff;
  stroke-width: 1.5;
  cursor: grab;
}
.layer-rot-line, .pm-layer-rot-line {
  stroke: #2563eb;
  stroke-width: 1.2;
  stroke-dasharray: 2 2;
  pointer-events: none;
}

/* 底部浮动控制条 */
.pm-canvas-bottom-toolbar {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #ffffff;
  padding: 5px 12px;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.08);
  border: 1px solid #e2e8f0;
  z-index: 20;
}
.pm-cbt-btn {
  background: none;
  border: none;
  padding: 5px 7px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  color: #475569;
}
.pm-cbt-btn:hover {
  background: #f1f5f9;
  color: #0f172a;
}
.pm-cbt-btn.active {
  background: #eff6ff;
  color: #2563eb;
}
.pm-cbt-divider {
  width: 1px;
  height: 16px;
  background: #e2e8f0;
  margin: 0 2px;
}
.pm-cbt-scale-text {
  font-size: 12px;
  font-weight: 600;
  color: #334155;
  min-width: 40px;
  text-align: center;
}
.pm-stage-hud {
  position: absolute;
  bottom: 14px;
  left: 14px;
  background: rgba(255,255,255,0.9);
  backdrop-filter: blur(4px);
  border: 1px solid #dfe4ea;
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 11px;
  color: #64748b;
  pointer-events: none;
  z-index: 5;
}

/* 控制栏参数行 */
.pm-right-controls {
  padding: 14px;
  font-size: 13px;
}
.pm-control-line {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 11px;
}
.pm-control-line label {
  width: 80px;
  color: #475569;
  font-size: 13px;
  flex-shrink: 0;
}
.pm-control-line input, .pm-control-line select {
  height: 32px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 0 8px;
  min-width: 0;
  flex: 1;
  font-size: 13px;
}
.pm-btn-outline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 30px;
  border: 1px solid #cbd5e1;
  background: #fff;
  color: #334155;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  padding: 0 10px;
  gap: 4px;
}
.pm-btn-outline:hover {
  background: #f8fafc;
  border-color: #94a3b8;
}
.pm-btn-primary {
  display: block;
  width: 100%;
  height: 32px;
  border: 0;
  background: #2563eb;
  color: #fff;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
}
.pm-btn-primary:hover {
  background: #1d4ed8;
}
.pm-btn-danger {
  color: #dc2626 !important;
  border-color: #fca5a5 !important;
}
.pm-btn-danger:hover {
  background: #fef2f2 !important;
}
.pm-param-head {
  border-top: 1px solid #e2e8f0;
  border-bottom: 1px solid #e2e8f0;
  padding: 10px 14px;
  font-weight: 700;
  text-align: center;
  background: #f8fafc;
  color: #1e293b;
  font-size: 13px;
}
.pm-param-list {
  border-top: 1px solid #f1f5f9;
}
.pm-param-row {
  display: grid;
  grid-template-columns: 35px 58px 1fr 90px;
  align-items: center;
  gap: 6px;
  min-height: 42px;
  border-bottom: 1px solid #f1f5f9;
  padding: 4px 10px;
  font-size: 12.5px;
}
.pm-param-table-head {
  min-height: 32px;
  background: #f8fafc;
  font-size: 12px;
  color: #64748b;
  font-weight: 600;
}
.pm-param-row input {
  height: 28px;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  padding: 0 6px;
  font-size: 12px;
}
.pm-tune {
  display: block;
  margin: 14px auto;
  border: 1px solid #93c5fd;
  background: #eff6ff;
  color: #1d4ed8;
  padding: 7px 24px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
}
.pm-tune:hover {
  background: #2563eb;
  color: #fff;
}
.pm-fold-player {
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  border-radius: 8px;
  padding: 10px;
  margin-bottom: 12px;
}
.pm-fold-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}
.pm-fold-actions .pm-tune {
  margin: 0;
  flex: 1;
}
.pm-fold-progress-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.pm-fold-progress-row input {
  flex: 1;
}
.pm-fold-progress-row span {
  width: 38px;
  text-align: right;
  font-size: 12px;
  color: #64748b;
}
.pm-side-scroll {
  overflow-y: auto;
  padding: 12px;
  max-height: calc(100vh - 160px);
}
.pm-props-group {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 10px;
  margin-bottom: 10px;
}
.pm-props-group-title {
  font-weight: 700;
  font-size: 12px;
  margin-bottom: 8px;
  color: #334155;
}
.pm-file-button {
  display: block;
  border: 1px dashed #94a3b8;
  border-radius: 6px;
  padding: 8px;
  text-align: center;
  cursor: pointer;
  font-size: 12px;
  color: #475569;
  background: #fff;
  margin-bottom: 8px;
}
.pm-file-button input {
  display: none;
}
.pm-color-box {
  width: 32px !important;
  height: 30px !important;
  padding: 1px !important;
  border-radius: 4px;
  cursor: pointer;
  flex: 0 0 32px !important;
}
.pm-btn-row {
  display: flex;
  gap: 6px;
}
.pm-btn-row > * {
  flex: 1;
}
.pm-layer-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.pm-layer-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
}
.pm-layer-item.active {
  border-color: #3b82f6;
  background: #eff6ff;
}
.pm-symbol-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-bottom: 10px;
}
.pm-symbol-btn {
  border: 1px solid #e2e8f0;
  background: #fff;
  border-radius: 6px;
  padding: 6px 2px;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  font-size: 10px;
  color: #64748b;
  gap: 3px;
}
.pm-symbol-btn:hover {
  border-color: #3b82f6;
  background: #eff6ff;
}
.pm-symbol-btn svg {
  width: 24px;
  height: 24px;
}
.pm-mark-card {
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 8px;
  background: #fff;
  margin-bottom: 8px;
  cursor: pointer;
}
.pm-mark-card:hover {
  border-color: #3b82f6;
  background: #eff6ff;
}
.pm-mark-card-header {
  font-weight: 700;
  font-size: 12px;
  display: flex;
  justify-content: space-between;
  margin-bottom: 4px;
}
.pm-mark-card-preview {
  font-family: monospace;
  font-size: 10px;
  color: #475569;
  line-height: 1.35;
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  padding: 5px;
  border-radius: 4px;
  white-space: pre-line;
}
.pm-barcode-preview-box {
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 70px;
  margin-bottom: 8px;
}
