/* ==================== 图片编辑器 ==================== */

/* 全屏遮罩 */
.ie-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: #000;
  display: flex;
  flex-direction: column;
  opacity: 0;
  transition: opacity 0.25s ease;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}
.ie-overlay.ie-active {
  opacity: 1;
}

/* 顶部工具栏 */
.ie-toolbar-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  padding-top: calc(10px + env(safe-area-inset-top, 0px));
  flex-shrink: 0;
  z-index: 2;
}

.ie-close-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}
.ie-close-btn:active {
  background: rgba(255, 255, 255, 0.25);
}

.ie-title {
  color: rgba(255, 255, 255, 0.9);
  font-size: 16px;
  font-weight: 600;
}

.ie-confirm-btn {
  padding: 8px 20px;
  border-radius: 20px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  font-size: 14px;
  font-weight: 600;
  transition: opacity 0.2s;
}
.ie-confirm-btn:active {
  opacity: 0.8;
}
.ie-confirm-btn:disabled {
  opacity: 0.4;
}

/* 画布区域 */
.ie-canvas-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
  min-height: 0;
}
.ie-canvas-wrap .canvas-container {
  max-width: 100% !important;
  max-height: 100% !important;
}

/* 底部工具面板 */
.ie-toolbar-bottom {
  flex-shrink: 0;
  background: rgba(20, 20, 20, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 14px 16px;
  padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px));
}

/* 工具按钮行 */
.ie-tools {
  display: flex;
  justify-content: center;
  gap: 32px;
  margin-bottom: 14px;
}

.ie-tool-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: rgba(255, 255, 255, 0.5);
  font-size: 11px;
  background: none;
  border: none;
  padding: 8px 16px;
  border-radius: 12px;
  transition: all 0.2s;
  min-width: 60px;
}
.ie-tool-btn i {
  font-size: 22px;
  margin-bottom: 2px;
}
.ie-tool-btn.active {
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
}
.ie-tool-btn:active {
  transform: scale(0.94);
}

/* 子选项行（画笔大小、颜色） */
.ie-options {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 36px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.ie-options-divider {
  width: 1px;
  height: 24px;
  background: rgba(255, 255, 255, 0.15);
  margin: 0 4px;
}

/* 画笔大小按钮 */
.ie-size-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.2);
  background: none;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
.ie-size-btn.active {
  border-color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

.ie-size-dot {
  border-radius: 50%;
  background: #fff;
}

/* 颜色按钮 */
.ie-color-btn {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2.5px solid transparent;
  transition: all 0.2s;
  flex-shrink: 0;
}
.ie-color-btn.active {
  border-color: #fff;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.4);
  transform: scale(1.15);
}

/* 操作栏（撤销/重做） */
.ie-action-bar {
  display: flex;
  justify-content: center;
  gap: 24px;
}

.ie-action-btn {
  color: rgba(255, 255, 255, 0.3);
  font-size: 18px;
  padding: 6px 12px;
  border-radius: 8px;
  transition: all 0.2s;
  background: none;
  border: none;
}
.ie-action-btn:not(:disabled) {
  color: rgba(255, 255, 255, 0.75);
}
.ie-action-btn:not(:disabled):active {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

/* 裁剪模式操作栏 */
.ie-crop-actions {
  display: flex;
  justify-content: center;
  gap: 16px;
}

.ie-crop-cancel-btn,
.ie-crop-apply-btn {
  padding: 8px 24px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.2s;
}

.ie-crop-cancel-btn {
  background: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.8);
  border: none;
}
.ie-crop-cancel-btn:active {
  background: rgba(255, 255, 255, 0.2);
}

.ie-crop-apply-btn {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  border: none;
}
.ie-crop-apply-btn:active {
  opacity: 0.8;
}

/* 加载状态 */
.ie-loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.7);
  z-index: 10;
  gap: 12px;
}
.ie-loading .spinner {
  width: 32px;
  height: 32px;
  border: 3px solid rgba(255, 255, 255, 0.2);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
.ie-loading span {
  color: rgba(255, 255, 255, 0.8);
  font-size: 14px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* 马赛克大小选项 */
.ie-mosaic-sizes {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* 上传图片后的编辑按钮 */
.block-image-actions {
  position: absolute;
  bottom: 8px;
  right: 8px;
  z-index: 2;
}

.block-image-edit-btn {
  padding: 6px 14px;
  border-radius: 16px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 12px;
  font-weight: 500;
  border: none;
  cursor: pointer;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  gap: 5px;
  transition: background 0.2s;
}
.block-image-edit-btn:active {
  background: rgba(79, 70, 229, 0.75);
}

/* 封面图编辑按钮 */
.cover-upload .cover-edit {
  position: absolute;
  top: 8px;
  right: 44px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  z-index: 2;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  border: none;
  transition: background 0.2s;
}
.cover-upload .cover-edit:active {
  background: rgba(79, 70, 229, 0.7);
}
