/* ==========================================================================
   KAI WANG PORTFOLIO — IN-PAGE VISUAL STUDIO EDITOR (可视化实时编辑与自由拖拽系统)
   支持：
   1. 鼠标按住任意元素（图片/卡片/标题/段落/首页模块）随意自由拖拽移动 (X/Y 自由坐标 + 对齐辅助线)
   2. 键盘方向键 (↑ ↓ ← →) 1px 微调位置，Shift + 方向键 10px 快速移动
   3. 拖拽右下角圆点直接无级缩放图片/卡片尺寸
   4. 点击任意文字直接打字修改、实时调字号/字重/行高/颜色
   5. 从 Keynote 提取素材库一键换图或上传本地图片
   ========================================================================== */

/* Floating Draggable Dock */
.ve-dock {
  position: fixed;
  left: 24px;
  bottom: 24px;
  right: auto;
  z-index: 9990;
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(14, 14, 18, 0.94);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.18);
  padding: 6px 10px;
  border-radius: 99px;
  box-shadow: 0 16px 44px rgba(0, 0, 0, 0.5);
  font-family: 'Inter', 'Noto Sans SC', sans-serif;
  user-select: none;
  cursor: grab;
  touch-action: none;
}

.ve-dock.is-dragging {
  cursor: grabbing;
  box-shadow: 0 22px 54px rgba(0, 0, 0, 0.62);
}

.ve-dock__grip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.55);
  font-size: 14px;
  line-height: 1;
  padding: 2px 4px 2px 2px;
  cursor: grab;
  transition: color 0.18s ease;
}

.ve-dock:hover .ve-dock__grip {
  color: rgba(255, 255, 255, 0.9);
}

.ve-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 0;
  border-radius: 99px;
  padding: 8px 14px;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  color: #ffffff;
  background: rgba(255, 255, 255, 0.1);
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.ve-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

.ve-btn--primary {
  background: #2359EF;
  color: #ffffff;
  box-shadow: 0 4px 16px rgba(35, 89, 239, 0.45);
}

.ve-btn--primary:hover {
  background: #1b49d4;
}

.ve-btn--active {
  background: #10b981;
  color: #ffffff;
  box-shadow: 0 4px 16px rgba(16, 185, 129, 0.4);
}

.ve-btn--dragmode {
  background: #f59e0b;
  color: #000000;
  box-shadow: 0 4px 16px rgba(245, 158, 11, 0.45);
}

.ve-status {
  font-size: 11.5px;
  color: rgba(255, 255, 255, 0.72);
  padding: 0 8px;
}

/* Editable Hover & Selection Outlines when Visual Edit Mode is ON */
body.ve-mode-on [data-ve-editable]:hover {
  outline: 1.5px dashed rgba(35, 89, 239, 0.65) !important;
  outline-offset: 3px !important;
}

body.ve-mode-on img:not(.ve-ignore):hover {
  outline: 2px dashed #2359EF !important;
  outline-offset: 3px !important;
  cursor: grab !important;
}

body.ve-mode-on.ve-free-drag-all [data-ve-editable],
body.ve-mode-on.ve-free-drag-all img:not(.ve-ignore),
body.ve-mode-on.ve-free-drag-all .jv-compare-card,
body.ve-mode-on.ve-free-drag-all .jv-flow-phone,
body.ve-mode-on.ve-free-drag-all .jv-phone-card,
body.ve-mode-on.ve-free-drag-all .jv-layer-card,
body.ve-mode-on.ve-free-drag-all .jv-spec-item,
body.ve-mode-on.ve-free-drag-all .lz-element,
body.ve-mode-on.ve-free-drag-all .lz-card-btn {
  cursor: move !important;
}

body.ve-mode-on .jv-article-image-wrapper:hover {
  box-shadow: inset 0 0 0 2px rgba(35, 89, 239, 0.35);
}

.ve-selected-el {
  outline: 2.5px solid #2359EF !important;
  outline-offset: 4px !important;
}

/* On-Canvas Selection Frame + Top Move Handle + Corner Resize Handle */
.ve-selection-box {
  position: fixed;
  z-index: 9985;
  pointer-events: none;
  border: 2px solid #2359EF;
  border-radius: 6px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.65);
  display: none;
}

body.ve-mode-on .ve-selection-box.visible {
  display: block;
}

.ve-selection-box__toolbar {
  position: absolute;
  top: -34px;
  left: 0;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #141418;
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 3px 6px;
  border-radius: 8px;
  pointer-events: auto;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4);
  white-space: nowrap;
  font-family: 'Inter', 'Noto Sans SC', sans-serif;
}

.ve-move-grip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #2359EF;
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: move;
  user-select: none;
}

.ve-move-grip:active {
  cursor: grabbing;
  background: #1b49d4;
}

.ve-mini-tool {
  background: rgba(255, 255, 255, 0.1);
  border: 0;
  color: #ffffff;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 5px;
  cursor: pointer;
}

.ve-mini-tool:hover {
  background: rgba(255, 255, 255, 0.24);
}

