/* Loading Animation Module CSS */
/* 로고 45도 회전 + 대각선 비 효과 로딩 화면 */

.loading-animation-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #d2d5dd; /* 웹페이지 배경색과 동일 */
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.loading-animation-container.visible {
    opacity: 1;
    pointer-events: auto;
}

/* 로고 컨테이너 */
.loading-logo-container {
    position: relative;
    z-index: 5; /* 메시지보다 낮게 설정 */
}

/* 로고 이미지 */
.loading-logo {
    width: 80px; /* 작게 조정 */
    height: auto;
    transform: rotate(45deg);
    animation: logo-pulse 2s ease-in-out infinite;
    filter: drop-shadow(0 10px 30px rgba(255, 69, 0, 0.3));
    opacity: 0.3; /* 살짝 투명하게 */
}

/* 로고 텍스트 대체 (이미지가 없을 경우) */
.loading-logo-text {
    font-size: 24px; /* 작게 조정 */
    font-weight: 900;
    color: #FF4500;
    transform: rotate(45deg);
    animation: logo-pulse 2s ease-in-out infinite;
    text-shadow: 0 10px 30px rgba(255, 69, 0, 0.3);
    font-family: 'Futura', 'Helvetica Neue', sans-serif;
    letter-spacing: 4px;
    opacity: 0.3; /* 살짝 투명하게 */
}

/* 로고 펄스 애니메이션 */
@keyframes logo-pulse {
    0%, 100% {
        transform: rotate(45deg) scale(1);
        filter: drop-shadow(0 10px 30px rgba(255, 69, 0, 0.3));
    }
    50% {
        transform: rotate(45deg) scale(1.05);
        filter: drop-shadow(0 15px 40px rgba(255, 69, 0, 0.5));
    }
}

/* 오로라 효과 컨테이너 */
.aurora-effect-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    pointer-events: none;
}

/* 오로라 레이어 */
.aurora-layer {
    position: absolute;
    width: 300%;
    height: 300%;
    top: -100%;
    left: -100%;
    opacity: 0.8;
    filter: blur(40px);
    mix-blend-mode: screen;
}

/* 첫 번째 오로라 웨이브 - 강렬한 주황 */
.aurora-layer:nth-child(1) {
    background: radial-gradient(ellipse at 30% 40%,
        rgba(255, 69, 0, 0.9) 0%,
        rgba(255, 100, 0, 0.6) 25%,
        rgba(255, 69, 0, 0.4) 50%,
        transparent 75%);
    animation: aurora-flow-1 4s ease-in-out infinite;
}

/* 두 번째 오로라 웨이브 - 밝은 주황 */
.aurora-layer:nth-child(2) {
    background: radial-gradient(ellipse at 70% 60%,
        rgba(255, 140, 0, 0.8) 0%,
        rgba(255, 100, 0, 0.5) 30%,
        rgba(255, 69, 0, 0.3) 60%,
        transparent 80%);
    animation: aurora-flow-2 5s ease-in-out infinite;
}

/* 세 번째 오로라 웨이브 - 깊은 주황 */
.aurora-layer:nth-child(3) {
    background: radial-gradient(ellipse at 50% 50%,
        rgba(255, 69, 0, 0.7) 0%,
        rgba(255, 90, 0, 0.5) 20%,
        rgba(255, 120, 0, 0.3) 45%,
        transparent 70%);
    animation: aurora-flow-3 6s ease-in-out infinite;
}

/* 네 번째 오로라 웨이브 - 추가 레이어 */
.aurora-layer:nth-child(4) {
    background: linear-gradient(45deg,
        transparent 0%,
        rgba(255, 69, 0, 0.6) 20%,
        rgba(255, 100, 0, 0.4) 40%,
        rgba(255, 69, 0, 0.6) 60%,
        transparent 100%);
    animation: aurora-flow-4 3s linear infinite;
}

/* 오로라 흐름 애니메이션 1 - 더 다이나믹 */
@keyframes aurora-flow-1 {
    0%, 100% {
        transform: rotate(0deg) scale(1.2) translate(0, 0);
        opacity: 0.6;
    }
    25% {
        transform: rotate(90deg) scale(1.5) translate(20%, -10%);
        opacity: 0.9;
    }
    50% {
        transform: rotate(180deg) scale(0.8) translate(-15%, 20%);
        opacity: 0.7;
    }
    75% {
        transform: rotate(270deg) scale(1.3) translate(10%, -15%);
        opacity: 0.8;
    }
}

/* 오로라 흐름 애니메이션 2 - 더 강렬 */
@keyframes aurora-flow-2 {
    0%, 100% {
        transform: rotate(-90deg) scale(1.3) translate(-10%, 0);
        opacity: 0.5;
    }
    33% {
        transform: rotate(-180deg) scale(1.6) translate(15%, -20%);
        opacity: 0.8;
    }
    66% {
        transform: rotate(-270deg) scale(0.9) translate(-20%, 15%);
        opacity: 0.6;
    }
}

