/**
 * CommentaryPanel Styles — AI 影视解说模式面板样式
 *
 * 浅色猫爪主题 + 玻璃态毛玻璃效果
 * 状态指示：圆形气泡 + 脉冲动画
 */

@import '@/styles/variables';

// ─── 主面板 ─────────────────────────────────────────────────────────────

.commentaryPanel {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: linear-gradient(135deg, var(--color-primary)10, transparent);
  border-bottom: 1px solid var(--color-border);
}

.content {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
  padding: 0;
}

// ─── 进度条 ─────────────────────────────────────────────────────────────

.progressWrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: var(--color-muted);
}

.progressBar {
  flex: 1;
  height: 6px;
  border-radius: 3px;

  :global(.ant-progress-bg) {
    background: linear-gradient(90deg, var(--color-primary), var(--color-accent));
    border-radius: 3px;
  }
}

.progressLabel {
  font-size: 11px;
  color: var(--color-text-secondary);
  min-width: 32px;
  text-align: right;
}

// ─── Tabs ────────────────────────────────────────────────────────────────

.tabsList {
  display: flex;
  gap: 4px;
  padding: 8px 16px;
  background: var(--color-muted);
  border-bottom: 1px solid var(--color-border);

  [data-radix-tabs-trigger] {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    font-size: 13px;
    border-radius: var(--radius-md);
    transition: all 0.2s;

    &:hover {
      background: var(--color-surface);
    }

    &[data-state='active'] {
      background: var(--color-primary);
      color: white;
    }
  }
}

.tabContent {
  flex: 1;
  overflow: auto;
  padding: 16px;
}

// ─── 操作栏 ───────────────────────────────────────────────────────────

.actionBar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: var(--color-muted);
  border-top: 1px solid var(--color-border);
}

// ─── 空状态 ────────────────────────────────────────────────────────────

.emptyState {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 48px 0;
  color: var(--color-text-muted);
  text-align: center;
}

// ─── Plan 详情 ────────────────────────────────────────────────────────

.planDetails {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 12px 0;
}

.planItem {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.planLabel {
  font-size: 13px;
  color: var(--color-text-secondary);
}

// ─── 脚本编辑器 ────────────────────────────────────────────────────────

.scriptEditor {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

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

.inputLabel {
  font-size: 12px;
  font-weight: 500;
  color: var(--color-text-secondary);
}

.apiKeyInput {
  max-width: 400px;
  font-size: 13px;
}

.fullScriptSection {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sectionHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.fullScriptTextarea {
  font-size: 13px;
  line-height: 1.6;
  resize: none;
}

.scriptMeta {
  display: flex;
  gap: 16px;
  font-size: 12px;
  color: var(--color-text-muted);
}

.segmentsSection {
  display: flex;
  flex-direction: column;
}

.segmentsList {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 300px;
  overflow-y: auto;
}

.segmentRow {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  transition: all 0.2s;

  &:hover {
    background: var(--color-muted);
    border-color: var(--color-primary);
  }
}

.segmentIndex {
  flex-shrink: 0;
  min-width: 24px;
  height: 24px;
  text-align: center;
  font-size: 11px;
}

.segmentTime {
  flex-shrink: 0;
  font-size: 11px;
  color: var(--color-text-muted);
  min-width: 90px;
}

.segmentText {
  flex: 1;
  font-size: 13px;
  line-height: 1.5;
  cursor: text;
  padding: 4px 0;

  &:hover {
    color: var(--color-primary);
  }
}

.segmentTextarea {
  flex: 1;
  font-size: 13px;
  resize: none;
}

.emotionBadge {
  flex-shrink: 0;
  font-size: 10px;
}

.emptyScript {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 48px 0;
  color: var(--color-text-muted);
  text-align: center;
}

// ─── 风格选择 ──────────────────────────────────────────────────────────

.styleSelector {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.styleHint,
.voiceHint,
.timelineHint {
  font-size: 13px;
  color: var(--color-text-secondary);
}

.styleGrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}

.styleCard {
  cursor: pointer;
  transition: all 0.2s;
  border: 2px solid transparent;

  &:hover {
    border-color: var(--color-primary);
    transform: translateY(-2px);
  }

  &Selected {
    border-color: var(--color-primary);
    background: var(--color-primary)10;
  }
}

.styleCardContent {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px;
}

.styleEmoji {
  font-size: 24px;
  line-height: 1;
}

.styleInfo {
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 2px;
}

.styleLabel {
  font-size: 14px;
  font-weight: 500;
}

.styleDesc {
  font-size: 12px;
  color: var(--color-text-secondary);
}

.styleSelectedBadge {
  flex-shrink: 0;
}

// ─── 音色选择 ──────────────────────────────────────────────────────────

.voiceSelector {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

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

.voiceList {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.voiceCard {
  cursor: pointer;
  transition: all 0.2s;
  border: 2px solid transparent;

  &:hover {
    border-color: var(--color-primary);
  }

  &Selected {
    border-color: var(--color-primary);
    background: var(--color-primary)10;
  }
}

.voiceCardContent {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
}

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

.voiceHeader {
  display: flex;
  align-items: center;
  gap: 8px;
}

.voiceName {
  font-size: 14px;
  font-weight: 500;
}

.genderBadge {
  font-size: 10px;
}

.voiceDesc {
  font-size: 12px;
  color: var(--color-text-secondary);
}

.voiceStyleBadge {
  flex-shrink: 0;
  font-size: 11px;
}

// ─── 时间线 ────────────────────────────────────────────────────────────

.timeline {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.timelineTrack {
  position: relative;
  height: 48px;
  background: var(--color-muted);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.timelineAxis {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
}

.timelineSegment {
  position: absolute;
  bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  transition: all 0.2s;

  &:hover {
    .timelineSegmentBar {
      background: var(--color-primary);
    }
  }
}

.timelineSegmentBar {
  height: 32px;
  background: var(--color-primary);
  opacity: 0.7;
  border-radius: 4px 4px 0 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.timelineSegmentNum {
  font-size: 11px;
  color: white;
  font-weight: 600;
}

.timelineSegmentLabel {
  font-size: 10px;
  color: var(--color-text-muted);
  margin-top: 2px;
}

.timelineList {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 300px;
  overflow-y: auto;
}

.timelineItem {
  cursor: pointer;
  transition: all 0.2s;
  border: 2px solid transparent;

  &:hover {
    border-color: var(--color-primary);
  }

  &Playing {
    border-color: var(--color-accent);
    background: var(--color-accent)10;
  }
}

.timelineItemContent {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 8px 12px;
}

.timelineItemIndex {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-muted);
  border-radius: 50%;
  font-size: 12px;
  font-weight: 600;
}

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

.timelineItemTimes {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--color-text-muted);
  font-family: monospace;
}

.timelineSeparator {
  color: var(--color-text-muted);
}

.timelineItemText {
  font-size: 13px;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}