/**
 * [2026-02-19] 树转让管理页面样式（纯新增）
 *
 * 包含：统计卡片、状态筛选、数据表格、详情页、Saga 进度时间线
 * 风格与预种管理页面一致
 *
 * 回滚方式：删除此文件
 */

@use '@/styles/variables' as *;

.transfers {
  display: flex;
  flex-direction: column;
  gap: 24px;

  // 页面标题
  &__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
  }

  &__title {
    font-size: 24px;
    font-weight: 600;
    color: $text-primary;
  }

  // 统计卡片网格
  &__statsGrid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 16px;

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

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

  &__statCard {
    background: $card-background;
    border-radius: 12px;
    padding: 20px;
    box-shadow: $shadow-base;
    text-align: center;
  }

  &__statValue {
    font-size: 28px;
    font-weight: 700;
    color: $text-primary;
  }

  &__statLabel {
    font-size: 13px;
    color: $text-secondary;
    margin-top: 4px;
  }

  // 数据卡片容器
  &__card {
    background: $card-background;
    border-radius: 12px;
    padding: 24px;
    box-shadow: $shadow-base;
  }

  &__toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    gap: 12px;
    flex-wrap: wrap;
  }

  &__toolbarLeft {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
  }

  &__search {
    input {
      width: 260px;
      padding: 8px 12px;
      border: 1px solid $border-color;
      border-radius: 8px;
      font-size: 14px;
      outline: none;

      &:focus {
        border-color: #d4af37;
      }
    }
  }

  &__filter {
    select {
      padding: 8px 12px;
      border: 1px solid $border-color;
      border-radius: 8px;
      font-size: 14px;
      outline: none;
      background: white;
      cursor: pointer;

      &:focus {
        border-color: #d4af37;
      }
    }
  }

  // 表格
  &__table {
    width: 100%;
    border-collapse: collapse;

    th,
    td {
      padding: 12px 16px;
      text-align: left;
      border-bottom: 1px solid $border-color;
      font-size: 14px;
    }

    th {
      font-weight: 600;
      color: $text-secondary;
      background: #fafafa;
    }

    td {
      color: $text-primary;
    }

    tr:hover td {
      background: #fafafa;
    }
  }

  &__orderLink {
    color: #d4af37;
    text-decoration: none;
    font-weight: 500;

    &:hover {
      text-decoration: underline;
    }
  }

  // 状态标签（13 种状态）
  &__status {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 500;

    // 进行中状态
    &--pending {
      background: #fff7e6;
      color: #d48806;
    }

    &--sellerConfirmed {
      background: #e6f7ff;
      color: #096dd9;
    }

    &--paymentFrozen {
      background: #f0f5ff;
      color: #2f54eb;
    }

    &--treesLocked {
      background: #f9f0ff;
      color: #722ed1;
    }

    &--ownershipTransferred {
      background: #fff0f6;
      color: #c41d7f;
    }

    &--contributionAdjusted {
      background: #fcffe6;
      color: #7cb305;
    }

    &--statsUpdated {
      background: #e6fffb;
      color: #08979c;
    }

    &--paymentSettled {
      background: #f6ffed;
      color: #389e0d;
    }

    // 终态
    &--completed {
      background: #f6ffed;
      color: #52c41a;
    }

    &--cancelled {
      background: #f5f5f5;
      color: #8c8c8c;
    }

    &--failed {
      background: #fff1f0;
      color: #cf1322;
    }

    &--rollingBack {
      background: #fff2e8;
      color: #d4380d;
    }

    &--rolledBack {
      background: #f5f5f5;
      color: #595959;
    }
  }

  // 加载 / 空 / 错误 状态
  &__loading,
  &__empty,
  &__error {
    text-align: center;
    padding: 48px 24px;
    color: $text-secondary;
    font-size: 14px;
  }

  &__error {
    color: #ff4d4f;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
  }

  // 分页
  &__pagination {
    display: flex;
    justify-content: flex-end;
    margin-top: 16px;
    gap: 8px;
    align-items: center;
  }

  &__pageBtn {
    padding: 6px 12px;
    border: 1px solid $border-color;
    border-radius: 6px;
    background: white;
    cursor: pointer;
    font-size: 13px;

    &:hover {
      border-color: #d4af37;
    }

    &:disabled {
      opacity: 0.4;
      cursor: not-allowed;
    }
  }

  &__pageInfo {
    font-size: 13px;
    color: $text-secondary;
  }

  // === 详情页样式 ===
  &__backBtn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: 1px solid $border-color;
    border-radius: 8px;
    background: white;
    cursor: pointer;
    font-size: 14px;
    color: $text-secondary;

    &:hover {
      border-color: #d4af37;
      color: $text-primary;
    }
  }

  &__detailGrid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 24px;

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

  &__detailItem {
    display: flex;
    flex-direction: column;
    gap: 4px;
  }

  &__detailLabel {
    font-size: 12px;
    color: $text-secondary;
  }

  &__detailValue {
    font-size: 15px;
    font-weight: 500;
    color: $text-primary;
  }

  &__section {
    margin-top: 24px;
  }

  &__sectionTitle {
    font-size: 16px;
    font-weight: 600;
    color: $text-primary;
    margin-bottom: 16px;
  }

  // Saga 进度时间线
  &__timeline {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin-bottom: 24px;
  }

  &__timelineStep {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    position: relative;
    padding-bottom: 24px;

    &:last-child {
      padding-bottom: 0;
    }

    // 竖线连接
    &::before {
      content: '';
      position: absolute;
      left: 11px;
      top: 24px;
      bottom: 0;
      width: 2px;
      background: $border-color;
    }

    &:last-child::before {
      display: none;
    }
  }

  &__timelineDot {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid $border-color;
    background: white;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    z-index: 1;

    &--completed {
      border-color: #52c41a;
      background: #52c41a;
      color: white;
    }

    &--current {
      border-color: #d4af37;
      background: #fff7e6;
      color: #d4af37;
    }

    &--failed {
      border-color: #ff4d4f;
      background: #ff4d4f;
      color: white;
    }
  }

  &__timelineContent {
    flex: 1;
    min-width: 0;
  }

  &__timelineLabel {
    font-size: 14px;
    font-weight: 500;
    color: $text-primary;
  }

  &__timelineTime {
    font-size: 12px;
    color: $text-secondary;
    margin-top: 2px;
  }

  // 操作按钮区
  &__actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
  }

  &__cancelBtn {
    padding: 8px 20px;
    border-radius: 8px;
    border: 1px solid #ff4d4f;
    background: white;
    color: #ff4d4f;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;

    &:hover {
      background: #fff1f0;
    }

    &:disabled {
      opacity: 0.5;
      cursor: not-allowed;
    }
  }
}
