/**
 * 成片库页面 - V21 设计系统样式
 * 卡片网格布局，支持批量操作、视频播放弹窗
 * 统一使用 CSS 变量，支持深色/浅色主题
 */
@import "../../styles/global.css";

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

/* ============================================================
   页面头部
   ============================================================ */
.xx-products-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-lg);
}

.xx-products-header h2 {
  margin: 0;
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-bold);
  color: var(--text-primary);
}

/* ============================================================
   批量操作栏
   ============================================================ */
.xx-products-batch-bar {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-sm) var(--space-md);
  background: var(--primary-soft);
  border: 1px solid var(--primary-color);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-md);
  animation: batch-bar-in 0.2s ease-out;
}

@keyframes batch-bar-in {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.xx-products-batch-bar-left {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.xx-products-batch-bar-right {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-left: auto;
}

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

/* 全选复选框 */
.xx-products-select-all {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  cursor: pointer;
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  user-select: none;
}

.xx-products-checkbox {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border-color);
  border-radius: var(--radius-xs);
  display: grid;
  place-items: center;
  transition: var(--transition-all);
  background: var(--bg-primary);
  flex-shrink: 0;
}

.xx-products-checkbox:hover {
  border-color: var(--primary-color);
}

.xx-products-checkbox.checked {
  background: var(--primary-color);
  border-color: var(--primary-color);
  color: var(--text-inverse);
}

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

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

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

/* ============================================================
   卡片网格（4列）
   ============================================================ */
.xx-products-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-md);
}

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

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

/* 选中状态 */
.xx-product-card.selected {
  border-color: var(--primary-color);
  box-shadow:
    0 0 0 2px var(--primary-soft),
    var(--shadow-sm);
}

/* 已发布状态 - 降低透明度 */
.xx-product-card.published {
  opacity: 0.65;
}

.xx-product-card.published:hover {
  opacity: 0.85;
}

/* 卡片复选框（左上角） */
.xx-product-card-checkbox {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 2;
  width: 22px;
  height: 22px;
  border: 2px solid rgba(255, 255, 255, 0.8);
  border-radius: var(--radius-xs);
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(4px);
  cursor: pointer;
  transition: var(--transition-all);
  color: var(--text-inverse);
  font-size: 12px;
}

.xx-product-card-checkbox:hover {
  border-color: var(--primary-color);
  background: rgba(0, 0, 0, 0.5);
}

.xx-product-card-checkbox.checked {
  background: var(--primary-color);
  border-color: var(--primary-color);
}

/* 已发布徽章（右上角） */
.xx-product-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  padding: 2px 10px;
  border-radius: var(--radius-full);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  background: rgba(16, 185, 129, 0.9);
  color: var(--text-inverse);
  backdrop-filter: blur(4px);
}

/* 缩略图区域 */
.xx-product-thumb {
  aspect-ratio: 9 / 16;
  max-height: 220px;
  position: relative;
  overflow: hidden;
  display: grid;
  place-items: center;
  color: var(--text-inverse);
}

.xx-product-thumb-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
}

.xx-product-play {
  position: relative;
  z-index: 1;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-full);
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(4px);
  display: grid;
  place-items: center;
  font-size: var(--font-size-md);
  transition: var(--transition-all);
}

.xx-product-card:hover .xx-product-play {
  background: var(--primary-color);
  transform: scale(1.1);
}

/* 时长标签 */
.xx-product-duration {
  position: absolute;
  bottom: var(--space-sm);
  right: var(--space-sm);
  z-index: 1;
  padding: var(--space-xxs) var(--space-sm);
  border-radius: var(--radius-xs);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-medium);
  background: rgba(0, 0, 0, 0.65);
  color: var(--text-inverse);
  backdrop-filter: blur(4px);
}

/* 卡片信息区 */
.xx-product-info {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.xx-product-title {
  margin: 0;
  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-product-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-xs);
}

/* 状态标签 */
.xx-product-status {
  padding: 2px 10px;
  border-radius: var(--radius-full);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-medium);
  white-space: nowrap;
}

.xx-product-status.completed {
  background: var(--success-soft);
  color: var(--success-color);
}

.xx-product-status.processing {
  background: var(--primary-soft);
  color: var(--primary-color);
}

.xx-product-status.review {
  background: var(--warning-soft);
  color: var(--warning-color);
}

.xx-product-status.failed {
  background: var(--error-soft);
  color: var(--error-color);
}

/* 深色模式状态标签 */
.dark .xx-product-status.completed,
[data-theme="dark"] .xx-product-status.completed {
  background: rgba(5, 150, 105, 0.15);
  color: var(--success-hover);
}

