/* ==========================================================================
   资产页（生成历史 / 主体）版式改版 —— 2026-09

   目标：保留站内既有能力（主体库、加入主体库、批量选择、分类、@ 用于生成），
   只重做整体布局、字体与间距：左侧分类标签 + 右上角紧凑操作区 + 按日期分组
   的无缝瀑布流，缩略图信息与操作收进悬停浮层。

   本文件在 styles.css / replica-theme.css 之后加载，用来覆盖旧版资产样式，
   因此选择器统一带 .client-body 前缀以保证优先级。
   ========================================================================== */

/* 资产页不再重复顶部的“搜索提示词 / 全部时间 / 全部类型”工具条：
   那是生成流工具，资产页自己有搜索与筛选，避免右上角出现两套重复控件。 */
.client-body .studio-shell.view-assets .workspace-toolbar { display: none; }

/* 资产页不使用左侧对话列表：把中间那一列收成 0，资产内容紧贴左侧导航，
   避免内容右边堆出一大块空白（与首页 view-inspire 的处理方式一致）。 */
.client-body .studio-shell.view-assets { grid-template-columns: 68px 0 minmax(0, 1fr) !important; }

.client-body .studio-shell.view-assets .conversation-sidebar {
  width: 0;
  min-width: 0;
  opacity: 0;
  overflow: hidden;
  border: 0;
  padding-left: 0;
  padding-right: 0;
  pointer-events: none;
}

.client-body .asset-stage { padding: 42px 40px 72px; }

.client-body .asset-library-header,
.client-body .asset-filter-bar,
.client-body .asset-date-groups,
.client-body .asset-empty.large {
  width: 100%;
  max-width: none;
  margin-left: 0;
  margin-right: 0;
}

/* ---------------------------------------------------------------- 顶部区 */
.client-body .asset-library-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 8px;
}

.client-body .asset-library-header nav { display: flex; align-items: center; gap: 4px; }

.client-body .asset-library-header nav button {
  position: static;
  height: 36px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #7f8996;
  padding: 0 15px;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: color 150ms ease, background 150ms ease;
}

