/* ── 全局隐藏旧版 3D Tab 和黄色按钮 ── */
.view-tab[data-target="3d"],
.btn-3d-preview { display: none !important; }

/* ── 移动端 2D 图纸修复：不在 3D 模式时恢复预览面板 ── */
@media (max-width: 767px) {
  body:not(.is-3d-mode) .preview-panel {
    display: flex !important;
    flex-direction: column;
    width: 100%;
    min-height: 50vh;
  }
  body:not(.is-3d-mode) #iframe-2d {
    display: block !important;
    min-height: 380px;
  }
  body:not(.is-3d-mode) .preview-canvas {
    height: auto !important;
    min-height: 380px;
  }
}

/* ── 左侧大图：可点击提示 ── */
.generator-sample img { cursor: pointer; }

/* ══════════════════════════════════════════════════════════════
   全新 3D 全屏模态框 (gs3d = generator-sample → 3D)
   ══════════════════════════════════════════════════════════════ */

.gs3d-overlay {
  position: fixed; inset: 0; z-index: 99999;
  background: rgba(0, 0, 0, 0.72);
  display: flex; align-items: center; justify-content: center;
  animation: gs3d-fadein 0.2s ease;
}
@keyframes gs3d-fadein { from { opacity: 0; } to { opacity: 1; } }

.gs3d-modal {
  position: relative;
  width: min(96vw, 1200px);
  height: min(94vh, 94dvh, 800px);
  background: #1a1a1e;
  border-radius: 14px;
  overflow: hidden;
  display: flex; flex-direction: column;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5);
  animation: gs3d-scalein 0.25s ease;
}
@keyframes gs3d-scalein {
  from { transform: scale(0.93); opacity: 0; }
  to   { transform: scale(1);    opacity: 1; }
}

.gs3d-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px;
  background: #1e1e24;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}
.gs3d-title {
  font-size: 13px; font-weight: 600;
  color: #dfb98a;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Noto Sans SC", sans-serif;
  letter-spacing: 0.02em;
}

.gs3d-close {
  width: 30px; height: 30px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.7);
  font-size: 18px; line-height: 1;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s, color 0.15s;
  flex-shrink: 0;
}
.gs3d-close:hover { background: rgba(255, 255, 255, 0.16); color: #fff; }

.gs3d-iframe {
  flex: 1; border: none;
  width: 100%; height: 100%;
  background: #1a1a1e;
}

@media (max-width: 768px) {
  .gs3d-modal {
    width: 100vw; height: 100dvh;
    max-height: none; border-radius: 0;
  }
  .gs3d-iframe { min-height: 300px; }
}

/* ══════════════════════════════════════════════════════════════
   2D 智能排版工具栏
   ══════════════════════════════════════════════════════════════ */
.gs-nest-toolbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 8px 14px; margin: 0;
  background: #f5f5f5;
  border-bottom: 1px solid #e0e0e0;
  flex-shrink: 0; flex-wrap: wrap;
}
.gs-nest-left { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; flex: 1; }
.gs-nest-right { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }

.gs-nest-btn {
  padding: 6px 14px; font-size: 12px; font-weight: 600;
  border: none; border-radius: 6px; cursor: pointer;
  letter-spacing: 0.3px; transition: background 0.15s, opacity 0.15s;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Noto Sans SC", sans-serif;
}
.gs-nest-btn-primary { background: #1a73e8; color: #fff; }
.gs-nest-btn-primary:hover { background: #1557b0; }
.gs-nest-btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
#gs-nest-restore { background: #fff; color: #555; border: 1px solid #ccc; }
#gs-nest-restore:hover { background: #eee; color: #333; }
.gs-nest-hidden { display: none !important; }
.gs-nest-info { font-size: 11px; color: #1a73e8; font-weight: 500; white-space: nowrap; }

/* 图标按钮（缩放） */
.gs-nest-btn-icon {
  width: 30px; height: 30px; padding: 0;
  background: #fff; color: #555; border: 1px solid #d0d0d0;
  font-size: 15px; font-weight: 700; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  border-radius: 6px; cursor: pointer;
}
.gs-nest-btn-icon:hover { background: #e8f0fe; color: #1a73e8; border-color: #1a73e8; }

/* 隐藏 2D 容器原生滚动条（缩放/平移由 JS 的 viewBox 操作替代） */
.preview-canvas,
.preview-canvas * { overflow: hidden !important; }
#iframe-2d { overflow: hidden !important; border: none; }

/* 2D 图纸区光标提示 */
.preview-canvas { cursor: grab; }
.preview-canvas:active { cursor: grabbing; }

/* ══════════════════════════════════════════════════════════════
   画布尺寸选择面板
   ══════════════════════════════════════════════════════════════ */
.gs-sheet-picker-overlay {
  position: fixed; inset: 0; z-index: 100000;
  background: rgba(0, 0, 0, 0.45);
  display: flex; align-items: center; justify-content: center;
  animation: gs3d-fadein 0.15s ease;
}
.gs-sheet-picker-box {
  background: #fff; border-radius: 14px;
  padding: 24px; width: 360px; max-width: 94vw;
  box-shadow: 0 16px 48px rgba(0,0,0,0.25);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Noto Sans SC", sans-serif;
}
.gs-sheet-picker-title {
  font-size: 15px; font-weight: 700; color: #222;
  margin-bottom: 16px; text-align: center;
}
.gs-sheet-presets {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 8px; margin-bottom: 16px;
}
.gs-sheet-preset {
  padding: 10px 12px; border: 2px solid #e0e0e0; border-radius: 8px;
  background: #fafafa; color: #444; font-size: 13px; font-weight: 600;
  cursor: pointer; transition: all 0.15s;
  text-align: center; font-family: inherit;
}
.gs-sheet-preset:hover { border-color: #1a73e8; background: #e8f0fe; }
.gs-sheet-preset-active { border-color: #1a73e8; background: #d2e3fc; color: #1a73e8; }

.gs-sheet-custom {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 20px;
}
.gs-sheet-input {
  flex: 1; padding: 8px 10px; border: 1px solid #d0d0d0;
  border-radius: 6px; font-size: 13px; text-align: center;
  outline: none; font-family: inherit; min-width: 0;
}
.gs-sheet-input:focus { border-color: #1a73e8; }
.gs-sheet-x { font-size: 14px; color: #999; flex-shrink: 0; }

.gs-sheet-picker-actions {
  display: flex; gap: 8px;
}
.gs-sheet-btn-cancel, .gs-sheet-btn-confirm {
  flex: 1; padding: 10px 0; border: none; border-radius: 8px;
  font-size: 13px; font-weight: 600; cursor: pointer; font-family: inherit;
}
.gs-sheet-btn-cancel { background: #f0f0f0; color: #666; }
.gs-sheet-btn-cancel:hover { background: #e4e4e4; }
.gs-sheet-btn-confirm { background: #1a73e8; color: #fff; }
.gs-sheet-btn-confirm:hover { background: #1557b0; }

@media (max-width: 768px) {
  .gs-nest-toolbar { padding: 6px 10px; gap: 6px; }
  .gs-nest-btn { padding: 5px 10px; font-size: 11px; }
  .gs-nest-btn-icon { width: 26px; height: 26px; font-size: 13px; }
  .gs-nest-info { font-size: 10px; }
  .gs-sheet-picker-box { width: 320px; padding: 18px; }
}
