/* Image Editor — Full-screen overlay inside .canvas-area */

/* ── OVERLAY ── */
.image-editor-overlay {
  position: absolute; inset: 0; z-index: 12;
  display: flex; flex-direction: column;
  background: #f0f2f5;
}

/* ── TOP TOOLBAR ── */
.ie-toolbar {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 16px; background: #fff;
  border-bottom: 1px solid #e2e8f0; flex-shrink: 0;
  overflow-x: auto;
}
.ie-toolbar::-webkit-scrollbar { height: 0; }

.ie-tool-btn {
  width: 36px; height: 36px; border-radius: 8px;
  border: 1.5px solid transparent; background: transparent;
  color: #64748b; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s; flex-shrink: 0;
  font-family: var(--font);
}
.ie-tool-btn:hover { background: #f1f5f9; color: #0f172a; }
.ie-tool-btn.active {
  background: var(--accent-subtle); color: var(--accent);
  border-color: var(--accent-border);
}
.ie-tool-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.ie-tool-btn svg { width: 18px; height: 18px; }

.ie-toolbar-divider {
  width: 1px; height: 24px; background: #e2e8f0; flex-shrink: 0;
}

/* ── TOOL OPTIONS (overlaid below toolbar) ── */
.ie-tool-options {
  display: none; align-items: center; gap: 10px;
  padding: 6px 16px; background: #fff;
  border-bottom: 1px solid #e2e8f0;
  position: absolute; top: 0; left: 0; right: 0; z-index: 3;
  overflow-x: auto;
}
.ie-tool-options::-webkit-scrollbar { height: 0; }
.ie-tool-options.visible { display: flex; }

.ie-tool-options label {
  font-size: 12px; font-weight: 600; color: #475569;
  white-space: nowrap; margin: 0;
}

/* Aspect ratio pills */
.ie-aspect-btn {
  padding: 4px 12px; border-radius: 100px;
  border: 1.5px solid #e2e8f0; background: #fff;
  font-size: 12px; font-weight: 600; color: #64748b;
  cursor: pointer; transition: all 0.15s;
  white-space: nowrap; font-family: var(--font);
}
.ie-aspect-btn:hover { border-color: #cbd5e1; color: #0f172a; }
.ie-aspect-btn.active {
  background: var(--accent); color: #fff; border-color: var(--accent);
}

/* Crop apply/cancel inline */
.ie-crop-actions {
  display: flex; gap: 6px; margin-left: auto;
}

/* Slider + number input */
.ie-slider {
  width: 120px; height: 4px;
  -webkit-appearance: none; appearance: none;
  background: #e2e8f0; border-radius: 2px; outline: none;
  cursor: pointer;
}
.ie-slider::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--accent); border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,0.15); cursor: pointer;
}
.ie-slider::-moz-range-thumb {
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--accent); border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,0.15); cursor: pointer;
}

.ie-number-input {
  width: 52px; padding: 3px 6px; border: 1px solid #e2e8f0;
  border-radius: 6px; font-size: 12px; font-family: var(--mono);
  color: #0f172a; text-align: center;
  -moz-appearance: textfield;
}
.ie-number-input::-webkit-inner-spin-button,
.ie-number-input::-webkit-outer-spin-button {
  -webkit-appearance: none; margin: 0;
}
.ie-number-input:focus { outline: none; border-color: var(--accent); }

/* Color palette */
.ie-palette {
  display: flex; align-items: center; gap: 5px;
}
.ie-palette-dot {
  width: 22px; height: 22px; border-radius: 50%;
  border: 2px solid transparent; cursor: pointer;
  transition: border-color 0.15s, transform 0.15s;
  flex-shrink: 0; padding: 0;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.08);
}
.ie-palette-dot:hover { transform: scale(1.15); }
.ie-palette-dot.active { border-color: var(--accent); }

