/* 图片加水印页专属样式（复用 app.css 基础变量与组件） */

.page-wm {
  max-width: 1180px;
}

.page-wm.is-editing {
  max-width: 1280px;
  padding-top: 12px;
  padding-bottom: 16px;
}

.page-wm.is-editing .header,
.page-wm.is-editing .seo-content,
.page-wm.is-editing .footer {
  display: none !important;
}

.page-wm.is-editing .panel {
  padding: 14px;
}

.wm-workspace[hidden] {
  display: none !important;
}

.wm-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 18px;
  margin-top: 4px;
}

.wm-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.wm-stage {
  position: relative;
  height: var(--wm-stage-h, min(48vh, 480px));
  min-height: 220px;
  border-radius: 16px;
  overflow: auto;
  background: #f4f7fb;
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  touch-action: none;
}

.wm-stage canvas {
  display: block;
  max-width: 100%;
  max-height: 100%;
  cursor: default;
}

.wm-stage.can-drag canvas {
  cursor: grab;
}

.wm-stage.is-dragging canvas {
  cursor: grabbing;
}

.wm-stage-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 2px 2px 0;
}

.wm-meta {
  font-size: 0.82rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.wm-meta strong {
  color: var(--ink);
  font-weight: 600;
}

.wm-thumbs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 2px 8px;
  -webkit-overflow-scrolling: touch;
}

.wm-thumb {
  flex: 0 0 auto;
  width: 64px;
  border: 2px solid transparent;
  border-radius: 10px;
  padding: 0;
  background: #fff;
  cursor: pointer;
  overflow: hidden;
  position: relative;
  box-shadow: 0 1px 4px rgba(24, 33, 43, 0.08);
  transition: border-color 0.15s, transform 0.15s;
}

.wm-thumb:hover {
  transform: translateY(-1px);
}

.wm-thumb.active {
  border-color: var(--accent);
}

.wm-thumb img {
  display: block;
  width: 64px;
  height: 48px;
  object-fit: cover;
}

.wm-thumb .thumb-status {
  position: absolute;
  right: 3px;
  bottom: 3px;
  font-size: 0.58rem;
  padding: 1px 4px;
  border-radius: 4px;
  background: rgba(24, 33, 43, 0.72);
  color: #fff;
  line-height: 1.3;
}

.wm-thumb.done .thumb-status {
  background: rgba(15, 118, 110, 0.9);
}

.wm-thumb.error .thumb-status {
  background: rgba(220, 38, 38, 0.9);
}

.wm-thumb .thumb-remove {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 18px;
  height: 18px;
  border: none;
  border-radius: 50%;
  background: rgba(24, 33, 43, 0.55);
  color: #fff;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  display: none;
  place-items: center;
  padding: 0;
}

.wm-thumb:hover .thumb-remove {
  display: grid;
}

.wm-add-more {
  flex: 0 0 auto;
  width: 64px;
  height: 52px;
  border: 2px dashed rgba(15, 118, 110, 0.35);
  border-radius: 10px;
  background: rgba(15, 118, 110, 0.04);
  color: var(--accent);
  font-size: 1.4rem;
  cursor: pointer;
  display: grid;
  place-items: center;
}

.wm-add-more:hover {
  background: rgba(15, 118, 110, 0.1);
}

.wm-sidebar {
  display: flex;
  flex-direction: column;
  gap: 0;
  min-width: 0;
  min-height: 0;
  max-height: calc(var(--wm-stage-h, 48vh) + 120px);
  overflow: hidden;
}

.wm-sidebar-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-right: 2px;
  padding-bottom: 4px;
}

.side-block {
  padding: 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #fff;
}

.side-block h3 {
  margin: 0 0 10px;
  font-size: 0.88rem;
  font-weight: 600;
}

