/* ============================================================
   Watermark tool — /img/watermark
   Reuses the crop editor shell (.crop-editor / .crop-panel /
   .crop-dropzone / .crop-seg / .crop-range) and only adds what
   the watermark stage needs on top of it.
   ============================================================ */

.wm-section { padding: 40px 0 56px; }

/* crop.css centres a single canvas in a flex row; the watermark stage stacks
   the preview, its hint and the batch filmstrip instead. */
.wm-section .crop-stage {
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  overflow: visible;
}

/* ---------- Stage ---------- */
.wm-canvas-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 260px;
  padding: 12px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--c-border);
  background-color: #fff;
  background-image:
    linear-gradient(45deg, #eef0f3 25%, transparent 25%, transparent 75%, #eef0f3 75%),
    linear-gradient(45deg, #eef0f3 25%, transparent 25%, transparent 75%, #eef0f3 75%);
  background-size: 18px 18px;
  background-position: 0 0, 9px 9px;
  overflow: hidden;
}

#wmCanvas {
  display: block;
  max-width: 100%;
  height: auto;
  cursor: grab;
  touch-action: none;
  box-shadow: 0 4px 22px rgba(0, 0, 0, .12);
}
#wmCanvas.is-dragging { cursor: grabbing; }
#wmCanvas.is-drawing  { cursor: crosshair; }

/* Live rectangle drawn while a blur area is being dragged out */
.wm-marquee {
  position: absolute;
  border: 2px dashed var(--c-primary);
  background: rgba(240, 114, 38, .14);
  pointer-events: none;
}

.wm-stage-hint {
  margin: 10px 2px 0;
  font-size: .8rem;
  color: var(--c-text-muted);
}

/* ---------- Batch filmstrip ---------- */
.wm-strip-wrap { margin-top: 18px; }

.wm-strip-head {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 10px;
  margin-bottom: 10px;
}
.wm-strip-label {
  font-family: var(--font-head);
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: 1.1px;
  text-transform: uppercase;
  color: var(--c-text-muted);
}
.wm-strip-hint { font-size: .78rem; color: var(--c-text-muted); }

.wm-strip {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 4px 2px 10px;
}

.wm-thumb {
  position: relative;
  flex: 0 0 auto;
  width: 92px;
  border: 2px solid var(--c-border);
  border-radius: var(--radius-md);
  background: #fff;
  padding: 5px;
  cursor: pointer;
  transition: var(--transition);
}
.wm-thumb:hover { border-color: rgba(240, 114, 38, .45); }
.wm-thumb.is-active {
  border-color: var(--c-primary);
  box-shadow: 0 4px 16px rgba(240, 114, 38, .18);
}
.wm-thumb canvas {
  display: block;
  margin: 0 auto;
  max-width: 100%;
  max-height: 62px;
  width: auto;
  height: auto;
}
.wm-thumb__name {
  margin-top: 4px;
  font-size: .66rem;
  color: var(--c-text-muted);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.wm-thumb__badge {
  position: absolute;
  left: 4px;
  top: 4px;
  padding: 0 5px;
  border-radius: 20px;
  background: var(--c-primary);
  color: #fff;
  font-size: .6rem;
  font-weight: 700;
  line-height: 15px;
}
.wm-thumb__del {
  position: absolute;
  right: 3px;
  top: 3px;
  width: 18px;
  height: 18px;
  border: 0;
  border-radius: 50%;
  background: rgba(17, 24, 39, .62);
  color: #fff;
  font-size: .7rem;
  line-height: 18px;
  padding: 0;
  cursor: pointer;
  opacity: 0;
  transition: var(--transition);
}
.wm-thumb:hover .wm-thumb__del { opacity: 1; }

/* ---------- Panel controls ---------- */
.wm-switch {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .85rem;
  color: var(--c-text-2);
  cursor: pointer;
  margin-bottom: 10px;
}
.wm-switch input { width: 15px; height: 15px; accent-color: var(--c-primary); cursor: pointer; }

.wm-input {
  width: 100%;
  padding: 9px 11px;
  border: 1.5px solid var(--c-border);
  border-radius: var(--radius-sm);
  font-size: .88rem;
  color: var(--c-text);
  background: #fff;
  transition: var(--transition);
}
.wm-input:focus { outline: none; border-color: var(--c-primary); }

.wm-color-row { display: flex; align-items: center; gap: 7px; margin-top: 6px; }
.wm-color-row input[type="color"] {
  width: 38px;
  height: 30px;
  padding: 0;
  border: 1.5px solid var(--c-border);
  border-radius: 7px;
  background: none;
  cursor: pointer;
}
.wm-swatch {
  width: 22px;
  height: 22px;
  border: 1.5px solid var(--c-border);
  border-radius: 50%;
  padding: 0;
  cursor: pointer;
  transition: var(--transition);
}
.wm-swatch:hover { transform: scale(1.15); }

/* Nine-point quick placement */
.wm-posgrid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
  width: 108px;
}
.wm-posgrid button {
  position: relative;
  height: 30px;
  border: 1.5px solid var(--c-border);
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
  transition: var(--transition);
}
.wm-posgrid button::after {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--c-border);
}
.wm-posgrid button:hover { border-color: rgba(240, 114, 38, .45); }
.wm-posgrid button.is-active { border-color: var(--c-primary); background: rgba(240, 114, 38, .08); }
.wm-posgrid button.is-active::after { background: var(--c-primary); }

.wm-logo-row { display: flex; align-items: center; gap: 10px; }
.wm-logo-row .crop-btn-ghost { flex: 1; }
.wm-logo-preview {
  width: 52px;
  height: 52px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1.5px dashed var(--c-border);
  border-radius: var(--radius-sm);
  color: var(--c-text-muted);
  overflow: hidden;
  background: #fff;
}
.wm-logo-preview img { max-width: 100%; max-height: 100%; object-fit: contain; }

@media (max-width: 575px) {
  .wm-posgrid { width: 96px; }
  .wm-thumb { width: 78px; }
  .wm-thumb canvas { max-height: 52px; }
}
