@use '../variables' as *;

// ==================== 一键修复抽屉（全模块） ====================

// 遮罩层
.fix-all-drawer-overlay {
  position: fixed;
  inset: 0;
  background: $overlay-bg;
  z-index: 2000;
}

// 遮罩层过渡动画
.fix-all-drawer-overlay-enter-active,
.fix-all-drawer-overlay-leave-active {
  transition: opacity 0.3s ease;
}
.fix-all-drawer-overlay-enter-from,
.fix-all-drawer-overlay-leave-to {
  opacity: 0;
}

// 抽屉主体
.fix-all-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: 8rem;
  height: var(--app-height, 100vh);
  background: #fff;
  z-index: 2001;
  display: flex;
  flex-direction: column;
  box-shadow: -4px 0 24px rgba(0, 0, 0, 0.08);
  font-size: 0.14rem;

  // ---- 顶部栏 ----
  &__header {
    display: flex;
    align-items: center;
    gap: 0.1rem;
    padding: 0.16rem 0.24rem;
    border-bottom: 1px solid $border-color;
    background: $bg-white;
    flex-shrink: 0;
  }

  &__close-btn {
    width: 0.28rem;
    height: 0.28rem;
    border-radius: 50%;
    border: none;
    background: none;
    color: $text-dark;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;

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

  &__close-icon {
    width: 0.16rem;
    height: 0.16rem;
  }

  &__title {
    font-size: 0.18rem;
    font-weight: 700;
    color: $text-dark;
    margin: 0;
  }

  // ---- 可滚动内容区 ----
  &__body {
    flex: 1;
    overflow-y: auto;
    padding: 0.2rem 0.24rem 0.4rem;
  }

  // ---- 模块标题 ----
  &__module-title {
    font-size: 0.18rem;
    font-weight: 700;
    color: $text-dark;
    margin: 0.24rem 0 0.12rem 0;

    &:first-child {
      margin-top: 0;
    }
  }

  // ---- 单条经历记录 ----
  &__record {
    margin-bottom: 0.2rem;
    background: $bg-main;
    padding: 0.16rem;
    border-radius: 0.12rem;
  }

  &__record-label {
    font-size: 0.13rem;
    font-weight: 600;
    color: $text-dark;
    margin: 0 0 0.08rem 0;
  }

  // ---- 卡片容器 ----
  &__card {
    background: #fff;
    border-radius: 0.1rem;
    padding: 0.16rem;
    position: relative;
    overflow: hidden;

    &--ai {
      border: 1px solid rgba($accent, 0.3);

      /* 顶部渐变背景层，不遮挡内容 */
      &::before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        border-radius: 0.1rem;
        background: linear-gradient(to bottom, #EDF9FA 0, #fff 0.5rem);
        z-index: 0;
      }
    }



    /* 让卡片内所有内容在渐变之上 */
    > * {
      position: relative;
      z-index: 1;
    }
  }

  // ---- 原文编辑 textarea ----
  &__textarea {
    width: 100%;
    min-height: 0.6rem;
    font-size: 0.13rem;
    color: $text-dark;
    line-height: 1.8;
    border: none;
    outline: none;
    resize: none;
    overflow: hidden;
    background: transparent;
    font-family: inherit;
    box-sizing: border-box;
    padding: 0;
    field-sizing: content;

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

  // ---- AI 润色结果区 ----
  &__ai-section {
    margin-top: 0.12rem;
  }

  &__ai-label {
    font-size: 0.13rem;
    font-weight: 600;
    color: $accent;
    margin: 0 0 0.08rem 0;
    display: flex;
    align-items: flex-start;
  }

  &__ai-text {
    font-size: 0.13rem;
    color: $text-dark;
    line-height: 1.8;
    margin: 0;
    white-space: pre-wrap;
    word-break: break-all;
  }

  // ---- AI 操作按钮 ----
  &__ai-actions {
    display: flex;
    align-items: center;
    gap: 0.12rem;
    margin-top: 0.1rem;
  }

  &__action-btn {
    font-size: 0.12rem;
    font-weight: 500;
    border: 1px solid $accent;
    border-radius: 0.04rem;
    padding: 0.04rem 0.06rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.04rem;

    &--replace {
      color: #fff;
      background: $accent;

      &:hover {
      }
    }

    &--regenerate {
      color: $accent;
      background: $bg-white;

      &:hover {
        background: rgba($accent, 0.08);
      }
    }
  }

  // ---- 底部按钮区 ----
  &__footer {
    padding: 0.16rem 0.24rem;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.2rem;
    flex-shrink: 0;
    background: $bg-white;
    border-top: 1px solid $border-color;
  }

  &__footer-btn {
    padding: 0.1rem 0.3rem;
    font-size: 0.14rem;
    font-weight: 600;
    border-radius: 0.22rem;
    cursor: pointer;
    transition: all 0.2s;

    &--use-ai {
      color: $accent;
      background: $bg-white;
      border: 1px solid $accent;

      &:hover {
        background: rgba($accent, 0.08);
      }
    }

    &--save {
      color: $bg-white;
      background: $btn-dark;
      border: 1px solid $btn-dark;

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

// 抽屉滑入动画
.fix-all-drawer-slide-enter-active,
.fix-all-drawer-slide-leave-active {
  transition: transform 0.3s ease;
}
.fix-all-drawer-slide-enter-from,
.fix-all-drawer-slide-leave-to {
  transform: translateX(100%);
}
