/* W3 asset detail view additions on top of ui-theme.css. */
.w3-backdrop {
  flex: 1;
  display: flex;
  min-height: 0;
}

.w3-backdrop .table-card {
  flex: 1;
  min-height: 0;
}

.w3-state-in-card {
  flex: 1;
  display: flex;
  min-height: 240px;
}

.w3-state-stack {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.w3-action-hint {
  flex: 0 0 100%;
  width: 100%;
  color: var(--text-tertiary);
  font-size: 12px;
  line-height: 1.4;
}

.w3-m-state {
  min-height: 220px;
}

.w3-m-card-head {
  margin-bottom: 12px;
}

.w3-photo-count {
  font-size: 12px;
  font-weight: 400;
  color: var(--text-tertiary);
}

.w3-edit-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 18px;
}

.w3-edit-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.w3-edit-label {
  font-size: 12px;
  color: var(--text-tertiary);
}

.w3-edit-input,
.w3-edit-select,
.w3-edit-textarea {
  width: 100%;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0 12px;
  font-size: 14px;
  color: var(--text-primary);
  background: #fff;
  outline: 0;
  box-sizing: border-box;
}

.w3-edit-textarea {
  height: auto;
  min-height: 72px;
  padding: 8px 12px;
  line-height: 1.5;
  resize: vertical;
}

.w3-edit-input:focus,
.w3-edit-select:focus,
.w3-edit-textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(51, 112, 255, .12);
}

.w3-overlay-dialog {
  width: min(680px, 100%);
}

.w3-overlay-body {
  min-height: 0;
}

.w3-sheet-mask {
  position: absolute;
  inset: 0;
  z-index: 95;
  display: flex;
  align-items: flex-end;
  background: rgba(15, 23, 42, .52);
}

.w3-sheet {
  width: 100%;
  max-height: 82%;
  display: flex;
  flex-direction: column;
  border-radius: 22px 22px 0 0;
  background: #fff;
  box-shadow: 0 -12px 30px rgba(15, 23, 42, .16);
  overflow: hidden;
}

.w3-sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 16px 16px 10px;
}

.w3-sheet-title {
  color: var(--text-primary);
  font-size: 17px;
  font-weight: 650;
}

.w3-sheet-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 8px 16px 16px;
}

.w3-sheet-foot {
  display: flex;
  gap: 8px;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--border-light);
}

.w3-sheet-foot .btn {
  flex: 1;
}

.w3-qr-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 4px 0 2px;
  text-align: center;
}

.w3-qr-svg {
  max-width: 100%;
  height: auto;
  display: block;
  border: 1px solid var(--border-light);
  border-radius: 4px;
}

/* 覆盖 global.css 中 .preview-app svg 的 16px 图标兜底规则，防止二维码被压缩 */
.w3-qr-body .w3-qr-svg {
  width: auto;
  height: auto;
}

.w3-qr-hint {
  font-size: 12px;
  color: var(--text-tertiary);
}

.w3-qr-fallback {
  width: 100%;
  max-width: 260px;
  padding: 12px;
  border: 1px dashed var(--border-dark);
  border-radius: 4px;
  background: var(--bg-page);
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.6;
  word-break: break-all;
  text-align: left;
}

.w3-qr-code-text {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  word-break: break-all;
}

.mobile-app {
  position: relative;
}

.photo-item img {
  cursor: zoom-in;
}

/* ========== 照片放大查看器 ========== */
.photo-viewer {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(8, 10, 16, .93);
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: none;
  overflow: hidden;
}

.photo-viewer-stage {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: 94vw;
  max-height: 90vh;
}

.photo-viewer-stage img {
  display: block;
  max-width: 94vw;
  max-height: 90vh;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
  cursor: grab;
  transform-origin: center center;
  will-change: transform;
}

.photo-viewer-stage img.dragging {
  cursor: grabbing;
}

.photo-viewer-close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 5;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .25);
  background: rgba(255, 255, 255, .1);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.photo-viewer-close:hover {
  background: rgba(255, 255, 255, .2);
}

.photo-viewer-count {
  position: absolute;
  top: 22px;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255, 255, 255, .85);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.photo-viewer-hint {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255, 255, 255, .55);
  font-size: 12px;
  white-space: nowrap;
}

/* ========== 独立资产详情页（扫码/分享直达） ========== */
.detail-standalone-app {
  height: 100%;
  display: flex;
  flex-direction: column;
}

.detail-standalone-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border-light);
  background: #fff;
}

.detail-standalone-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--text-primary);
}

.detail-standalone-sub {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.detail-standalone-app .content-scroll {
  padding: 20px 24px;
  display: flex;
  justify-content: center;
}

.detail-standalone-card {
  width: 100%;
  max-width: 880px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: var(--shadow-card);
  padding: 20px 24px;
}

.w3-standalone-state {
  width: 100%;
  max-width: 880px;
  min-height: 360px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: var(--shadow-card);
  display: flex;
  align-items: center;
  justify-content: center;
}

@media (max-width: 768px) {
  .w3-edit-form {
    grid-template-columns: 1fr;
  }
}

/* Production desktop detail dialog: keep ui-theme sizing after components.css. */
#app .detail-modal {
  width: min(880px, 100%);
}

#app .detail-modal-body {
  padding: 22px 24px 24px;
}
