@import 'press-ui/common/style/smoba/layout.scss';
@import 'press-ui/common/style/smoba/mixin.scss';


$popoverPadding: 12px;
$popoverPaddingBottom: 12px;
$popoverBorderWidth: 7px;


// 会话框的三角形
@mixin triangle() {
  &--left,
  &--right {
    position: relative;
  }

  &--left::after,
  &--right::after {
    position: absolute;
    box-sizing: border-box;
    content: '';
    border-top: .07rem solid $color-bg;
    border-bottom: .07rem solid $color-bg;
    width: 0;
    top: .37rem;
  }

  &--left::after {
    left: -$popoverBorderWidth;
    border-right: $popoverBorderWidth solid $color-white;
  }

  &--right::after {
    right: -$popoverBorderWidth;
    border-left: $popoverBorderWidth solid $color-primary;
  }
}


.press-message-detail {
  height: 100%;
  position: relative;
  background: #f5f6fa;

  &__scroll-view {
    height: 100%;
    // height: auto;
    // flex: 1;
    overflow: scroll;
    position: relative;
    overflow-anchor: auto;
  }

  &__placeholder {
    height: 0;
  }

  &__scrollbar {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: .28rem;
    background: #f5f6fa;
  }

  &__layout {
    position: relative;
    height: auto;
  }

  &__loading {
    display: flex;
    justify-content: center;
    // position: absolute;
    left: 0;
    right: 0;
    // top: 0;
    height: 18px;
  }
}



