/**
 * 圖片裁切工具樣式
 */

/* 模態框 */
.image-cropper-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* 遮罩層 */
.image-cropper-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.8);
}

/* 容器 */
.image-cropper-container {
  position: relative;
  background-color: #1e1e1e;
  border-radius: 12px;
  width: 90%;
  max-width: 600px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

/* 頭部 */
.image-cropper-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid #333;
}

.image-cropper-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: #fff;
}

.image-cropper-close {
  background: none;
  border: none;
  color: #999;
  font-size: 32px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: all 0.2s;
}

.image-cropper-close:hover {
  background-color: rgba(255, 255, 255, 0.1);
  color: #fff;
}

/* 主體 */
.image-cropper-body {
  padding: 24px;
  flex: 1;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Canvas 容器 */
.image-cropper-canvas-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #000;
  border-radius: 8px;
  overflow: hidden;
  min-height: 200px;
}

.image-cropper-canvas {
  display: block;
  max-width: 100%;
  max-height: 500px;
  cursor: grab;
  user-select: none;
}

.image-cropper-canvas:active {
  cursor: grabbing;
}

/* 遮罩 (顯示裁切區域) */
.image-cropper-mask {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.6);
  border: 2px solid rgba(255, 255, 255, 0.5);
}

.image-cropper-mask.circular {
  /* 圓形遮罩 - 固定尺寸確保是正圓 */
  width: 300px;
  height: 300px;
  border-radius: 50%;
}

.image-cropper-mask:not(.circular) {
  /* 矩形遮罩 - 固定尺寸與裁切區域一致 */
  width: 480px;
  height: calc(480px / var(--aspect-ratio, 3));
}

/* 控制項 */
.image-cropper-controls {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.image-cropper-label {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #fff;
  font-size: 14px;
}

.image-cropper-label span {
  min-width: 60px;
  color: #999;
}

.image-cropper-slider {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  background: #333;
  border-radius: 3px;
  outline: none;
}

.image-cropper-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  background: #1d9bf0;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.2s;
}

.image-cropper-slider::-webkit-slider-thumb:hover {
  background: #1a8cd8;
  transform: scale(1.1);
}

.image-cropper-slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  background: #1d9bf0;
  border-radius: 50%;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
}

.image-cropper-slider::-moz-range-thumb:hover {
  background: #1a8cd8;
  transform: scale(1.1);
}

/* 底部 */
.image-cropper-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  padding: 20px 24px;
  border-top: 1px solid #333;
}

.image-cropper-btn {
  padding: 10px 24px;
  border-radius: 20px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
  outline: none;
}

.image-cropper-btn-cancel {
  background-color: transparent;
  color: #999;
  border: 1px solid #333;
}

.image-cropper-btn-cancel:hover {
  background-color: rgba(255, 255, 255, 0.05);
  color: #fff;
  border-color: #555;
}

.image-cropper-btn-confirm {
  background-color: #1d9bf0;
  color: #fff;
}

.image-cropper-btn-confirm:hover {
  background-color: #1a8cd8;
}

.image-cropper-btn-confirm:active {
  transform: scale(0.98);
}

/* 響應式 */
@media (max-width: 768px) {
  .image-cropper-container {
    width: 95%;
    max-height: 95vh;
  }

  .image-cropper-header,
  .image-cropper-body,
  .image-cropper-footer {
    padding: 16px;
  }

  .image-cropper-header h3 {
    font-size: 16px;
  }
}

