/* =============================================================
   图片上传组件样式（竞赛后台 · 对齐 yl.css 设计令牌）
   与 www 项目 image_upload.css 同源，令牌改为 --yl-*（带字面兜底）。
   配合 image_upload.js 使用：ImageUploader / initImageUploadArea / showLargeImage。
   ============================================================= */

/* --- 上传区域外层容器 --- */
.image-upload-area { margin-top: 0; }

.image-upload-container {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-start;
  justify-content: flex-start;
  width: 100%;
}

/* --- 上传 / 预览方框（统一基础） --- */
.image-upload-box {
  width: 130px;
  height: 140px;
  border: 1.5px dashed var(--yl-border, #c9cdd4);
  border-radius: var(--yl-radius-2, 8px);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  transition: all 220ms cubic-bezier(.4, 0, .2, 1);
  background: var(--yl-bg-2, #fcfdfe);
  overflow: hidden;
  flex-shrink: 0;
}

/* ---- 上传触发按钮（虚线 + 号） ---- */
.image-upload-box.upload-btn {
  border-style: dashed;
  flex-direction: column;
  gap: 4px;
  background: var(--yl-bg-2, #fcfdfe);
}

.image-upload-box.upload-btn .upload-icon {
  font-size: 32px;
  color: var(--yl-text-3, #86909c);
  line-height: 1;
  transition: all 220ms cubic-bezier(.4, 0, .2, 1);
}

.image-upload-box.upload-btn .upload-hint {
  font-size: 10px;
  color: var(--yl-text-3, #86909c);
  font-weight: 500;
  transition: all 220ms cubic-bezier(.4, 0, .2, 1);
  white-space: nowrap;
}

.image-upload-box.upload-btn:hover {
  border-color: var(--yl-primary, #1664ff);
  background: var(--yl-primary-bg, #ecf3ff);
}

.image-upload-box.upload-btn:hover .upload-icon { color: var(--yl-primary, #1664ff); transform: scale(1.08); }
.image-upload-box.upload-btn:hover .upload-hint { color: var(--yl-primary, #1664ff); }

/* ---- 已上传图片预览框 ---- */
.image-upload-box:not(.upload-btn) {
  border-style: solid;
  border-color: var(--yl-border, #e5e6eb);
  box-shadow: 0 2px 4px rgba(0, 0, 0, .04);
}

.image-upload-box:not(.upload-btn):hover {
  box-shadow: 0 4px 10px rgba(0, 0, 0, .08);
  border-color: var(--yl-primary, #1664ff);
}

.image-upload-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: calc(var(--yl-radius-2, 8px) - 1px);
  position: absolute;
  top: 0;
  left: 0;
}

/* ---- 查看按钮（整框悬浮半透明遮罩 + 居中眼睛图标） ---- */
.image-upload-box .view-btn {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(12, 13, 14, .35);
  color: #fff;
  border: none;
  opacity: 0;
  cursor: pointer;
  transition: opacity 150ms ease;
  z-index: 10;
}

.image-upload-box:hover .view-btn { opacity: 1; }

/* ---- 审核状态角标（左上角，仅传入 reviewStatus 时渲染） ---- */
.image-upload-box .doc-review-badge {
  position: absolute;
  top: 4px;
  left: 4px;
  z-index: 11;
  padding: 2px 7px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.4;
  border-radius: 6px;
  color: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .18);
  pointer-events: none;
  white-space: nowrap;
}
.image-upload-box .doc-review-badge--pending  { background: #d48806; }
.image-upload-box .doc-review-badge--rejected { background: var(--yl-danger, #d7312a); }
.image-upload-box .doc-review-badge--approved { background: #00b42a; }

/* ---- 删除按钮（右上角红色圆钮） ---- */
.image-upload-box .delete-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  background: var(--yl-danger, #d7312a);
  color: #fff;
  border: 2px solid #fff;
  border-radius: 50%;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  transition: all 140ms cubic-bezier(.4, 0, .2, 1);
  z-index: 11;
  padding: 0;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .2);
}
.image-upload-box .delete-btn:hover {
  background: #ee3f38;
  transform: scale(1.15);
  box-shadow: 0 2px 8px rgba(215, 49, 42, .35);
}

/* ---- 小尺寸上传框（紧凑表格单元格用） ---- */
.image-upload-box.image-upload-box--sm {
  width: 30px;
  height: 30px;
  border-width: 1px;
  border-radius: 4px;
}
.image-upload-box.image-upload-box--sm.upload-btn .upload-icon { font-size: 18px; }
.image-upload-box.image-upload-box--sm.upload-btn .upload-hint { display: none; }
.image-upload-box.image-upload-box--sm .view-btn { display: none; }
.image-upload-box.image-upload-box--sm .delete-btn {
  width: 16px;
  height: 16px;
  font-size: 9px;
  line-height: 1;
  top: 1px;
  right: 1px;
  border-width: 1px;
}

/* ---- 上传中遮罩 ---- */
.image-upload-box.is-uploading::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, .6);
  z-index: 12;
}
.image-upload-box .upload-spinner {
  position: absolute;
  z-index: 13;
  width: 22px;
  height: 22px;
  border: 2px solid var(--yl-border, #c9cdd4);
  border-top-color: var(--yl-primary, #1664ff);
  border-radius: 50%;
  animation: ylUploadSpin .7s linear infinite;
}
@keyframes ylUploadSpin { to { transform: rotate(360deg); } }

/* =============================================================
   全屏透明 lightbox 预览（showLargeImage / showLightbox 渲染）
   ============================================================= */
.lightbox-mask {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, .92);
  z-index: 100000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: default;
  user-select: none;
  -webkit-user-select: none;
}
.lightbox-toolbar {
  position: fixed;
  top: 16px; right: 20px;
  display: flex;
  gap: 6px;
  z-index: 2;
}
.lightbox-toolbar button {
  background: rgba(255, 255, 255, .12);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, .25);
  border-radius: 6px;
  padding: 6px 10px;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  transition: background .15s;
  display: flex;
  align-items: center;
  gap: 4px;
}
.lightbox-toolbar button:hover { background: rgba(255, 255, 255, .25); }
.lightbox-toolbar button svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; }
.lightbox-body {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  overflow: hidden;
  min-height: 50vh;
  max-height: 80vh;
}
.lightbox-body img {
  max-width: 90vw;
  max-height: 70vh;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 4px;
  cursor: grab;
  transition: transform .25s cubic-bezier(.4, 0, .2, 1);
  user-select: none;
  -webkit-user-select: none;
  will-change: transform;
}
.lightbox-body img.dragging { cursor: grabbing; transition: none; }
.lightbox-nav {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  z-index: 3;
  width: 48px;
  height:48px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .12);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, .25);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background .15s;
  user-select: none;
}
.lightbox-nav:hover { background: rgba(255, 255, 255, .25); }
.lightbox-nav svg { width: 24px; height: 24px; stroke: currentColor; fill: none; stroke-width: 2; }
.lightbox-nav.prev { left: 24px; }
.lightbox-nav.next { right: 24px; }
.lightbox-counter {
  position: fixed;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;
  color: #fff;
  background: rgba(0, 0, 0, .45);
  padding: 4px 14px;
  border-radius: 14px;
  font-size: 13px;
  letter-spacing: .5px;
}

/* =============================================================
   响应式适配
   ============================================================= */
@media (max-width: 768px) {
  .image-upload-box { width: 100px; height: 110px; }
  .image-upload-box.upload-btn .upload-icon { font-size: 26px; }
  .image-upload-box.upload-btn .upload-hint { display: none; }
}
@media (max-width: 576px) {
  .image-upload-box { width: 90px; height: 98px; }
  .image-upload-box.upload-btn .upload-icon { font-size: 22px; }
}
