/* ==========================================================================
   前台投诉表单 - 多图凭证上传组件
   作用域前缀 .img-gallery，浅色主题，与官网 #f8fafc / #ffffff 配色一致
   ========================================================================== */
.img-gallery {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 4px;
}

/* 原生 file 输入：从视觉中隐藏，但保留在表单内以便正常提交 */
.img-gallery-input {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* 统一的方形卡片尺寸 */
.img-gallery-tile {
  position: relative;
  width: 108px;
  height: 108px;
  flex: 0 0 108px;
  border-radius: 10px;
  overflow: hidden;
}

/* ---------- 空态：虚线加号框 ---------- */
.img-gallery-add {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 2px dashed #cbd5e1;
  background: #f8fafc;
  color: #94a3b8;
  cursor: pointer;
  transition: border-color .25s, background .25s, color .25s, transform .2s;
  user-select: none;
}
.img-gallery-add:hover {
  border-color: #2563eb;
  background: #eff6ff;
  color: #2563eb;
  transform: translateY(-2px);
}
.img-gallery-add:focus-visible {
  outline: none;
  border-color: #16a34a;
  color: #16a34a;
}
.img-gallery-add.is-full {
  display: none;
}
/* 加号：两条线交叉，用 currentColor 跟随文字颜色 */
.img-gallery-plus {
  position: relative;
  width: 34px;
  height: 34px;
}
.img-gallery-plus::before,
.img-gallery-plus::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  background: currentColor;
  border-radius: 2px;
  transform: translate(-50%, -50%);
}
.img-gallery-plus::before { width: 34px; height: 3px; }
.img-gallery-plus::after  { width: 3px; height: 34px; }
.img-gallery-add-text {
  font-size: 13px;
  line-height: 1;
}

/* ---------- 已选：图片预览卡 ---------- */
.img-gallery-item {
  border: 1px solid #e2e8f0;
  background: #fff;
  animation: gallery-in .25s ease both;
}
@keyframes gallery-in {
  from { opacity: 0; transform: scale(.9); }
  to   { opacity: 1; transform: scale(1); }
}
.img-gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  cursor: zoom-in;
}

/* 悬浮遮罩：显示「查看 / 删除」提示 */
.img-gallery-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: rgba(15, 23, 42, .62);
  opacity: 0;
  transition: opacity .2s;
  cursor: zoom-in;
}
.img-gallery-item:hover .img-gallery-overlay { opacity: 1; }
.img-gallery-overlay-tip {
  font-size: 12px;
  color: #e8e8e8;
  pointer-events: none;
}

/* 右上角删除图标 */
.img-gallery-remove {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 24px;
  height: 24px;
  border: none;
  border-radius: 50%;
  background: #dc2626;
  color: #fff;
  font-size: 17px;
  line-height: 22px;
  text-align: center;
  cursor: pointer;
  z-index: 2;
  opacity: 0;
  transform: scale(.85);
  transition: opacity .2s, transform .2s, background .2s;
  padding: 0;
  font-family: Arial, sans-serif;
}
.img-gallery-item:hover .img-gallery-remove,
.img-gallery-remove:focus-visible { opacity: 1; transform: scale(1); }
.img-gallery-remove:hover { background: #b91c1c; }
@media (hover: none) {
  /* 触屏设备无悬浮：删除按钮常显 */
  .img-gallery-remove { opacity: 1; transform: scale(1); }
  .img-gallery-overlay { display: none; }
}

/* ---------- 查看大图 lightbox ---------- */
.img-gallery-lightbox {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(15, 23, 42, .9);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.img-gallery-lightbox.show { display: flex; }
.img-gallery-lightbox img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 12px 48px rgba(0, 0, 0, .7);
}
.img-gallery-lightbox-close {
  position: absolute;
  top: 18px;
  right: 22px;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, .12);
  color: #fff;
  font-size: 26px;
  line-height: 38px;
  text-align: center;
  cursor: pointer;
  transition: background .2s;
  padding: 0;
}
.img-gallery-lightbox-close:hover { background: rgba(255, 255, 255, .25); }

/* ---------- 计数提示 ---------- */
.img-gallery-count {
  width: 100%;
  font-size: 12px;
  color: #94a3b8;
  margin-top: 2px;
}
