@use '../variables' as *;

.side-nav {
  display: flex;
  flex-direction: column;
  width: 2.2rem;
  height: var(--app-height, 100vh);
  background: $bg-white;
  color: #fff;
  padding: 0.2rem 0.12rem;
  box-sizing: border-box;
  z-index: 100;
  flex-shrink: 0;

  // 窄版模式（window.innerWidth < 1440）
  &--narrow {
    width: 0.8rem;
    padding: 0.16rem 0.10rem;
    align-items: center;
  }

  &__header {
    display: flex;
    align-items: center;
    gap: 0.08rem;
    padding: 0.1rem 0.08rem;
    margin-bottom: 0.2rem;
  }

  // 窄版header居中
  &--narrow &__header {
    justify-content: center;
    padding: 0.1rem 0;
  }

  &__avatar {
    width: 0.36rem;
    height: 0.36rem;
    border-radius: 50%;
    background: #2e3142;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.18rem;
  }

  &__logo-text {
    font-size: 0.16rem;
    font-weight: 600;
    color: #fff;
  }

  // Logo 图片
  &__logo-img {
    width: 1.32rem;
    height: 0.34rem;
    display: block;

    // 窄版logo
    &--narrow {
      width: 0.46rem;
      height: auto;
    }
  }

  &__menu {
    display: flex;
    flex-direction: column;
    gap: 0.04rem;
    flex: 1;
  }

  // 窄版菜单宽度撑满
  &--narrow &__menu {
    width: 100%;
  }

  &__item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.04rem;
    padding: 0.1rem 0.12rem;
    border-radius: 0.08rem;
    color: #9598ab;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    font-size: 0.14rem;

    &:hover {
      background: #EDF9FA;
      color: $accent;

      svg{
        color: $btn-dark;
      }
    }

    &--active {
      background: #EDF9FA;
      color: $accent;
    }
  }

  // 窄版导航项：纵向居中排列
  &--narrow &__item {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.04rem;
    padding: 0.1rem 0.06rem;
  }

  &__item-icon {
    width: 0.2rem;
    height: 0.2rem;
    object-fit: contain;
    font-size: 0.16rem;

    // 内部SVG/img统一撑满容器
    svg, img {
      width: 100%;
      height: 100%;
      display: block;
    }
  }

  // 窄版图标放大，防止scale缩放后图标过小
  &--narrow &__item-icon {
    width: 0.24rem;
    height: 0.24rem;
  }

  &__item-label {

  }

  // 窄版label字号缩小
  &--narrow &__item-label {
    font-size: 0.11rem;
    white-space: nowrap;
  }

  &__badge {
    background: #e85635;
    color: #fff;
    font-size: 0.1rem;
    padding: 0.02rem 0.06rem;
    border-radius: 0.2rem;
    font-weight: 600;
  }

  /* 索引0菜单项的"全网"小标签 */
  &__tag-quanwang {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.02rem 0.04rem;
    min-width: 0.28rem;
    height: 0.17rem;
    background: linear-gradient(128.17deg, #52CAD1 0%, #82D79B 100%);
    border-radius: 0.04rem;
    font-family: 'MiSans';
    font-style: normal;
    font-weight: 620;
    font-size: 0.10rem;
    line-height: 0.13rem;
    text-align: center;
    color: #FFFFFF;
    flex: none;

    // 窄版角标样式（右上角定位）
    &--corner {
      position: absolute;
      top: -0.07rem;
      right: -0.05rem;
      min-width: auto;
      padding: 0.02rem 0.04rem;
      height: 0.17rem;
      font-size: 0.10rem;
      line-height: 0.12rem;
      border-radius: 0.03rem;
    }
  }

  // 公测群二维码弹出层（hover索引5时显示）
  &__qrcode-popup {
    position: absolute;
    top: calc(100% + 0.08rem);
    left: 0;
    padding: 0.08rem;
    background: #fff;
    border-radius: 0.08rem;
    box-shadow: 0 0.02rem 0.12rem rgba(0, 0, 0, 0.08);
    z-index: 100;
  }

  &__qrcode-img {
    display: block;
    width: auto;
    height: auto;
    max-width: 1.6rem;
    border-radius: 0.04rem;
  }

  &__footer {
    display: flex;
    flex-direction: column;
    gap: 0.04rem;
    padding-top: 0.12rem;
  }

  // 窄版footer居中
  &--narrow &__footer {
    align-items: center;
    width: 100%;
  }
}

// ==================== 窄版邀请图片卡片 ====================
.side-nav__referral-card-narrow {
  display: flex;
  justify-content: center;
  margin-top: 0.12rem;
}

