/* --- 1. Loading 覆蓋層 --- */
#loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #f5f5f5;
    z-index: 9999;
    display: none; 
    opacity: 0;
    justify-content: center;
    align-items: center;
    transition: opacity 0.3s ease-in-out;
}

#loading-overlay.active {
    display: flex;
    opacity: 1;
}

/* --- 2. Loading 元件詳細樣式 --- */
.loading-container {
    text-align: center;
    max-width: 600px;
    width: 100%;
}

.animation-area {
    width: 300px;
    height: 200px;
    margin: 0 auto 40px;
    position: relative;
    overflow: hidden;
}

.loading-animation {
    width: 100%;
    height: 100%;
    background-image: url('../images/loading動畫_1.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

.loading-animation.animated {
    animation: frameAnimation 2s steps(1, end) infinite;
}

/* PNG序列動畫 */
@keyframes frameAnimation {
    0%    { background-image: url('../images/loading動畫_1.png'); }
    5.88% { background-image: url('../images/loading動畫_2.png'); }
    11.76% { background-image: url('../images/loading動畫_3.png'); }
    17.64% { background-image: url('../images/loading動畫_4.png'); }
    23.52% { background-image: url('../images/loading動畫_5.png'); }
    29.40% { background-image: url('../images/loading動畫_6.png'); }
    35.28% { background-image: url('../images/loading動畫_7.png'); }
    41.16% { background-image: url('../images/loading動畫_8.png'); }
    47.04% { background-image: url('../images/loading動畫_9.png'); }
    52.92% { background-image: url('../images/loading動畫_10.png'); }
    58.80% { background-image: url('../images/loading動畫_11.png'); }
    64.68% { background-image: url('../images/loading動畫_12.png'); }
    70.56% { background-image: url('../images/loading動畫_13.png'); }
    76.44% { background-image: url('../images/loading動畫_14.png'); }
    82.32% { background-image: url('../images/loading動畫_15.png'); }
    88.20% { background-image: url('../images/loading動畫_16.png'); }
    94.08% { background-image: url('../images/loading動畫_17.png'); }
    100%  { background-image: url('../images/loading動畫_17.png'); }
}

/* 網站相關文字 */
.website-info {
    margin-bottom: 40px;
}
.website-info h2 {
    font-size: 28px;
    margin-bottom: 15px;
}
.website-info p {
    font-size: 16px;
    color: #666;
    line-height: 1.6;
    max-width: 500px;
    margin: 0 auto;
}

/* 進度條區域 */
.progress-area {
    margin-top: 40px;
}
.progress-bar {
    width: 100%;
    max-width: 400px;
    height: 8px;
    background: #e0e0e0;
    border-radius: 4px;
    margin: 0 auto 15px;
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #4CAF50, #45a049);
    width: 0%;
    transition: width 0.3s ease;
}
.progress-text {
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 10px;
}
.progress-status {
    font-size: 14px;
    color: #666;
}

/* 載入完成後的樣式 */
.loading-container.loading-complete {
    opacity: 0;
    transform: translateY(-20px);
    transition: all 0.5s ease;
}

/* 備用動畫 */
.fallback-animation {
    width: 60px;
    height: 60px;
    border: 4px solid #e0e0e0;
    border-top: 4px solid #4CAF50;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}