[data-ai-loading-layer]{
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(17, 24, 39, 0.45);
    z-index: 9999;
}

[data-ai-loading-layer].is_active{
    display: flex;
}

.ai_loading_box{
    min-width: 320px;
    max-width: 420px;
    padding: 28px 32px;
    border-radius: 18px;
    background: #ffffff;
    box-shadow: 0 18px 48px rgba(15, 23, 42, 0.22);
    text-align: center;
}

.ai_loading_spinner{
    width: 42px;
    height: 42px;
    margin: 0 auto 18px;
    border: 4px solid #dbe3f0;
    border-top-color: #2563eb;
    border-radius: 50%;
    animation: aiLoadingSpin 0.8s linear infinite;
}

.ai_loading_step{
    font-size: 18px;
    font-weight: 700;
    color: #111827;
}

.ai_loading_message{
    margin-top: 10px;
    font-size: 14px;
    line-height: 1.6;
    color: #4b5563;
}

@keyframes aiLoadingSpin{
    from{
        transform: rotate(0deg);
    }

    to{
        transform: rotate(360deg);
    }
}

.ai_button{
    display: flex;
    flex-direction: row;
    gap: 5px;
    align-content: center;
    justify-content: center;
    align-items: center;

    &.m_button{ height: 37px; }

    /* &::after{ content: 'AI 작성'; } */

    & .icon{
        height: 22px;
        display: flex;
        align-content: center;
        justify-content: center;
        align-items: center;

        /* & > img{
            height: 70%; 
            width: auto; 
            object-fit: contain; 
            flex-shrink: 0;
        } */
    }

    & img[src="/img_work/icon_faq.png"]{ margin-bottom: -3px !important; }
}

.ai_textarea_wrap {
  position: relative;
  display: inline-block;
  width: 100%;
  height: 100%;
}

.ai_refining_button {
  position: absolute;
  display: flex;
  align-content: center;
  justify-content: center;
  align-items: center;
  right: 5px;
  bottom: 5px;
  z-index: 2; /* ::before, ::after 적용 위함 */
  border: 0;  
  padding: 0; 
  background: transparent; /* 배경은 ::after에서 제어 */
  color: #fff;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  /* 기본 상태 : 아이콘 크기 만큼 */
  height: 15px;
  width: 23px;
  border-radius: 3px;

  /* 🌈 Glow 애니메이션 배경 */
  &::before {
    content: '';
    background: linear-gradient(45deg, #ff0000, #ff7300, #fffb00, #48ff00, #00ffd5, #002bff, #7a00ff, #ff00c8, #ff0000);
    position: absolute;
    top: -2px;
    left: -2px;
    background-size: 400%;
    z-index: -2;
    filter: blur(3px);
    width: calc(100% + 4px);
    height: calc(100% + 4px);
    animation: glowing 20s linear infinite;
    opacity: 1; /* opacity를 1로 고정하여 항상 on */  
    border-radius: inherit; /* 버튼 모양(원형/타원형)을 그대로 따라감 */
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  }

  /* ⬛ 내부 배경 덮개 (가운데를 덮어 테두리만 빛나게 만듦) */
  &::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    background: #fff;   
    left: 0;
    top: 0;
    border-radius: inherit;
    z-index: -1; /* Glow(::before)보다는 앞, 아이콘보다는 뒤에 배치 */
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  }

  /* 마우스 오버 */
  &:hover {
    padding: 8px 12px;
    height: auto;
    width: fit-content;
    border-radius: 999px;

    &::after {
      background: #01696f; 
    }

    & .text {
      max-width: 60px; 
      opacity: 1;
      margin-left: 5px;     
    }
  }

  & .icon {
    flex-shrink: 0; 
    z-index: 1;
  }

  & .text {
    max-width: 0;
    opacity: 0;
    overflow: hidden;
    white-space: nowrap; 
    margin-left: 0; 
    z-index: 1;
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  }
}

/* 애니메이션 키프레임 */
@keyframes glowing {
  0% { background-position: 0 0; }
  50% { background-position: 400% 0; }
  100% { background-position: 0 0; }
}