@use "sass:color";

.custom-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 8px;
  font-weight: 500;
  transition: all 0.3s;
  position: relative;
  padding: 0 24px;
  outline: none;

  &::after {
    border: none;
  }

  // 类型样式
  &--primary {
    background-color: #4285f4;
    color: #fff;

    &:active {
      background-color: color.adjust(#4285f4, $lightness: 10%);
    }
  }

  &--secondary {
    background-color: #f5f5f5;
    color: #333;

    &:active {
      background-color: color.adjust(#f5f5f5, $lightness: 10%);
    }
  }

  &--outline {
    background-color: transparent;
    color: #4285f4;
    border: 1px solid #4285f4;

    &:active {
      background-color: rgba(66, 133, 244, 0.1);
    }
  }

  &--link {
    background-color: transparent;
    color: #4285f4;
    padding: 0;
    height: auto;
    line-height: 1.5;

    &:active {
      opacity: 0.8;
    }
  }

  // 尺寸样式
  &--large {
    height: 48px;
    font-size: 16px;
  }

  &--medium {
    height: 40px;
    font-size: 14px;
  }

  &--small {
    height: 32px;
    font-size: 12px;
    padding: 0 16px;
  }

  // 块级样式
  &--block {
    display: flex;
    width: 100%;
  }

  // 圆角样式
  &--round {
    border-radius: 24px;
  }

  // 加载样式
  &--loading {
    opacity: 0.8;
    pointer-events: none;
  }

  // 图标位置
  &--icon-left {
    .custom-button__icon {
      margin-right: 8px;
      margin-left: 0;
    }
  }

  &--icon-right {
    .custom-button__icon {
      margin-left: 8px;
      margin-right: 0;
    }
  }

  &__loading {
    width: 16px;
    height: 16px;
    margin-right: 8px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: button-loading 0.8s linear infinite;
  }

  &__icon {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  &__text {
    display: inline-block;
  }
}

@keyframes button-loading {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
} 