/* 식자재코리아 공용 로딩: #171c61 남색 + #e1670a 작은 강조선 */
/* =========================================================
   공용 LoadingOverlay.show()/hide()
   긴 작업: 아주 약한 블러 / 연한 배경 / 무카드 / 큰 안내 문구
   전용 CSS만 사용하며 구형 로딩 클래스는 더 이상 정의하지 않습니다.
========================================================= */
body #common-loading-overlay[hidden],
body #common-loading-overlay .common-loading__cancel[hidden] {
  display: none !important;
}
body #common-loading-overlay,
body #common-loading-overlay * {
  box-sizing: border-box;
}
body #common-loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 2147483647;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 30px 16px;
  /* background: rgba(245, 248, 252, 0.35); */
  -webkit-backdrop-filter: blur(2px) saturate(1);
  backdrop-filter: blur(2px) saturate(1);
  text-align: center;
}
body #common-loading-overlay .common-loading__panel {
  width: 100%;
  max-width: 600px;
  min-height: 0;
  max-height: none;
  padding: 0;
  overflow: visible;
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  font-family: "Pretendard", "Noto Sans KR", sans-serif;
  color: var(--foodn-primary, #171c61);
}
/* 문구 주변만 부드럽게 밝힙니다. 카드처럼 사각 테두리가 생기지 않게 방사형으로 처리. */
body #common-loading-overlay .common-loading__panel::before {
  content: "";
  position: absolute;
  inset: -100px -100px;
  z-index: -1;
  pointer-events: none;
  /* closest-side: 사각형 경계에 닿기 전 투명하게 사라져 잘림 방지 */
  background: radial-gradient(
    ellipse closest-side at center,
    rgba(255, 255, 255, 0.96) 0%,
    rgba(255, 255, 255, 0.87) 37%,
    rgba(255, 255, 255, 0.68) 53%,
    rgba(255, 255, 255, 0.32) 69%,
    rgba(255, 255, 255, 0) 87%
  );
}
body #common-loading-overlay .common-loading__spinner {
  width: 62px;
  height: 62px;
  margin: 0 auto 18px;
  border: 6px solid rgba(23, 28, 97, 0.14);
  border-top-color: var(--foodn-primary, #171c61);
  border-right-color: var(--foodn-primary, #171c61);
  border-radius: 50%;
  animation: foodnine-loading-spin 1.05s linear infinite;
}
body #common-loading-overlay .common-loading__message {
  display: block;
  width: 100%;
  margin: 0;
  font-size: 24px;
  font-weight: 750;
  line-height: 1.5;
  letter-spacing: 0.02em;
  color: #262d56;
  white-space: pre-line;
  word-break: keep-all;
  /* 글씨 바로 주위는 흰 테두리, 바깥에는 넓은 흰 후광 */
  text-shadow:
    -1.5px -1.5px 0 #fff,
    0 -1.5px 0 #fff,
    1.5px -1.5px 0 #fff,
    -1.5px 0 0 #fff,
    1.5px 0 0 #fff,
    -1.5px 1.5px 0 #fff,
    0 1.5px 0 #fff,
    1.5px 1.5px 0 #fff,
    0 0 8px rgba(255, 255, 255, 1),
    0 0 18px rgba(255, 255, 255, 0.97),
    0 0 28px rgba(255, 255, 255, 0.78);
  -webkit-text-stroke: 0;
}
/* 기본 두 줄 메시지의 첫 줄만 더 크게: JS/HTML 수정 없이 v7 시안 재현 */
body #common-loading-overlay .common-loading__message::first-line {
  font-size: 36px;
  font-weight: 800;
  line-height: 1.4;
  letter-spacing: 0.025em;
  color: var(--foodn-primary, #171c61);
  /* 큰 제목도 넓은 흰 후광으로 대비 강화 */
  text-shadow:
    -2px -2px 0 #fff,
    0 -2px 0 #fff,
    2px -2px 0 #fff,
    -2px 0 0 #fff,
    2px 0 0 #fff,
    -2px 2px 0 #fff,
    0 2px 0 #fff,
    2px 2px 0 #fff,
    0 0 10px rgba(255, 255, 255, 1),
    0 0 20px rgba(255, 255, 255, 0.98),
    0 0 30px rgba(255, 255, 255, 0.82);
  -webkit-text-stroke: 0;
}
/* 스피너는 남색 단색, 주황은 작은 하단 포인트로만 사용 */
body #common-loading-overlay .common-loading__message::after {
  content: "";
  display: block;
  width: 32px;
  height: 3px;
  margin: 18px auto 0;
  background: var(--foodn-accent, #e1670a);
  border-radius: 999px;
}
body #common-loading-overlay .common-loading__cancel {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 32px;
  height: 32px;
  margin-top: 17px;
  padding: 5px 13px;
  border: 1px solid #8990c3;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 1px 4px rgba(24, 47, 66, 0.1);
  color: var(--foodn-primary, #171c61);
  font:
    650 12px "Pretendard",
    "Noto Sans KR",
    sans-serif;
  line-height: 20px;
  cursor: pointer;
  text-shadow: none;
}
body #common-loading-overlay .common-loading__cancel:hover {
  background: #fff;
  border-color: var(--foodn-primary, #171c61);
}
body #common-loading-overlay .common-loading__cancel:disabled {
  opacity: 0.5;
  cursor: default;
}
body #common-loading-overlay .common-loading__cancel:focus-visible {
  outline: 3px solid var(--foodn-accent, #e1670a);
  outline-offset: 3px;
}

/* 짧은 작업은 해당 버튼 내부 스피너로 표시: 기존 버튼 색상 유지 */
button.common-loading-button--busy,
input[type="button"].common-loading-button--busy {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: wait !important;
  opacity: 0.8;
}
.common-loading-button__spinner {
  display: inline-block;
  flex: none;
  width: 16px;
  height: 16px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: foodnine-loading-spin 0.8s linear infinite;
}
.common-loading-button__label {
  white-space: nowrap;
}

/* 텍스트 옆 미니 스피너: showMini()/hideMini()로 필요한 위치에만 표시 */
.common-loading-mini__spinner {
  display: inline-block;
  box-sizing: border-box;
  width: 15px;
  height: 15px;
  margin-left: 8px;
  vertical-align: -2px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: foodnine-loading-spin 0.8s linear infinite;
}

@keyframes foodnine-loading-spin {
  to {
    transform: rotate(360deg);
  }
}
@media (max-width: 620px) {
  body #common-loading-overlay .common-loading__spinner {
    width: 56px;
    height: 56px;
  }
  body #common-loading-overlay .common-loading__message {
    font-size: 20px;
  }
  body #common-loading-overlay .common-loading__message::first-line {
    font-size: 30px;
  }
}
@media (max-height: 440px) {
  body #common-loading-overlay .common-loading__spinner {
    width: 44px;
    height: 44px;
    margin-bottom: 10px;
  }
  body #common-loading-overlay .common-loading__message {
    font-size: 18px;
  }
  body #common-loading-overlay .common-loading__message::first-line {
    font-size: 26px;
  }
  body #common-loading-overlay .common-loading__cancel {
    margin-top: 10px;
  }
}
@media (prefers-reduced-motion: reduce) {
  body #common-loading-overlay .common-loading__spinner,
  .common-loading-button__spinner,
  .common-loading-mini__spinner {
    animation-duration: 2.5s;
  }
}