.ve-selection-box__dims {
  font-size: 10.5px;
  color: rgba(255, 255, 255, 0.72);
  padding: 0 6px;
  font-variant-numeric: tabular-nums;
}

.ve-selection-box__handle {
  position: absolute;
  width: 16px;
  height: 16px;
  right: -9px;
  bottom: -9px;
  background: #ffffff;
  border: 3px solid #2359EF;
  border-radius: 50%;
  cursor: nwse-resize;
  pointer-events: auto;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
  transition: transform 0.15s ease;
}

.ve-selection-box__handle:hover {
  transform: scale(1.28);
}

/* Alignment Snap Guide Lines (Figma-style Red/Blue Guides while dragging) */
.ve-snap-guide-v,
.ve-snap-guide-h {
  position: fixed;
  z-index: 9984;
  pointer-events: none;
  background: #f43f5e;
  display: none;
}

.ve-snap-guide-v {
  top: 0;
  bottom: 0;
  width: 1.5px;
}

.ve-snap-guide-h {
  left: 0;
  right: 0;
  height: 1.5px;
}

/* Right-Side Floating Inspector Panel */
.ve-inspector {
  position: fixed;
  top: 80px;
  right: 24px;
  width: 326px;
  max-height: calc(100vh - 165px);
  overflow-y: auto;
  z-index: 9989;
  background: rgba(18, 18, 22, 0.96);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 20px;
  padding: 18px;
  color: #ffffff;
  font-family: 'Inter', 'Noto Sans SC', sans-serif;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.58);
  display: none;
  flex-direction: column;
  gap: 14px;
}

body.ve-mode-on .ve-inspector.open {
  display: flex;
}

.ve-inspector__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  cursor: move;
  user-select: none;
}

.ve-inspector__title {
  font-size: 13px;
  font-weight: 700;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 7px;
}

.ve-inspector__tag {
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 99px;
  background: rgba(35, 89, 239, 0.35);
  color: #93b4ff;
  border: 1px solid rgba(35, 89, 239, 0.6);
}

.ve-inspector__close {
  background: transparent;
  border: 0;
  color: rgba(255, 255, 255, 0.6);
  font-size: 15px;
  cursor: pointer;
  padding: 2px 6px;
}

.ve-inspector__close:hover {
  color: #ffffff;
}

.ve-group {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.ve-group:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.ve-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11.5px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.75);
}

.ve-label__val {
  color: #93b4ff;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.ve-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ve-slider {
  flex: 1;
  accent-color: #2359EF;
  cursor: pointer;
}

.ve-num-input {
  width: 64px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  color: #ffffff;
  font-size: 12px;
  font-weight: 600;
  padding: 5px 7px;
  text-align: center;
}

.ve-step-btn {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #ffffff;
  border-radius: 7px;
  width: 28px;
  height: 28px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.ve-step-btn:hover {
  background: #2359EF;
  border-color: #2359EF;
}

.ve-seg-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.ve-seg-grid--3 {
  grid-template-columns: repeat(3, 1fr);
}

.ve-seg-grid--2 {
  grid-template-columns: repeat(2, 1fr);
}

.ve-seg-btn {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  color: rgba(255, 255, 255, 0.88);
  font-size: 11.5px;
  font-weight: 600;
  padding: 6px 8px;
  cursor: pointer;
  transition: all 0.18s ease;
  text-align: center;
}

.ve-seg-btn:hover,
.ve-seg-btn.active {
  background: #2359EF;
  border-color: #2359EF;
  color: #ffffff;
}

.ve-seg-btn--danger:hover {
  background: #ef4444;
  border-color: #ef4444;
}

/* Swatches */
.ve-swatches {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ve-swatch {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.35);
  cursor: pointer;
  padding: 0;
  transition: transform 0.15s ease;
}

.ve-swatch:hover {
  transform: scale(1.15);
}

.ve-color-input {
  width: 32px;
  height: 26px;
  border: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
}

/* Keynote Asset Picker Modal */
.ve-asset-modal {
  position: fixed;
  inset: 0;
  z-index: 9995;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 32px;
  font-family: 'Inter', 'Noto Sans SC', sans-serif;
}

.ve-asset-modal.open {
  display: flex;
}

.ve-asset-dialog {
  width: 100%;
  max-width: 980px;
  max-height: 84vh;
  background: #141418;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 24px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  color: #ffffff;
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.65);
}

.ve-asset-dialog__head {
  padding: 20px 26px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.ve-asset-dialog__title {
  font-size: 16px;
  font-weight: 700;
}

.ve-asset-tabs {
  display: flex;
  gap: 8px;
  padding: 14px 26px;
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.ve-asset-grid {
  padding: 24px 26px;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 16px;
}

.ve-asset-card {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  padding: 10px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: all 0.2s ease;
}

.ve-asset-card:hover {
  border-color: #2359EF;
  background: rgba(35, 89, 239, 0.16);
  transform: translateY(-2px);
}

.ve-asset-card__thumb {
  width: 100%;
  height: 130px;
  object-fit: contain;
  background: #0a0a0d;
  border-radius: 8px;
}

.ve-asset-card__name {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.78);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
}
