/* ============================================
   IMAGE WATERMARK
   ============================================ */

.wm-tool {
  width: 100%;
  max-width: none;
  margin: 0 auto;
}

.wm-upload {
  position: relative;
  width: 100%;
  max-width: none;
  margin: 0 auto 1.75rem;
  border: 2px dashed var(--border);
  border-radius: 12px;
  background: var(--surface);
  cursor: pointer;
  overflow: hidden;
  transition: var(--transition);
}

.wm-upload:hover,
.wm-upload.wm-dragover {
  border-color: var(--primary);
  background: rgba(var(--primary-rgb), 0.06);
}

.wm-file {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.wm-upload-inner {
  min-height: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 3rem 2rem;
  text-align: center;
  color: var(--text);
  pointer-events: none;
}

.wm-upload-emoji {
  margin-bottom: 0.25rem;
  font-size: 3rem;
  line-height: 1;
}

.wm-upload-inner p {
  margin: 0;
}

.wm-hint,
.wm-status,
#wmFileMeta {
  color: var(--text-muted);
  font-size: 0.875rem;
}

.wm-status {
  min-height: 1.4rem;
  max-width: 1060px;
  margin: -0.75rem auto 1rem;
  text-align: center;
}

.wm-status-error {
  color: var(--danger);
}

.wm-status-success {
  color: var(--success);
}

.wm-editor {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(320px, 0.7fr);
  gap: 1.25rem;
  align-items: start;
  max-width: 1180px;
  margin: 0 auto;
}

.wm-editor[hidden],
.wm-upload[hidden] {
  display: none;
}

.wm-preview-panel,
.wm-controls {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
}

.wm-preview-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.wm-preview-head div {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

#wmFileName {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wm-canvas-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 280px;
  background: linear-gradient(45deg, var(--bg) 25%, var(--surface) 25%, var(--surface) 50%, var(--bg) 50%, var(--bg) 75%, var(--surface) 75%, var(--surface));
  background-size: 24px 24px;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) - 4px);
  overflow: hidden;
}

#wmCanvas {
  display: block;
  max-width: 100%;
  max-height: 70vh;
  width: auto;
  height: auto;
}

.wm-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1rem;
}

.wm-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.wm-control {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.wm-wide {
  grid-column: 1 / -1;
}

.wm-control label {
  font-weight: 600;
  color: var(--text);
}

.wm-control .control-input {
  width: 100%;
  min-height: 44px;
  padding: 0.75rem 1rem;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  transition: var(--transition);
}

.wm-control .control-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.1);
}

.wm-color {
  padding: 0.35rem;
}

.wm-control input[type="range"] {
  width: 100%;
  min-height: 44px;
  accent-color: var(--primary);
}

.wm-control .btn {
  min-height: 44px;
  align-self: flex-start;
}

.wm-logo-file {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.wm-file-btn {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  align-self: flex-start;
  padding: 0.75rem 1rem;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
}

.wm-file-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.wm-check {
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  font-weight: 600;
}

.wm-check input {
  width: 1.1rem;
  height: 1.1rem;
  accent-color: var(--primary);
}

.wm-tool .btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 2px solid var(--border);
}

.wm-tool .btn-ghost:hover {
  color: var(--danger);
  border-color: var(--danger);
}

@media (max-width: 900px) {
  .wm-editor {
    grid-template-columns: 1fr;
  }

  .wm-controls {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .wm-upload-inner {
    min-height: auto;
    padding: 2rem 1rem;
  }

  .wm-preview-panel,
  .wm-controls {
    padding: 0.85rem;
  }

  .wm-preview-head,
  .wm-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .wm-actions .btn,
  .wm-preview-head .btn,
  .wm-control .btn,
  .wm-file-btn {
    width: 100%;
  }

  .wm-canvas-wrap {
    min-height: 220px;
  }
}
