/**
 * 로딩바 공통 스타일
 */

/* 전체 화면 로딩 오버레이 */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    backdrop-filter: blur(2px);
}

/* 로딩 컨테이너 */
.loading-container {
    background: white;
    border-radius: 8px;
    padding: 30px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    text-align: center;
    min-width: 200px;
}

/* 로딩 스피너 */
.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

/* 로딩 텍스트 */
.loading-text {
    color: #333;
    font-size: 14px;
    font-weight: 500;
    margin: 0;
}

/* 버튼 로딩 상태 */
.btn-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.7;
}

.btn-loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.btn-loading .btn-text {
    opacity: 0;
}

/* 인라인 로딩 */
.inline-loading {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 8px;
}

/* 작은 로딩 스피너 */
.loading-spinner-sm {
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* 큰 로딩 스피너 */
.loading-spinner-lg {
    width: 60px;
    height: 60px;
    border: 6px solid #f3f3f3;
    border-top: 6px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* 펄스 애니메이션 */
.loading-pulse {
    width: 40px;
    height: 40px;
    background-color: #007bff;
    border-radius: 50%;
    animation: pulse 1.5s ease-in-out infinite;
    margin: 0 auto 15px;
}

/* 도트 로딩 */
.loading-dots {
    display: inline-block;
}

.loading-dots::after {
    content: '';
    animation: dots 1.5s steps(5, end) infinite;
}

/* 프로그레스 바 */
.loading-progress {
    width: 100%;
    height: 4px;
    background-color: #f3f3f3;
    border-radius: 2px;
    overflow: hidden;
    margin: 15px 0;
}

.loading-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #007bff, #0056b3);
    border-radius: 2px;
    animation: progress 2s ease-in-out infinite;
}

/* 컨테이너 내 로딩 */
.container-loading {
    position: relative;
}

.container-loading::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.container-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    margin-left: -20px;
    margin-top: -20px;
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    z-index: 1001;
}

/* 애니메이션 키프레임 */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes pulse {
    0% {
        transform: scale(0.8);
        opacity: 1;
    }
    50% {
        transform: scale(1.2);
        opacity: 0.5;
    }
    100% {
        transform: scale(0.8);
        opacity: 1;
    }
}

@keyframes dots {
    0%, 20% {
        color: rgba(0,0,0,0);
        text-shadow: .25em 0 0 rgba(0,0,0,0),
                     .5em 0 0 rgba(0,0,0,0);
    }
    40% {
        color: black;
        text-shadow: .25em 0 0 rgba(0,0,0,0),
                     .5em 0 0 rgba(0,0,0,0);
    }
    60% {
        text-shadow: .25em 0 0 black,
                     .5em 0 0 rgba(0,0,0,0);
    }
    80%, 100% {
        text-shadow: .25em 0 0 black,
                     .5em 0 0 black;
    }
}

@keyframes progress {
    0% {
        width: 0%;
        transform: translateX(0);
    }
    50% {
        width: 70%;
        transform: translateX(0);
    }
    100% {
        width: 100%;
        transform: translateX(100%);
    }
}

/* 다크 테마 */
.loading-overlay.dark {
    background-color: rgba(0, 0, 0, 0.8);
}

.loading-overlay.dark .loading-container {
    background: #2d3748;
    color: white;
}

.loading-overlay.dark .loading-text {
    color: white;
}

/* 커스텀 색상 */
.loading-spinner.success {
    border-top-color: #28a745;
}

.loading-spinner.warning {
    border-top-color: #ffc107;
}

.loading-spinner.danger {
    border-top-color: #dc3545;
}

.loading-spinner.info {
    border-top-color: #17a2b8;
}

