/**
 * Loading Progress Bar Styles
 * ローディング画面のスタイル
 */

/* ========================================
   1. ローディング画面の基本スタイル
   ======================================== */

#loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    z-index: 999999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 1;
    transition: opacity 0.8s ease;
}

/* ローディング完了時 */
#loading-screen.loaded {
    opacity: 0;
    pointer-events: none;
}

/* ========================================
   2. ローディングコンテナ
   ======================================== */

.loading-container {
    width: 90%;
    max-width: 500px;
    text-align: center;
}

/* ========================================
   3. ロゴ・タイトル
   ======================================== */

.loading-logo {
    margin-bottom: 3rem;
    animation: pulse 2s ease-in-out infinite;
}

.loading-logo h1 {
    font-size: 3rem;
    font-weight: 900;
    color: #ffffff;
    margin: 0;
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    letter-spacing: 0.05em;
}

.loading-logo p {
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.9);
    margin: 0.5rem 0 0 0;
    font-weight: 300;
}

/* ロゴのパルスアニメーション */
@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

/* ========================================
   4. プログレスバー
   ======================================== */

.loading-progress {
    width: 100%;
    margin-top: 2rem;
}

/* プログレスバーの背景 */
.progress-bar-container {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 100px;
    overflow: hidden;
    position: relative;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* プログレスバー本体 */
.progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, 
        rgba(255, 255, 255, 0.8) 0%, 
        rgba(255, 255, 255, 1) 50%, 
        rgba(255, 255, 255, 0.8) 100%
    );
    border-radius: 100px;
    transition: width 0.3s ease;
    position: relative;
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.5);
}

/* プログレスバーの光沢効果 */
.progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 50%;
    background: linear-gradient(180deg, 
        rgba(255, 255, 255, 0.3) 0%, 
        transparent 100%
    );
    border-radius: 100px 100px 0 0;
}

/* プログレスバーの動くグラデーション */
.progress-bar::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, 
        transparent 0%, 
        rgba(255, 255, 255, 0.4) 50%, 
        transparent 100%
    );
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% {
        left: -100%;
    }
    100% {
        left: 200%;
    }
}

/* ========================================
   5. パーセント表示
   ======================================== */

.loading-percentage {
    margin-top: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
}

.loading-text {
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 300;
    letter-spacing: 0.1em;
}

.percentage-number {
    font-size: 2.5rem;
    font-weight: 700;
    color: #ffffff;
    min-width: 80px;
    text-align: center;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    font-variant-numeric: tabular-nums;
}

/* ========================================
   6. ローディングドット（オプション）
   ======================================== */

.loading-dots {
    display: inline-block;
    margin-left: 0.5rem;
}

.loading-dots span {
    display: inline-block;
    width: 6px;
    height: 6px;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    margin: 0 2px;
    animation: dot-pulse 1.4s infinite ease-in-out;
}

.loading-dots span:nth-child(1) {
    animation-delay: 0s;
}

.loading-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.loading-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes dot-pulse {
    0%, 80%, 100% {
        opacity: 0.3;
        transform: scale(0.8);
    }
    40% {
        opacity: 1;
        transform: scale(1.2);
    }
}

/* ========================================
   7. スピナー（オプション）
   ======================================== */

.loading-spinner {
    width: 60px;
    height: 60px;
    margin: 2rem auto;
    position: relative;
}

.spinner-ring {
    width: 100%;
    height: 100%;
    border: 4px solid rgba(255, 255, 255, 0.2);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* ========================================
   8. ヒント・メッセージ（オプション）
   ======================================== */

.loading-hint {
    margin-top: 3rem;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.7);
    font-weight: 300;
    font-style: italic;
}

/* ========================================
   9. レスポンシブ対応
   ======================================== */

@media (max-width: 768px) {
    .loading-logo h1 {
        font-size: 2rem;
    }
    
    .loading-container {
        width: 85%;
    }
    
    .percentage-number {
        font-size: 2rem;
        min-width: 60px;
    }
    
    .loading-text {
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    .loading-logo h1 {
        font-size: 1.5rem;
    }
    
    .percentage-number {
        font-size: 1.8rem;
    }
    
    .progress-bar-container {
        height: 6px;
    }
}

/* ========================================
   10. body のローディング状態管理
   ======================================== */

/* ローディング中はスクロールを無効化 */
body.page-loading {
    overflow: hidden;
    height: 100vh;
}

/* ページ読み込み完了後 */
body.page-loaded {
    overflow: auto;
    height: auto;
}

/* ========================================
   11. コンテンツのフェードイン
   ======================================== */

/* ローディング中はコンテンツを非表示 */
body.page-loading #main-content,
body.page-loading .site-header,
body.page-loading .site-footer {
    opacity: 0;
    transition: opacity 0.5s ease;
}

/* ローディング完了後にフェードイン */
body.page-loaded #main-content,
body.page-loaded .site-header,
body.page-loaded .site-footer {
    opacity: 1;
}

/* ========================================
   12. 高コントラストモード対応
   ======================================== */

@media (prefers-contrast: high) {
    #loading-screen {
        background: #000000;
    }
    
    .loading-logo h1,
    .percentage-number {
        color: #ffffff;
        text-shadow: none;
    }
    
    .progress-bar {
        background: #ffffff;
    }
}

/* ========================================
   13. アニメーション無効化設定を尊重
   ======================================== */

@media (prefers-reduced-motion: reduce) {
    #loading-screen,
    .progress-bar,
    .loading-logo,
    .loading-dots span {
        animation: none !important;
        transition: none !important;
    }
    
    #loading-screen.loaded {
        display: none;
    }
}

/* ========================================
   14. デバッグ用（開発時のみ）
   ======================================== */

/* デバッグモードを有効にする場合は以下のコメントを外す */
/*
#loading-screen {
    outline: 2px solid red;
}

.progress-bar {
    outline: 1px solid yellow;
}
*/
