/**
 * ローディング表示CSS
 *
 * ログイン・新規登録時のローディングインジケーター
 * AdminLTEデザインに準拠したスピナーと二重送信防止
 *
 * @version 1.0
 * @date 2025-10-19
 */

/* ==========================================================================
   ローディングオーバーレイ
   ========================================================================== */

.loading-overlay {
    display: none; /* 初期状態は非表示 */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5); /* 半透明の黒背景 */
    z-index: 9999; /* 最前面に表示 */
    justify-content: center;
    align-items: center;
    flex-direction: column;
}

.loading-overlay.active {
    display: flex; /* アクティブ時に表示 */
}

/* ==========================================================================
   ローディングスピナー
   ========================================================================== */

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 6px solid #f3f3f3; /* ライトグレー */
    border-top: 6px solid #3c8dbc; /* AdminLTEプライマリーカラー（ブルー） */
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* ==========================================================================
   ローディングメッセージ
   ========================================================================== */

.loading-message {
    margin-top: 20px;
    color: #ffffff;
    font-size: 18px;
    font-weight: 600;
    text-align: center;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.5);
}

/* ドットアニメーション */
.loading-message .dots {
    display: inline-block;
    width: 20px;
}

.loading-message .dots::after {
    content: '';
    animation: dots 1.5s steps(4, end) infinite;
}

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

/* ==========================================================================
   フォーム送信時のボタン無効化
   ========================================================================== */

.btn-loading {
    position: relative;
    pointer-events: none; /* クリック無効化 */
    opacity: 0.6;
}

.btn-loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid #ffffff;
    border-top-color: transparent;
    border-radius: 50%;
    animation: btn-spin 0.6s linear infinite;
}

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

/* ==========================================================================
   モバイル対応
   ========================================================================== */

@media (max-width: 767px) {
    .loading-spinner {
        width: 50px;
        height: 50px;
        border-width: 5px;
    }

    .loading-message {
        font-size: 16px;
        margin-top: 15px;
    }
}

/* ==========================================================================
   アクセシビリティ対応
   ========================================================================== */

/* スクリーンリーダー用の非表示テキスト */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* ==========================================================================
   AdminLTE準拠のローディング（代替スタイル）
   ========================================================================== */

.loading-spinner-alt {
    width: 40px;
    height: 40px;
    position: relative;
    margin: 0 auto;
}

.loading-spinner-alt .double-bounce1,
.loading-spinner-alt .double-bounce2 {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background-color: #3c8dbc;
    opacity: 0.6;
    position: absolute;
    top: 0;
    left: 0;
    animation: bounce 2s infinite ease-in-out;
}

.loading-spinner-alt .double-bounce2 {
    animation-delay: -1s;
}

@keyframes bounce {
    0%, 100% {
        transform: scale(0);
    }
    50% {
        transform: scale(1);
    }
}
