/**
 * 图片处理工具统一UI样式
 * 适用于：图片裁剪、图片加水印、图片格式转换、图片压缩、图片尺寸调整等工具
 * 
 * 这个文件包含了所有图片处理工具的通用UI组件样式，确保视觉一致性
 */

/* =============================================================================
   上传区域样式 - 所有图片工具通用
   ============================================================================= */

.preview-upload-area {
  margin-bottom: 30px;
}

.upload-drop-zone {
  position: relative;
  min-height: 400px;
  background: #111116;
  border: 3px dashed #24242a;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  overflow: hidden;
  max-width: 800px;
  margin: 0 auto;
}

.upload-drop-zone:hover {
  border-color: #7aa2ff;
  background: #1a1a20;
}

.upload-drop-zone.drag-over {
  border-color: #7aa2ff;
  background: #1f1f26;
  transform: scale(1.02);
}

.upload-drop-zone.has-image {
  background: #111116;
  border: 2px solid #24242a;
  min-height: auto;
}

.upload-placeholder {
  text-align: center;
  padding: 40px 20px;
  color: #a6a6b2;
  max-width: 400px;
}

.upload-icon {
  font-size: 64px;
  margin-bottom: 20px;
  opacity: 0.7;
}

.upload-placeholder h3 {
  font-size: 24px;
  margin: 0 0 10px 0;
  color: #e7e7ea;
}

.upload-placeholder p {
  font-size: 16px;
  margin: 0 0 20px 0;
  color: #a6a6b2;
}

.upload-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(122, 162, 255, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
}

.overlay-content {
  text-align: center;
  color: white;
}

.overlay-content .upload-icon {
  font-size: 48px;
  margin-bottom: 10px;
}

.overlay-content p {
  font-size: 18px;
  margin: 0;
  font-weight: 500;
}

/* =============================================================================
   画布样式 - 图片预览和处理
   ============================================================================= */

.image-canvas {
  max-width: 100%;
  max-height: 600px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  border: 1px solid #24242a;
}

/* 针对不同工具的画布ID */
#crop-canvas,
#wm-canvas,
#watermark-canvas,
#compress-canvas,
#resize-canvas,
#convert-canvas {
  max-width: 100%;
  max-height: 600px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  border: 1px solid #24242a;
}

/* =============================================================================
   控制面板样式 - 工具设置区域
   ============================================================================= */

.controls-panel,
.watermark-controls {
  background: #111116;
  border: 1px solid #24242a;
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.controls-title {
  margin: 0 0 24px 0;
  color: #e7e7ea;
  font-size: 20px;
  font-weight: 600;
  text-align: center;
  border-bottom: 2px solid #24242a;
  padding-bottom: 12px;
}

.controls-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 25px;
  margin-bottom: 30px;
}

.control-section {
  background: #1a1a20;
  border-radius: 8px;
  padding: 20px;
  border: 1px solid #2a2a33;
}

.control-section h4 {
  margin: 0 0 16px 0;
  color: #e7e7ea;
  font-size: 16px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.control-group {
  margin-bottom: 16px;
}

.control-group:last-child {
  margin-bottom: 0;
}

.control-group label {
  display: block;
  margin-bottom: 6px;
  font-size: 14px;
  color: #e7e7ea;
  font-weight: 500;
}

.control-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
}

/* =============================================================================
   表单控件样式 - 输入框、按钮、选择器等
   ============================================================================= */

.input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #2a2a33;
  border-radius: 6px;
  font-size: 14px;
  transition: border-color 0.3s ease;
  box-sizing: border-box;
  background: #1a1a20;
  color: #e7e7ea;
}

.input:focus {
  outline: none;
  border-color: #7aa2ff;
  box-shadow: 0 0 0 2px rgba(122, 162, 255, 0.2);
}

.select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #2a2a33;
  border-radius: 6px;
  font-size: 14px;
  transition: border-color 0.3s ease;
  box-sizing: border-box;
  background: #1a1a20;
  color: #e7e7ea;
}

.select:focus {
  outline: none;
  border-color: #7aa2ff;
  box-shadow: 0 0 0 2px rgba(122, 162, 255, 0.2);
}

/* 范围滑块样式 */
.range-wrapper {
  position: relative;
}

.range-input {
  width: 100%;
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  border-radius: 3px;
  background: #2a2a33;
  outline: none;
  margin: 10px 0;
}

.range-input::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #7aa2ff;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.range-input::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #7aa2ff;
  cursor: pointer;
  border: none;
  box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.range-labels {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: #a6a6b2;
  margin-top: 5px;
}

.current-value {
  font-weight: 600;
  color: #7aa2ff;
}

/* 复选框样式 */
.checkbox-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.checkbox-wrapper input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: #7aa2ff;
}

.checkbox-wrapper label {
  color: #e7e7ea !important;
  margin: 0 !important;
}

/* =============================================================================
   按钮样式 - 工具页面特定样式
   注意：基础.btn样式已在style.css中定义，这里只添加额外的修饰
   ============================================================================= */

