/* ============================================================
 * 后台「出图」模块样式
 * 类名统一 ph- 前缀，避免和 style.css 里已有的规则打架
 * ============================================================ */

.ph-wrap { padding: 0 20px 24px; }

/* ---------- 顶部工具条 ---------- */
.ph-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 14px 0 12px;
}

.ph-bar button {
  padding: 9px 14px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
}

.ph-bar button:disabled { opacity: .5; cursor: not-allowed; }

.ph-bar select,
.ph-bar input[type="text"] {
  padding: 9px 12px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 14px;
  background: #fff;
}

.ph-bar input[type="text"] { flex: 1; min-width: 160px; }

.ph-bar .ph-sep {
  width: 1px;
  height: 22px;
  background: #e6e6e6;
  margin: 0 2px;
}

/* ---------- 参数条 ---------- */
.ph-params {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
  padding: 10px 14px;
  margin-bottom: 14px;
  background: #fbf9f5;
  border: 1px solid #f0e9dd;
  border-radius: 10px;
  font-size: 13px;
  color: #6b6257;
}

.ph-params label {
  display: flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
}

.ph-params select {
  padding: 5px 8px;
  border: 1px solid #e0d8ca;
  border-radius: 6px;
  background: #fff;
  font-size: 13px;
}

.ph-params input[type="range"] {
  width: 110px;
  accent-color: #b08d57;
}

.ph-params .ph-val {
  color: #b08d57;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  min-width: 22px;
}

.ph-srcname {
  font-size: 12.5px;
  color: #8a8178;
  padding: 0 2px 10px;
}

/* ---------- 网格 ---------- */
.ph-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-content: flex-start;
  /* ★ flex 默认 align-items:stretch，会把同一行的卡片全拉到「该行最高那张」的高度。
     详情图是 750×1000（比其他高 1/3），一 stretch 就让主图卡片底下空出一大块。
     改成 flex-start 后每张卡片只包住自己的内容。 */
  align-items: flex-start;
}

.ph-card {
  width: calc(25% - 11px);
  background: #fff;
  border: 1px solid #eee;
  border-radius: 10px;
  padding: 8px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .04);
}

.ph-card canvas {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 6px;
  background: #fff;
  cursor: zoom-in;
  background-image:
    linear-gradient(45deg, #f2f2f2 25%, transparent 25%),
    linear-gradient(-45deg, #f2f2f2 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #f2f2f2 75%),
    linear-gradient(-45deg, transparent 75%, #f2f2f2 75%);
  background-size: 14px 14px;
  background-position: 0 0, 0 7px, 7px -7px, -7px 0;
}

.ph-cap {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 5px;
  margin-top: 7px;
  font-size: 12.5px;
}

.ph-cap b { font-weight: 600; color: #3a352f; }
.ph-cap em { font-style: normal; color: #9a9a9a; font-size: 11px; }

/* ---------- 空态 / 加载 ---------- */
.ph-empty {
  width: 100%;
  padding: 56px 20px;
  text-align: center;
  color: #9a9a9a;
  background: #fbfbfb;
  border: 1px dashed #e2ddd5;
  border-radius: 12px;
}

.ph-empty-ico {
  font-size: 30px;
  color: #d8d2c7;
  margin-bottom: 10px;
}

.ph-empty p { margin: 4px 0; font-size: 13.5px; }
.ph-empty .sub { font-size: 12.5px; color: #b0b0b0; line-height: 1.8; }

.ph-spin {
  width: 26px;
  height: 26px;
  margin: 0 auto 12px;
  border: 3px solid #efe9df;
  border-top-color: #b08d57;
  border-radius: 50%;
  animation: ph-rotate .8s linear infinite;
}

@keyframes ph-rotate { to { transform: rotate(360deg); } }

/* ---------- 底部操作 ---------- */
.ph-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid #f0f0f0;
}

.ph-actions button {
  padding: 10px 16px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
}

.ph-actions button:disabled { opacity: .55; cursor: not-allowed; }

.ph-actions select {
  padding: 9px 12px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 14px;
  background: #fff;
  min-width: 180px;
}

.ph-tip {
  font-size: 12.5px;
  color: #9a9a9a;
  margin-left: auto;
}

/* ---------- fileID 列表 ---------- */
.ph-fids {
  margin-top: 14px;
  padding: 12px;
  background: #fafafa;
  border: 1px solid #eee;
  border-radius: 10px;
  max-height: 220px;
  overflow: auto;
}

.ph-fid {
  display: flex;
  gap: 10px;
  padding: 4px 0;
  font-size: 12px;
  border-bottom: 1px dashed #eee;
}

.ph-fid:last-child { border-bottom: none; }
.ph-fid span { flex: none; width: 56px; color: #b08d57; font-weight: 600; }
.ph-fid code {
  color: #777;
  word-break: break-all;
  font-size: 11.5px;
}

/* ---------- 大图预览 ---------- */
.ph-modal {
  position: fixed;
  inset: 0;
  background: rgba(20, 16, 10, .72);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 30px;
}

.ph-modal-box {
  background: #fff;
  border-radius: 14px;
  padding: 14px;
  max-width: 92vw;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ph-modal-head {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13.5px;
  color: #4a4238;
}

.ph-modal-head button {
  margin-left: auto;
  padding: 6px 14px;
  border: none;
  border-radius: 7px;
  background: #eee;
  cursor: pointer;
  font-size: 13px;
}

.ph-modal-box canvas {
  max-width: 80vw;
  max-height: 76vh;
  object-fit: contain;
  display: block;
  border-radius: 6px;
}

/* ---------- 拖拽高亮 ---------- */
#panel-photo.ph-drag { outline: 2px dashed #b08d57; outline-offset: -8px; }

/* ---------- 窄屏 ---------- */
@media (max-width: 1100px) { .ph-card { width: calc(33.33% - 10px); } }
@media (max-width: 760px) { .ph-card { width: calc(50% - 7px); } }