.side-nav__referral-card-narrow-img {
  width: 0.56rem;
  height: 0.85rem;
  display: block;
  border-radius: 0.06rem;
}

// ==================== 窄版用户信息 ====================
.side-nav__user-info-narrow {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.06rem;
  cursor: pointer;
  padding: 0.08rem 0;
  border-radius: 0.08rem;

  &:hover {

  }
}

.side-nav__user-avatar-narrow {
  width: 0.26rem;
  height: 0.26rem;
  border-radius: 50%;
  display: block;
}

.side-nav__dialog-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: var(--app-height, 100vh);
  background: $overlay-bg;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.side-nav__dialog {
  background: $bg-white;
  border-radius: 0.12rem;
  width: 4rem;
  max-width: 90vw;
  box-shadow: 0 0.04rem 0.2rem rgba(0, 0, 0, 0.15);
}

.side-nav__dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.16rem 0.2rem;
  border-bottom: 1px solid $border-color;
  font-size: 0.16rem;
  font-weight: 600;
  color: $text-dark;
}

.side-nav__dialog-close {
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 0.24rem;
  height: 0.24rem;
  border-radius: 4px;
  transition: background 0.2s;

  &:hover {
    background: rgba(0, 0, 0, 0.05);
  }

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

.side-nav__dialog-body {
  padding: 0.2rem;
  font-size: 0.14rem;
  color: $text-dark;
}

// ==================== 消息通知弹窗（左右分栏） ====================
.side-nav__message-dialog {
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 0.24rem 0.32rem;
  gap: 0.24rem;
  width: 8rem;
  height: 6rem;
  max-width: 90vw;
  max-height: 90vh;
  background: linear-gradient(180deg, #EDF9FA 0%, #FFFFFF 12.08%);
  border: 1px solid #F0F0F0;
  box-shadow: 0 0 0.16rem rgba(0, 0, 0, 0.05);
  border-radius: 0.12rem;
}

.side-nav__message-dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  flex-shrink: 0;

  span:first-child {
    font-weight: 620;
    font-size: 0.18rem;
    line-height: 0.24rem;
    color: $text-dark;
  }
}

.side-nav__message-dialog-content {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 0.16rem;
  width: 100%;
  flex: 1;
  overflow: hidden;
  background: $bg-white;
}

// 左侧消息列表
.side-nav__message-list {
  display: flex;
  flex-direction: column;
  gap: 0.04rem;
  width: 2.24rem;
  height: 100%;
  overflow-y: auto;
  flex-shrink: 0;
}

.side-nav__message-list-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 0.16rem 0.12rem;
  border-radius: 0.08rem;
  cursor: pointer;
  transition: background 0.2s;

  &:hover {
    background: #F6F6F6;
  }

  &--active {
    background: #EDF9FA;
  }
}

