/**
 * GraphicTextCard 图文卡片组件样式
 */

.graphic-text-card {
  display: inline-flex;
  position: relative;
  box-sizing: border-box;
  // transition: all 0.3s cubic-bezier(0.645, 0.045, 0.355, 1);
  cursor: default;
  user-select: none;

  // ========== 可点击状态 ==========
  &--clickable {
    cursor: pointer;

    &:active {
      transform: scale(0.98);
    }
  }

  // ========== 尺寸变体 ==========
  &--small {
    font-size: 12px;
    line-height: 18px;
    gap: 4px;
  }

  &--default {
    font-size: 14px;
    line-height: 20px;
    gap: 6px;
  }

  &--large {
    font-size: 16px;
    line-height: 22px;
    gap: 8px;
  }

  // ========== 样式变体 1: 垂直布局-图片 ==========
  &--vertical-image {
    flex-direction: column;
    align-items: center;

    .graphic-text-card__text {
      font-weight: 600;
      color: var(--Gray-600, #666666);
      // transition: color 0.3s;
    }

    &.graphic-text-card--active {
      .graphic-text-card__text {
        color: #7F56DA;
        font-weight: 600;
      }
    }

    &:hover:not(.graphic-text-card--disabled):not(.graphic-text-card--loading).graphic-text-card--clickable {
      .graphic-text-card__text {
        color: var(--Gray-900, #101828);
        font-weight: 600;
      }
    }
  }

  // ========== 样式变体 2: 垂直布局-图标 ==========
  &--vertical-icon {
    flex-direction: column;
    align-items: center;

    .graphic-text-card__graphic {
      color: var(--Gray-500, #667085);
      // transition: color 0.3s;
    }

    .graphic-text-card__text {
      color: var(--Gray-500, #667085);
      font-weight: 600;
      // transition: color 0.3s;
    }

    &.graphic-text-card--active {
      .graphic-text-card__graphic {
        color: #7F56DA;
      }

      .graphic-text-card__text {
        font-weight: 600;
        color: #7F56DA;
      }
    }

    &:hover:not(.graphic-text-card--disabled):not(.graphic-text-card--loading).graphic-text-card--clickable {
      .graphic-text-card__graphic {
        color: var(--Gray-900, #101828);
      }

      .graphic-text-card__text {
        font-weight: 600;
        color: var(--Gray-900, #101828);
      }
    }
  }

  // ========== 样式变体 3: 横向布局 ==========
  &--horizontal {
    flex-direction: row;
    align-items: center;
    padding: 4px;
    border-radius: 8px;
    border: 1px solid #E2E2E2;
    background: #FFFFFF;
    gap: 4px;
    // transition: all 0.3s;

    .graphic-text-card__graphic {
      flex-shrink: 0;
      border-radius: 8px;
      overflow: hidden;
    }

    .graphic-text-card__text {
      flex: 1;
      color: #1B1B1B;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }

    &.graphic-text-card--active {
      background: #7F56DA;
      border-color: #7F56DA;

      .graphic-text-card__text {
        color: #FFFFFF;
      }
    }

    &:hover:not(.graphic-text-card--disabled):not(.graphic-text-card--loading):not(.graphic-text-card--active).graphic-text-card--clickable {
      background: var(--Gray-50, #F9FAFB);
      border-color: #E2E2E2;
    }
  }

  // ========== 样式变体 4: 卡片式 ==========
  &--card {
    flex-direction: column;
    align-items: center;
    padding: 4px;
    border-radius: 8px;
    border: 4px solid var(--Gray-600, transparent);
    background: var(--Gray-600, #475467);
    gap: 4px;
    // transition: all 0.3s;

    .graphic-text-card__graphic {
      width: 100%;
      border-radius: 8px;
      overflow: hidden;
      flex-shrink: 0;
    }

    .graphic-text-card__text {
      color: #FFFFFF;
      text-align: center;
      padding: 0 4px 4px;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }

    &.graphic-text-card--active {
      border: 4px solid #7F56DA;
      background: #ffffff;
      padding: 4px;

      .graphic-text-card__content-wrapper {
        background: #FFFFFF;
        border-radius: 8px;
        display: flex;
        flex-direction: column;
        gap: 4px;
        padding: 0;
      }

      .graphic-text-card__text {
        color: #000000;
      }
    }

    &:hover:not(.graphic-text-card--disabled):not(.graphic-text-card--loading):not(.graphic-text-card--active).graphic-text-card--clickable {
      background: var(--Gray-900, #101828);
      border-color: var(--Gray-900, #101828);
    }
  }

  // ========== 状态样式 ==========
  &--disabled {
    cursor: not-allowed;
    opacity: 0.4;
    pointer-events: none;
  }

  &--loading {
    cursor: wait;
    opacity: 0.6;
    pointer-events: none;
  }

  // ========== 图形区域 ==========
  &__graphic {
    position: relative;
    flex-shrink: 0;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #CCCCCC;

    img {
      width: 100%;
      height: 100%;
      object-fit: cover;
      display: block;
    }

    span {
      display: flex;
      align-items: center;
      justify-content: center;
      width: 100%;
      height: 100%;
    }

    svg {
      width: 100%;
      height: 100%;
    }
  }

  // ========== 文本区域 ==========
  &__text {
    min-width: 0;
    // transition: color 0.3s;
    max-width: 100%;
  }

  // ========== Extra 容器 ==========
  &__extra {
    margin-left: auto;
    flex-shrink: 0;
  }

  // ========== 卡片样式的内容包装器（仅在 active 状态下使用） ==========
  &__content-wrapper {
    display: contents;
  }
}

// ========== 尺寸对应的图形区域默认尺寸 ==========
// 这些尺寸会被 JavaScript 动态计算并应用，这里提供参考值

// 垂直布局样式（样式一和样式二）
.graphic-text-card--vertical-image,
.graphic-text-card--vertical-icon {
  &.graphic-text-card--small {
    .graphic-text-card__graphic {
      // 默认 28x28
    }
  }

  &.graphic-text-card--default {
    .graphic-text-card__graphic {
      // 默认 36x36
    }
  }

  &.graphic-text-card--large {
    .graphic-text-card__graphic {
      // 默认 44x44
    }
  }
}

// 横向布局样式（样式三）
.graphic-text-card--horizontal {
  &.graphic-text-card--small {
    // 图形区域默认 48x40
    min-width: 80px;
  }

  &.graphic-text-card--default {
    // 图形区域默认 64x52
    min-width: 100px;
  }

  &.graphic-text-card--large {
    // 图形区域默认 80x64
    min-width: 120px;
  }
}

// 卡片样式（样式四）
.graphic-text-card--card {
  &.graphic-text-card--small {
    // 图形区域默认 56x56
    width: 64px;
  }

  &.graphic-text-card--default {
    // 图形区域默认 72x60
    width: 80px;
  }

  &.graphic-text-card--large {
    // 图形区域默认 88x72
    width: 96px;
  }
}