/* 预览弹窗样式。
 *
 * 单独成文件而不是写在 index.html 的 <style> 里：弹窗的层级（z-index）、
 * 裁切方式（object-fit）这些只能靠真实浏览器验证，而真机验证页
 * （tests/preview.test.html）需要引到**同一份**样式才能测到真实效果。
 * 写在 index.html 里的 <style> 里，验证页测到的就是一个没样式的裸 DOM，
 * 那几条断言必然失败（第一版就是这么被暴露出来的）。
 */

/* z-index 必须高于 toast(999)：预览开着时弹的提示不该被遮住 */
.pv-overlay {
  position: fixed; inset: 0; z-index: 1200;
  background: rgba(16,14,10,.82);
  backdrop-filter: blur(3px);
  display: flex; flex-direction: column;
  padding: 20px;
  animation: pvIn .16s ease-out;
}
@keyframes pvIn { from { opacity: 0; } to { opacity: 1; } }

.pv-stage {
  flex: 1; min-height: 0; display: flex; align-items: center;
  justify-content: center; gap: 10px;
}
.pv-media {
  flex: 1; min-width: 0; height: 100%;
  display: flex; align-items: center; justify-content: center;
}
/* 用 object-fit: contain 而不是拉满：预览要看清整张图，不能裁 */
.pv-media img, .pv-media video {
  max-width: 100%; max-height: 100%;
  object-fit: contain; border-radius: 8px;
  background: rgba(0,0,0,.35);
}

.pv-close {
  position: absolute; top: 18px; right: 20px;
  padding: 7px 14px; border-radius: 999px; font-size: 13px; cursor: pointer;
  background: rgba(255,255,255,.14); color: #fff;
  border: 1px solid rgba(255,255,255,.22);
}
.pv-close:hover { background: rgba(255,255,255,.24); }

.pv-nav {
  flex: none; width: 40px; height: 40px; border-radius: 999px;
  font-size: 22px; line-height: 1; cursor: pointer;
  background: rgba(255,255,255,.12); color: #fff;
  border: 1px solid rgba(255,255,255,.2);
}
.pv-nav:hover { background: rgba(255,255,255,.22); }

.pv-bar {
  flex: none; margin-top: 14px;
  display: flex; align-items: center; gap: 12px;
  color: rgba(255,255,255,.88); font-size: 13px;
}
.pv-title {
  flex: 1; min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pv-counter { flex: none; color: rgba(255,255,255,.6); font-size: 12.4px; }
.pv-copy {
  flex: none; padding: 6px 13px; border-radius: 999px; cursor: pointer;
  font-size: 12.4px; background: rgba(255,255,255,.14); color: #fff;
  border: 1px solid rgba(255,255,255,.22);
}
.pv-copy:hover { background: rgba(255,255,255,.24); }

/* ─────────────────────────────────────────────────────────────
   确认弹窗
   ─────────────────────────────────────────────────────────────
   替代 window.confirm —— 那玩意是浏览器画的控件，CSS 完全碰不到，
   外观由操作系统决定。

   设计上是「水」这个隐喻的镜像：投放区那缸水的水面就是进度本身，
   而删除一条记录就是把水位降下去。所以面板顶部是一条水位线，
   而不是通用的圆角卡片 + 阴影。这是这一页唯一说得通的结构装饰。

   其余部分刻意克制：暖白面板、一条细线、两个按钮。
   破坏性动作用 danger 色，但**不填满** —— 填满的红色按钮会喊得
   比这件事本身更响，而删一条 24 小时就过期的记录没那么严重。
   ───────────────────────────────────────────────────────────── */

.cf-scrim {
  position: fixed; inset: 0; z-index: 1300;   /* 高于预览弹窗(1200) */
  background: rgba(20,17,12,.42);
  backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  animation: cfFade .14s ease-out;
}
@keyframes cfFade { from { opacity: 0 } to { opacity: 1 } }

.cf-panel {
  position: relative;
  width: 100%; max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 22px 18px;
  box-shadow: 0 12px 40px rgba(20,17,12,.18);
  overflow: hidden;
  animation: cfRise .18s cubic-bezier(.2,.9,.3,1);
}
@keyframes cfRise {
  from { opacity: 0; transform: translateY(8px) scale(.985); }
  to { opacity: 1; transform: none; }
}

/* 水位线：顶部一条薄暮橙的渐变线，从实到虚。
   「删掉一点」＝水面降下去，这是本站隐喻的镜像。 */
.cf-waterline {
  position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(
    to right,
    var(--accent) 0%,
    var(--accent) 35%,
    transparent 100%
  );
  opacity: .85;
}

.cf-title {
  font-size: 16px; font-weight: 620; letter-spacing: -.01em;
  line-height: 1.4;
}

.cf-body {
  margin-top: 9px;
  font-size: 13px; line-height: 1.75; color: var(--text-muted);
}

/* 具体对象（文件名 / 条数）单独一行，等宽。
   这一页的名字多是「粘贴-20261009-131925.png」这类机器生成的编号，
   等宽字才好逐字辨认，也能一眼看出是不是自己要删的那条。 */
.cf-detail {
  margin-top: 12px; padding: 9px 11px;
  font-family: var(--mono); font-size: 12.2px;
  color: var(--text);
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  word-break: break-all;
  /* 很长的文件名不该把面板撑破 */
  max-height: 4.6em; overflow: auto;
}

.cf-careful {
  margin-top: 10px;
  font-size: 12.4px; line-height: 1.7;
  color: var(--accent-tint);
}

.cf-actions {
  margin-top: 20px;
  display: flex; justify-content: flex-end; gap: 9px;
}

.cf-actions button {
  padding: 8px 16px; border-radius: 9px; cursor: pointer;
  font-size: 13.2px; font-weight: 540;
  border: 1px solid var(--border);
  background: var(--surface2); color: var(--text-muted);
  transition: background .14s, color .14s, border-color .14s;
}
.cf-actions button:hover { color: var(--text); border-color: var(--border-hover); }

/* 键盘焦点必须看得见 */
.cf-actions button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* 确认按钮：不是实心红底。填满的红色比「删一条 24 小时过期的记录」
   这件事本身喊得更响；用描边 + 危险色文字，语气刚好。 */
.cf-actions .cf-ok {
  border-color: var(--border-hover);
  background: var(--surface);
  color: var(--text);
}
.cf-actions .cf-ok.danger {
  border-color: var(--danger);
  color: var(--danger);
  background: var(--surface);
}
.cf-actions .cf-ok.danger:hover { background: var(--danger-soft); }

html[data-theme="dark"] .cf-panel { box-shadow: 0 12px 40px rgba(0,0,0,.5); }

@media (max-width: 640px) {
  /* 窄屏上左右箭头占地方 */
  .pv-overlay { padding: 12px; }
  .pv-nav { width: 34px; height: 34px; font-size: 19px; }
  .pv-close { top: 10px; right: 12px; }

  .cf-panel { padding: 19px 17px 15px; }
  /* 窄屏上按钮撑满，拇指好点 */
  .cf-actions { flex-direction: column-reverse; }
  .cf-actions button { width: 100%; padding: 10px 16px; }
}

@media (prefers-reduced-motion: reduce) {
  .cf-scrim, .cf-panel { animation: none; }
}
