/* =========================================================
   27/02 受講者マイページ専用CSS

   共通デザイン：../css/style.css
   研修フローチャート：flow.css

   このファイルでは以下のみ定義する。
   ・受講者情報セクション
   ・ログインモーダル
   ・ログインフォーム
   ・メッセージ／エラー表示
   ・申込み情報表示
   ========================================================= */

/* ========================================
   1. ページ配置
======================================== */

.is-close {
    text-align: center;
    padding: 1rem;
    border: 1.5px solid #dcdcdc;
    background: #f4f4f4;
    border-radius: 10px;
    margin-bottom: 1rem;
    box-shadow: 0 4px 4px rgba(0, 0, 0, 0.2);
    font-weight: bold;
    margin: 2rem 0 4rem;
}


.mypage-area [hidden] {
    display: none !important;
}

.page-heading {
    margin-bottom: 0.5rem;
}

.page-heading p {
    color: #666;
    margin: 0;
}


/* ========================================
   2. 共通パネル
======================================== */

.mypage-area .panel {
    padding: 20px;
    margin-bottom: 24px;
    border: 1px solid #ddd;
    border-radius: 14px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

.mypage-area .eyebrow {
    margin: 0 0 6px;
    color: var(--main-color, #e04a42);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.1em;
}

.mypage-area .section-note {
    margin-top: 12px;
    font-size: 0.8rem;
    color: #666;
}


/* ========================================
   3. ボタン
======================================== */

.mypage-area .button-primary {
    min-height: 46px;
    padding: 10px 24px;
    border: none;
    border-radius: 8px;
    background: var(--main-color, #e04a42);
    color: #fff;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    transition: opacity 0.2s;
}

.mypage-area .button-primary:hover:not(:disabled) {
    opacity: 0.85;
}

.mypage-area .button-secondary {
    min-height: 42px;
    padding: 8px 18px;
    border: 1px solid #ccc;
    border-radius: 8px;
    background: #fff;
    color: #333;
    font: inherit;
    cursor: pointer;
}

.mypage-area .button-secondary:hover {
    background: #f5f5f5;
}

.mypage-area button:disabled,
.login-dialog button:disabled {
    opacity: 0.6;
    cursor: wait;
}


/* ========================================
   4. ログイン前の案内
======================================== */

.account-panel {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 24px;
    background: color-mix(in srgb, var(--main-color) 5%, white) 0%;
}

.account-panel h2 {
    margin: 0 0 12px;
    font-size: 1.3rem;
    color: var(--main-color, #e04a42);
}

.account-panel p {
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.8;
    color: #555;
}

.account-panel .section-note {
    margin-top: 12px;
}

.account-login-button {
    min-width: 180px;
    flex-shrink: 0;
}


/* ========================================
   5. ログイン後の受講者情報
======================================== */

.account-panel-logged-in {
    display: block;
}

.account-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.account-identity {
    min-width: 0;
    flex: 1;
}

.account-panel .account-id {
    margin: 0 0 4px;
    font-size: 0.78rem;
    color: #666;
}

.account-panel .account-org {
    margin: 0 0 3px;
    font-size: 0.78rem;
    color: #666;
    overflow-wrap: anywhere;
}

.account-panel #welcome-name {
    margin: 0;
    font-size: 1.2rem;
    line-height: 1.5;
    color: var(--text-color);
}

.mypage-area .account-logout {
    min-height: 34px;
    padding: 5px 12px;
    font-size: 0.78rem;
    flex-shrink: 0;
}

/* ========================================
   6. ステータス
======================================== */

.account-summary {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
    gap: 12px;
    margin-top: 16px;
    align-items: stretch;
}

.account-summary-item {
    min-width: 0;
    padding: 14px 16px;
    background: #ffffff;
    border: 1px solid #eee;
    border-radius: 10px;
}

.account-summary-item .summary-label {
    display: block;
    margin-bottom: 5px;
    font-size: 0.78rem;
    color: #666;
}

.account-summary-item>strong {
    display: block;
    font-size: 0.9rem;
    overflow-wrap: anywhere;
}

.account-summary-receipt #receipt-message {
    margin: 4px 0 0;
    font-size: 0.72rem;
    line-height: 1.5;
    color: #666;
}

.receipt-actions {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 12px;
}

/* ダウンロードボタン */

.mypage-area .receipt-actions .receipt-download {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;

    width: auto;
    padding: 10px 14px;

    border: 1px solid var(--main-color, #c55049);
    border-radius: 7px;
    background: var(--main-color, #c55049);
    color: #fff;

    font-size: 0.8rem;
    font-weight: 600;
    line-height: 1.4;
    text-decoration: none;
    white-space: nowrap;

    transition:
        opacity 0.2s,
        background-color 0.2s;
}

.mypage-area .receipt-actions .receipt-download:hover {
    opacity: 0.85;
}

.receipt-download svg {
    flex-shrink: 0;
}

/* 再発行リンク */

.mypage-area .receipt-reissue {
    align-self: center;
    width: auto;
    padding: 4px 0;

    border: none;
    background: transparent;
    color: #666;

    font: inherit;
    font-size: 0.78rem;
    text-decoration: underline;
    text-underline-offset: 3px;
    cursor: pointer;
}

.mypage-area .receipt-reissue:hover {
    color: var(--main-color, #c55049);
}

/* 初回発行ボタン */

.mypage-area .receipt-actions .button-primary {
    width: auto;
    min-height: 36px;
    padding: 7px 14px;
    font-size: 0.8rem;
}

/* ========================================
   7. 領収書モーダル
======================================== */

.receipt-dialog {
    width: min(460px, calc(100% - 32px));
    max-width: none;
    max-height: calc(100dvh - 40px);
    padding: 0;
    border: none;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
    overflow-y: auto;
}

.receipt-dialog::backdrop {
    background: rgba(0, 0, 0, 0.55);
}

.receipt-dialog-content {
    padding: 24px;
}

.receipt-dialog .modal-header {
    margin-bottom: 12px;
}

.receipt-dialog-description {
    margin: 0 0 18px;
    color: #666;
    font-size: 0.85rem;
}

.receipt-recipient {
    padding: 8px 0;
    background: #ffffff;
}

.receipt-label {
    margin: 0 0 5px;
    font-size: 0.75rem;
    color: #666;
}

.receipt-recipient>strong {
    display: block;
    font-size: 1rem;
}

.receipt-option {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    margin-top: 14px;
    font-size: 0.83rem;
    line-height: 1.6;
    cursor: pointer;
}

.receipt-option input {
    margin-top: 5px;
    accent-color: var(--main-color, #e04a42);
    flex-shrink: 0;
}

.receipt-dialog-message {
    margin: 14px 0;
    color: #a52f2f;
    font-size: 0.83rem;
}

.mypage-area .receipt-confirm-button {
    width: 100%;
    margin-top: 18px;
}

@media (max-width: 700px) {
    .account-summary {
        grid-template-columns: 1fr;
    }

    .account-header {
        gap: 12px;
    }

    .receipt-dialog-content {
        padding: 20px;
    }
}

/* ========================================
   7. ログインモーダル
======================================== */

.login-dialog {
    width: min(520px, calc(100% - 32px));
    max-width: none;
    max-height: calc(100dvh - 40px);
    padding: 0;
    border: none;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
    overflow-y: auto;
    box-sizing: border-box;
}

.login-dialog::backdrop {
    background: rgba(0, 0, 0, 0.6);
}

/* 共通パネルの装飾をモーダル内部では解除 */
.login-dialog #login-view {
    margin: 0;
    padding: 32px;
    border: none;
    border-radius: 0;
    box-shadow: none;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 18px;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.3rem;
}

.modal-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    flex-shrink: 0;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: #f0f0f0;
    color: #333;
    font-size: 1.5rem;
    cursor: pointer;
}

.modal-close:hover {
    background: #e5e5e5;
}

.panel-heading {
    margin-bottom: 20px;
}

.panel-heading h2 {
    margin: 0 0 6px;
    font-size: 1.1rem;
}

.panel-heading p {
    margin: 0;
    color: #666;
    font-size: 0.85rem;
}


/* ========================================
   8. ログインフォーム
======================================== */

.login-dialog .form-field {
    margin-bottom: 20px;
}

.login-dialog .form-field label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
}

.login-dialog .form-field input {
    width: 100%;
    min-height: 46px;
    padding: 10px 12px;
    border: 1px solid #ccc;
    border-radius: 8px;
    background: #fff;
    font: inherit;
    box-sizing: border-box;
}

.login-dialog .form-field input:focus-visible {
    outline: 2px solid var(--main-color, #e04a42);
    outline-offset: 1px;
}

.password-wrapper {
    display: flex;
    gap: 8px;
}

.password-wrapper input {
    min-width: 0;
    flex: 1;
}

.password-toggle {
    flex-shrink: 0;
    padding: 0 14px;
    border: 1px solid #ccc;
    border-radius: 8px;
    background: #f5f5f5;
    font: inherit;
    cursor: pointer;
}

.login-dialog .button-primary {
    width: 100%;
    min-height: 48px;
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    background: var(--main-color, #e04a42);
    color: #fff;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.login-note {
    margin: 22px 0 0;
    color: #666;
    font-size: 0.8rem;
}

.recaptcha-notice {
    margin: 18px 0 0;
    color: #777;
    font-size: 0.7rem;
}

.recaptcha-notice a {
    color: var(--main-color, #e04a42);
    text-decoration: underline;
}


/* ========================================
   9. メッセージ・読み込み・エラー
======================================== */

.mypage-area .message,
.login-dialog .message {
    margin-bottom: 18px;
    padding: 12px 16px;
    border: 1px solid #eac7a3;
    border-radius: 8px;
    background: #fff7ed;
    color: #744010;
    font-size: 0.9rem;
}

.mypage-area .message.error,
.login-dialog .message.error {
    border-color: #e9b0b0;
    background: #fff0f0;
    color: #9b2828;
}

.loading-text {
    margin: 0;
    text-align: center;
    color: #666;
}

#error-view h2 {
    margin-top: 0;
    font-size: 1.2rem;
}

#error-view .button-primary {
    margin-top: 18px;
}


/* ========================================
   10. 公開研修案内との間隔
======================================== */

.training-guide {
    margin-top: 32px;
}

.training-guide>h2 {
    margin: 0 0 10px;
    font-size: 1.5rem;
}

.training-guide>p {
    margin: 0 0 24px;
    color: #666;
    font-size: 0.9rem;
}


/* ========================================
   11. スマートフォン対応
======================================== */

@media (max-width: 700px) {

    .mypage-area .panel {
        padding: 22px 18px;
    }

    .account-panel {
        align-items: stretch;
        gap: 18px;
    }

    .account-login-button {
        width: 100%;
    }

    .account-summary {
        grid-template-columns: 1fr;
    }

    .profile-grid {
        grid-template-columns: 1fr;
    }

    .login-dialog #login-view {
        padding: 18px;
    }
}

.receipt-dialog [hidden] {
    display: none !important;
}

.receipt-dialog .receipt-confirm-button {
    display: block;
    width: 100%;
    min-height: 46px;
    padding: 10px 16px;
    border: none;
    border-radius: 8px;
    background: var(--main-color, #e04a42);
    color: #fff;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.receipt-dialog .receipt-confirm-button:disabled {
    opacity: 0.6;
    cursor: wait;
}

/* ========================================
   トースト通知
======================================== */

.mypage-toast {
    position: fixed;
    top: 24px;
    left: 50%;
    transform: translateX(-50%);

    z-index: 9999;
    width: max-content;
    max-width: calc(100vw - 32px);

    padding: 12px 24px;
    border: 1px solid #d5e8db;
    border-radius: 10px;

    background: #f1faf4;
    color: #24643b;

    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1.6;
    text-align: center;

    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.13);
    pointer-events: none;
}

.mypage-toast[hidden] {
    display: none !important;
}

.mypage-toast.is-error {
    background: #fff2f2;
    border-color: #edcccc;
    color: #a52f2f;
}

@media (max-width: 600px) {
    .mypage-toast {
        top: 16px;
        padding: 11px 18px;
    }
}

#receipt-org-name {
    white-space: pre-line;
}


/* ========================================
   領収書モーダル：発行完了画面
======================================== */

.receipt-dialog [hidden] {
    display: none !important;
}

.receipt-complete-heading {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 8px 0 14px;
}

.receipt-complete-heading strong {
    font-size: 1rem;
    line-height: 1.6;
}

.receipt-complete-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;

    width: 30px;
    height: 30px;
    border-radius: 50%;

    background: #e8f5eb;
    color: #237543;
    font-size: 17px;
    font-weight: bold;
}

.receipt-complete-description {
    margin: 0 0 20px;
    font-size: 0.85rem;
    color: #666;
    line-height: 1.7;
}

.receipt-modal-pdf-button {
    display: flex;
    align-items: center;
    justify-content: center;

    width: 100%;
    min-height: 46px;
    padding: 10px 18px;

    border-radius: 8px;
    background: var(--main-color, #c55049);
    color: #fff;

    font-size: 0.9rem;
    font-weight: 700;
    text-decoration: none;
    box-sizing: border-box;
}

.receipt-modal-pdf-button:hover {
    color: #fff;
    opacity: 0.85;
}

.receipt-complete-close {
    display: block;
    width: 100%;
    margin-top: 10px;
    padding: 10px;

    border: 1px solid #ddd;
    border-radius: 8px;
    background: #fff;
    color: #444;

    font: inherit;
    font-size: 0.85rem;
    cursor: pointer;
}

.receipt-complete-close:hover {
    background: #f7f7f7;
}


/* ========================================
   受講状況ステップインジケーター
======================================== */

.training-progress {
    width: 100%;
    min-width: 0;
    padding-top: 8px;
}

.training-progress-loading {
    margin: 0;
    font-size: 0.85rem;
    color: #777;
}

.training-steps {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    width: 100%;
}

.training-step {
    position: relative;
    display: flex;
    flex: 1 1 0;
    min-width: 0;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    text-align: center;
}

/* STEPをつなぐライン */
.training-step:not(:last-child)::after {
    content: "";
    position: absolute;
    top: 16px;
    left: calc(50% + 23px);
    width: calc(100% - 46px);
    height: 2px;
    background: #dce2e6;
}

/* 円形のステップ番号 */
.training-step-circle {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: #edf0f2;
    border: 2px solid #dce2e6;
    color: #65717b;
    font-size: 0.82rem;
    font-weight: 700;
}

/* STEP名 */
.training-step-name {
    font-size: 0.75rem;
    line-height: 1.4;
    font-weight: 600;
    color: #444;
    overflow-wrap: anywhere;
}

/* 判定結果 */
.training-step-status {
    font-size: 0.75rem;
    line-height: 1.4;
    font-weight: 600;
    color: #777;
}

/* 完了・修了 */
.training-step.is-completed .training-step-circle {
    background: #16856d;
    border-color: #16856d;
    color: #fff;
}

.training-step.is-completed .training-step-status {
    color: #16856d;
}

/* 未完了・未修了 */
.training-step.is-incomplete .training-step-circle {
    background: #fff;
    border-color: #bcc5cd;
    color: #65717b;
}

/* 準備中 */
.training-step.is-preparing .training-step-circle {
    background: #f3f4f6;
    border-color: #e5e7eb;
    color: #9ca3af;
}

.training-step.is-preparing .training-step-status {
    color: #9ca3af;
}

/* 判定保留 */
.training-step.is-pending .training-step-status {
    color: #a36b14;
}

/* スマートフォン */
@media (max-width: 480px) {
    .account-summary-item.account-summary-training {
        padding: 12px 8px;
    }

    .training-step {
        gap: 4px;
    }

    .training-step-circle {
        width: 30px;
        height: 30px;
        font-size: 0.75rem;
    }

    .training-step:not(:last-child)::after {
        top: 14px;
        left: calc(50% + 19px);
        width: calc(100% - 38px);
    }

    .training-step-name,
    .training-step-status {
        font-size: 0.67rem;
    }
}

/* 領収書の宛名選択 */

.receipt-dialog .receipt-option {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.receipt-dialog .receipt-option input[type="radio"] {
    accent-color: var(--main-color, #e04a42);
    flex-shrink: 0;
}

.receipt-recipient-preview {
    margin-top: 18px;
    padding: 14px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: #f8f9fa;
}

.receipt-recipient-preview strong {
    display: block;
    white-space: pre-line;
    line-height: 1.8;
    overflow-wrap: anywhere;
}

.receipt-issue-note {
    margin: 16px 0 0;
    font-size: 0.8rem;
    line-height: 1.7;
    color: #666;
}