/* ==========================================================================
 * cropper.css — 裁切浮窗（模态层）样式
 * ========================================================================== */

/* ---------- 模态遮罩 ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;               /* JS 控制 display:none/flex */
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  animation: fadeIn 0.2s ease;
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ---------- 模态容器 ---------- */
.modal-container {
  width: min(90vw, 800px);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.25s ease;
  overflow: hidden;
}
@keyframes slideUp {
  from { transform: translateY(30px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

/* ---------- 模态头部 ---------- */
.modal-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}
.modal-header h3 {
  font-size: 15px;
  flex-shrink: 0;
}
.modal-header-actions {
  display: flex;
  gap: 6px;
  flex: 1;
  justify-content: center;
}

/* 预设按钮 */
.preset-btn {
  background: var(--color-bg);
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  font-size: 12px;
  transition: all var(--transition-fast);
}
.preset-btn:hover {
  color: var(--color-text);
  border-color: var(--color-text-muted);
}
.preset-btn.active {
  background: var(--color-accent);
  color: #fff;
  border-color: var(--color-accent);
}

/* 关闭按钮 */
.modal-close-btn {
  background: transparent;
  color: var(--color-text-muted);
  font-size: 18px;
  padding: 4px 8px;
  line-height: 1;
}
.modal-close-btn:hover {
  color: var(--color-danger);
}

/* ---------- 模态主体 ---------- */
.modal-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px;
  overflow: hidden;
  min-height: 0;
}

/* 画布包装器（限制最大显示尺寸，居中） */
.crop-canvas-wrapper {
  position: relative;
  width: 100%;
  max-width: 600px;
  aspect-ratio: 1;
  background: #000;             /* 画布外区域为黑色 */
  border-radius: var(--radius);
  overflow: hidden;
  cursor: grab;
  flex-shrink: 0;
}
.crop-canvas-wrapper:active {
  cursor: grabbing;
}
.crop-canvas-wrapper canvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* 裁切区域指示器（CSS overlay，显示裁剪区域轮廓） */
.crop-overlay-indicator {
  position: absolute;
  inset: 0;
  pointer-events: none;         /* 不拦截鼠标事件，由 canvas 处理 */
  /* 使用 box-shadow 实现外部暗化 + 内部透明 */
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.55);
  border-radius: 0;
  border: 2px dashed rgba(255, 255, 255, 0.7);
}

/* ★ 裁切分辨率设置行（1:1 锁定） */
.crop-settings-row {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  max-width: 600px;
  margin-top: 12px;
  padding: 8px 12px;
  background: var(--color-bg);
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}
.crop-settings-row label {
  font-size: 12px;
  color: var(--color-text-muted);
  white-space: nowrap;
}
.crop-settings-row input[type="number"] {
  width: 64px;
  font-family: inherit;
  font-size: 13px;
  padding: 4px 6px;
  text-align: center;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-text);
}
.crop-settings-row input[type="number"]:focus {
  outline: none;
  border-color: var(--color-accent);
}
.crop-settings-row input[disabled] {
  opacity: 0.6;
  cursor: not-allowed;
}
.crop-settings-row .crop-res-unit {
  font-size: 14px;
  color: var(--color-text-muted);
}
.crop-settings-row .crop-res-label {
  font-size: 11px;
  color: var(--color-text-muted);
  margin-left: 4px;
}

/* 操作提示 */
.crop-hints {
  display: flex;
  justify-content: space-between;
  width: 100%;
  max-width: 600px;
  margin-top: 8px;
  font-size: 11px;
  color: var(--color-text-muted);
  flex-shrink: 0;
}

/* ---------- 模态底部按钮 ---------- */
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 12px 16px;
  border-top: 1px solid var(--color-border);
  flex-shrink: 0;
}
.btn-cancel {
  background: transparent;
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
}
.btn-cancel:hover {
  color: var(--color-text);
  border-color: var(--color-text-muted);
}
.btn-confirm {
  background: var(--color-accent);
  color: #fff;
  padding: 8px 20px;
  font-weight: 600;
}
.btn-confirm:hover {
  background: var(--color-accent-hover);
}