.seg {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.seg-btn {
  appearance: none;
  border: 1px solid var(--line);
  background: #f8fafc;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.78rem;
  cursor: pointer;
  color: var(--muted);
  transition: all 0.15s;
}

.seg-btn:hover {
  border-color: rgba(15, 118, 110, 0.3);
  color: var(--ink);
}

.seg-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 10px;
  font-size: 0.75rem;
  color: var(--muted);
}

.field:last-child {
  margin-bottom: 0;
}

.field > span {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}

.field > span em {
  font-style: normal;
  color: var(--ink);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.field input[type="text"],
.field input[type="number"],
.field textarea,
.field select {
  appearance: none;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 10px;
  font-size: 0.88rem;
  color: var(--ink);
  background: #fff;
  font-family: inherit;
  width: 100%;
}

.field textarea {
  min-height: 72px;
  resize: vertical;
  line-height: 1.45;
}

.field input:focus,
.field textarea:focus,
.field select:focus {
  outline: none;
  border-color: rgba(15, 118, 110, 0.45);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

.field input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

.field input[type="color"] {
  width: 100%;
  height: 36px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.check-inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--ink);
  cursor: pointer;
  margin-right: 12px;
}

.check-inline input {
  accent-color: var(--accent);
}

.preset-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.preset-chip {
  appearance: none;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 0.72rem;
  cursor: pointer;
  color: var(--muted);
}

.preset-chip:hover {
  border-color: rgba(15, 118, 110, 0.35);
  color: var(--accent);
}

.anchor-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.anchor-btn {
  appearance: none;
  aspect-ratio: 1.4;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  cursor: pointer;
  position: relative;
  padding: 0;
}

.anchor-btn::after {
  content: "";
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #94a3b8;
}

.anchor-btn[data-anchor="top-left"]::after { top: 6px; left: 6px; }
.anchor-btn[data-anchor="top-center"]::after { top: 6px; left: 50%; margin-left: -4px; }
.anchor-btn[data-anchor="top-right"]::after { top: 6px; right: 6px; }
.anchor-btn[data-anchor="middle-left"]::after { top: 50%; left: 6px; margin-top: -4px; }
.anchor-btn[data-anchor="center"]::after { top: 50%; left: 50%; margin: -4px 0 0 -4px; }
.anchor-btn[data-anchor="middle-right"]::after { top: 50%; right: 6px; margin-top: -4px; }
.anchor-btn[data-anchor="bottom-left"]::after { bottom: 6px; left: 6px; }
.anchor-btn[data-anchor="bottom-center"]::after { bottom: 6px; left: 50%; margin-left: -4px; }
.anchor-btn[data-anchor="bottom-right"]::after { bottom: 6px; right: 6px; }

.anchor-btn:hover {
  border-color: rgba(15, 118, 110, 0.35);
}

.anchor-btn.active {
  border-color: var(--accent);
  background: rgba(15, 118, 110, 0.08);
}

.anchor-btn.active::after {
  background: var(--accent);
}

.logo-pick {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.logo-preview {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: 10px;
  border: 1px dashed var(--line);
  background: #f8fafc;
  min-height: 56px;
}

.logo-preview img {
  max-width: 72px;
  max-height: 48px;
  object-fit: contain;
}

.logo-preview .logo-empty {
  font-size: 0.8rem;
  color: var(--muted);
}

.hint {
  margin: 8px 0 0;
  font-size: 0.75rem;
  color: var(--muted);
  line-height: 1.5;
}

.side-actions {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
}

.btn-block {
  width: 100%;
}

.side-actions-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.wm-list {
  margin-top: 8px;
}

.wm-list .item {
  grid-template-columns: minmax(0, 1fr) auto minmax(100px, 140px) auto;
}

.panel-toggle[hidden],
#type-text[hidden],
#type-image[hidden],
#layout-single[hidden],
#layout-tile[hidden],
#quality-field[hidden] {
  display: none !important;
}

@media (max-width: 900px) {
  .wm-layout {
    grid-template-columns: 1fr;
  }

  .wm-sidebar {
    max-height: min(70vh, 640px);
  }

  .wm-stage {
    height: min(42vh, 360px);
  }
}
