/* =============================================================================
   DramaBoard · 裁剪编辑器 (CropEditor)
   设计文档:E:\openclaw\DramaBoard\docs\裁剪功能设计方案-v2.md
   Phase 1:视觉骨架(所有控件点了没反应,只有 × / Esc 能关)
   ============================================================================= */

/* === 全屏 modal === */
.crop-modal {
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  flex-direction: column;
  font-family: inherit;
  color: #e8ebf0;
}

/* === 中央 stage === */
.crop-stage {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
}

.crop-img-wrap {
  position: relative;
  max-width: calc(100vw - 40px);
  max-height: calc(100vh - 140px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.crop-image {
  max-width: none;       /* 让 CSS transform: scale(zoom) 视觉缩放不被 max-width 截断 */
  max-height: none;
  display: block;
  user-select: none;
  -webkit-user-drag: none;
  transform-origin: center center; /* zoom 时图片中心不动 */
}

/* === 选区外 4 块暗色遮罩 === */
.crop-mask {
  position: absolute;
  background: rgba(0, 0, 0, 0.55);
  pointer-events: none;
}

/* === 选区边框(细线,装饰用) === */
.crop-frame {
  position: absolute;
  border: 2px solid rgba(255, 255, 255, 0.8);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.3);
  pointer-events: none;
}

/* === 4 条边命中区(8px 宽,透明,可拖拽) === */
.crop-edge {
  position: absolute;
  background: transparent;
  z-index: 1;
}
.crop-edge-n { left: 0; right: 0; top: -4px; height: 8px; cursor: n-resize; }
.crop-edge-s { left: 0; right: 0; bottom: -4px; height: 8px; cursor: s-resize; }
.crop-edge-e { top: 0; bottom: 0; right: -4px; width: 8px; cursor: e-resize; }
.crop-edge-w { top: 0; bottom: 0; left: -4px; width: 8px; cursor: w-resize; }

/* === 4 个角命中区(12px 方块,透明,可拖拽) === */
.crop-handle {
  position: absolute;
  width: 12px;
  height: 12px;
  background: transparent;
  z-index: 2;
}
.crop-handle[data-handle="nw"] { top: -6px; left: -6px; cursor: nwse-resize; }
.crop-handle[data-handle="ne"] { top: -6px; right: -6px; cursor: nesw-resize; }
.crop-handle[data-handle="sw"] { bottom: -6px; left: -6px; cursor: nesw-resize; }
.crop-handle[data-handle="se"] { bottom: -6px; right: -6px; cursor: nwse-resize; }

/* 角:hover 时给点视觉提示(蓝色边框)— Phase 1 加这个让用户知道是命中区 */
.crop-handle:hover {
  background: rgba(79, 195, 247, 0.4);
  border: 1px solid #4fc3f7;
}
.crop-edge:hover {
  background: rgba(79, 195, 247, 0.15);
}

/* === × 关闭按钮 === */
.crop-close {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 32px;
  height: 32px;
  border: none;
  background: rgba(20, 23, 29, 0.7);
  color: #ffffff;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  border-radius: 50%;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background 0.15s;
}
.crop-close:hover { background: rgba(40, 43, 49, 0.9); }

/* === 底栏工具栏 === */
.crop-toolbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 20px;
  background: rgba(20, 23, 29, 0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}

.crop-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.crop-group-label {
  color: #aab0bc;
  font-size: 12px;
  white-space: nowrap;
}

/* 比例下拉 + 输出分辨率下拉(共用样式) */
.crop-ratio,
.crop-output-res {
  background: rgba(20, 23, 29, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #e8ebf0;
  padding: 5px 8px;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  outline: none;
  font-family: inherit;
}
.crop-ratio:hover,
.crop-output-res:hover {
  border-color: rgba(79, 195, 247, 0.5);
}
.crop-ratio:focus,
.crop-output-res:focus {
  border-color: #4fc3f7;
}
/* 让 select 在不同浏览器下一致 */
.crop-ratio option,
.crop-output-res option {
  background: #15181f;
  color: #e8ebf0;
}

/* 调整组(6 个图标按钮) */
.crop-tools {
  display: flex;
  gap: 4px;
}

.crop-tool {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #e8ebf0;
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
  min-width: 32px;
  text-align: center;
  font-family: inherit;
  transition: all 0.12s;
}
.crop-tool:hover {
  background: rgba(79, 195, 247, 0.15);
  color: #4fc3f7;
  border-color: rgba(79, 195, 247, 0.3);
}

/* === 确认修改按钮(紫色) === */
.crop-confirm {
  margin-left: auto;
  background: #7c4dff;
  color: #ffffff;
  border: none;
  padding: 8px 24px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s;
}
.crop-confirm:hover { background: #9575ff; }
.crop-confirm:active { background: #6c3def; }