/* 오로라 흐름 애니메이션 3 - 더 활동적 */
@keyframes aurora-flow-3 {
    0%, 100% {
        transform: rotate(45deg) scale(1) translate(10%, 10%);
        opacity: 0.4;
    }
    50% {
        transform: rotate(-135deg) scale(1.7) translate(-25%, -25%);
        opacity: 0.7;
    }
}

/* 오로라 흐름 애니메이션 4 - 선형 이동 */
@keyframes aurora-flow-4 {
    0% {
        transform: rotate(45deg) translateX(-100%);
        opacity: 0;
    }
    10% {
        opacity: 0.6;
    }
    90% {
        opacity: 0.6;
    }
    100% {
        transform: rotate(45deg) translateX(100%);
        opacity: 0;
    }
}

/* 로딩 메시지 - 화면 전체 중앙 배치 */
.loading-message {
    position: fixed; /* absolute 대신 fixed 사용 */
    top: 50vh; /* 뷰포트 높이의 50% */
    left: 50vw; /* 뷰포트 너비의 50% */
    transform: translate(-50%, -50%);
    font-size: 36px;
    color: #FFFFFF; /* 흰색으로 변경 */
    font-weight: 900;
    font-family: 'Futura', 'Helvetica Neue', 'Arial Black', sans-serif;
    letter-spacing: 5px;
    text-transform: uppercase;
    text-shadow: none; /* 섀도우 제거 */
    animation: message-pulse 2s ease-in-out infinite;
    z-index: 1000000; /* 매우 높은 z-index */
    pointer-events: none;
    white-space: nowrap;
}

@keyframes message-pulse {
    0%, 100% {
        opacity: 0.8;
        transform: translate(-50%, -50%) scale(1);
    }
    50% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.05);
    }
}

/* 프로그레스 바 (선택적) */
.loading-progress {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    width: 200px;
    height: 2px;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 2px;
    overflow: hidden;
}

.loading-progress-bar {
    height: 100%;
    background: #FF4500;
    width: 0;
    transition: width 0.3s ease;
    border-radius: 2px;
}

/* 다크 테마 지원 */
.loading-animation-container.dark-theme {
    background: #1a1a1a;
}

.loading-animation-container.dark-theme .loading-message {
    color: #999;
}

.loading-animation-container.dark-theme .loading-progress {
    background: rgba(255, 255, 255, 0.1);
}

/* 커스텀 색상 변수 */
.loading-animation-container.custom-color {
    --primary-color: #FF4500;
    --bg-color: #d2d5dd;
}

.loading-animation-container.custom-color .loading-logo-text,
.loading-animation-container.custom-color .loading-progress-bar {
    color: var(--primary-color);
    background: var(--primary-color);
}

.loading-animation-container.custom-color {
    background: var(--bg-color);
}

/* 반응형 디자인 */
@media (max-width: 768px) {
    .loading-logo {
        width: 120px;
    }

    .loading-logo-text {
        font-size: 36px;
        letter-spacing: 6px;
    }

    .loading-message {
        font-size: 12px;
        letter-spacing: 1px;
    }

    .loading-progress {
        width: 150px;
    }
}

/* 애니메이션 퍼포먼스 최적화 */
@media (prefers-reduced-motion: reduce) {
    .loading-logo,
    .loading-logo-text {
        animation: none;
        transform: rotate(45deg);
    }

    .rain-drop {
        animation: none;
        display: none;
    }

    .loading-message {
        animation: none;
        opacity: 1;
    }
}

/* 페이드 아웃 애니메이션 */
.loading-animation-container.fade-out {
    animation: loading-fade-out 0.5s ease forwards;
}

@keyframes loading-fade-out {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
        pointer-events: none;
    }
}

/* 라이트박스 내부에서 사용될 때 */
#lightbox-of-project-container .loading-animation-container,
.lightbox-main .loading-animation-container {
    position: absolute;
    border-radius: 0;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* lightbox-main 내부에서 보장 */
.lightbox-main {
    position: relative !important; /* Position context for loading animation */
}

.lightbox-main .loading-animation-container {
    z-index: 100001 !important; /* Above lightbox content */
}

/* 라이트박스 내부의 로딩 메시지는 화면 중앙에 고정 */
.lightbox-main .loading-message,
#lightbox-of-project-container .loading-message {
    position: fixed !important;
    top: 50vh !important;
    left: 50vw !important;
}

/* 스크롤 복원 시 사용 */
.loading-animation-container.scroll-restore {
    background: linear-gradient(135deg, rgba(245, 245, 245, 0.98) 0%, rgba(224, 224, 224, 0.98) 100%);
    backdrop-filter: blur(10px);
}

/* 빠른 애니메이션 모드 */
.loading-animation-container.quick-mode .rain-drop {
    animation-duration: 0.4s !important;
}

.loading-animation-container.quick-mode .loading-logo,
.loading-animation-container.quick-mode .loading-logo-text {
    animation-duration: 1s;
}