/* ============================================================================
   AI Cinema Studio — Dashboard 视觉系统
   深炭底 + 琥珀光 + 电青色
   ============================================================================ */

// ============================================================================
// 设计变量（对应 theme.ts）
// ============================================================================
@bg-base: #0C0D14;
@bg-surface: #141520;
@bg-elevated: #1C1D2E;
@bg-overlay: #24263A;

@border-subtle: rgba(255, 255, 255, 0.06);
@border-default: rgba(255, 255, 255, 0.10);
@border-strong: rgba(255, 255, 255, 0.18);

@accent: #d4a574;
@accent-light: #e8c9a8;
@accent-dark: #c49660;
@accent-glow: rgba(212, 165, 116, 0.25);
@accent-glow-strong: rgba(212, 165, 116, 0.40);

@cyan: #00D4FF;
@cyan-light: #66E3FF;
@cyan-dark: #00A8CC;
@cyan-glow: rgba(0, 212, 255, 0.20);

@text-primary: #F0F0F5;
@text-secondary: #8888A0;
@text-tertiary: #55556A;

@success: #4ADE80;
@warning: #FBBF24;
@error: #F87171;

@font-display: "Outfit", system-ui, -apple-system, sans-serif;
@font-body: "Figtree", system-ui, -apple-system, sans-serif;
@font-mono: "JetBrains Mono", "Fira Code", monospace;

@radius-sm: 4px;
@radius-md: 8px;
@radius-lg: 12px;
@radius-xl: 16px;
@radius-2xl: 24px;
@radius-full: 9999px;

// 导入共享 mixins
@import '../../styles/mixins.less';

// ============================================================================
// 页面容器
// ============================================================================
.dashboardContainer {
  max-width: 1440px;
  margin: 0 auto;
  padding: 40px 32px;
  min-height: 100vh;
  background: @bg-base;

  @media (max-width: 768px) {
    padding: 24px 16px;
  }
}

// ============================================================================
// 页面头部
// ============================================================================
.dashboardHeader {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 40px;
  .fade-in-up();

  @media (max-width: 576px) {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 28px;
  }
}

.headerLeft {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.pageTitle {
  font-family: @font-display;
  font-size: 32px;
  font-weight: 700;
  color: @text-primary;
  letter-spacing: -0.5px;
  line-height: 1.2;
  margin: 0;

  @media (max-width: 768px) {
    font-size: 26px;
  }
}

.pageSubtitle {
  font-family: @font-body;
  font-size: 14px;
  color: @text-secondary;
  margin: 0;
}

.headerActions {
  display: flex;
  align-items: center;
  gap: 12px;
}

// 新建项目按钮
.createButton {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 20px;
  background: @accent !important;
  border: none !important;
  border-radius: @radius-lg !important;
  color: @bg-base !important;
  font-family: @font-display !important;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 4px 16px @accent-glow;

  &:hover {
    background: @accent-light !important;
    box-shadow: 0 6px 24px @accent-glow-strong;
    transform: translateY(-1px);
  }

  &:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px @accent-glow;
  }

  .createButtonIcon {
    font-size: 14px;
  }
}

// ============================================================================
// 统计数据栏
// ============================================================================
.statsRow {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 36px;
  animation: fadeInUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) 0.05s both;

  @media (max-width: 768px) {
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 28px;
  }

  @media (max-width: 480px) {
    grid-template-columns: 1fr;
  }
}

.statCard {
  .glass-card();
  padding: 20px 24px;
  .transition-bounce();

  &:hover {
    border-color: @border-default;
    background: rgba(20, 21, 32, 0.90);
  }

  @media (max-width: 768px) {
    padding: 16px 18px;
  }
}

.statLabel {
  font-family: @font-body;
  font-size: 12px;
  font-weight: 500;
  color: @text-tertiary;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.statIcon {
  font-size: 13px;
  color: @accent;
  opacity: 0.8;
}

.statValue {
  font-family: @font-display;
  font-size: 28px;
  font-weight: 700;
  color: @text-primary;
  line-height: 1;
  margin-bottom: 4px;

  @media (max-width: 768px) {
    font-size: 22px;
  }
}

.statUnit {
  font-family: @font-body;
  font-size: 13px;
  font-weight: 400;
  color: @text-secondary;
  margin-left: 4px;
}

// ============================================================================
// 搜索工具栏
// ============================================================================
.projectToolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  gap: 16px;
  animation: fadeInUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) 0.1s both;

  @media (max-width: 576px) {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    margin-bottom: 20px;
  }
}

