/* =========================================================================
   ImageUploader — composant réutilisable (drop, CTRL+V, rognage)
   ========================================================================= */

.img-uploader {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-family: var(--font-sans);
}

/* --- Zone preview (drop target) --- */
.iu-preview {
  position: relative;
  width: 100%;
  min-height: 160px;
  background: var(--bg-panel);
  border: 2px dashed var(--border-subtle);
  border-radius: 6px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.12s, background 0.12s;
}
.iu-preview.has-image {
  border-style: solid;
  min-height: 200px;
}
.iu-preview.is-drop-over {
  border-color: var(--accent-flame);
  background: rgba(161, 120, 76, 0.1);
}
.iu-preview.is-drop-over .iu-drop-overlay { display: flex; }

.iu-preview img {
  max-width: 100%;
  max-height: 280px;
  object-fit: contain;
  display: block;
}

.iu-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--text-muted);
  text-align: center;
  padding: 20px;
  pointer-events: none;
}
.iu-empty-icon svg {
  width: 34px;
  height: 34px;
  stroke: var(--accent-flame);
  fill: none;
  stroke-width: 1.5;
  opacity: 0.5;
}
.iu-empty-hint {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.5px;
  line-height: 1.5;
}
.iu-empty-hint strong { color: var(--accent-flame); }

.iu-drop-overlay {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(161, 120, 76, 0.25);
  backdrop-filter: blur(4px);
  pointer-events: none;
}
.iu-drop-hint {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: #fff;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.iu-clear {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 26px;
  height: 26px;
  background: rgba(6, 8, 17, 0.75);
  border: 1px solid rgba(216, 17, 68, 0.5);
  border-radius: 50%;
  color: var(--accent-red);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.12s;
}
.iu-clear:hover { background: rgba(216, 17, 68, 0.5); color: #fff; }
.iu-clear svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 2.5; }

/* --- Actions row --- */
.iu-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.iu-file-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
}
.iu-file-btn svg { width: 13px; height: 13px; stroke: currentColor; fill: none; stroke-width: 2; }

/* --- État chargement --- */
.iu-loading {
  padding: 40px;
  text-align: center;
  color: var(--accent-flame);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 2px;
  border: 1px dashed var(--accent-flame);
  border-radius: 6px;
  background: rgba(161, 120, 76, 0.08);
  animation: iuPulse 1.2s ease-in-out infinite;
}
.iu-loading svg {
  width: 18px; height: 18px;
  stroke: currentColor; fill: none; stroke-width: 2;
  vertical-align: -3px;
  margin-right: 6px;
}
@keyframes iuPulse { 50% { opacity: 0.55; } }

/* =========================================================================
   Cropper (rognage manuel)
   ========================================================================= */

.iu-crop-wrap {
  background: var(--bg-panel);
  border: 1px solid var(--border-default);
  border-radius: 6px;
  padding: 10px;
}
.iu-crop-canvas-wrap {
  position: relative;
  background: #0a0a0a;
  border-radius: 4px;
  overflow: hidden;
  min-height: 260px;
  max-height: 480px;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
}
.iu-crop-canvas-wrap img {
  max-width: 100%;
  max-height: 480px;
  display: block;
  pointer-events: none;
}
.iu-crop-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.iu-crop-box {
  position: absolute;
  border: 2px solid var(--accent-flame);
  cursor: move;
  pointer-events: auto;
  box-shadow:
    0 0 0 9999px rgba(0, 0, 0, 0.55),
    inset 0 0 0 1px rgba(255, 255, 255, 0.15);
}
.iu-crop-handle {
  position: absolute;
  width: 14px;
  height: 14px;
  background: var(--accent-flame);
  border: 2px solid #fff;
  border-radius: 50%;
  z-index: 2;
}
.iu-crop-handle.nw { top: -7px; left: -7px; cursor: nwse-resize; }
.iu-crop-handle.ne { top: -7px; right: -7px; cursor: nesw-resize; }
.iu-crop-handle.sw { bottom: -7px; left: -7px; cursor: nesw-resize; }
.iu-crop-handle.se { bottom: -7px; right: -7px; cursor: nwse-resize; }
.iu-crop-handle.n  { top: -7px; left: 50%; transform: translateX(-50%); cursor: ns-resize; }
.iu-crop-handle.s  { bottom: -7px; left: 50%; transform: translateX(-50%); cursor: ns-resize; }
.iu-crop-handle.e  { right: -7px; top: 50%; transform: translateY(-50%); cursor: ew-resize; }
.iu-crop-handle.w  { left: -7px; top: 50%; transform: translateY(-50%); cursor: ew-resize; }

.iu-crop-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}
.iu-crop-hint {
  flex: 1;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-muted);
  font-style: italic;
}
