/**
 * 图片涂色编辑器（跨 video_workflow / storyboard 共享）
 * 含独立 modal 外壳，不依赖宿主页面其它弹层样式。
 */

.coloring-editor-modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.55);
  z-index: 10050;
  padding: 16px;
  box-sizing: border-box;
}

.coloring-editor-modal.show {
  display: flex;
}

.coloring-editor-modal .coloring-modal-card {
  width: min(900px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  overflow: auto;
  background: #ffffff;
  color: #111827;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  box-shadow: 0 16px 48px rgba(15, 23, 42, 0.28);
}

.coloring-editor-modal .coloring-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: #f8fafc;
  border-bottom: 1px solid #e5e7eb;
}

.coloring-editor-modal .coloring-modal-title {
  font-size: 14px;
  font-weight: 700;
  color: #0f172a;
}

.coloring-editor-modal .coloring-modal-close {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: #e2e8f0;
  color: #0f172a;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
}

.coloring-editor-modal .coloring-modal-close:hover {
  background: #cbd5e1;
}

.coloring-editor-modal .coloring-modal-body {
  background: #ffffff;
  padding: 20px;
}

.coloring-editor-modal .coloring-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 12px 16px;
  border-top: 1px solid #e5e7eb;
}

.coloring-canvas-container {
  position: relative;
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
  border: 2px solid #e5e7eb;
  border-radius: 12px;
  overflow: hidden;
  background: #f9fafb;
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
}

.coloring-canvas-container canvas {
  display: block;
  max-width: 100%;
  max-height: min(500px, 60vh);
  cursor: none;
}

.coloring-tools {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  flex-wrap: wrap;
  margin-top: 16px;
}

.coloring-tools .coloring-field {
  flex: 1;
  min-width: 120px;
}

.coloring-tools .coloring-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #0f172a;
  margin-bottom: 6px;
}

.coloring-tools input[type="range"] {
  width: 100%;
}

.coloring-tools input[type="color"] {
  width: 100%;
  height: 40px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  cursor: pointer;
  background: #fff;
  padding: 0;
}

.coloring-tools .coloring-value {
  text-align: center;
  font-size: 12px;
  color: #6b7280;
  margin-top: 4px;
}

.coloring-action-row {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-top: 12px;
}

.coloring-btn {
  appearance: none;
  border: 1px solid #cbd5e1;
  background: #fff;
  color: #0f172a;
  border-radius: 10px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  line-height: 1.2;
}

.coloring-btn:hover {
  background: #f8fafc;
}

.coloring-btn.primary {
  background: #2563eb;
  border-color: #2563eb;
  color: #fff;
}

.coloring-btn.primary:hover {
  background: #1d4ed8;
}

.coloring-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* 兼容 video_workflow 旧 class（若页面仍用 .modal） */
.modal#coloringEditorModal.coloring-editor-modal {
  z-index: 10050;
}

/* 暗色模式：仅 html.theme-dark 时生效 */
html.theme-dark .coloring-editor-modal .coloring-modal-card {
  background: var(--surface, #161920);
  color: var(--text, #e8eaed);
  border-color: var(--border, #2a2f3a);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.55);
}
html.theme-dark .coloring-editor-modal .coloring-modal-header {
  background: var(--panel, #1a1d24);
  border-bottom-color: var(--border, #2a2f3a);
}
html.theme-dark .coloring-editor-modal .coloring-modal-title {
  color: var(--text, #e8eaed);
}
html.theme-dark .coloring-editor-modal .coloring-modal-close {
  background: var(--surface-3, #252a33);
  color: var(--text, #e8eaed);
}
html.theme-dark .coloring-editor-modal .coloring-modal-close:hover {
  background: var(--panel-hover, #2f3540);
}
html.theme-dark .coloring-editor-modal .coloring-modal-body {
  background: var(--surface, #161920);
}
html.theme-dark .coloring-editor-modal .coloring-modal-footer {
  border-top-color: var(--border, #2a2f3a);
}
html.theme-dark .coloring-canvas-container {
  border-color: var(--border, #2a2f3a);
  background: var(--surface-2, #1c1f26);
}
html.theme-dark .coloring-tools .coloring-label {
  color: var(--text, #e8eaed);
}
html.theme-dark .coloring-tools input[type="color"] {
  border-color: var(--border-strong, #3a4150);
  background: var(--input-bg, #1c1f26);
}
html.theme-dark .coloring-tools .coloring-value {
  color: var(--muted, #9aa0a6);
}
html.theme-dark .coloring-btn {
  border-color: var(--border, #2a2f3a);
  background: var(--surface, #161920);
  color: var(--text, #e8eaed);
}
html.theme-dark .coloring-btn:hover {
  background: var(--panel, #1a1d24);
}
html.theme-dark .coloring-btn.primary {
  background: #2563eb;
  border-color: #2563eb;
  color: #fff;
}