.press-message-item {
  overflow: hidden;

  &:last-child {
    padding-bottom: .32rem;
  }

  &__time,
  &__tip {
    margin-top: .32rem;
    height: .36rem;
    line-height: .36rem;
    text-align: center;
    color: $color-gray;
    font-size: $font-xxs;
  }

  &__tip-btn {
    color: $color-primary;
  }

  &__box {
    padding: 0 .32rem;
    display: flex;
    margin-top: .32rem;

    &--right {
      flex-direction: row-reverse;

      .press-message-item__box-popover {
        background: $color-primary;
        color: $color-white;
      }
    }

    .press-message-status {
      font-size: $font-xxs;
      display: flex;
      align-items: flex-end;

      &--read {
        color: $color-gray-4;
      }

      &--unread {
        color: $color-gray;
      }

      &--error {
        font-size: 0;
        width: .32rem;
        background: url(https://image-1251917893.file.myqcloud.com/Esports/new/user/warn.png) no-repeat;
        background-size: .32rem .32rem;
        background-position: bottom;
      }
    }
  }

  &__box-avatar {
    border-radius: 50%;
    width: .88rem;
    height: .88rem;
    background: url('https://image-1251917893.file.myqcloud.com/Esports/new/user/helper-logo.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center center;
    position: relative;
  }

  &__box-img {
    width: 1.92rem;
    border-radius: .08rem;
    margin: 0 .2rem;
    height: 100%;
    object-fit: cover;
  }

  &__box-popover {
    padding: $popoverPaddingBottom $popoverPadding;
    background: $color-white;
    color: $color-gray-5;
    max-width: 4.98rem;
    margin: 0 .2rem;
    border-radius: .1rem;
    display: flex;
    justify-content: center;
    flex-direction: column;

    @include triangle();
  }

  // 战队申请消息
  &__apply {
    .press-message-item__box-popover {
      width: 4.98rem;
      max-width: 4.98rem;
      padding: .22rem .32rem;
    }
  }

  &__apply-buttons {
    height: .76rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-top: 1px solid $color-gray-7;
    margin-top: .16rem;
    padding: .22rem .8rem 0;
  }

  &__apply-button {
    &--gray {
      color: $color-gray-4;
      font-size: $font-xm;
      margin: 0 auto;
    }

    &--primary {
      @include primary-btn(.96rem, .52rem, $font-xm);
    }

    &--secondary {
      @include secondary-btn(.96rem, .52rem, $font-xm);
    }
  }

  &__apply-card {
    border-radius: .08rem;
    background: rgba(238, 240, 246, .6);
    padding: .24rem .16rem;
    margin-bottom: .16rem;
  }

  &__apply-card-header {
    display: flex;
    align-items: center;
    position: relative;
    padding-bottom: .42rem;

    &::after {
      content: '';
      display: block;
      width: 3.96rem;
      height: .18rem;
      background: url('https://image-1251917893.file.myqcloud.com/Esports/new/user/team-apply-card-line.png') no-repeat;
      background-size: cover;
      position: absolute;
      bottom: .12rem;
      left: 0;
    }
  }

  &__apply-card-desc {
    display: flex;
    align-items: center;
    margin-bottom: .08rem;

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

  &__apply-card-desc-tit {
    color: $color-gray-9;
    font-size: $font-s;
    line-height: .4rem;

    &--value {
      color: $color-gray-5;
    }
  }

  &__apply-card-desc-hero {
    width: .48rem;
    height: .48rem;
    border-radius: .48rem;
    border: .02rem solid $color-gray-7;
    background-repeat: no-repeat;
    background-size: cover;
    margin-right: .04rem;
  }

  &__apply-card-head {
    width: .64rem;
    height: .64rem;
    border-radius: .8rem;
    border: .02rem solid $color-white;
    background-repeat: no-repeat;
    background-size: cover;
  }

  &__apply-card-info {
    margin-left: .16rem;
  }

  &__apply-card-nick {
    color: $color-black;
    font-size: $font-xm;
    line-height: .44rem;
  }

  &__apply-card-tier {
    color: $color-gray-5;
    font-size: $font-xxs;
    line-height: .32rem;
  }

  &__content {
    word-break: break-all;
  }

  &__title {
    line-height: .48rem;
    font-size: $font-l;
    margin-bottom: .2rem;
    font-weight: 700;
    color: $color-black;
  }

  &__content {
    line-height: .48rem;
    font-size: $font-xm;
    line-height: .44rem;
    text-align: justify;
  }

  &__content-link {
    color: $color-primary;
  }

  &__content-item-line {
    line-height: .48rem;
  }
}


// 卡片信息
.press-message-item-card {
  width: 5.14rem;
  padding: 0 $popoverPadding;
  box-sizing: border-box;

  @include triangle();


  &__title {
    padding: .16rem .24rem 0;
    height: 1.12rem;
    background: url(https://image-1251917893.file.myqcloud.com/Esports/new/user/card-tit-bg.png) no-repeat;
    background-size: 100% 100%;
  }

  &__title-main,
  &__title-desc {
    font-weight: bold;
    font-size: $font-xm;
    line-height: .44rem;
    color: $color-white;
  }

  &__title-desc {
    font-weight: 400;
    font-size: $font-s;
    line-height: .36rem;
    transform: scale(.83);
    transform-origin: 0 center;
  }

  &__main {
    padding: .24rem;
    background: linear-gradient(0deg, rgba(255, 255, 255, .2), rgba(255, 255, 255, .2)), linear-gradient(67.27deg, #ccecff -65.69%, #fff 125.52%);
  }

  &--right::after {
    right: .1rem;
    border-left: $popoverBorderWidth solid #7bd0f8;
  }

  &--left::after {
    left: .1rem;
    border-right: $popoverBorderWidth solid #4ca1e2;
  }

  &--owner {
    .press-message-item-card__title {
      background: url(https://image-1251917893.file.myqcloud.com/Esports/new/user/owner-card-tit-bg.png) no-repeat;
      background-size: 100% 100%;
    }

    .press-message-item-card__main {
      background: linear-gradient(246.76deg, rgba(255, 255, 255, .67) 0%, rgba(255, 255, 255, .402) 100%), linear-gradient(58.41deg, #bccff9 1.84%, #dae6fd 114.52%);
    }

    &.press-message-item-card--right::after {
      border-left: $popoverBorderWidth solid #8199cc;
    }

    &.press-message-item-card--left::after {
      border-right: $popoverBorderWidth solid #5a71ab;
    }
  }
}

// 卡片主体，不包含标题、描述
.press-message-card {
  &__user {
    display: flex;
    align-items: center;
  }

  &__avatar {
    width: .88rem;
    height: .88rem;
    margin-right: .16rem;
    border-radius: 50%;
  }

  &__user-meta {
    flex: 1;
  }

  &__user-name {
    font-weight: bold;
    font-size: $font-xm;
    line-height: .44rem;
    color: $color-black;
    max-width: 3.2rem;

    @include single-line-ellipsis;
  }

  &__user-desc {
    font-size: $font-s;
    line-height: .36rem;
    color: $color-gray;
    transform: scale(.83);
    transform-origin: 0 center;
  }

  &__contact {
    margin-top: .22rem;
  }

  &__contact-item {
    display: flex;
    align-items: center;
    padding-top: .1rem;

    .iconfont {
      font-size: $font-l;
      color: $color-gray;
      margin-right: .1rem;

      &.icon-wx2 {
        font-size: $font-xm;
      }
    }
  }

  &__contact-value {
    font-size: $font-s;
    line-height: .4rem;
    align-items: center;
    color: $color-black;
    flex: 1;

    @include single-line-ellipsis;
  }

  &__contact-tip,
  &__contact-tag {
    font-size: $font-s;
    line-height: .36rem;
    transform: scale(.83);
    color: $color-gray;
    margin-left: auto;
  }

  &__contact-tag {
    color: $color-primary;
  }

  &__contact-btn {
    font-size: $font-xm;
    line-height: .44rem;
    color: $color-primary;
    text-align: center;
    margin-top: .24rem;

    &--disable {
      color: $color-gray-4;
    }
  }
}
