/* 載入中遮罩層 */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.9);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 0.3s ease-out;
}

.loading-overlay.hide {
    opacity: 0;
    pointer-events: none;
}

/* 載入中容器 */
.loading-container {
    text-align: center;
    padding: 20px;
}

/* 旋轉載入動畫 */
.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

/* 旋轉動畫 */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 載入文字 */
.loading-text {
    font-size: 16px;
    color: #666;
    margin-top: 10px;
    font-weight: 500;
}

/* 點點載入動畫 */
.loading-dots {
    display: inline-block;
}

.loading-dots::after {
    content: '';
    animation: dots 1.5s infinite;
}

@keyframes dots {
    0%, 20% { content: ''; }
    40% { content: '.'; }
    60% { content: '..'; }
    80%, 100% { content: '...'; }
}

/* 進度條樣式 */
.loading-progress {
    width: 200px;
    height: 4px;
    background-color: #f0f0f0;
    border-radius: 2px;
    margin: 15px auto 0;
    overflow: hidden;
}

.loading-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #007bff, #0056b3);
    width: 0%;
    border-radius: 2px;
    animation: progress 2s ease-in-out infinite;
}

@keyframes progress {
    0% { width: 0%; }
    50% { width: 70%; }
    100% { width: 100%; }
}

/* 脈衝載入動畫 */
.loading-pulse {
    width: 60px;
    height: 60px;
    background-color: #007bff;
    border-radius: 50%;
    margin: 0 auto 15px;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    50% {
        transform: scale(1.2);
        opacity: 1;
    }
    100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
}

/* 波浪載入動畫 */
.loading-wave {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0 auto 15px;
}

.loading-wave-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: #007bff;
    margin: 0 3px;
    animation: wave 1.4s ease-in-out infinite both;
}

.loading-wave-dot:nth-child(1) { animation-delay: -0.32s; }
.loading-wave-dot:nth-child(2) { animation-delay: -0.16s; }
.loading-wave-dot:nth-child(3) { animation-delay: 0s; }

@keyframes wave {
    0%, 80%, 100% {
        transform: scale(0);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* RWD 響應式設計 */
@media (max-width: 768px) {
    .loading-container {
        padding: 15px;
    }
    
    .loading-spinner {
        width: 40px;
        height: 40px;
        border-width: 3px;
    }
    
    .loading-text {
        font-size: 14px;
    }
    
    .loading-progress {
        width: 150px;
    }
    
    .loading-pulse {
        width: 50px;
        height: 50px;
    }
}

@media (max-width: 480px) {
    .loading-spinner {
        width: 35px;
        height: 35px;
    }
    
    .loading-text {
        font-size: 12px;
    }
    
    .loading-progress {
        width: 120px;
        height: 3px;
    }
}

/* 深色主題支援 */
@media (prefers-color-scheme: dark) {
    .loading-overlay {
        background-color: rgba(0, 0, 0, 0.9);
    }
    
    .loading-text {
        color: #ccc;
    }
    
    .loading-spinner {
        border-color: #333;
        border-top-color: #007bff;
    }
    
    .loading-progress {
        background-color: #333;
    }
}