.client-body .asset-library-header nav button::after { content: none; }
.client-body .asset-library-header nav button:hover { color: #e4eaf0; }
.client-body .asset-library-header nav button.active { background: rgba(255, 255, 255, .07); color: #f6f9fc; font-weight: 600; }

/* Lost legacy files are isolated from normal cards; this is the explicit,
   user-controlled cleanup notice for their records. */
.client-body .asset-unavailable-notice {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  margin: 14px 0 18px;
  padding: 12px 14px;
  border: 1px solid rgba(245, 158, 11, .35);
  border-radius: 10px;
  background: rgba(120, 78, 10, .16);
  color: #f6dfac;
}
.client-body .asset-unavailable-notice > .ui-icon { color: #fbbf24; flex: 0 0 auto; }
.client-body .asset-unavailable-notice > div { min-width: 0; flex: 1; }
.client-body .asset-unavailable-notice strong { display: block; font-size: 13px; }
.client-body .asset-unavailable-notice p { margin: 3px 0 0; color: #cbbd9e; font-size: 12px; }
.client-body .asset-unavailable-notice button {
  flex: 0 0 auto;
  border: 1px solid rgba(251, 191, 36, .5);
  border-radius: 7px;
  background: rgba(251, 191, 36, .12);
  color: #fde7a5;
  padding: 7px 10px;
  font-size: 12px;
  cursor: pointer;
}
.client-body .asset-unavailable-notice button:hover { background: rgba(251, 191, 36, .2); }

/* “画布”只是跳转入口（离开资产页），用细分隔线区分，避免被误认为资产页的第三个分组。 */
.client-body .asset-library-header nav .asset-tab-jump { position: relative; margin-left: 6px; color: #8a939f; }
.client-body .asset-library-header nav .asset-tab-jump::before {
  content: "";
  position: absolute;
  left: -3px;
  top: 50%;
  width: 1px;
  height: 15px;
  background: rgba(255, 255, 255, .13);
  transform: translateY(-50%);
}

.client-body .asset-header-actions { display: flex; align-items: center; gap: 8px; }

.client-body .asset-header-actions .asset-search-field {
  width: min(220px, 26vw);
  height: 36px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  background: rgba(255, 255, 255, .04);
  color: var(--color-text-subtle);
  padding: 0 14px;
  transition: border-color 150ms ease, background 150ms ease;
}

.client-body .asset-header-actions .asset-search-field:focus-within {
  border-color: var(--brand-border);
  background: rgba(255, 255, 255, .06);
}

.client-body .asset-header-actions #assetSearch {
  min-width: 0;
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--color-text);
  font-size: 13px;
}

.client-body .asset-header-actions .subtle-button {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  background: rgba(255, 255, 255, .04);
  color: var(--color-text-muted);
  padding: 0 14px;
  font-size: 13px;
  white-space: nowrap;
  cursor: pointer;
  transition: border-color 150ms ease, background 150ms ease, color 150ms ease;
}

.client-body .asset-header-actions .subtle-button:hover {
  border-color: var(--brand-border);
  background: rgba(255, 255, 255, .07);
  color: var(--color-text);
}

.client-body .asset-header-actions .asset-selection-entry.active {
  border-color: var(--brand-border-strong);
  background: var(--brand-surface);
  color: #eaffff;
}

/* ---------------------------------------------------------------- 筛选区 */
.client-body .asset-filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  margin-bottom: 2px;
  border-bottom: 0;
  padding-bottom: 0;
}

.client-body .asset-filter-bar > div {
  display: flex;
  align-items: center;
  gap: 2px;
  overflow-x: auto;
  scrollbar-width: none;
}

.client-body .asset-filter-bar > div::-webkit-scrollbar { display: none; }

.client-body .asset-filter-bar button {
  height: 32px;
  flex: 0 0 auto;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #79838f;
  padding: 0 10px;
  font-size: 14px;
  cursor: pointer;
  transition: color 150ms ease;
}

.client-body .asset-filter-bar button:hover { color: #d7dee5; }
.client-body .asset-filter-bar button.active { border-bottom-color: transparent; color: #f4f7fa; font-weight: 600; }

.client-body .asset-category-tabs { margin-left: 8px; padding-left: 12px; border-left: 1px solid var(--color-border); }

.client-body .asset-filter-bar .asset-sort-hint {
  margin-left: auto;
  flex: 0 0 auto;
  color: #5f6975;
  font-size: 12px;
}

/* ------------------------------------------------------- 日期分组 + 瀑布流 */
.client-body .asset-date-groups { display: grid; gap: 32px; margin-top: 16px; }

.client-body .asset-date-groups section > h2 {
  margin: 0 0 12px;
  color: #eef2f6;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: .01em;
}

.client-body .asset-gallery {
  --asset-tile: 152px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(var(--asset-tile), 1fr));
  gap: 4px;
  border: 0;
  box-shadow: none;
}

.client-body .asset-gallery-item {
  position: relative;
  min-width: 0;
  height: auto;
  aspect-ratio: 1;
  overflow: hidden;
  border: 0;
  border-radius: 3px;
  background: #1a1e24;
  transition: box-shadow 160ms ease;
}

.client-body .asset-gallery-item.selected { box-shadow: inset 0 0 0 2px var(--color-brand); background: #14161a; }

/* Temporary files stay visibly different from permanent account assets. */
.client-body .asset-expiry-badge {
  position: absolute;
  z-index: 4;
  top: 8px;
  left: 8px;
  display: inline-flex;
  align-items: center;
  min-height: 23px;
  border: 1px solid rgba(125, 211, 252, .42);
  border-radius: 999px;
  background: rgba(8, 47, 73, .78);
  color: #bae6fd;
  padding: 0 8px;
  font-size: 11px;
  line-height: 1;
  backdrop-filter: blur(8px);
  pointer-events: none;
}
.client-body .asset-expiry-badge.urgent {
  border-color: rgba(251, 146, 60, .58);
  background: rgba(124, 45, 18, .84);
  color: #fed7aa;
}

.client-body .asset-gallery-media {
  position: relative;
  width: 100%;
  height: 100%;
  aspect-ratio: auto;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: #1a1e24;
  color: #7ecddc;
  padding: 0;
  cursor: pointer;
}

.client-body .asset-gallery-media img,
.client-body .asset-gallery-media video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 420ms cubic-bezier(.2, .7, .3, 1);
}

.client-body .asset-gallery-item:hover .asset-gallery-media img,
.client-body .asset-gallery-item:hover .asset-gallery-media video { transform: scale(1.04); }

/* 悬停浮层：底部渐隐 + 名称/时间 + 原有操作按钮。 */
.client-body .asset-gallery-item::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(180deg, rgba(4, 7, 10, 0) 42%, rgba(4, 7, 10, .88));
  opacity: 0;
  transition: opacity 180ms ease;
  pointer-events: none;
}

.client-body .asset-gallery-item:hover::after,
.client-body .asset-gallery-item:focus-within::after,
.client-body .asset-gallery-item.selected::after { opacity: 1; }

.client-body .asset-gallery-meta {
  position: absolute;
  z-index: 3;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 8px;
  padding: 22px 10px 10px;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 180ms ease, transform 180ms ease;
  /* 浮层不拦截指针：整块缩略图保持可悬停/可点击，只有真正的按钮与下拉可交互。 */
  pointer-events: none;
}

.client-body .asset-gallery-meta :is(button, select, a, input) { pointer-events: auto; }

.client-body .asset-gallery-item:hover .asset-gallery-meta,
.client-body .asset-gallery-item:focus-within .asset-gallery-meta,
.client-body .asset-gallery-item.selected .asset-gallery-meta { opacity: 1; transform: none; }

.client-body .asset-gallery-caption { min-width: 0; flex: 1 1 120px; display: grid; gap: 2px; }

.client-body .asset-gallery-caption strong {
  overflow: hidden;
  color: #f4f7fa;
  font-size: 12.5px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.client-body .asset-gallery-caption small { color: rgba(226, 234, 242, .62); font-size: 11px; white-space: nowrap; }

.client-body .asset-gallery-tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 6px; }

.client-body .asset-gallery-tools button,
.client-body .asset-gallery-tools select {
  height: 27px;
  min-width: 0;
  border: 1px solid rgba(255, 255, 255, .24);
  border-radius: 7px;
  background: rgba(10, 14, 18, .72);
  color: #e9eff5;
  padding: 0 8px;
  font-size: 11.5px;
  cursor: pointer;
  backdrop-filter: blur(8px);
}

.client-body .asset-gallery-tools button:hover { border-color: var(--brand-border-strong); color: #eaffff; }
.client-body .asset-gallery-tools button:disabled { opacity: .5; cursor: default; }
.client-body .asset-gallery-tools select option { background: #1c2026; }

.client-body .asset-select-toggle {
  z-index: 6;
  border-radius: 999px;
  background: rgba(9, 12, 15, .72);
  backdrop-filter: blur(8px);
}

.client-body .asset-batch-toolbar { border-radius: 14px; }
.client-body .asset-stage:has(.asset-batch-toolbar) { padding-bottom: 160px; }

/* 触摸设备没有 hover，浮层常显，保证信息与按钮都能点到。 */
@media (hover: none) {
  .client-body .asset-gallery-item::after { opacity: 1; }
  .client-body .asset-gallery-meta { opacity: 1; transform: none; }
}

/* ---------------------------------------------------------------- 空状态 */
.client-body .asset-empty {
  display: grid;
  place-items: center;
  min-height: 280px;
  border: 1px dashed var(--color-border);
  border-radius: 14px;
  color: var(--color-text-subtle);
}

.client-body .asset-empty.large { min-height: 360px; margin-top: 22px; }

/* ---------------------------------------------------------------- 响应式 */
@media (max-width: 1200px) {
  .client-body .asset-stage { padding: 34px 24px 64px; }
  .client-body .asset-gallery { --asset-tile: 140px; }
}

@media (max-width: 900px) {
  .client-body .asset-library-header { align-items: stretch; flex-direction: column; gap: 12px; }
  .client-body .asset-header-actions { flex-wrap: wrap; }
  .client-body .asset-header-actions .asset-search-field { order: 2; width: 100%; }
  .client-body .asset-filter-bar { flex-wrap: wrap; row-gap: 6px; }
  .client-body .asset-category-tabs { margin-left: 0; }
  .client-body .asset-sort-hint { display: none; }
  .client-body .asset-gallery { --asset-tile: 120px; }
}

/* 窄屏：桌面三列栅格会把资产舞台压成几十像素宽（左下角导航在手机上已隐藏），
   这里显式把外壳收成一/两列，资产页才能自适应。 */
@media (max-width: 820px) and (min-width: 601px) {
  .client-body .studio-shell.view-assets { grid-template-columns: 64px minmax(0, 1fr) !important; }
}

@media (max-width: 600px) {
  .client-body .asset-stage { padding: 24px 14px 56px; }
  .client-body .asset-date-groups { gap: 26px; }
  .client-body .asset-date-groups section > h2 { font-size: 18px; }
  .client-body .asset-gallery { --asset-tile: 104px; gap: 3px; }
  .client-body .asset-library-header nav button { font-size: 14px; padding: 0 12px; }
  .client-body .studio-shell.view-assets { grid-template-columns: minmax(0, 1fr) !important; }
  .client-body .studio-shell.view-assets .workspace { grid-column: 1 !important; min-width: 0; }
}
