/* =================================
   관리자 스피너(로딩) 공통 스타일
   ================================= */

/* 전체 화면 오버레이 스피너 */
.admin-spinner-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease;
}

.admin-spinner-overlay.show {
  opacity: 1;
  visibility: visible;
}

/* 모달 내부용 스피너 */
.admin-spinner-modal {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  border-radius: 0.375rem;
}

/* 인라인 스피너 (버튼 내부 등) */
.admin-spinner-inline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* 스피너 컨테이너 */
.admin-spinner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
  background: #ffffff;
  padding: 2.5rem 3rem;
  border-radius: 1rem;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
  min-width: 200px;
  animation: spinner-appear 0.2s ease;
}

@keyframes spinner-appear {
  from {
    transform: scale(0.9);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

/* 스피너 애니메이션 - 타입 1: 회전하는 원 */
.admin-spinner-circle {
  width: 50px;
  height: 50px;
  border: 4px solid #e9ecef;
  border-top: 4px solid #0d6efd;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.admin-spinner-circle.sm {
  width: 20px;
  height: 20px;
  border-width: 2px;
}

.admin-spinner-circle.lg {
  width: 70px;
  height: 70px;
  border-width: 5px;
}

/* 스피너 애니메이션 - 타입 2: 점들이 튀는 애니메이션 */
.admin-spinner-dots {
  display: flex;
  gap: 4px;
}

.admin-spinner-dots .dot {
  width: 8px;
  height: 8px;
  background: #007bff;
  border-radius: 50%;
  animation: bounce 1.4s ease-in-out infinite both;
}

.admin-spinner-dots .dot:nth-child(1) { animation-delay: -0.32s; }
.admin-spinner-dots .dot:nth-child(2) { animation-delay: -0.16s; }
.admin-spinner-dots .dot:nth-child(3) { animation-delay: 0s; }

/* 스피너 애니메이션 - 타입 3: 펄스 */
.admin-spinner-pulse {
  width: 40px;
  height: 40px;
  background: #007bff;
  border-radius: 50%;
  animation: pulse 2s ease-in-out infinite;
}

.admin-spinner-pulse.sm {
  width: 20px;
  height: 20px;
}

.admin-spinner-pulse.lg {
  width: 60px;
  height: 60px;
}

/* 스피너 텍스트 */
.admin-spinner-text {
  color: #495057;
  font-size: 1rem;
  font-weight: 500;
  text-align: center;
  line-height: 1.5;
  letter-spacing: -0.01em;
}

/* 오버레이 내부 스피너는 흰색 배경 카드이므로 텍스트도 어두운 색 유지 */
.admin-spinner-overlay .admin-spinner-text {
  color: #495057;
}

/* 버튼 내부 스피너 */
.btn .admin-spinner-inline {
  margin-right: 0.5rem;
}

.btn .admin-spinner-circle.sm {
  width: 16px;
  height: 16px;
  border-width: 2px;
  border-color: currentColor transparent currentColor currentColor;
}

/* 테이블 로딩 스피너 */
.admin-table-spinner {
  position: relative;
}

.admin-table-spinner::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

/* 애니메이션 정의 */
@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes bounce {
  0%, 80%, 100% { 
    transform: scale(0);
    opacity: 0.5;
  } 
  40% { 
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes pulse {
  0% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.2);
    opacity: 0.7;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

/* 색상 변형 */
.admin-spinner-success .admin-spinner-circle {
  border-top-color: #198754;
}

.admin-spinner-success .admin-spinner-dots .dot,
.admin-spinner-success .admin-spinner-pulse {
  background: #198754;
}

.admin-spinner-warning .admin-spinner-circle {
  border-top-color: #ffc107;
}

.admin-spinner-warning .admin-spinner-dots .dot,
.admin-spinner-warning .admin-spinner-pulse {
  background: #ffc107;
}

.admin-spinner-danger .admin-spinner-circle {
  border-top-color: #dc3545;
}

.admin-spinner-danger .admin-spinner-dots .dot,
.admin-spinner-danger .admin-spinner-pulse {
  background: #dc3545;
}

/* 반응형 */
@media (max-width: 991.98px) {
  .admin-spinner {
    padding: 2rem 2.5rem;
    min-width: 180px;
  }

  .admin-spinner-circle {
    width: 45px;
    height: 45px;
    border-width: 4px;
  }

  .admin-spinner-pulse {
    width: 45px;
    height: 45px;
  }

  .admin-spinner-text {
    font-size: 0.95rem;
  }
}

@media (max-width: 575.98px) {
  .admin-spinner {
    padding: 1.75rem 2rem;
    min-width: 160px;
  }

  .admin-spinner-circle {
    width: 40px;
    height: 40px;
    border-width: 3px;
  }

  .admin-spinner-text {
    font-size: 0.9rem;
  }
}

/**
 * 스피너 시스템 CSS
 */

/* Bootstrap 스피너 기본 스타일 확장 */
.spinner-border-sm {
  width: 1rem;
  height: 1rem;
}

.spinner-border-xs {
  width: 0.75rem;
  height: 0.75rem;
}

/* 인라인 스피너 */
.spinner-inline {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

/* 텍스트와 함께 사용되는 스피너 */
.spinner-with-text {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 1rem;
}

.spinner-with-text .spinner-text {
  font-size: 0.875rem;
  color: #6c757d;
}

/* 전체 화면 스피너 오버레이 */
.spinner-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.spinner-overlay-dark {
  background: rgba(0, 0, 0, 0.5);
}

.spinner-overlay-dark .spinner-border {
  color: #ffffff;
}

/* 페이지 로딩 스피너 */
.page-loading {
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 1rem;
}

.page-loading .spinner-border {
  width: 3rem;
  height: 3rem;
}

.page-loading .loading-text {
  font-size: 1rem;
  color: #6c757d;
}

/* 컨테이너 로딩 스피너 */
.container-loading {
  position: relative;
  min-height: 100px;
}

.container-loading .spinner-overlay {
  position: absolute;
  border-radius: inherit;
}

/* 애니메이션 */
@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.spinner-fade-in {
  animation: fade-in 0.3s ease-in-out;
}