/* 操作按钮区域 */
.action-section {
  border-top: 2px solid #24242a;
  padding-top: 20px;
}

.action-buttons {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.action-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  font-weight: 600;
  border-radius: 8px;
  transition: all 0.3s ease;
  min-width: 140px;
  justify-content: center;
}

.action-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.btn-icon {
  font-size: 16px;
}

/* =============================================================================
   状态和信息显示
   ============================================================================= */

.status-display {
  text-align: center;
  padding: 12px;
  border-radius: 6px;
  background: #1a1a20;
  border: 1px solid #2a2a33;
  color: #e7e7ea;
  font-weight: 500;
  min-height: 20px;
}

.status-display:empty {
  display: none;
}

.notice {
  background: #1a1a20;
  border: 1px solid #2a2a33;
  color: #a6a6b2;
  padding: 15px;
  border-radius: 8px;
  font-size: 14px;
  text-align: center;
  margin-top: 20px;
}

/* 选择信息和图片信息 */
.selection-info, 
.image-info, 
.status-info {
  font-size: 14px;
  color: #a6a6b2;
  margin-top: 10px;
}

.status-info {
  padding: 8px 12px;
  background: #1a1a20;
  border: 1px solid #2a2a33;
  border-radius: 6px;
}

/* =============================================================================
   预览区域样式
   ============================================================================= */

.preview-container {
  margin-bottom: 15px;
}

.preview-wrapper {
  position: relative;
  min-height: 200px;
  background: #111116;
  border: 2px dashed #24242a;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 10px;
  padding: 1rem;
}

.preview-canvas {
  max-width: 100%;
  max-height: 300px;
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
  display: none;
  border: 1px solid #24242a;
}

.preview-placeholder {
  text-align: center;
  color: #a6a6b2;
  padding: 20px;
}

.preview-icon {
  font-size: 32px;
  margin-bottom: 10px;
  opacity: 0.5;
}

.preview-placeholder p {
  margin: 0;
  font-size: 14px;
}

/* =============================================================================
   响应式设计 - 移动端适配
   ============================================================================= */

@media (max-width: 768px) {
  .controls-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  
  .control-row {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  
  .action-buttons {
    flex-direction: column;
    align-items: stretch;
  }
  
  .action-btn {
    min-width: auto;
  }
  
  .upload-drop-zone {
    padding: 30px 15px;
    min-height: 300px;
  }
  
  .controls-panel,
  .watermark-controls {
    padding: 16px;
  }
  
  .control-section {
    padding: 16px;
  }
  
  .upload-placeholder {
    padding: 30px 15px;
  }
  
  .upload-icon {
    font-size: 48px;
  }
  
  .upload-placeholder h3 {
    font-size: 20px;
  }
}

@media (max-width: 480px) {
  .controls-panel,
  .watermark-controls {
    padding: 12px;
  }
  
  .control-section {
    padding: 12px;
  }
  
  .upload-placeholder {
    padding: 20px 10px;
  }
  
  .upload-icon {
    font-size: 40px;
    margin-bottom: 15px;
  }
  
  .upload-placeholder h3 {
    font-size: 18px;
  }
  
  .upload-placeholder p {
    font-size: 14px;
  }
}

/* =============================================================================
   专用组件样式 - 特定工具可能需要的样式
   ============================================================================= */

/* 输入框带单位样式 */
.input-with-unit {
  position: relative;
  display: flex;
  align-items: center;
}

.input-with-unit input {
  padding-right: 35px;
}

.unit {
  position: absolute;
  right: 12px;
  color: #a6a6b2;
  font-size: 12px;
  font-weight: 500;
  pointer-events: none;
}

/* 颜色选择器样式 */
.color-picker-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
}

.color-input {
  width: 50px !important;
  height: 40px;
  padding: 4px;
  border-radius: 6px;
  border: 2px solid #2a2a33;
  cursor: pointer;
  background: #1a1a20;
}

.color-label {
  font-size: 12px;
  color: #a6a6b2;
  font-weight: 500;
}

/* 位置选择网格 */
.position-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  margin-top: 8px;
}

.position-btn {
  padding: 12px;
  border: 2px solid #2a2a33;
  background: #1a1a20;
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.3s ease;
  font-size: 12px;
  text-align: center;
  color: #e7e7ea;
}

.position-btn:hover {
  border-color: #7aa2ff;
  background: #1f1f26;
}

.position-btn.active {
  border-color: #7aa2ff;
  background: #7aa2ff;
  color: #0d0d12;
}

/* 间距控制 */
.spacing-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
}

.spacing-input {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.spacing-label {
  font-size: 12px;
  color: #e7e7ea;
  font-weight: 500;
  margin: 0;
}

/* 平铺控制区域 */
.tiling-controls {
  margin-top: 15px;
  padding: 15px;
  background: #1f1f26;
  border-radius: 6px;
  border: 1px solid #2a2a33;
}

.tiling-controls.hidden {
  display: none;
}