/* 토스트 스타일 */
.loading-toast {
    position: fixed;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 12px 16px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    z-index: 10000;
    opacity: 0;
    transform: translateY(-20px);
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.loading-toast.show {
    opacity: 1;
    transform: translateY(0);
}

.loading-toast-top-right {
    top: 20px;
    right: 20px;
}

.loading-toast-top-left {
    top: 20px;
    left: 20px;
}

.loading-toast-bottom-right {
    bottom: 20px;
    right: 20px;
}

.loading-toast-bottom-left {
    bottom: 20px;
    left: 20px;
}

/* 로고 4분할 로딩 */
.logo-loading-container {
    position: relative;
    display: inline-block;
    width: 200px;
    height: 200px;
}

.logo-loading-image {
    width: 100%;
    height: 100%;
    background-image: url('../images/common/logo/loading_logo.jpg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    position: relative;
    border-radius: 8px;
    overflow: hidden;
}

/* 4개 영역 오버레이 */
.logo-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.logo-loading-overlay .overlay-quadrant {
    position: absolute;
    background-color: rgba(0, 0, 0, 0.6);
    transition: background-color 0.5s ease;
}

/* 좌상단 (1분면) */
.logo-loading-overlay .overlay-quad-1 {
    top: 0;
    left: 0;
    width: 50%;
    height: 50%;
}

/* 우상단 (2분면) */
.logo-loading-overlay .overlay-quad-2 {
    top: 0;
    right: 0;
    width: 50%;
    height: 50%;
}

/* 좌하단 (3분면) */
.logo-loading-overlay .overlay-quad-3 {
    bottom: 0;
    left: 0;
    width: 50%;
    height: 50%;
}

/* 우하단 (4분면) */
.logo-loading-overlay .overlay-quad-4 {
    bottom: 0;
    right: 0;
    width: 50%;
    height: 50%;
}

/* 각 단계별 활성화 (dim 해제) - 시계 방향 */
.logo-loading-step-1 .overlay-quad-1 {
    background-color: transparent;
}

.logo-loading-step-2 .overlay-quad-2 {
    background-color: transparent;
}

.logo-loading-step-3 .overlay-quad-4 {
    background-color: transparent;
}

.logo-loading-step-4 .overlay-quad-3 {
    background-color: transparent;
}

/* 로고 로딩 텍스트 */
.logo-loading-text {
    position: absolute;
    bottom: -30px;
    left: 50%;
    transform: translateX(-50%);
    color: #333;
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
}

/* 로고 로딩 전체 화면 오버레이 */
.logo-loading-fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.9);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    backdrop-filter: blur(2px);
}

.logo-loading-fullscreen .logo-loading-container {
    margin-bottom: 30px;
}

/* 로고 크기 변형 */
.logo-loading-sm {
    width: 100px;
    height: 100px;
}

.logo-loading-md {
    width: 150px;
    height: 150px;
}

.logo-loading-lg {
    width: 250px;
    height: 250px;
}

.logo-loading-xl {
    width: 300px;
    height: 300px;
}

/* 애니메이션 효과 */
.logo-loading-pulse {
    animation: logoPulse 1.5s ease-in-out infinite;
}

@keyframes logoPulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.05);
        opacity: 0.8;
    }
}

/* 반응형 */
@media (max-width: 768px) {
    .loading-container {
        margin: 20px;
        padding: 20px;
        min-width: auto;
    }
    
    .loading-spinner {
        width: 30px;
        height: 30px;
        border-width: 3px;
    }
    
    .loading-text {
        font-size: 13px;
    }
    
    .loading-toast {
        margin: 10px;
        padding: 10px 14px;
        font-size: 13px;
    }
    
    .loading-toast-top-right,
    .loading-toast-top-left {
        top: 10px;
    }
    
    .loading-toast-bottom-right,
    .loading-toast-bottom-left {
        bottom: 10px;
    }
    
    .logo-loading-container {
        width: 150px;
        height: 150px;
    }
    
    .logo-loading-fullscreen .logo-loading-container {
        width: 120px;
        height: 120px;
    }
    
    .logo-loading-text {
        font-size: 12px;
        bottom: -25px;
    }
}