.searchInput {
  max-width: 320px;
  flex: 1;

  :global(.ant-input-affix-wrapper) {
    background: rgba(20, 21, 32, 0.80) !important;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid @border-default !important;
    border-radius: @radius-lg !important;
    padding: 8px 14px !important;
    transition: all 0.2s ease;

    &:hover,
    &:focus,
    &.ant-input-affix-wrapper-focused {
      border-color: @accent !important;
      box-shadow: 0 0 0 3px @accent-glow !important;
      background: rgba(20, 21, 32, 0.95) !important;
    }

    .ant-input {
      background: transparent !important;
      color: @text-primary !important;
      font-family: @font-body;
      font-size: 14px;

      &::placeholder {
        color: @text-tertiary !important;
      }
    }

    .ant-input-prefix {
      color: @text-tertiary;
      margin-right: 8px;
    }
  }
}

.viewToggle {
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(20, 21, 32, 0.80);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid @border-default;
  border-radius: @radius-lg;
  padding: 4px;

  :global(.ant-segmented) {
    background: transparent !important;
    padding: 0 !important;

    .ant-segmented-item {
      color: @text-secondary !important;
      font-family: @font-body;
      font-size: 13px;
      border-radius: @radius-md !important;
      transition: all 0.2s ease;
      min-width: 36px;

      &:hover {
        color: @text-primary !important;
      }
    }

    .ant-segmented-item-selected {
      background: @bg-elevated !important;
      color: @text-primary !important;
      box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    }

    .ant-segmented-thumb {
      background: @bg-elevated !important;
      border-radius: @radius-md !important;
    }
  }
}

// ============================================================================
// 项目网格
// ============================================================================
.projectGrid {
  animation: fadeInUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) 0.15s both;
}

// ============================================================================
// 项目卡片（玻璃拟态 + 琥珀光边框）
// ============================================================================
.projectCard {
  .glass-card();
  overflow: hidden;
  cursor: pointer;
  .transition-bounce();

  &:hover {
    border-color: @accent !important;
    box-shadow: 0 0 0 1px @accent, 0 0 32px @accent-glow, 0 12px 40px rgba(0, 0, 0, 0.5) !important;
    transform: translateY(-4px) !important;

    .thumbnailOverlay {
      opacity: 1;
    }

    .thumbnail {
      transform: scale(1.06);
    }
  }

  :global(.ant-card-body) {
    padding: 0 !important;
  }

  :global(.ant-card-actions) {
    background: rgba(12, 13, 20, 0.60) !important;
    border-top: 1px solid @border-subtle !important;
    padding: 8px 12px !important;
    display: flex;
    justify-content: flex-end;
    gap: 4px;

    li {
      margin: 0 !important;
      width: auto !important;
      min-width: 32px !important;

      .anticon {
        color: @text-tertiary;
        font-size: 15px;
        transition: color 0.15s ease;

        &:hover {
          color: @accent;
        }
      }
    }
  }
}

// 缩略图容器
.thumbnailContainer {
  position: relative;
  height: 160px;
  overflow: hidden;
  background: @bg-elevated;
}

.thumbnail {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  display: block;
}

.thumbnailOverlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    135deg,
    rgba(255, 159, 67, 0.15) 0%,
    rgba(0, 0, 0, 0.5) 100%
  );
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.viewIcon {
  font-size: 36px;
  color: @accent;
  filter: drop-shadow(0 0 12px @accent-glow-strong);
}

// 时长标签
.duration {
  .duration-badge();
}

// 收藏按钮
.starButton {
  .circle-icon-btn(32px);
}

// ============================================================================
// 项目信息区
// ============================================================================
.projectInfo {
  padding: 14px 16px 12px;
}

.projectTitle {
  font-family: @font-display;
  font-size: 15px;
  font-weight: 600;
  color: @text-primary;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 8px;
  letter-spacing: -0.01em;
}