.dark .xx-product-status.processing,
[data-theme="dark"] .xx-product-status.processing {
  background: var(--primary-soft);
  color: var(--primary-color);
}

.dark .xx-product-status.review,
[data-theme="dark"] .xx-product-status.review {
  background: rgba(202, 138, 4, 0.15);
  color: var(--warning-hover);
}

.dark .xx-product-status.failed,
[data-theme="dark"] .xx-product-status.failed {
  background: rgba(220, 38, 38, 0.15);
  color: var(--error-hover);
}

/* 日期 */
.xx-product-date {
  font-size: var(--font-size-xs);
  color: var(--text-tertiary);
}

/* 查重率 */
.xx-product-dup-rate {
  font-size: var(--font-size-xs);
  color: var(--text-tertiary);
}

.xx-product-dup-rate.good {
  color: var(--success-color);
}

.xx-product-dup-rate.warn {
  color: var(--warning-color);
}

.xx-product-dup-rate.bad {
  color: var(--error-color);
}

/* 操作按钮区 */
.xx-product-actions {
  display: flex;
  gap: 6px;
  padding: 0 14px 14px;
}

.xx-product-action-btn {
  flex: 1;
  padding: 6px 4px;
  border-radius: var(--radius-sm);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-medium);
  cursor: pointer;
  transition: var(--transition-all);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  border: 1px solid var(--border-color);
  background: var(--bg-primary);
  color: var(--text-secondary);
}

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

.xx-product-action-btn.primary {
  background: var(--gradient-primary);
  color: var(--text-inverse);
  border: none;
}

.xx-product-action-btn.primary:hover {
  box-shadow: var(--shadow-primary);
  transform: translateY(-1px);
}

.xx-product-action-btn.success {
  background: var(--success-color);
  color: var(--text-inverse);
  border: none;
}

.xx-product-action-btn.success:hover {
  background: var(--secondary-dark);
}

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

/* ============================================================
   视频播放弹窗
   ============================================================ */
.xx-player-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  display: grid;
  place-items: center;
  animation: player-fade-in 0.25s ease-out;
}

@keyframes player-fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.xx-player-container {
  width: 90%;
  max-width: 540px;
  background: var(--bg-primary);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.3);
  animation: player-scale-in 0.25s ease-out;
}

@keyframes player-scale-in {
  from {
    opacity: 0;
    transform: scale(0.92);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.xx-player-video-wrap {
  position: relative;
  background: var(--color-gray-950);
  aspect-ratio: 9 / 16;
  max-height: 60vh;
  display: grid;
  place-items: center;
}

.xx-player-video-wrap video {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* 播放/暂停大按钮 */
.xx-player-play-btn {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 64px;
  height: 64px;
  border-radius: var(--radius-full);
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  color: var(--text-inverse);
  font-size: 28px;
  display: grid;
  place-items: center;
  cursor: pointer;
  border: none;
  transition: var(--transition-all);
  z-index: 2;
}

.xx-player-play-btn:hover {
  background: var(--primary-color);
  transform: translate(-50%, -50%) scale(1.1);
}

/* 进度条 */
.xx-player-progress-wrap {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 8px 16px 12px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.6));
  z-index: 2;
}

.xx-player-progress {
  height: 4px;
  background: rgba(255, 255, 255, 0.25);
  border-radius: var(--radius-full);
  overflow: hidden;
  cursor: pointer;
}

.xx-player-progress-bar {
  height: 100%;
  background: var(--gradient-primary);
  border-radius: var(--radius-full);
  transition: width 0.1s linear;
}

.xx-player-time {
  display: flex;
  justify-content: space-between;
  font-size: var(--font-size-xs);
  color: rgba(255, 255, 255, 0.8);
  margin-top: 4px;
}

/* 弹窗信息区 */
.xx-player-info {
  padding: var(--space-md);
}

.xx-player-title {
  margin: 0 0 10px;
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-semibold);
  color: var(--text-primary);
}

.xx-player-details {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-sm);
}

.xx-player-detail-item {
  font-size: var(--font-size-sm);
}

.xx-player-detail-label {
  color: var(--text-tertiary);
}

.xx-player-detail-value {
  color: var(--text-primary);
  font-weight: var(--font-weight-medium);
}

/* 弹窗底部操作 */
.xx-player-footer {
  display: flex;
  gap: var(--space-sm);
  padding: 0 var(--space-md) var(--space-md);
}

/* 关闭按钮 */
.xx-player-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 3;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  color: var(--text-inverse);
  font-size: var(--font-size-md);
  display: grid;
  place-items: center;
  cursor: pointer;
  border: none;
  transition: var(--transition-all);
}

.xx-player-close:hover {
  background: rgba(0, 0, 0, 0.8);
  transform: scale(1.1);
}

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

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

