// 会员弹窗样式（新版）
@use '../variables' as *;

// 遮罩层
.member-dialog-overlay {
  position: fixed;
  inset: 0;
  background: $overlay-bg;
  z-index: 2300;
  display: flex;
  align-items: center;
  justify-content: center;

  // 扫码支付弹窗的遮罩层级更高
  &--qrcode {
    z-index: 2400;
  }
}

// 弹窗主体
.member-dialog {
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 0.24rem 0.32rem;
  gap: 0.24rem;
  width: 4.8rem;
  background: linear-gradient(180deg, #EDF9FA 0%, #FFFFFF 20.63%);
  border: 1px solid #F0F0F0;
  box-shadow: 0 0 0.16rem rgba(0, 0, 0, 0.05);
  border-radius: 0.12rem;
  font-size: 0.14rem;

  // 扫码支付弹窗变体
  &--qrcode {
    align-items: center;
  }

  // ==================== 顶部标题行 ====================
  &__header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    width: 100%;
  }

  &__header-left {
    display: flex;
    flex-direction: column;
    gap: 0.04rem;
  }

  &__header-right {
    display: flex;
    align-items: center;
    gap: 0.16rem;
  }

  &__title {
    font-weight: 620;
    font-size: 0.18rem;
    line-height: 0.24rem;
    color: $text-dark;
    margin: 0;
  }

  &__subtitle {
    font-weight: 330;
    font-size: 0.12rem;
    line-height: 0.16rem;
    color: $text-middle;
    margin: 0;
  }

  &__contact {
    font-weight: 330;
    font-size: 0.12rem;
    line-height: 0.16rem;
    color: $text-light;
    cursor: pointer;

    &:hover {
      color: $text-middle;
    }
  }

  // 联系客服外层包装（用于定位二维码弹出框）
  &__contact-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;

    &:hover .member-dialog__contact-qr {
      display: flex;
    }
  }

  // 联系客服二维码弹出框
  &__contact-qr {
    display: none;
    position: absolute;
    bottom: calc(100% + 0.1rem);
    left: 50%;
    transform: translateX(-50%);
    width: 0.96rem;
    height: 0.96rem;
    background: $bg-white;
    border-radius: 0.08rem;
    box-shadow: 0 0 0.08rem rgba(0, 0, 0, 0.08);
    padding: 0.06rem;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10;

    img {
      width: 100%;
      height: 100%;
      border-radius: 0.04rem;
      object-fit: contain;
    }
  }

  // 二维码弹出框底部箭头
  &__contact-qr-arrow {
    position: absolute;
    bottom: -0.07rem;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 0.08rem solid transparent;
    border-right: 0.08rem solid transparent;
    border-top: 0.08rem solid $bg-white;
    filter: drop-shadow(0 0.02rem 0.02rem rgba(0, 0, 0, 0.05));
  }

  &__close {
    width: 0.24rem;
    height: 0.24rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.14rem;
    color: $text-middle;
    cursor: pointer;

    &:hover {
      color: $text-dark;
    }
  }

  // ==================== 套餐选择区域 ====================
  &__plans {
    display: flex;
    gap: 0.13rem;
    width: 100%;
  }

  &__plan-card {
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0.12rem 0.16rem;
    gap: 0.04rem;
    width: 1.3rem;
    height: 1.01rem;
    background: $bg-white;
    border: 1px solid #F0F0F0;
    border-radius: 0.08rem;
    cursor: pointer;
    transition: border-color 0.2s;
    position: relative;

    &:hover {
      border-color: $accent;
    }

    // 选中状态 — 粗边框
    &--active {
      border: 3px solid $accent;
    }
  }

  &__plan-recommend {
    position: absolute;
    top: -0.1rem;
    left: 10%;
    transform: translateX(-50%);
    white-space: nowrap;
    background: $accent;
    color: $bg-white;
    font-size: 0.1rem;
    padding: 0.02rem 0.08rem;
    border-radius: 0.08rem;
    font-weight: 620;
  }

  &__plan-name {
    font-weight: 450;
    font-size: 0.14rem;
    line-height: 0.19rem;
    text-align: center;
    color: $text-dark;
  }

  &__plan-price {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 0.04rem;
    padding: 0.04rem 0;
  }

  &__plan-price-symbol {
    font-weight: 450;
    font-size: 0.14rem;
    line-height: 0.19rem;
    color: $text-dark;
  }

  &__plan-price-num {
    font-weight: 630;
    font-size: 0.24rem;
    line-height: 0.18rem;
    color: $text-dark;
  }

  &__plan-original-price {
    font-weight: 330;
    font-size: 0.12rem;
    line-height: 0.16rem;
    text-decoration: line-through;
    color: $text-light;
  }

  &__plan-daily {
    font-weight: 330;
    font-size: 0.12rem;
    line-height: 0.16rem;
    text-align: center;
    color: $accent;
  }

  // ==================== 会员权益区域 ====================
  &__benefits {
    width: 100%;
  }

  &__benefits-title {
    font-weight: 450;
    font-size: 0.14rem;
    line-height: 0.19rem;
    color: $text-dark;
    margin: 0 0 0.16rem;
  }

  &__benefits-cards {
    display: flex;
    gap: 0.13rem;
    width: 100%;
  }

  &__benefit-card {
    box-sizing: border-box;
    flex: 1;
    display: flex;
    align-items: center;
    padding: 0.12rem 0.16rem;
    gap: 0.1rem;
    background: $bg-white;
    border: 1px solid #AEE6EA;
    border-radius: 0.08rem;
  }

  &__benefit-icon {
    width: 0.4rem;
    height: 0.4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #EDF9FA;
    border-radius: 50%;
    flex-shrink: 0;

    svg {
      width: 0.24rem;
      height: 0.24rem;
    }
  }

  &__benefit-info {
    display: flex;
    flex-direction: column;
    gap: 0.04rem;
  }

  &__benefit-name {
    font-weight: 450;
    font-size: 0.14rem;
    line-height: 0.19rem;
    color: $accent;
  }

  &__benefit-desc {
    font-weight: 330;
    font-size: 0.12rem;
    line-height: 0.16rem;
    color: $text-middle;
  }

  // ==================== 支付方式选择 ====================
  &__payment {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
  }

  &__payment-label {
    font-weight: 450;
    font-size: 0.14rem;
    line-height: 0.19rem;
    color: $text-dark;
  }

  &__payment-methods {
    display: flex;
    align-items: center;
    gap: 0.24rem;
  }

  &__payment-item {
    display: flex;
    align-items: center;
    padding: 0.04rem 0.08rem;
    gap: 0.06rem;
    border-radius: 0.04rem;
    cursor: pointer;
    transition: background 0.2s;

    svg {
      width: 0.16rem;
      height: 0.16rem;
      flex-shrink: 0;
    }

    // 微信选中态
    &--wechat-active {
      background: #EBFEF4;
    }

    // 支付宝选中态
    &--alipay-active {
      background: #EBF3FF;
    }
  }

  &__payment-text {
    font-weight: 620;
    font-size: 0.12rem;
    line-height: 0.18rem;

    &--wechat {
      color: #07C160;
    }

    &--alipay {
      color: #1677FF;
    }
  }

  // ==================== 购买按钮 ====================
  &__buy-btn {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0.08rem 0.12rem;
    height: 0.35rem;
    background: #AEE6EA;
    border-radius: 0.08rem;
    border: none;
    font-weight: 450;
    font-size: 0.14rem;
    line-height: 0.19rem;
    color: $bg-white;
    cursor: default;
    opacity: 0.4;
    transition: background 0.2s, opacity 0.2s;

    // 选择了支付方式后变为主题色、不透明、可点击
    &--active {
      background: $accent;
      opacity: 1;
      cursor: pointer;

      &:hover {
        background: $accent-hover;
      }
    }
  }

  // ==================== 扫码支付弹窗内容 ====================
  &__qrcode-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.16rem;
    width: 100%;
  }

  &__qrcode-image {
    width: 2.1rem;
    height: 2.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  &__payment-iframe {
    width: 100%;
    height: 100%;
    border: none;
    border-radius: 0.08rem;
  }

  &__wechat-qr-iframe {
    width: 2.2rem;
    height: 2.2rem;
    border: none;
    border-radius: 0.08rem;
  }

  &__qrcode-price-row {
    display: flex;
    align-items: flex-end;
    gap: 0.08rem;
  }

  &__qrcode-price {
    font-weight: 630;
    font-size: 0.32rem;
    line-height: 0.25rem;
    color: $text-dark;
  }

  &__qrcode-tip {
    font-weight: 330;
    font-size: 0.14rem;
    line-height: 0.1rem;
    color: $text-dark;
  }

  &__qrcode-agreement {
    font-weight: 330;
    font-size: 0.14rem;
    line-height: 0.19rem;
    color: $text-light;
    margin: 0;

    a {
      color: $text-light;
      text-decoration: none;

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

  // 已支付成功按钮
  &__paid-btn {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0.08rem 0.12rem;
    height: 0.35rem;
    background: $accent;
    border-radius: 0.08rem;
    border: none;
    font-weight: 450;
    font-size: 0.14rem;
    line-height: 0.19rem;
    color: $bg-white;
    cursor: pointer;
    transition: background 0.2s;

    &:hover {
      background: $accent-hover;
    }
  }
}