.projectMeta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.projectTime {
  font-family: @font-body;
  font-size: 12px;
  color: @text-tertiary;
  display: flex;
  align-items: center;
  gap: 4px;
}

.projectSize {
  font-family: @font-mono;
  font-size: 11px;
  color: @text-tertiary;
}

// 状态标签
.statusBadge {
  .status-badge-base();

  // 琥珀色 — 已完成
  &.statusCompleted {
    background: rgba(255, 159, 67, 0.12);
    border-color: rgba(255, 159, 67, 0.25);
    color: @accent-light;

    .statusDot {
      background: @accent;
      box-shadow: 0 0 6px @accent-glow-strong;
    }
  }

  // 电青色 — 分析中 / AI 处理中
  &.statusProcessing {
    background: rgba(0, 212, 255, 0.10);
    border-color: rgba(0, 212, 255, 0.20);
    color: @cyan-light;

    .statusDot {
      background: @cyan;
      box-shadow: 0 0 6px @cyan-glow;
      animation: sparkPulse 1.8s ease-in-out infinite;
    }
  }

  // 灰色 — 草稿
  &.statusDraft {
    background: rgba(136, 136, 160, 0.10);
    border-color: rgba(136, 136, 160, 0.18);
    color: @text-secondary;

    .statusDot {
      background: @text-tertiary;
    }
  }
}

// ============================================================================
// 列表视图
// ============================================================================
.projectList {
  background: transparent !important;
  border: none !important;

  :global(.ant-list-item) {
    background: rgba(20, 21, 32, 0.80) !important;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid @border-subtle !important;
    border-radius: @radius-lg !important;
    margin-bottom: 10px !important;
    padding: 14px 16px !important;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;

    &:hover {
      border-color: @accent !important;
      box-shadow: 0 0 16px @accent-glow, 0 4px 16px rgba(0, 0, 0, 0.3);
      background: rgba(20, 21, 32, 0.95) !important;
    }
  }
}

.listThumbnailContainer {
  position: relative;
  width: 100px;
  height: 64px;
  border-radius: @radius-md;
  overflow: hidden;
  flex-shrink: 0;
}

.listThumbnail {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.listDuration {
  position: absolute;
  bottom: 4px;
  right: 4px;
  background: rgba(0, 0, 0, 0.70);
  backdrop-filter: blur(4px);
  border-radius: 2px;
  padding: 1px 5px;
  font-family: @font-mono;
  font-size: 10px;
  color: @text-primary;
}

// ============================================================================
// 加载骨架屏
// ============================================================================
.loadingContainer {
  animation: fadeIn 0.3s ease both;
}

.skeletonCard {
  .glass-card();
  overflow: hidden;

  :global(.ant-card-body) {
    padding: 0 !important;
  }

  :global(.ant-skeleton-content) {
    .ant-skeleton-title {
      .skeleton-shimmer();
    }

    .ant-skeleton-paragraph > li {
      .skeleton-shimmer();
    }
  }
}

// ============================================================================
// 空状态
// ============================================================================
.emptyState {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 24px;
  text-align: center;
  animation: fadeInUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.emptyIcon {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: rgba(255, 159, 67, 0.08);
  border: 1px solid rgba(255, 159, 67, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 24px;
  position: relative;

  &::before {
    content: '';
    position: absolute;
    inset: -20px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 159, 67, 0.05) 0%, transparent 70%);
    animation: neuralPulse 3s ease-in-out infinite;
  }

  .anticon {
    font-size: 40px;
    color: @accent;
    filter: drop-shadow(0 0 12px @accent-glow);
    position: relative;
    z-index: 1;
  }
}

.emptyTitle {
  font-family: @font-display;
  font-size: 20px;
  font-weight: 600;
  color: @text-primary;
  margin: 0 0 8px;
}

.emptyDescription {
  font-family: @font-body;
  font-size: 14px;
  color: @text-secondary;
  margin: 0 0 28px;
  max-width: 360px;
  line-height: 1.6;
}

.emptyButton {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 44px;
  padding: 0 28px;
  background: @accent !important;
  border: none !important;
  border-radius: @radius-lg !important;
  color: @bg-base !important;
  font-family: @font-display !important;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 4px 20px @accent-glow;

  &:hover {
    background: @accent-light !important;
    box-shadow: 0 6px 28px @accent-glow-strong;
    transform: translateY(-2px);
  }

  &:active {
    transform: translateY(0);
  }
}

// ============================================================================
// 快速工具区
// ============================================================================
.quickTools {
  margin-top: 48px;
  background: rgba(20, 21, 32, 0.60) !important;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid @border-subtle !important;
  border-radius: @radius-xl !important;
  animation: fadeInUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) 0.2s both;

  :global(.ant-card-head) {
    border-bottom: 1px solid @border-subtle !important;

    .ant-card-head-title {
      font-family: @font-display;
      font-size: 16px;
      font-weight: 600;
      color: @text-primary;
    }
  }

  :global(.ant-card-body) {
    padding: 20px 24px !important;
  }
}

