/**
 * 素材库页面 - V21 设计系统样式
 * 两栏布局：左侧素材库列表（260px）+ 右侧素材网格
 * 统一使用 CSS 变量，支持深色/浅色主题
 */
@import "../../styles/global.css";

/* ============================================================
   页面容器
   ============================================================ */
.xx-assets-page {
  min-height: 100%;
  padding: var(--space-xl);
}

/* ============================================================
   两栏布局
   ============================================================ */
.xx-assets-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 20px;
  align-items: start;
}

/* ============================================================
   左侧素材库列表
   ============================================================ */
.xx-asset-library-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  position: sticky;
  top: var(--space-md);
}

.xx-asset-library-item {
  border: 1px solid var(--border-color);
  background: var(--bg-primary);
  border-radius: var(--radius-sm);
  padding: 14px;
  cursor: pointer;
  transition: var(--transition-all);
}

.xx-asset-library-item:hover {
  border-color: var(--primary-color);
  background: var(--primary-soft);
}

.xx-asset-library-item.active {
  border-color: var(--primary-color);
  background: var(--primary-soft);
  box-shadow: var(--shadow-primary);
}

.xx-asset-library-item:active {
  transform: scale(0.98);
  box-shadow: var(--shadow-sm);
}

.xx-asset-library-item h4 {
  margin: 0 0 var(--space-xs);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-semibold);
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.xx-asset-library-item span {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
}

.xx-asset-library-delete {
  background: none;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-xs);
  font-size: var(--font-size-sm);
  transition: var(--transition-all);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  flex-shrink: 0;
}

.xx-asset-library-item:hover .xx-asset-library-delete {
  opacity: 1;
}

.xx-asset-library-delete:hover {
  color: var(--error-color);
  background: var(--error-soft);
}

.xx-asset-library-delete:active {
  background: var(--error-color);
  color: var(--text-inverse);
  transform: scale(0.92);
}

.xx-asset-library-add {
  border: 1px dashed var(--border-color);
  background: transparent;
  border-radius: var(--radius-sm);
  padding: 14px;
  cursor: pointer;
  text-align: center;
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
  transition: var(--transition-all);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
}

.xx-asset-library-add:hover {
  border-color: var(--primary-color);
  color: var(--primary-color);
  background: var(--primary-soft);
}

.xx-asset-library-add:active {
  transform: scale(0.98);
  background: var(--primary-soft);
  border-style: solid;
}

/* ============================================================
   右侧内容区
   ============================================================ */
.xx-assets-content {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

/* ============================================================
   上传区域
   ============================================================ */
.xx-asset-upload-zone {
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--space-2xl) var(--space-xl);
  text-align: center;
  background: var(--bg-secondary);
  cursor: pointer;
  transition: var(--transition-all);
}

.xx-asset-upload-zone:hover {
  border-color: var(--primary-color);
  background: var(--primary-soft);
}

.xx-asset-upload-zone:active {
  border-style: solid;
  transform: scale(0.99);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.06);
}

.xx-asset-upload-icon {
  font-size: 40px;
  margin-bottom: var(--space-sm);
  color: var(--primary-color);
}

.xx-asset-upload-text {
  font-size: var(--font-size-base) !important;
  color: var(--text-primary) !important;
  margin: 0 0 var(--space-xs) !important;
  font-weight: var(--font-weight-medium);
}

.xx-asset-upload-hint {
  font-size: var(--font-size-sm) !important;
  color: var(--text-tertiary) !important;
  margin: 0 !important;
}

/* ============================================================
   筛选栏
   ============================================================ */
.xx-assets-filters {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  flex-wrap: wrap;
}

.xx-assets-filters-left {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.xx-assets-filters-right {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

/* ============================================================
   素材网格
   ============================================================ */
.xx-asset-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

/* ============================================================
   素材卡片
   ============================================================ */
.xx-asset-card {
  border: 1px solid var(--border-color);
  background: var(--bg-primary);
  border-radius: var(--radius-md);
  overflow: hidden;
  cursor: pointer;
  transition: var(--transition-all);
}

.xx-asset-card:hover {
  border-color: var(--primary-color);
  box-shadow: var(--shadow-sm);
  transform: translateY(-2px);
}

.xx-asset-card:active {
  transform: translateY(0) scale(0.98);
  box-shadow: var(--shadow-sm);
}

/* 缩略图 */
.xx-asset-thumb {
  aspect-ratio: 9 / 16;
  position: relative;
  overflow: hidden;
  display: grid;
  place-items: center;
  color: var(--text-inverse);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}

.xx-asset-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.xx-asset-thumb-placeholder {
  font-size: var(--font-size-3xl);
  opacity: 0.7;
}

/* 播放按钮 */
.xx-asset-play {
  position: absolute;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(4px);
  display: grid;
  place-items: center;
  color: var(--text-inverse);
  font-size: var(--font-size-md);
  transition: var(--transition-all);
}

.xx-asset-card:hover .xx-asset-play {
  background: rgba(255, 255, 255, 0.4);
  transform: scale(1.1);
}

/* 选中态 */
.xx-asset-card-selected {
  border-color: var(--primary-color) !important;
  box-shadow: var(--shadow-primary) !important;
}

.xx-asset-check {
  position: absolute;
  top: var(--space-sm);
  right: var(--space-sm);
  width: 24px;
  height: 24px;
  border-radius: var(--radius-full);
  background: var(--gradient-primary);
  color: var(--text-inverse);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-size-sm);
  z-index: 2;
}

/* 卡片信息 */
.xx-asset-info {
  padding: 12px;
}

.xx-asset-name {
  margin: 0 0 6px;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.xx-asset-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: var(--font-size-xs);
  color: var(--text-secondary);
  margin-bottom: var(--space-sm);
}

/* 诊断按钮 */
.xx-asset-diagnose-btn {
  width: 100%;
  padding: 6px;
  font-size: var(--font-size-sm);
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xs);
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition-all);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
}