// 列表项内部行布局
.side-nav__message-list-item-row {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.side-nav__message-list-item-left {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.08rem;
}

.side-nav__message-unread-dot {
  width: 0.08rem;
  height: 0.08rem;
  border-radius: 50%;
  background: $accent;
  flex-shrink: 0;
}

.side-nav__message-list-title {
  font-weight: 620;
  font-size: 0.14rem;
  line-height: 0.19rem;
  color: $text-dark;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.side-nav__message-list-date {
  font-weight: 330;
  font-size: 0.12rem;
  line-height: 0.16rem;
  color: $text-light;
  flex-shrink: 0;
}

.side-nav__message-list-loading,
.side-nav__message-list-empty {
  padding: 0.16rem;
  text-align: center;
  font-size: 0.12rem;
  color: $text-light;
}

// 右侧消息详情
.side-nav__message-detail {
  flex: 1;
  height: 100%;
  overflow-y: auto;
  position: relative;
  padding: 0.16rem 0.24rem;
}

.side-nav__message-detail-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.side-nav__message-detail-title {
  font-weight: 630;
  font-size: 0.22rem;
  line-height: 0.29rem;
  color: $text-dark;
}

.side-nav__message-detail-time {
  font-weight: 330;
  font-size: 0.12rem;
  line-height: 0.16rem;
  color: $text-middle;
  flex-shrink: 0;
}

.side-nav__message-detail-divider {
  width: 100%;
  height: 1px;
  background: #F0F0F0;
  margin: 0.16rem 0;
}

.side-nav__message-detail-content {
  font-weight: 330;
  font-size: 0.14rem;
  line-height: 0.24rem;
  color: $text-dark;
  white-space: pre-wrap;
  word-break: break-word;
}

.side-nav__message-detail-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  font-size: 0.14rem;
  color: $text-light;
}

// 反馈弹窗
.feedback-dialog {
  padding: 0.28rem 0.24rem;
  width: 4.83rem;

  &__title {
    font-size: 0.2rem;
    font-weight: 700;
    color: $text-dark;
    margin-bottom: 0.24rem;
  }

  &__section {
    margin-bottom: 0.2rem;
  }

  &__label {
    font-size: 0.14rem;
    font-weight: 600;
    color: $text-dark;
    margin-bottom: 0.12rem;
  }

  &__options {
    display: flex;
    flex-direction: column;
    gap: 0.08rem;
  }

  &__option {
    padding: 0.08rem 0.16rem;
    background: $bg-main;
    border-radius: 0.08rem;
    font-size: 0.14rem;
    color: $text-dark;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;

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

    &--active {
      background: $theme-color;
      border-color: $accent;
      color: $accent-hover;
    }
  }

  &__textarea {
    width: 100%;
    padding: 0.12rem 0.14rem;
    background: $bg-main;
    border: 1px solid transparent;
    border-radius: 0.08rem;
    font-size: 0.13rem;
    color: $text-dark;
    resize: none;
    outline: none;
    box-sizing: border-box;
    font-family: inherit;
    transition: border-color 0.2s;

    &::placeholder {
      color: $text-light;
    }

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

  &__actions {
    display: flex;
    gap: 0.12rem;
    margin-top: 0.24rem;
  }

  &__btn {
    flex: 1;
    padding: 0.12rem 0;
    border-radius: 0.24rem;
    font-size: 0.14rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid $border-color;

    &--cancel {
      background: $bg-white;
      color: $text-dark;

      &:hover {
        background: $bg-main;
      }
    }

    &--submit {
      background: $btn-dark;
      color: $bg-white;
      border-color: $btn-dark;

      &:hover {
        background: $btn-dark-hover;
        border-color: $btn-dark-hover;
      }
    }
  }
}

// ==================== 邀请会员卡片 ====================
.side-nav__referral-card {
  position: relative;
  width: 100%;
  height: 2.21rem;
  background: linear-gradient(90deg, #DFF5F6 0%, #FBFDF7 100%);
  box-shadow: 0px 0px 0.08rem rgba(0, 0, 0, 0.06);
  border-radius: 0.08rem;
  box-sizing: border-box;
  margin-top: 0.12rem;
  overflow: hidden;
}

// 顶部区域：标题在左上，礼物图片定位在右下角
.side-nav__referral-top {
  position: relative;
  padding: 0.2rem 0.16rem 0.4rem;
}

.side-nav__referral-top-text {
  position: relative;
  z-index: 1;
}

.side-nav__referral-title {
  font-size: 0.18rem;
  font-weight: 630;
  color: #1A1A1A;
  line-height: 0.24rem;

  &--accent {
    background: linear-gradient(128.17deg, #52CAD1 0%, #82D79B 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
  }
}

.side-nav__referral-subtitle {
  font-size: 0.14rem;
  font-weight: 330;
  color: #6A7282;
  line-height: 0.19rem;
  margin-top: 0.08rem;
}

// 礼物图片：absolute定位在顶部区域的右下角，底部被毛玻璃面板遮住
.side-nav__referral-gift {
  position: absolute;
  right: 0.10rem;
  bottom: 0.02rem;
  width: 0.68rem;
  height: 0.68rem;
  mix-blend-mode: darken;
}

// 白色毛玻璃面板（覆盖在礼物底部之上）
.side-nav__referral-panel {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 1.38rem;
  background: rgba(255, 255, 255, 0.4);
  border: 1px solid #FFFFFF;
  border-bottom: none;
  backdrop-filter: blur(3px);
  border-radius: 0.08rem 0.08rem 0 0;
  box-sizing: border-box;
  padding: 0.16rem;
}

.side-nav__referral-row {
  display: flex;
  align-items: center;
  gap: 0.08rem;
}

.side-nav__referral-label {
  font-size: 0.14rem;
  font-weight: 330;
  color: #6A7282;
  line-height: 0.19rem;
}

.side-nav__referral-value {
  font-size: 0.14rem;
  font-weight: 450;
  line-height: 0.19rem;
  background: linear-gradient(128.17deg, #52CAD1 0%, #82D79B 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.side-nav__referral-track {
  width: 100%;
  height: 0.06rem;
  background: #EDF9FA;
  border-radius: 0.06rem;
  margin-top: 0.1rem;
  overflow: hidden;
}

.side-nav__referral-fill {
  height: 100%;
  background: #52CAD1;
  border-radius: 0.06rem;
}

.side-nav__referral-tip {
  font-size: 0.12rem;
  font-weight: 330;
  color: #6A7282;
  line-height: 0.16rem;
  margin-top: 0.06rem;

  strong {
    font-weight: 630;
  }
}

.side-nav__referral-action {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 0.40rem;
  background: linear-gradient(90deg, #36C1C9 16.99%, #AFE9D0 100%);
  box-shadow: inset 0px 0px 0.06rem rgba(255, 255, 255, 0.5);
  border-radius: 0.08rem;
  font-size: 0.14rem;
  font-weight: 600;
  color: #FFFFFF;
  margin-top: 0.12rem;
  cursor: pointer;

  &:hover {
    opacity: 0.9;
  }
}

// ==================== 用户信息模块 ====================
.side-nav__user-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: #fff;
  border-radius: 0.08rem;
  padding: 0.12rem 0.16rem;
  box-sizing: border-box;
  margin-top: 0.12rem;
  cursor: pointer;

  &:hover,
  &:active,
  &--active {
    background: #F3F4F6;
  }
}

.side-nav__user-left {
  display: flex;
  flex-direction: column;
  gap: 0.04rem;
}

.side-nav__user-phone {
  font-size: 0.14rem;
  font-weight: 330;
  color: #1A1A1A;
  line-height: 0.19rem;
}

.side-nav__user-member-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.02rem 0.04rem;
  border-radius: 0.04rem;
  font-size: 0.10rem;
  font-weight: 620;
  line-height: 0.13rem;
  width: fit-content;

  // 正式会员：主题色字 + 浅绿底
  &--formal {
    color: #52CAD1;
    background: #EDF9FA;
  }

  // 试用会员：橙色字 + 浅橙底
  &--trial {
    color: #F59E0B;
    background: #FFFBF5;
  }

  // 免费用户：中灰字 + 灰底
  &--free {
    color: #6A7282;
    background: #F3F4F6;
  }
}

.side-nav__user-bell {
  width: 0.20rem;
  height: 0.20rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;

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

  &:hover {
    opacity: 0.7;
  }
}

// 铃铛右上角未读红点
.side-nav__user-bell-dot {
  position: absolute;
  top: -0.005rem;
  right: 0.01rem;
  width: 0.08rem;
  height: 0.08rem;
  background: #EF4444;
  border-radius: 50%;
}

// ==================== 账户弹窗 ====================
.side-nav__user-info-wrapper {
  position: relative;
  margin-top: 0.12rem;
}

.side-nav__account-popup {
  position: absolute;
  bottom: calc(100% + 0.08rem);
  left: 0;
  width: 100%;
  min-width: 1.65rem;
  background: #FFFFFF;
  border: 1px solid #F0F0F0;
  box-shadow: 0px 0.02rem 0.08rem rgba(0, 0, 0, 0.04);
  border-radius: 0.08rem;
  overflow: hidden;
  z-index: 1000;
}

.side-nav__account-popup-header {
  padding: 0.16rem;
  background: linear-gradient(180deg, #EDF9FA 0%, #FFFFFF 38.18%);
  border-radius: 0.08rem 0.08rem 0 0;

  /* 正式会员背景 */
  &--formal {
    background: linear-gradient(180deg, #EDF9FA 0%, #FFFFFF 38.18%);
  }
  /* 试用会员背景 */
  &--trial {
    background: linear-gradient(180deg, #FEF5E7 0%, #FFFFFF 38.18%);
  }
  /* 免费用户背景 */
  &--free {
    background: linear-gradient(180deg, #F1F2F4 0%, #FFFFFF 38.18%);
  }
}

.side-nav__account-popup-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.side-nav__account-popup-header-left {
  display: flex;
  flex-direction: column;
  gap: 0.04rem;
}

.side-nav__account-popup-member-type {
  font-size: 0.14rem;
  font-weight: 450;
  line-height: 0.19rem;

  // 正式会员 — 主题色
  &--formal {
    color: $accent;
  }

  // 试用会员 — 橙色
  &--trial {
    color: #F59E0B;
  }

  // 免费用户 — 中灰色
  &--free {
    color: $text-middle;
  }
}

.side-nav__account-popup-expire {
  font-size: 0.12rem;
  font-weight: 330;
  color: $text-light;
  line-height: 0.16rem;
}

.side-nav__account-popup-detail {
  font-size: 0.12rem;
  font-weight: 330;
  color: $text-light;
  line-height: 0.16rem;
  cursor: pointer;

  &:hover {
    color: $accent;
  }
}

.side-nav__account-popup-item {
  padding: 0.12rem 0.16rem;
  font-size: 0.12rem;
  font-weight: 330;
  color: #000000;
  line-height: 0.16rem;
  cursor: pointer;

  &:hover {
    background: $bg-main;
  }
}
