/* =====================================================================
   资产库 · 形象管理 / 声音管理（UI）
   2026-09-27 · 开发员12号
   ---------------------------------------------------------------------
   来源：用户给的参考录屏里「AI数字人 → 形象管理 / 声音管理」两个功能，要求
   「提取复刻优化，融合到咱们的数字人功能里，UI 界面要高级」。

   参考产品里的做法（我照它的**信息结构**复刻，视觉换成咱们的品牌橙）：
     · 形象：起名 + 上传视频人像（MP4/MOV，1 分钟内）→ 卡片列表（缩略图 + 名字 + 状态）
     · 声音：上传音频 →「AI 正在分析声纹特征…nn%」→ 起名 → 卡片列表
     · 使用：在生成流程里横向一排「选择数字人形象」卡片，第一张永远是「+ 添加形象」，
             选中的卡片打**绿勾** + 描边

   🔴 三条硬约束（照项目铁律来）
     ① **不动 style.css** —— 新建独立文件、排在 style.css 之后加载；
     ② **类名全局唯一** —— 一律 `asl-` 前缀，避免与其它页撞车；
     ③ `[hidden]` 兜底在本文件作用域内自己补一条（display:flex 会盖掉 [hidden]）。
   ===================================================================== */

/* ---------- 统一：隐藏态兜底（作用域内自补，别指望全局的 [hidden]） ---------- */
#aslPanel [hidden], .asl-mask [hidden], #aslPick [hidden] { display: none !important; }

/* ---------- 变量（只在本模块作用域用前缀，避免污染全局） ---------- */
#aslPanel, #aslPick, .asl-mask {
  --asl-ink: #2b1d12;
  --asl-sub: #a08c7c;
  --asl-line: #f1e3d8;
  --asl-soft: #fff7f1;
}

/* =====================================================================
   一、管理面板（子页：#aslPanel）
   ===================================================================== */
#aslPanel { padding-bottom: 40px; }

/* 顶部 hero：渐变 + 数量统计 */
.asl-hero {
  position: relative; overflow: hidden;
  margin: 6px 14px 14px; padding: 18px 18px 16px;
  border-radius: 22px;
  background: linear-gradient(135deg, #ff8a4c 0%, #f94400 100%);
  color: #fff;
  box-shadow: 0 10px 26px rgba(249, 68, 0, .22);
}
.asl-hero::after {            /* 右上角光斑，做出"高级"的层次 */
  content: ''; position: absolute; right: -34px; top: -46px;
  width: 148px; height: 148px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,.40) 0%, rgba(255,255,255,0) 68%);
  pointer-events: none;
}
.asl-hero-t { font-size: 19px; font-weight: 800; letter-spacing: .3px; }
.asl-hero-s { font-size: 12.5px; opacity: .92; margin-top: 5px; line-height: 1.6; }
.asl-hero-stat { display: flex; gap: 18px; margin-top: 13px; }
.asl-hero-stat b { font-size: 21px; font-weight: 800; }
.asl-hero-stat span { font-size: 11.5px; opacity: .9; margin-left: 4px; }

