/* ============================================================
   组件：预览面板 (Preview Panel)
   ============================================================ */

/* ── 预览面板底部工具栏 ── */
.preview-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-4);
  margin-bottom: var(--space-4);
}

.preview-toolbar-actions {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.preview-hint {
  font-size: var(--text-xs);
  color: var(--color-success);
  margin-top: var(--space-1);
  line-height: var(--leading-relaxed);
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.preview-hint::before {
  content: "✓";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--color-success);
  color: white;
  font-size: 9px;
  font-weight: 700;
  flex-shrink: 0;
}

/* ── 预览画板 ── */
.preview-board {
  background: var(--gradient-surface);
  border-radius: var(--border-radius-xl);
  padding: var(--space-5);
  overflow: auto;
  border: 1px solid var(--border-light);
  min-height: 780px;
  position: relative;
}

.preview-board::before {
  content: "";
  position: absolute;
  inset: 0;
  background: 
    radial-gradient(circle at 20% 30%, rgba(59, 130, 246, 0.03) 0%, transparent 50%),
    radial-gradient(circle at 80% 70%, rgba(6, 182, 212, 0.03) 0%, transparent 50%);
  pointer-events: none;
  border-radius: inherit;
}

/* ── 预览外层 ── */
.sheet-preview-shell {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  min-width: min-content;
  position: relative;
  z-index: 1;
}

.sheet-preview-viewport {
  margin: 0 auto;
  position: relative;
  transition: height var(--duration-fast) var(--ease-default);
  overflow: hidden;
}

.sheet-preview-inner {
  position: absolute;
  left: 0;
  top: 0;
  transform-origin: top left;
}

/* ── 水印层 ── */
.preview-watermark-layer {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 12;
}

.preview-watermark-item {
  position: absolute;
  color: rgba(38, 58, 92, 0.09);
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 1px;
  white-space: nowrap;
  transform: rotate(-24deg);
  transform-origin: center center;
  user-select: none;
}

/* ── 空白状态 ── */
.blank-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 460px;
  text-align: center;
  color: var(--text-tertiary);
  font-size: var(--text-base);
  line-height: var(--leading-loose);
  padding: var(--space-5);
}

.blank-state::before {
  content: "📄";
  font-size: 48px;
  margin-bottom: var(--space-4);
  opacity: 0.4;
}

/* ── 可拖拽区域 ── */
.code-drag-area {
  position: absolute;
  cursor: grab;
  user-select: none;
  touch-action: none;
  z-index: 6;
  transition: filter var(--duration-instant) var(--ease-default);
}

.code-drag-area:hover {
  filter: brightness(1.05);
}

.code-drag-area.is-dragging {
  cursor: grabbing;
  filter: brightness(1.1);
}

.code-drag-area canvas,
.code-drag-area svg,
.code-drag-area img {
  display: block;
}

/* ── 响应式 ── */
@media (max-width: 768px) {
  .preview-board {
    padding: var(--space-3);
    min-height: auto;
    overflow-x: hidden;
    overflow-y: auto;
  }

  .sheet-preview-shell {
    min-width: 0;
    width: 100%;
    justify-content: flex-start;
  }
}

/* ── 暗色模式适配 ── */
[data-theme="dark"] .preview-board {
  background: var(--gradient-surface);
}

[data-theme="dark"] .blank-state {
  color: var(--text-tertiary);
}
