/* ============================================================
   Aellus · shadcn/ui 组件层（zinc light）
   令牌来自 common.css。本文件只保留当前实际使用的组件样式：
   Badge / Separator / Checkbox / Alert / Alert Dialog / Toast。
   其余 shadcn 组件基类（Dropdown / Switch / Tabs / Accordion /
   Avatar / Popover / Sheet / Table / Toggle / Textarea / Select /
   Input Group / Button Group / Skeleton / Kbd / Tooltip / Slider /
   Pagination / Field / Hover Card 等）尚无对应界面，已移除，
   需要时再按 shadcn 规范补回。
   ============================================================ */

/* ---------- Badge ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  height: 20px; padding: 0 8px; border-radius: 9999px;
  font-size: 11px; font-weight: 600; line-height: 1; white-space: nowrap;
  border: 1px solid transparent;
}
.badge-outline { background: hsl(var(--background)); color: hsl(var(--foreground)); border-color: hsl(var(--border)); }

/* ---------- Separator ---------- */
.separator { height: 1px; width: 100%; background: hsl(var(--border)); margin: 16px 0; }

/* ---------- Checkbox（shadcn 风格原生实现） ---------- */
.checkbox {
  appearance: none; -webkit-appearance: none;
  width: 16px; height: 16px; flex-shrink: 0; margin: 0; padding: 0; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid hsl(var(--border));
  border-radius: calc(var(--radius) - 4px); /* rounded-sm */
  background: transparent;
  transition: background-color .15s, border-color .15s;
}
.checkbox:checked { background: hsl(var(--primary)); border-color: hsl(var(--primary)); }
.checkbox:checked::after {
  content: ""; display: block;
  width: 6px; height: 3px;
  border: solid hsl(var(--primary-foreground));
  border-width: 0 0 2px 2px;
  /* 视觉居中：勾旋转后视觉重心偏下约 1px。translateY 写在前面 = 先旋转、
     后在页面坐标系内整体上移 1px（纯平移，不歪斜）。 */
  transform: translateY(-1px) rotate(-45deg);
}
.checkbox:focus-visible { outline: 2px solid hsl(var(--ring)); outline-offset: 2px; }
.checkbox:disabled, .checkbox[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }

/* ---------- Alert ---------- */
.alert {
  display: flex; flex-direction: column; gap: 4px;
  padding: 12px 14px; border: 1px solid hsl(var(--border));
  border-radius: var(--radius); background: hsl(var(--background));
  font-size: 13px;
}
.alert-destructive {
  border-color: hsl(var(--destructive) / .4);
  background: hsl(var(--destructive) / .06);
  color: hsl(var(--destructive));
}
.alert-title { font-weight: 600; }
.alert-desc { color: hsl(var(--muted-foreground)); }
.alert-destructive .alert-desc { color: hsl(var(--destructive) / .85); }

/* ---------- Modal 体系（遮罩 / 面板 / 关闭钮：设置、扫码、确认、相机四个弹窗共用） ----------
   公共观感集中在这里，各弹窗只保留差异（z-index、激活方式、局部尺寸）。
   用法：弹窗容器加 .modal-overlay，面板加 .modal-card，关闭钮加 .modal-close。 */
.modal-overlay {
  display: none; position: fixed; inset: 0;
  align-items: center; justify-content: center; padding: 16px;
  background: rgb(0 0 0 / .45);
  backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px);
}
.modal-card {
  background: hsl(var(--card)); border: 1px solid hsl(var(--border));
  border-radius: var(--radius-lg);
}
.modal-close {
  border: none; background: transparent; color: hsl(var(--muted-foreground));
  font-size: 18px; min-height: 0; cursor: pointer;
  border-radius: calc(var(--radius) - 2px);
  transition: background .15s, color .15s;
}
.modal-close:active { background: hsl(var(--accent)); }
@media (hover: hover) and (pointer: fine) {
  .modal-close:hover { background: hsl(var(--accent)); color: hsl(var(--foreground)); }
}

/* ---------- 卡片碎片（读取页文件卡 / 上传页进度与结果卡共用） ---------- */
/* 缩略图族：图片(淡入) / 视频(黑底) / 通用图标(居中容器)；尺寸由各页面给（72px / 48px） */
.thumb, .thumb-video, .thumb-other, .thumb-folder {
  border-radius: calc(var(--radius) - 2px); flex-shrink: 0;
  object-fit: cover; background: hsl(var(--muted));
}
.thumb { opacity: 0; transition: opacity .25s ease; }
.thumb.loaded { opacity: 1; }
.thumb-video { background: #000; }
.thumb-other, .thumb-folder { display: flex; align-items: center; justify-content: center; }
/* 图高对齐的文字列：文件名顶对齐缩略图顶、元信息底对齐缩略图底 */
.file-item .file-meta-col, .up-meta {
  min-width: 0; min-height: 72px; display: flex; flex-direction: column; justify-content: space-between;
}
/* 卡片文字：文件名 / 元信息（字号与颜色统一，换行方式等差异由各页补充） */
.file-item .fname, .up-prog-item .fname, .up-name { font-size: 14px; color: hsl(var(--foreground)); }
.file-item .fmeta, .up-prog-item .fmeta, .up-size { font-size: 12px; color: hsl(var(--muted-foreground)); }

/* ---------- Alert Dialog ---------- */
/* 遮罩与面板的公共外观来自上面的 .modal-overlay / .modal-card（类名挂在 JS 生成的节点上） */
.alert-dialog-overlay {
  z-index: 2000;
}
.alert-dialog-overlay[data-open="true"] { display: flex; animation: fadeIn .15s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.alert-dialog {
  width: 100%; max-width: 420px;
  overflow: hidden;
  animation: dialogIn .18s ease;
}
@keyframes dialogIn { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
.alert-dialog-header { padding: 20px 20px 0; }
.alert-dialog-title { font-size: 16px; font-weight: 600; }
.alert-dialog-desc { font-size: 13px; color: hsl(var(--muted-foreground)); margin-top: 6px; line-height: 1.5; }
.alert-dialog-footer { display: flex; justify-content: flex-end; gap: 8px; padding: 16px 20px 20px; }

/* ---------- Toast / Sonner ---------- */
.toast-viewport {
  position: fixed; bottom: 20px; right: 20px; z-index: 200;
  display: flex; flex-direction: column; gap: 10px; width: min(380px, calc(100vw - 32px));
}
.toast {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 14px; border-radius: var(--radius);
  background: hsl(var(--background)); color: hsl(var(--foreground));
  border: 1px solid hsl(var(--border));
  animation: toastIn .2s ease;
}
.toast.leaving { animation: toastOut .18s ease forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateX(16px); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateX(16px); } }
.toast.destructive { border-color: hsl(var(--destructive) / .4); background: hsl(var(--destructive) / .06); }
.toast-title { font-size: 13px; font-weight: 600; line-height: 1.4; }
.toast-desc { font-size: 12px; color: hsl(var(--muted-foreground)); margin-top: 2px; line-height: 1.4; }
.toast-ico { flex-shrink: 0; margin-top: 1px; }
.toast.destructive .toast-ico { color: hsl(var(--destructive)); }
.toast-close {
  margin-left: auto; flex-shrink: 0; border: none; background: transparent; cursor: pointer;
  color: hsl(var(--muted-foreground)); padding: 2px; border-radius: calc(var(--radius) - 4px); min-height: auto; font-size: 14px;
}
@media (hover: hover) and (pointer: fine) {
  .toast-close:hover { background: hsl(var(--accent)); color: hsl(var(--foreground)); }
}
