/* 蓝寻三端统一图片上传预览，仅负责展示与交互外观。 */
.lx-image-upload-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-start;
  min-width: 0;
}

.lx-image-upload-tile {
  position: relative;
  width: 144px;
  height: 144px;
  flex: 0 0 144px;
  overflow: hidden;
  border: 1px solid var(--lx-color-border, #d8dee8);
  border-radius: 6px;
  background: #fff;
}

.lx-image-upload-tile.is-compact {
  width: 112px;
  height: 112px;
  flex-basis: 112px;
}

.lx-image-upload-tile.is-embedded {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: inherit;
}

.lx-image-upload-media,
.lx-image-upload-media img {
  display: block;
  width: 100%;
  height: 100%;
}

.lx-image-upload-media {
  padding: 0;
  border: 0;
  color: inherit;
  background: #fff;
}

.lx-image-upload-media img {
  object-fit: contain;
  background: #fff;
}

.lx-image-upload-actions {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: rgba(17, 24, 39, 0.58);
  opacity: 0;
  pointer-events: none;
  transition: opacity 150ms ease;
}

.lx-image-upload-tile:hover .lx-image-upload-actions,
.lx-image-upload-tile:focus-within .lx-image-upload-actions {
  opacity: 1;
}

.lx-image-upload-action {
  display: inline-grid;
  width: 34px;
  height: 34px;
  min-width: 34px;
  min-height: 34px;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.76);
  border-radius: 50%;
  color: #fff;
  background: rgba(17, 24, 39, 0.18);
  cursor: pointer;
  pointer-events: auto;
  transition: background-color 150ms ease, border-color 150ms ease;
}

.lx-image-upload-action:hover,
.lx-image-upload-action:focus-visible {
  border-color: #fff;
  color: #fff;
  outline: none;
  background: rgba(37, 99, 235, 0.92);
}

.lx-image-upload-action.is-danger:hover,
.lx-image-upload-action.is-danger:focus-visible {
  background: var(--lx-color-danger, #dc2626);
}

.lx-image-upload-action svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.lx-image-upload-meta {
  display: grid;
  min-width: 0;
  gap: 3px;
  align-content: center;
}

.lx-image-upload-meta strong,
.lx-image-upload-meta small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lx-image-upload-meta strong {
  color: var(--lx-color-text-primary, #101828);
  font-size: 13px;
}

.lx-image-upload-meta small {
  color: var(--lx-color-text-tertiary, #667085);
  font-size: 12px;
}

/* 兼容三端现有上传容器，上传完成后只保留干净的图片缩略图。 */
.upload-tile.has-upload:has(> [data-lx-image-upload-tile]) > b,
.upload-tile.has-upload:has(> [data-lx-image-upload-tile]) > em,
.ref-upload.has-upload:has(> [data-lx-image-upload-tile]) > b,
.ref-upload.has-upload:has(> [data-lx-image-upload-tile]) > em,
.feedback-upload-tile.has-upload:has(> [data-lx-image-upload-tile]) > b,
.feedback-upload-tile.has-upload:has(> [data-lx-image-upload-tile]) > em {
  display: none !important;
}

.upload-tile.has-upload:has(> [data-lx-image-upload-tile]) > .upload-status-line,
.ref-upload.has-upload:has(> [data-lx-image-upload-tile]) > .upload-status-line,
.feedback-upload-tile.has-upload:has(> [data-lx-image-upload-tile]) > .upload-status-line {
  display: none;
}

.payment-proof-field > .lx-image-upload-tile,
.upload-proof-field > .lx-image-upload-tile,
.task-proof-field > .lx-image-upload-tile {
  margin-top: 10px;
}

.trial-local-preview,
.merchant-repayment-upload-preview,
.support-attachment-preview,
.support-admin-attachment {
  min-width: 0;
}

.trial-local-preview:empty,
.merchant-repayment-upload-preview:empty {
  display: none;
}

.support-attachment-preview .lx-image-upload-tile,
.support-admin-attachment .lx-image-upload-tile {
  flex: 0 0 104px;
}

.extra-product-image-box {
  width: 144px !important;
  height: 144px !important;
  padding: 0 !important;
  overflow: hidden;
  border-radius: 6px;
  background: #fff !important;
}

.product-image-box.has-image:has(> [data-lx-image-upload-tile]) > span,
.product-image-box.has-image:has(> [data-lx-image-upload-tile]) > .upload-view-btn {
  display: none;
}

.lx-image-preview-modal {
  position: fixed;
  inset: 0;
  z-index: 3200;
  display: grid;
  place-items: center;
  padding: 24px;
}

.lx-image-preview-modal__mask {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(15, 23, 42, 0.74);
  cursor: zoom-out;
}

.lx-image-preview-modal__dialog {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: min(960px, calc(100vw - 48px));
  height: min(760px, calc(100vh - 48px));
  overflow: hidden;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.28);
}

.lx-image-preview-modal__header {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--lx-color-border, #e4e7ec);
}

.lx-image-preview-modal__header strong {
  overflow: hidden;
  color: var(--lx-color-text-primary, #101828);
  font-size: 15px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lx-image-preview-modal__tools {
  display: flex;
  gap: 6px;
  flex: 0 0 auto;
}

.lx-image-preview-modal__tools button {
  display: inline-grid;
  width: 34px;
  height: 34px;
  place-items: center;
  padding: 0;
  border: 1px solid var(--lx-color-border, #d0d5dd);
  border-radius: 6px;
  color: var(--lx-color-text-secondary, #344054);
  background: #fff;
  cursor: pointer;
}

.lx-image-preview-modal__tools button:hover,
.lx-image-preview-modal__tools button:focus-visible {
  border-color: var(--lx-color-primary, #2563eb);
  color: var(--lx-color-primary, #2563eb);
  outline: none;
}

.lx-image-preview-modal__stage {
  display: grid;
  overflow: auto;
  place-items: center;
  padding: 20px;
  background: #f2f4f7;
}

.lx-image-preview-modal__stage img {
  display: block;
  max-width: none;
  max-height: none;
  width: auto;
  height: auto;
  transform: scale(var(--lx-image-preview-scale, 1));
  transform-origin: center;
  transition: transform 150ms ease;
}

@media (hover: none), (pointer: coarse) {
  .lx-image-upload-actions {
    inset: auto 6px 6px auto;
    width: auto;
    padding: 4px;
    border-radius: 999px;
    opacity: 1;
    background: rgba(17, 24, 39, 0.66);
  }

  .lx-image-upload-action {
    width: 32px;
    height: 32px;
    min-width: 32px;
    min-height: 32px;
  }
}

@media (max-width: 767px) {
  .lx-image-upload-tile {
    width: 132px;
    height: 132px;
    flex-basis: 132px;
  }

  .lx-image-upload-tile.is-compact {
    width: 104px;
    height: 104px;
    flex-basis: 104px;
  }

  .lx-image-preview-modal {
    padding: 0;
  }

  .lx-image-preview-modal__dialog {
    width: 100%;
    height: 100%;
    border-radius: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .lx-image-upload-actions,
  .lx-image-upload-action,
  .lx-image-preview-modal__stage img {
    transition: none;
  }
}