.xx-asset-diagnose-btn:hover {
  border-color: var(--primary-color);
  color: var(--primary-color);
  background: var(--primary-soft);
}

.xx-asset-diagnose-btn:active {
  background: var(--primary-color);
  color: var(--text-inverse);
  transform: scale(0.97);
}

.xx-asset-diagnose-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* ============================================================
   状态标签（StatusPill）
   ============================================================ */
.xx-status-pill {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-xxs) var(--space-sm);
  border-radius: var(--radius-full);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-medium);
  line-height: 1.5;
}

.xx-status-pill-ok {
  background: var(--success-soft);
  color: var(--success-color);
}

.xx-status-pill-warn {
  background: var(--warning-soft);
  color: var(--warning-color);
}

.xx-status-pill-bad {
  background: var(--error-soft);
  color: var(--error-color);
}

.xx-status-pill-info {
  background: var(--info-soft);
  color: var(--info-color);
}

/* ============================================================
   骨架屏（素材列表加载占位）
   ============================================================ */
@keyframes xx-skeleton-pulse {
  0% {
    opacity: 1;
  }
  50% {
    opacity: 0.4;
  }
  100% {
    opacity: 1;
  }
}

.xx-asset-skeleton {
  pointer-events: none;
}

.xx-asset-skeleton .xx-asset-thumb {
  background: var(--bg-tertiary);
}

.xx-skeleton-pulse {
  animation: xx-skeleton-pulse 1.5s ease-in-out infinite;
}

.xx-skeleton-line {
  height: 14px;
  border-radius: var(--radius-xs);
  background: var(--bg-tertiary);
}

/* 诊断按钮 loading 态 */
.xx-asset-diagnose-btn-loading {
  opacity: 0.7;
  cursor: not-allowed;
}

/* ============================================================
   空状态
   ============================================================ */
.xx-assets-empty {
  text-align: center;
  padding: var(--space-3xl) var(--space-xl);
  color: var(--text-secondary);
}

.xx-assets-empty-icon {
  font-size: var(--font-size-3xl);
  margin-bottom: var(--space-md);
  opacity: 0.5;
}

/* ============================================================
   批量操作栏
   ============================================================ */
.xx-assets-batch-bar {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md) var(--space-lg);
  background: var(--primary-soft);
  border: 1px solid var(--primary-color);
  border-radius: var(--radius-md);
}

.xx-assets-batch-count {
  font-size: var(--font-size-sm);
  color: var(--primary-color);
  font-weight: var(--font-weight-semibold);
}

/* ============================================================
   内联样式迁移类
   ============================================================ */
.xx-asset-library-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.xx-asset-library-header h4 {
  flex: 1;
  margin: 0;
}

.xx-asset-form-body {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  padding: var(--space-sm) 0;
}

.xx-asset-form-label {
  margin-bottom: 6px;
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
}

.xx-asset-video-player {
  width: 100%;
  max-height: 400px;
  background: #000;
}

.xx-asset-empty-fallback {
  text-align: center;
  padding: var(--space-2xl) 0;
}

.xx-asset-empty-fallback-id {
  font-size: var(--font-size-xs);
  color: var(--text-tertiary);
}

/* ============================================================
   骨架屏网格（加载态）
   ============================================================ */
.xx-assets-skeleton-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

.xx-assets-skeleton-card .xx-asset-thumb {
  background: var(--bg-tertiary);
}

/* ============================================================
   响应式
   ============================================================ */
@media (max-width: 1400px) {
  .xx-asset-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 1200px) {
  .xx-assets-layout {
    grid-template-columns: 1fr;
  }

  .xx-asset-library-list {
    flex-direction: row;
    overflow-x: auto;
    position: static;
    gap: var(--space-sm);
    padding-bottom: var(--space-sm);
  }

  .xx-asset-library-item {
    min-width: 180px;
    flex-shrink: 0;
  }

  .xx-asset-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 768px) {
  .xx-assets-page {
    padding: var(--space-md);
  }

  .xx-asset-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .xx-assets-filters {
    flex-direction: column;
    align-items: stretch;
  }

  .xx-assets-filters-left,
  .xx-assets-filters-right {
    justify-content: flex-start;
  }
}

@media (max-width: 480px) {
  .xx-assets-page {
    padding: var(--space-sm);
  }

  .xx-asset-grid {
    grid-template-columns: 1fr;
  }
}

/* ─── 上传进度弹窗 ─── */
.xx-upload-progress-modal .ant-modal-content {
  padding: 24px 16px 20px;
  border-radius: 16px;
}

.xx-upload-progress-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 8px 0;
}

.xx-upload-progress-ring {
  display: block;
}

.xx-upload-progress-text {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.xx-upload-progress-pct {
  font-size: 22px;
  font-weight: 700;
  color: var(--primary-color, #6366f1);
  line-height: 1;
}

.xx-upload-progress-label {
  font-size: 13px;
  color: var(--text-secondary, #6b7280);
}