/* Color swatch */
.ie-color-wrapper {
  position: relative; display: flex; align-items: center; gap: 4px;
}
.ie-color-swatch {
  width: 24px; height: 24px; border-radius: 6px;
  border: 1.5px solid #e2e8f0; cursor: pointer;
  overflow: hidden; flex-shrink: 0;
}
.ie-color-swatch input[type="color"] {
  width: 40px; height: 40px; border: none; padding: 0;
  cursor: pointer; transform: translate(-8px, -8px);
}

/* ── CANVAS AREA ── */
.ie-canvas-area {
  flex: 1; overflow: auto;
  display: flex; align-items: center; justify-content: center;
  background: #f0f2f5; position: relative; z-index: 0;
}

.ie-canvas-wrapper {
  box-shadow: 0 8px 40px rgba(0,0,0,0.1);
  border-radius: 4px; line-height: 0;
}
.ie-canvas-wrapper canvas { border-radius: 4px; }

/* ── BOTTOM BAR ── */
.ie-bottom-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px; background: #fff;
  border-top: 1px solid #e2e8f0; flex-shrink: 0;
}

.ie-zoom {
  display: flex; align-items: center; gap: 2px;
  background: #fff; border: 1px solid #e2e8f0;
  border-radius: 100px; padding: 4px;
}
.ie-zoom-btn {
  width: 28px; height: 28px; border-radius: 50%; border: none;
  background: transparent; color: #94a3b8; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s; font-size: 14px; font-family: var(--font);
}
.ie-zoom-btn:hover { color: #0f172a; background: #f1f5f9; }
.ie-zoom-level {
  padding: 0 10px; font-size: 12px; font-weight: 600;
  color: #475569; font-family: var(--mono);
  min-width: 44px; text-align: center;
}

.ie-bottom-actions {
  display: flex; align-items: center; gap: 8px;
}

.ie-btn-cancel {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: 8px; font-size: 13px; font-weight: 600;
  border: 1.5px solid #e2e8f0; background: #fff; color: #475569;
  cursor: pointer; transition: all 0.15s; font-family: var(--font);
}
.ie-btn-cancel:hover { border-color: rgba(239,68,68,0.3); color: var(--red); }

.ie-btn-apply {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 20px; border-radius: 8px; font-size: 13px; font-weight: 600;
  border: 1.5px solid var(--accent); background: var(--accent); color: #fff;
  cursor: pointer; transition: all 0.15s; font-family: var(--font);
}
.ie-btn-apply:hover:not(.disabled) {
  background: var(--accent-hover); border-color: var(--accent-hover);
  transform: translateY(-1px); box-shadow: 0 4px 16px var(--accent-border);
}
.ie-btn-apply.disabled {
  opacity: 0.5; cursor: not-allowed;
  background: #94a3b8; border-color: #94a3b8;
  transform: none; box-shadow: none;
  pointer-events: none;
}

/* ── BRUSH CURSOR ── */
.ie-brush-cursor {
  position: fixed; border-radius: 50%;
  border: 2px solid var(--accent);
  pointer-events: none; z-index: 9999;
  display: none;
  transform: translate(-50%, -50%);
}
.ie-brush-cursor.visible { display: block; }

/* ── LOADING ── */
.ie-loading {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(240,242,245,0.85);
  backdrop-filter: blur(4px); z-index: 5;
}
.ie-loading .generating-spinner {
  width: 40px; height: 40px;
}

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  .ie-toolbar { gap: 4px; padding: 6px 10px; flex-wrap: wrap; }
  .ie-tool-options { padding: 6px 10px; flex-wrap: wrap; }
  .ie-bottom-bar { padding: 8px 10px; }
}

@media (max-width: 480px) {
  .ie-toolbar { gap: 3px; padding: 4px 8px; }
  .ie-tool-options { gap: 6px; padding: 4px 8px; }
  .ie-slider { width: 80px; }
  .ie-bottom-bar { padding: 6px 8px; }
  .ie-bottom-actions { gap: 6px; }
  .ie-btn-cancel { padding: 6px 10px; font-size: 12px; }
  .ie-btn-apply { padding: 6px 14px; font-size: 12px; }
  .ie-zoom-level { padding: 0 6px; min-width: 36px; font-size: 11px; }
}
