@use '../variables' as *;
@use 'sass:color';

// ==================== 个人资料编辑抽屉 ====================

// 遮罩层
.profile-drawer-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: $overlay-bg;
  z-index: 2000;
}

// 抽屉主体 — 固定在右侧，占满屏幕高度
// 重置 font-size + line-height 避免 html font-size:100px 导致行高撑大间距
.profile-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: 6.2rem;
  height: 100vh;
  background: $bg-white;
  z-index: 2001;
  box-shadow: -0.04rem 0 0.2rem rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  font-size: 14px;
  line-height: 1.5;

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

  &__close-btn {
    background: none;
    border: none;
    padding: 0.04rem;
    cursor: pointer;
    color: $text-dark;
    display: flex;
    align-items: center;
    border-radius: 0.04rem;
    transition: all 0.2s;

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

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

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

  // 表单内容区 — 中间可滚动
  &__body {
    flex: 1;
    overflow-y: auto;
    padding: 0.2rem 0.2rem 3rem;

    // 地区选择器下拉面板提升层级，避免被其他元素遮挡
    .region-selector__panel {
      z-index: 2100;
    }
  }

  // 单个字段
  &__field {
    margin-bottom: 0.18rem;
  }

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

  &__required {
    color: $danger;
    margin-right: 0.02rem;
  }

  &__input {
    width: 100%;
    box-sizing: border-box;
    padding: 0.1rem 0.14rem;
    font-size: 0.13rem;
    color: $text-dark;
    background: $bg-main;
    border: 1px solid transparent;
    border-radius: 0.06rem;
    outline: none;
    transition: all 0.2s;

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

    &:focus {
      border-color: $accent;
      background: $bg-white;
    }
  }

  // 多行文本输入框（经历描述等）
  &__textarea {
    width: 100%;
    box-sizing: border-box;
    padding: 0.1rem 0.14rem;
    font-size: 0.13rem;
    color: $text-dark;
    background: $bg-main;
    border: 1px solid transparent;
    border-radius: 0.06rem;
    outline: none;
    transition: all 0.2s;
    resize: vertical;
    font-family: inherit;
    line-height: 1.6;

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

    &:focus {
      border-color: $accent;
      background: $bg-white;
    }

    // 矮版 textarea — 用于分段描述，右侧留出删除按钮空间
    &--short {
      padding-right: 0.36rem;
    }
  }

  // ==================== 描述段落编辑 ====================

  // 单条描述段落容器 — textarea + 右侧删除按钮
  &__desc-item {
    position: relative;
    margin-bottom: 0.08rem;
  }

  // 描述段落内的删除按钮（叉号）
  &__desc-remove {
    position: absolute;
    right: 0.18rem;
    top: 0.08rem;
    background: none;
    border: none;
    padding: 0.02rem;
    cursor: pointer;
    color: $text-light;
    display: flex;
    align-items: center;
    border-radius: 0.03rem;
    transition: all 0.2s;

    &:hover {
      color: $danger;
    }
  }

  &__desc-remove-icon {
    width: 0.12rem;
    height: 0.12rem;
  }

  // 小号新增按钮 — 用于"新增一段描述"
  &__add-btn--small {
    font-size: 0.11rem;
    padding: 0.04rem 0.12rem;
    margin-top: 0.04rem;
    margin-bottom: 0;
  }

  // 空状态占位
  &__empty {
    text-align: center;
    padding: 0.6rem 0;
  }

  &__empty-text {
    font-size: 0.14rem;
    color: $text-light;
  }

  // ==================== 教育经历模块 ====================

  // 单条教育经历卡片
  &__edu-card {
    padding-bottom: 0.2rem;
    margin-bottom: 0.2rem;
    border-bottom: 1px solid $border-color;

    &:last-of-type {
      border-bottom: none;
    }
  }

  // 教育经历标题栏
  &__edu-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.14rem;
  }

  // 序号标识
  &__edu-index {
    display: flex;
    align-items: center;
    gap: 0.06rem;
    font-size: 0.14rem;
    font-weight: 600;
    color: $text-dark;
  }

  &__edu-index-icon {
    width: 0.1rem;
    height: 0.1rem;
    color: $accent;
  }

  // 删除按钮
  &__edu-delete {
    background: none;
    border: none;
    padding: 0.04rem;
    cursor: pointer;
    color: $text-light;
    display: flex;
    align-items: center;
    border-radius: 0.04rem;
    transition: all 0.2s;

    &:hover {
      color: $danger;
      background: rgba($danger, 0.06);
    }
  }

  &__edu-delete-icon {
    width: 0.15rem;
    height: 0.15rem;
  }

  // 横排字段容器（学院+专业、学历+GPA、入学+毕业时间）
  &__row {
    display: flex;
    gap: 0.12rem;
  }

  // 半宽字段
  &__field--half {
    flex: 1;
    min-width: 0;
  }

  // 下拉选择器包裹（带箭头图标）
  &__select-wrap {
    position: relative;
  }

  &__select-wrap &__input {
    padding-right: 0.3rem;
  }

  &__select-arrow {
    position: absolute;
    right: 0.1rem;
    top: 50%;
    transform: translateY(-50%);
    width: 0.12rem;
    height: 0.12rem;
    color: $text-light;
    pointer-events: none;
  }

  // 新增教育经历按钮
  &__add-btn {
    text-align: center;
    background: none;
    border: 1px solid $border-color;
    border-radius: 0.2rem;
    padding: 0.06rem 0.16rem;
    font-size: 0.12rem;
    color: $text-dark;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 0.04rem;

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

  &__add-icon {
    font-size: 0.14rem;
    font-weight: 600;
  }

  // ==================== 日期选择器样式覆盖 ====================
  // Element Plus 的 el-date-picker 在 html font-size:100px 下需要用 px 还原

  &__date-picker {
    width: 100% !important;

    .el-input__wrapper {
      background: $bg-main !important;
      border: 1px solid transparent !important;
      border-radius: 6px !important;
      box-shadow: none !important;
      padding: 4px 12px !important;
      font-size: 13px !important;
      line-height: 1.5 !important;
      height: auto !important;

      &:hover {
        border-color: $border-color !important;
      }

      &.is-focus {
        border-color: $accent !important;
        background: $bg-white !important;
      }
    }

    .el-input__inner {
      font-size: 13px !important;
      color: $text-dark !important;
      height: auto !important;
      line-height: 1.5 !important;

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

    .el-input__prefix,
    .el-input__suffix {
      font-size: 14px !important;
    }

    .el-input__icon {
      width: 14px !important;
      height: 14px !important;
      font-size: 14px !important;
    }
  }

  // ==================== 技能模块 ====================

  // 技能标签列表容器
  &__skills-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.08rem;
    margin-bottom: 0.2rem;
    min-height: 0.4rem;
  }

  // 单个技能标签
  &__skill-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.06rem;
    padding: 0.06rem 0.1rem 0.06rem 0.14rem;
    background: $bg-main;
    border-radius: 0.16rem;
    font-size: 0.13rem;
    color: $text-dark;
    transition: all 0.2s;

    &:hover {
      background: color.adjust($bg-main, $lightness: -3%);
    }
  }

  // 技能标签文本
  &__skill-text {
    line-height: 1.4;
  }

  // 技能标签删除按钮
  &__skill-remove {
    background: none;
    border: none;
    padding: 0.02rem;
    cursor: pointer;
    color: $text-light;
    display: flex;
    align-items: center;
    border-radius: 50%;
    transition: all 0.2s;

    &:hover {
      color: $danger;
      background: rgba($danger, 0.1);
    }
  }

  &__skill-remove-icon {
    width: 0.12rem;
    height: 0.12rem;
  }

  // 底部保存按钮
  &__footer {
    padding: 0.16rem 0.2rem;
    border-top: 1px solid $border-color;
    text-align: center;
    flex-shrink: 0;
  }

  &__save-btn {
    width: 2.0rem;
    padding: 0.1rem 0;
    font-size: 0.14rem;
    font-weight: 600;
    color: $bg-white;
    background: $btn-dark;
    border: none;
    border-radius: 0.24rem;
    cursor: pointer;
    transition: all 0.2s;

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

// ==================== 过渡动画 ====================

// 日期选择器弹出面板样式覆盖（teleport 到 body，需在全局作用域）
.profile-drawer-date-popper {
  font-size: 14px !important;
  line-height: 1.5 !important;

  .el-date-picker {
    font-size: 14px !important;
  }

  .el-picker-panel__body {
    font-size: 14px !important;
  }

  .el-date-picker__header {
    font-size: 14px !important;
  }

  .el-month-table td .cell {
    font-size: 13px !important;
    padding: 8px 0 !important;
  }
}

// 遮罩层淡入淡出
.profile-drawer-overlay-enter-active,
.profile-drawer-overlay-leave-active {
  transition: opacity 0.3s ease;
}

.profile-drawer-overlay-enter-from,
.profile-drawer-overlay-leave-to {
  opacity: 0;
}

// 抽屉滑入滑出
.profile-drawer-slide-enter-active,
.profile-drawer-slide-leave-active {
  transition: transform 0.3s ease;
}

.profile-drawer-slide-enter-from,
.profile-drawer-slide-leave-to {
  transform: translateX(100%);
}