/* ============================================================
   产品详情页
   ============================================================ */
.xx-product-detail-page {
  padding: var(--space-lg);
}

.xx-detail-loading,
.xx-detail-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  gap: var(--space-sm);
}

.xx-detail-error h3 {
  font-size: 20px;
  font-weight: var(--font-weight-bold);
  color: var(--text-primary);
  margin: var(--space-md) 0 0;
}

.xx-detail-error p {
  color: var(--text-secondary);
  font-size: 14px;
  margin: 0 0 var(--space-lg);
}

/* 顶部导航 */
.xx-detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-lg);
  padding: var(--space-md) var(--space-lg);
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(226, 232, 240, 0.95);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xs);
}

.xx-detail-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  background: transparent;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}

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

.xx-detail-actions {
  display: flex;
  gap: var(--space-sm);
}

/* 主体 */
.xx-detail-body {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: var(--space-lg);
  align-items: start;
}

@media (max-width: 1100px) {
  .xx-detail-body {
    grid-template-columns: 1fr;
  }
}

/* 播放器 */
.xx-detail-player {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  box-shadow: var(--shadow-md);
}

.xx-detail-player video {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.xx-detail-player.is-fullscreen {
  border-radius: 0;
}

.xx-detail-player-empty {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.xx-detail-player-empty img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.xx-detail-player-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
  color: var(--text-tertiary);
}

.xx-detail-player-placeholder p {
  font-size: 14px;
  margin: 0;
}

/* 播放器控制条 */
.xx-detail-player-controls {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
  padding: var(--space-lg) var(--space-md) var(--space-md);
  opacity: 0;
  transition: opacity var(--transition-base);
  pointer-events: none;
}

.xx-detail-player-controls.visible {
  opacity: 1;
  pointer-events: auto;
}

/* 进度条 */
.xx-dp-progress {
  width: 100%;
  height: 20px;
  display: flex;
  align-items: center;
  cursor: pointer;
  margin-bottom: var(--space-xs);
}

.xx-dp-progress-track {
  position: relative;
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.25);
  border-radius: 2px;
  overflow: hidden;
  transition: height var(--transition-fast);
}

.xx-dp-progress:hover .xx-dp-progress-track {
  height: 6px;
}

.xx-dp-progress-buffered {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  background: rgba(255, 255, 255, 0.35);
  border-radius: 2px;
}

.xx-dp-progress-played {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  background: var(--primary-color);
  border-radius: 2px;
}

/* 控制栏 */
.xx-dp-bar {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.xx-dp-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  border-radius: var(--radius-xs);
  transition: background var(--transition-fast);
}

.xx-dp-btn:hover {
  background: rgba(255, 255, 255, 0.15);
}

.xx-dp-time {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.8);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.xx-dp-volume {
  display: flex;
  align-items: center;
  gap: 4px;
}

.xx-dp-volume-slider {
  width: 72px;
  height: 4px;
  appearance: none;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}

.xx-dp-volume-slider::-webkit-slider-thumb {
  appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #fff;
  cursor: pointer;
}

.xx-dp-volume-slider::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #fff;
  border: none;
  cursor: pointer;
}

/* 产品信息面板 */
.xx-detail-info {
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(226, 232, 240, 0.95);
  border-radius: var(--radius-xl);
  padding: var(--space-xl);
  box-shadow: var(--shadow-card);
}

.xx-detail-title {
  font-size: 22px;
  font-weight: var(--font-weight-bold);
  color: var(--text-primary);
  margin: 0 0 var(--space-lg);
  line-height: var(--line-height-tight);
}

.xx-detail-meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-md);
}

.xx-detail-meta-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.xx-detail-meta-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-tertiary);
}

.xx-detail-meta-value {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

/* 详情页响应式 */
@media (max-width: 768px) {
  .xx-product-detail-page {
    padding: var(--space-md);
  }

  .xx-detail-header {
    flex-direction: column;
    gap: var(--space-sm);
    align-items: stretch;
  }

  .xx-detail-actions {
    justify-content: flex-end;
  }

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

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

@media (max-width: 992px) {
  .xx-products-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

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

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

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

  .xx-products-batch-bar {
    flex-direction: column;
    align-items: flex-start;
  }

  .xx-products-batch-bar-right {
    margin-left: 0;
    width: 100%;
  }
}

@media (max-width: 576px) {
  .xx-products-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .xx-product-info {
    padding: 10px;
  }

  .xx-product-actions {
    padding: 0 10px 10px;
    flex-direction: column;
  }

  .xx-player-container {
    width: 95%;
  }
}

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

  .xx-products-header {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-sm);
  }
}