.toolGrid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;

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

  @media (max-width: 576px) {
    grid-template-columns: 1fr;
  }
}

.toolCard {
  background: rgba(28, 29, 46, 0.60) !important;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid @border-subtle !important;
  border-radius: @radius-lg !important;
  padding: 20px !important;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
  text-align: center;

  &:hover {
    border-color: @accent !important;
    box-shadow: 0 0 20px @accent-glow, 0 4px 16px rgba(0, 0, 0, 0.3);
    background: rgba(28, 29, 46, 0.90) !important;
    transform: translateY(-2px);

    .toolIcon {
      color: @accent;
      filter: drop-shadow(0 0 8px @accent-glow);
    }
  }

  :global(.ant-card-body) {
    padding: 0 !important;
  }
}

.toolIcon {
  font-size: 28px;
  color: @text-secondary;
  margin-bottom: 10px;
  transition: all 0.2s ease;
  display: block;
}

.toolTitle {
  font-family: @font-display;
  font-size: 14px;
  font-weight: 600;
  color: @text-primary;
  margin-bottom: 4px;
}

.toolDesc {
  font-family: @font-body;
  font-size: 12px;
  color: @text-tertiary;
  line-height: 1.4;
}

// ============================================================================
// 关键帧动画
// ============================================================================
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

@keyframes neuralPulse {
  0%, 100% {
    opacity: 0.6;
    transform: scale(1);
  }
  50% {
    opacity: 1;
    transform: scale(1.05);
  }
}

@keyframes sparkPulse {
  0%, 100% {
    opacity: 0.5;
    transform: scale(0.85);
  }
  50% {
    opacity: 1;
    transform: scale(1.2);
  }
}

// ============================================================================
// 全局 Ant Design 覆盖
// ============================================================================

// 模态框
:global(.ant-modal-content) {
  background: @bg-elevated !important;
  border: 1px solid @border-default !important;
  border-radius: @radius-xl !important;

  .ant-modal-header {
    background: transparent !important;
    border-bottom: 1px solid @border-subtle !important;

    .ant-modal-title {
      color: @text-primary !important;
      font-family: @font-display !important;
      font-weight: 600 !important;
    }
  }

  .ant-modal-close {
    color: @text-tertiary;

    &:hover {
      color: @text-primary;
    }
  }

  .ant-modal-body {
    background: transparent !important;
  }
}

// 表单项
:global(.ant-form-item-label > label) {
  color: @text-secondary !important;
  font-family: @font-body !important;
}

:global(.ant-select-selector),
:global(.ant-input),
:global(.ant-picker) {
  background: @bg-surface !important;
  border-color: @border-default !important;
  color: @text-primary !important;
  border-radius: @radius-md !important;
  font-family: @font-body !important;

  &:hover,
  &:focus {
    border-color: @accent !important;
    box-shadow: 0 0 0 2px @accent-glow !important;
  }
}

:global(.ant-select-dropdown) {
  .select-dropdown-amber();
}

// 确认弹窗
:global(.ant-popconfirm) {
  .ant-btn {
    font-family: @font-body;
  }
}

// Ant Empty
:global(.ant-empty-description) {
  color: @text-secondary !important;
  font-family: @font-body !important;
}

// Ant Tooltip
:global(.ant-tooltip-inner) {
  background: @bg-overlay !important;
  border: 1px solid @border-default !important;
  border-radius: @radius-md !important;
  color: @text-primary !important;
  font-family: @font-body !important;
  font-size: 12px !important;
}