/* 工具条：搜索 / 筛选 */
.asl-bar { display: flex; gap: 8px; align-items: center; margin: 0 14px 12px; }
.asl-search {
  flex: 1; min-width: 0; height: 40px; padding: 0 14px;
  border-radius: 12px; border: 1.5px solid var(--asl-line);
  background: #fff; font-size: 13.5px; color: var(--asl-ink); outline: none;
}
.asl-search:focus { border-color: #ffb489; box-shadow: 0 0 0 3px rgba(249,89,1,.10); }
.asl-add {
  flex: 0 0 auto; height: 40px; padding: 0 16px; border: none; cursor: pointer;
  border-radius: 12px; color: #fff; font-size: 13.5px; font-weight: 700;
  background: linear-gradient(135deg, #ff8845 0%, #f94400 100%);
  box-shadow: 0 6px 16px rgba(249,68,0,.25);
}
.asl-add:active { transform: translateY(1px); }

/* 卡片网格 */
.asl-grid {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 11px; padding: 0 14px;
}
@media (min-width: 560px) { .asl-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

.asl-card {
  position: relative; cursor: pointer; overflow: hidden;
  border-radius: 16px; background: #fff;
  border: 1.5px solid var(--asl-line);
  box-shadow: 0 2px 10px rgba(249,89,1,.07);
  transition: transform .16s, box-shadow .16s, border-color .16s;
}
.asl-card:active { transform: scale(.985); }
.asl-card.on {
  border-color: #f95901;
  box-shadow: 0 0 0 3px rgba(249,89,1,.14), 0 8px 22px rgba(249,68,0,.18);
}
/* 缩略图：3:4，视频带播放角标 */
.asl-thumb {
  position: relative; width: 100%; padding-top: 118%;
  background: linear-gradient(160deg, #fff1e7, #ffe0cb); overflow: hidden;
}
.asl-thumb > img, .asl-thumb > video {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block;
}
.asl-thumb .asl-ph {        /* 没有图时的占位（emoji 大字，别用灰色块） */
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 30px; opacity: .55;
}
.asl-tag-v {                /* 「视频」角标 */
  position: absolute; left: 6px; top: 6px; z-index: 2;
  padding: 2px 7px; border-radius: 999px; font-size: 10px; font-weight: 700;
  background: rgba(0,0,0,.52); color: #fff; backdrop-filter: blur(4px);
}
.asl-name {
  padding: 7px 8px 8px; font-size: 12.5px; font-weight: 700; color: var(--asl-ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: center;
}
/* 选中绿勾 */
.asl-tick {
  position: absolute; right: 6px; top: 6px; z-index: 3;
  width: 21px; height: 21px; border-radius: 50%;
  background: #22c55e; color: #fff; font-size: 12px; font-weight: 900;
  display: none; align-items: center; justify-content: center;
  box-shadow: 0 2px 8px rgba(34,197,94,.45);
}
.asl-card.on .asl-tick { display: flex; }
/* 状态角标：分析中（覆盖层 + 转圈） */
.asl-busy {
  position: absolute; inset: 0; z-index: 4;
  background: rgba(28,16,8,.55); backdrop-filter: blur(2px);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7px;
  color: #fff; font-size: 11.5px; font-weight: 700;
}
.asl-spin {
  width: 22px; height: 22px; border-radius: 50%;
  border: 2.5px solid rgba(255,255,255,.32); border-top-color: #ffb489;
  animation: asl-spin .85s linear infinite;
}
@keyframes asl-spin { to { transform: rotate(360deg); } }

/* 悬浮操作（改名 / 删除）—— 默认藏在右下，hover 或点开才显，避免卡片太花 */
.asl-ops { position: absolute; right: 5px; bottom: 5px; z-index: 5; display: flex; gap: 5px; }
.asl-op {
  width: 25px; height: 25px; border-radius: 50%; border: none; cursor: pointer;
  background: rgba(255,255,255,.94); color: #6b5548; font-size: 12px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 7px rgba(0,0,0,.14);
}
.asl-op.del { color: #ef4444; }
@media (hover: hover) {
  .asl-ops { opacity: 0; transition: opacity .18s; }
  .asl-card:hover .asl-ops { opacity: 1; }
}

/* 「+ 添加」占位卡：虚线框 */
.asl-card.add {
  border-style: dashed; border-color: #f3c9ab; background: #fffaf6;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding-top: 118%; position: relative;
}
.asl-card.add .asl-add-in {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 6px; color: #d2691e;
}
.asl-card.add .asl-plus { font-size: 26px; font-weight: 300; line-height: 1; }
.asl-card.add .asl-add-t { font-size: 12px; font-weight: 700; }

/* 空态 */
.asl-empty { padding: 44px 20px 30px; text-align: center; color: var(--asl-sub); }
.asl-empty .asl-e-ico {
  width: 76px; height: 76px; margin: 0 auto 12px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; font-size: 34px;
  background: linear-gradient(160deg, #fff1e7, #ffe0cb);
  box-shadow: inset 0 0 0 1px rgba(249,89,1,.10);
}
.asl-empty b { display: block; color: var(--asl-ink); font-size: 14.5px; margin-bottom: 5px; }
.asl-empty p { font-size: 12.5px; line-height: 1.7; }

/* =====================================================================
   二、选择器（弹层：#aslPick）—— 各数字人功能里调起来选一个
   ===================================================================== */
#aslPick .asl-sheet {
  width: 100%; max-width: 460px; max-height: 84vh; overflow-y: auto;
  background: #fff; border-radius: 22px; padding: 18px 16px 16px;
}
#aslPick .asl-sheet-h { display: flex; align-items: center; margin-bottom: 12px; }
#aslPick .asl-sheet-t { flex: 1; font-size: 16px; font-weight: 800; color: var(--asl-ink); }
#aslPick .asl-x {
  width: 30px; height: 30px; border-radius: 50%; border: none; cursor: pointer;
  background: #f6efe9; color: #7c6555; font-size: 15px; line-height: 1;
}
#aslPick .asl-grid { padding: 0; }
#aslPick .asl-foot { display: flex; gap: 10px; margin-top: 14px; }
#aslPick .asl-btn {
  flex: 1; height: 44px; border-radius: 13px; border: none; cursor: pointer;
  font-size: 14.5px; font-weight: 700;
}
#aslPick .asl-btn.ghost { background: #f6efe9; color: #6b5548; }
#aslPick .asl-btn.go {
  color: #fff; background: linear-gradient(135deg, #ff8845 0%, #f94400 100%);
  box-shadow: 0 8px 20px rgba(249,68,0,.26);
}
#aslPick .asl-btn:disabled { opacity: .45; box-shadow: none; cursor: not-allowed; }

/* =====================================================================
   三、新增弹窗里的上传区 + 全屏「声纹分析中」
   ===================================================================== */
.asl-up {
  margin-top: 6px; border: 1.6px dashed #f3c9ab; border-radius: 16px;
  background: #fffaf6; min-height: 158px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7px;
  color: #c2724a; padding: 16px; text-align: center;
}
.asl-up .asl-up-ico { font-size: 30px; }
.asl-up b { font-size: 14px; color: #a4571f; }
.asl-up span { font-size: 11.5px; color: var(--asl-sub); line-height: 1.6; }
.asl-prev { width: 100%; border-radius: 14px; overflow: hidden; background: #000; position: relative; }
.asl-prev > img, .asl-prev > video { width: 100%; display: block; max-height: 300px; object-fit: contain; }
.asl-prev .asl-prev-n {
  position: absolute; right: 8px; bottom: 8px; padding: 2px 8px; border-radius: 999px;
  background: rgba(0,0,0,.55); color: #fff; font-size: 11px;
}
.asl-up-again {
  margin-top: 8px; width: 100%; height: 40px; border-radius: 12px; cursor: pointer;
  border: 1.5px solid #f3c9ab; background: #fff; color: #c2724a; font-size: 13px; font-weight: 700;
}
.asl-field-t { font-size: 13px; font-weight: 800; color: var(--asl-ink); margin: 14px 0 7px; }
.asl-field-h { font-size: 11.5px; color: var(--asl-sub); margin-top: 6px; line-height: 1.6; }

/* 「AI 正在分析声纹特征…」深色全屏（照参考产品的观感） */
.asl-mask { position: fixed; inset: 0; z-index: 120; display: none; }
.asl-mask.on { display: block; }
.asl-analyze {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 18px;
  background: radial-gradient(circle at 50% 42%, #21232e 0%, #14151c 62%, #0d0e13 100%);
  color: #fff;
}
.asl-wave { display: flex; align-items: flex-end; gap: 3px; height: 44px; }
.asl-wave i {
  width: 3.5px; border-radius: 3px; background: linear-gradient(180deg, #ff5fa2, #ff2d78);
  animation: asl-wave 1s ease-in-out infinite;
}
@keyframes asl-wave { 0%,100% { height: 8px; opacity: .55; } 50% { height: 40px; opacity: 1; } }
.asl-orb {
  width: 96px; height: 96px; border-radius: 50%;
  background: radial-gradient(circle at 34% 30%, #ff9dc4, #ff2d78 62%, #d81b60 100%);
  display: flex; align-items: center; justify-content: center; font-size: 38px;
  box-shadow: 0 0 44px rgba(255,45,120,.45), inset 0 -6px 18px rgba(0,0,0,.16);
  animation: asl-pulse 1.6s ease-in-out infinite;
}
@keyframes asl-pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.06); } }
.asl-an-t { font-size: 15px; font-weight: 700; letter-spacing: .4px; }
.asl-an-p { font-size: 30px; font-weight: 800; color: #ff5fa2; letter-spacing: 1px; }
.asl-an-h { font-size: 12px; color: #9aa0b4; }

/* 顶部轻提示（本模块自用，避免依赖外部 toast 的时序） */
.asl-toast {
  position: fixed; left: 50%; top: 18px; transform: translateX(-50%) translateY(-14px);
  z-index: 130; padding: 10px 18px; border-radius: 999px;
  background: rgba(43,29,18,.94); color: #fff; font-size: 13px; font-weight: 600;
  opacity: 0; transition: opacity .22s, transform .22s; pointer-events: none;
  max-width: 86vw; text-align: center; line-height: 1.5;
}
.asl-toast.on { opacity: 1; transform: translateX(-50%) translateY(0); }

/* 名字条：卡片内的一条浅底，别让文字"浮"在彩色缩略图上（2026-09-27） */
.asl-card .asl-name {
  background: #fff;
  border-top: 1px solid #f7ece4;
}
