/* === crop.css - 裁剪图片页面（深色主题） === */

.tool-content { padding: var(--space-lg) 20px; max-width: 1440px; margin: 0 auto; }
.page-header { text-align: center; margin-bottom: var(--space-xl); }
.page-title { font-size: 32px; font-weight: 700; color: var(--color-text-primary); margin-bottom: 12px; }
.page-subtitle { font-size: 16px; color: var(--color-text-secondary); line-height: 1.6; }

/* --- 上传区域 --- */
.upload-container {
  background: var(--color-bg-secondary);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  max-width: 800px; margin: 0 auto; overflow: hidden;
  border: 1px solid var(--color-border);
}

.upload-zone {
  padding: 60px 40px; text-align: center;
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  color: var(--color-text-primary); cursor: pointer;
  transition: all 0.3s;
  border: 2px dashed var(--color-border);
  margin: 20px; border-radius: var(--radius-md);
}
.upload-zone:hover { border-color: var(--color-accent); }

.upload-actions { display: flex; align-items: center; justify-content: center; gap: 12px; margin-bottom: 20px; }

.btn-upload {
  padding: 14px 32px;
  background: var(--color-accent);
  color: var(--text-on-accent); border: none;
  border-radius: var(--radius-sm);
  font-size: 16px; font-weight: 500; cursor: pointer;
  transition: all 0.2s;
}
.btn-upload:hover { background: var(--color-accent-hover); transform: translateY(-2px); }
.upload-hint { font-size: 14px; opacity: 0.8; margin-bottom: 12px; }
.upload-rules { font-size: 12px; opacity: 0.6; }

/* --- 编辑区域 --- */
.editor-layout { display: none; gap: var(--space-md); align-items: stretch; height: calc(100vh - 200px); }
.editor-layout.active { display: flex; }

.preview-section {
  flex: 0 0 70%;
  background: var(--color-bg-secondary);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  padding: 20px;
  overflow: hidden;
  border: 1px solid var(--color-border);
}

.preview-container { position: relative; width: 100%; height: 100%; overflow: hidden; }
.preview-image { width: 100%; height: 100%; object-fit: contain; display: block; }

.crop-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; }
.crop-mask { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: rgba(2, 6, 23, 0.6); pointer-events: none; }

.crop-box {
  position: absolute;
  border: 2px solid var(--color-accent);
  background: transparent;
  cursor: move;
  pointer-events: auto;
  overflow: hidden;
}
.crop-box::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; bottom: 0;
  border: 1px dashed rgba(255, 255, 255, 0.4);
  pointer-events: none;
}

.crop-handle {
  position: absolute; width: 12px; height: 12px;
  background: var(--color-accent);
  border: 2px solid #fff;
  border-radius: 50%;
  pointer-events: auto; z-index: 10;
}
.crop-handle-nw { top: -6px; left: -6px; cursor: nw-resize; }
.crop-handle-ne { top: -6px; right: -6px; cursor: ne-resize; }
.crop-handle-sw { bottom: -6px; left: -6px; cursor: sw-resize; }
.crop-handle-se { bottom: -6px; right: -6px; cursor: se-resize; }
.crop-handle-n { top: -6px; left: 50%; transform: translateX(-50%); cursor: n-resize; }
.crop-handle-s { bottom: -6px; left: 50%; transform: translateX(-50%); cursor: s-resize; }
.crop-handle-w { top: 50%; left: -6px; transform: translateY(-50%); cursor: w-resize; }
.crop-handle-e { top: 50%; right: -6px; transform: translateY(-50%); cursor: e-resize; }

/* --- 右侧配置区 --- */
.config-section {
  flex: 0 0 calc(30% - 24px);
  background: var(--color-bg-secondary);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  border: 1px solid var(--color-border);
}
.config-title { font-size: 20px; font-weight: 700; color: var(--color-text-primary); text-align: center; margin-bottom: 8px; }
.input-group { display: flex; flex-direction: column; gap: 8px; }
.input-label { font-size: 14px; font-weight: 500; color: var(--color-text-primary); }

.number-input {
  padding: 10px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  outline: none;
  background: var(--color-bg-primary);
  color: var(--color-text-primary);
  transition: border-color 0.2s;
}
.number-input:focus { border-color: var(--color-accent); }

.checkbox-group { margin-top: 8px; }
.checkbox-item { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.checkbox-item input[type="checkbox"] { display: none; }
.checkbox-custom {
  width: 20px; height: 20px;
  border: 2px solid var(--color-border);
  border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s; flex-shrink: 0;
}
.checkbox-item input:checked + .checkbox-custom { background: var(--color-accent); border-color: var(--color-accent); }
.checkbox-custom::after { content: '✓'; color: #fff; font-size: 12px; font-weight: 700; display: none; }
.checkbox-item input:checked + .checkbox-custom::after { display: block; }
.checkbox-label { font-size: 14px; color: var(--color-text-primary); }

.btn-primary {
  width: 100%; padding: 14px;
  background: var(--color-accent); color: var(--text-on-accent); border: none;
  border-radius: var(--radius-sm); font-size: 16px; font-weight: 500;
  cursor: pointer; transition: all 0.2s;
  margin-top: auto;
}
.btn-primary:hover { background: var(--color-accent-hover); transform: translateY(-2px); }

#fileInput { display: none; }

/* --- 响应式 --- */
@media (max-width: 1024px) {
  .editor-layout { flex-direction: column; height: auto; }
  .preview-section, .config-section { flex: 0 0 100%; }
}
@media (max-width: 768px) {
  .page-title { font-size: 24px; }
  .page-subtitle { font-size: 14px; }
  .upload-zone { padding: 40px 20px; }
}