/**
 * ログイン / 新規登録ページ専用CSS
 */

/* ==========================================================================
   メインコンテナ
   ========================================================================== */
body.page-auth,
body.page-forgot,
body.page-reset,
body.page-auth-password-forgot,
body.page-auth-password-reset {
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
}

.p-auth {
    flex: 1 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-48) var(--space-16);
    background: url('../../images/background/auth_pc.svg') center/cover no-repeat;
}

/* ==========================================================================
   カード
   ========================================================================== */
.p-auth__card {
    width: min(768px, calc(768 / 1440 * 100%));
    min-width: 590px;
    box-sizing: border-box;
    background: var(--color-white);
    padding: 40px 40px;
    border-radius: 8px;
    box-shadow: 0 4px 30px 0 rgba(0, 0, 0, 0.1);
}

/* ==========================================================================
   パスワードカード（パスワードお忘れ / パスワード再設定専用）
   ========================================================================== */
.p-auth-password {
    width: min(768px, calc(768 / 1440 * 100%));
    min-width: 590px;
    box-sizing: border-box;
    background: var(--color-white);
    padding: 40px;
    border-radius: 8px;
    box-shadow: 0 4px 30px 0 rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    gap: var(--space-24);
}

.p-auth-password__header {
    display: flex;
    flex-direction: column;
    gap: var(--space-8);
}

.p-auth-password .p-auth__title {
    font-size: 24px;
    font-weight: 600;
    color: var(--color-text);
    text-align: center;
}

.p-auth-password .p-auth__description {
    font-size: var(--font-size-sub);
    color: #5B5B5B;
    text-align: center;
}

.p-auth-password .c-form-label {
    font-size: var(--font-size-small);
    color: #5B5B5B;
}

.p-auth-password .c-form {
    align-items: center;
}

.p-auth-password .c-form-field,
.p-auth-password .p-auth__actions {
    width: 510px;
    max-width: 100%;
}



.p-auth-password .p-auth__forgot-footer {
    width: 246px;
    max-width: 100%;
}

.p-auth-password .p-auth__complete {
    display: flex;
    flex-direction: column;
    gap: var(--space-24);
    text-align: center;
    align-items: center;
}

.p-auth-password .p-auth__complete-actions {
    width: 246px;
    max-width: 100%;
}

/* ==========================================================================
   タブナビゲーション
   ========================================================================== */
.p-auth__tabs {
    display: flex;
    border-bottom: 1px solid var(--color-border);
    margin-bottom: var(--space-32);
}

.p-auth__tab {
    flex: 1;
    padding: var(--space-16) var(--space-24);
    font-size: 20px;
    font-weight: 400;
    color: #5B5B5B;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: color 0.2s ease, border-color 0.2s ease;
    margin-bottom: -1px;
    text-align: center;
}

.p-auth__tab:hover {
    color: #5B5B5B;
}

.p-auth__tab.is-active {
    font-weight: 700;
    color: var(--color-primary);
    border-bottom-color: var(--color-primary);
}

/* ==========================================================================
   パネル
   ========================================================================== */
.p-auth__panel {
    display: none;
}

.p-auth__panel.is-active {
    display: block;
}

/* ==========================================================================
   フォーム
   ========================================================================== */
.p-auth .c-form {
    display: flex;
    flex-direction: column;
    gap: var(--space-24);
}

#panel-login .c-form-field,
#panel-register .c-form-field,
#password-forgot-form .c-form-field,
#password-reset-form .c-form-field {
    width: 510px;
    max-width: 100%;
    margin-inline: auto;
}

.p-auth .c-form-field {
    gap: var(--space-8);
}

#panel-login .c-form-label {
    color: #5B5B5B;
    font-size: 12px;
}

#panel-register .c-form-label,
#password-forgot-form .c-form-label,
#password-reset-form .c-form-label {
    color: #5B5B5B;
    font-size: 12px;
}

.p-auth__login-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

#panel-login .p-auth__checkbox,
#panel-register .p-auth__checkbox {
    width: 510px;
    max-width: 100%;
    margin-inline: auto;
}

/* hidden属性の強制適用 */
.p-auth .c-form[hidden],
.p-auth__complete[hidden] {
    display: none !important;
}

/* ==========================================================================
   パスワード入力ラッパー（トグルボタン付き）
   ========================================================================== */
.p-auth__toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    padding: 0;
    background: transparent;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.p-auth__toggle svg {
    display: none;
}

.p-auth__toggle::before {
    content: "";
    display: block;
    width: 20px;
    height: 20px;
    background-color: #CF83F4;
    -webkit-mask-image: url('../../images/icon/visibility.svg');
    mask-image: url('../../images/icon/visibility.svg');
    -webkit-mask-size: contain;
    mask-size: contain;
    -webkit-mask-position: center;
    mask-position: center;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
}

.p-auth__toggle.is-visible::before {
    -webkit-mask-image: url('../../images/icon/visibility_off.svg');
    mask-image: url('../../images/icon/visibility_off.svg');
}

/* ==========================================================================
   パスワードリセットリンク
   ========================================================================== */
.p-auth__forgot {
    display: block;
    text-align: center;
    font-size: var(--font-size-sub);
    color: #2873C9;
    text-decoration: none;
    transition: color 0.2s ease;
}

.p-auth__forgot:hover {
    color: #2873C9;
    text-decoration: underline;
}

/* ==========================================================================
   エラーメッセージ（固有プロパティ）
   ========================================================================== */
.p-auth .c-form-error {
    font-size: 15px;
    min-height: 0;
}

#password-reset-form .c-form-error {
    font-size: var(--font-size-small);
}



.p-auth .c-form-error:empty {
    display: none;
}

.p-auth .c-form-error:not(:empty) {
    display: block;
}

.p-auth__error--login {
    width: 510px;
    max-width: 100%;
    margin: 0;
    align-self: center;
    min-height: 0;
    display: none;
}

.p-auth__error--login:not(:empty) {
    display: block;
}

.p-auth__error--global {
    width: 510px;
    max-width: 100%;
    margin: 0;
    align-self: center;
}

.p-auth__error--checkbox {
    margin-top: var(--space-4);
}

/* ==========================================================================
   チェックボックス
   ========================================================================== */
.p-auth__checkbox {
    display: flex;
    flex-direction: column;
}

.p-auth__checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: var(--space-8);
    cursor: pointer;
}

.p-auth__checkbox-label input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    margin-top: 2px;
    border: 1px solid #DAE4F2;
    border-radius: 2px;
    background-color: var(--color-white);
    display: grid;
    place-content: center;
    cursor: pointer;
    flex-shrink: 0;
}

.p-auth__checkbox-label input[type="checkbox"]::before {
    content: "";
    width: 10px;
    height: 10px;
    transform: scale(0);
    transition: transform 0.12s ease-in-out;
    box-shadow: inset 1em 1em var(--color-primary);
    clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%);
}

.p-auth__checkbox-label input[type="checkbox"]:checked::before {
    transform: scale(1);
}

#panel-register .p-auth__checkbox-label input[type="checkbox"] {
    border-radius: 99px;
}

.p-auth__checkbox-text {
    font-size: var(--font-size-sub);
    color: var(--color-text);
    line-height: 1.5;
}

.p-auth__checkbox-text a {
    color: var(--color-primary);
    text-decoration: underline;
}

.p-auth__checkbox-text a:hover {
    text-decoration: none;
}

/* ==========================================================================
   ボタンエリア
   ========================================================================== */
.p-auth__actions {
    margin-top: var(--space-8);
}

.p-auth__login-footer {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 246px;
    max-width: 100%;
    margin-inline: auto;
}

.p-auth__forgot-footer {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 246px;
    max-width: 100%;
    margin-inline: auto;
}

.p-auth__login-footer .p-auth__actions {
    margin-top: 0;
}

.p-auth__forgot-footer .p-auth__actions {
    margin-top: 0;
}

.p-auth__forgot-footer .p-auth__back-link {
    margin-top: 0;
}

.p-auth__password-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-8);
    width: 510px;
    max-width: 100%;
}

.p-auth__submit {
    width: 100%;
    justify-content: center;
    padding: 14px 32px;
}

.p-auth__submit::after {
    display: none;
}

#panel-login .p-auth__actions,
#panel-register .p-auth__actions,
#password-forgot-form .p-auth__actions,
#password-reset-form .p-auth__actions {
    display: flex;
    justify-content: center;
    width: 246px;
    max-width: 100%;
    margin-inline: auto;
}

#panel-login .p-auth__submit,
#panel-register .p-auth__submit,
#password-forgot-form .p-auth__submit,
#password-reset-form .p-auth__submit {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

/* ==========================================================================
   タイトル（タブなし画面用）
   ========================================================================== */
.p-auth__title {
    font-size: var(--font-size-lg);
    font-weight: 600;
    color: var(--color-text);
    text-align: center;
    margin: 0;
}

/* ==========================================================================
   説明文
   ========================================================================== */
.p-auth__description {
    font-size: var(--font-size-sub);
    color: var(--color-gray);
    text-align: center;
    margin: 0;
}

/* ==========================================================================
   ログインに戻るリンク
   ========================================================================== */
.p-auth__back-link {
    display: block;
    text-align: center;
    font-size: var(--font-size-sub);
    color: var(--color-primary);
    text-decoration: none;
    margin-top: var(--space-16);
}

.p-auth__back-link:hover {
    text-decoration: underline;
}

/* ==========================================================================
   完了メッセージ
   ========================================================================== */
.p-auth__complete {
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: var(--space-24);
}

.p-auth__complete-message {
    font-size: var(--font-size-base);
    text-align: center;
    line-height: 1.8;
    color: #5B5B5B;
    margin: 0;
}

.p-auth__complete-actions {
    display: flex;
    justify-content: center;
    width: 246px;
    max-width: 100%;
    margin-inline: auto;
}

/* ==========================================================================
   レスポンシブ (SP: 768px以下)
   ========================================================================== */
@media screen and (max-width: 768px) {
    .p-auth {
        min-height: calc(100vh - var(--header-height) - var(--footer-height));
        padding: var(--space-24) var(--space-16);
        background-image: url('../../images/background/auth_sp.svg');
        align-items: flex-start;
    }

    .p-auth__card {
        width: 100%;
        min-width: 0;
        padding: 32px 16px;
    }

    .p-auth__tabs {
        margin-bottom: var(--space-24);
    }

    .p-auth__tab {
        padding: var(--space-12) var(--space-16);
        font-size: 16px;
        font-weight: 400;
    }

    .p-auth .c-form {
        gap: var(--space-20);
    }

    .p-auth .c-form-error {
        font-size: 14px;
    }

    #panel-login .c-form-field,
    #panel-register .c-form-field,
    #password-forgot-form .c-form-field,
    #password-reset-form .c-form-field {
        width: 100%;
        max-width: none;
    }

    .p-auth__password-group {
        width: 100%;
        max-width: none;
    }

    #panel-login .p-auth__checkbox,
    #panel-register .p-auth__checkbox {
        width: 100%;
        max-width: none;
    }

    .p-auth__error--login,
    .p-auth__error--global {
        width: 100%;
        max-width: none;
    }

    .p-auth__submit {
        padding: 12px 24px;
    }

    #panel-login .p-auth__actions,
    #panel-register .p-auth__actions,
    #password-forgot-form .p-auth__actions,
    #password-reset-form .p-auth__actions {
        width: 100%;
        max-width: none;
    }

    .p-auth__login-footer {
        width: 100%;
        max-width: none;
    }

    .p-auth__forgot-footer {
        width: 100%;
        max-width: none;
    }

    .p-auth__complete-actions {
        width: 100%;
        max-width: none;
    }

    #panel-login .p-auth__submit,
    #panel-register .p-auth__submit,
    #password-forgot-form .p-auth__submit,
    #password-reset-form .p-auth__submit {
        width: 100%;
        max-width: none;
    }

    .p-auth__complete-message {
        font-size: 12px;
    }


    .p-auth-password {
        width: 100%;
        min-width: 0;
        padding: 32px 16px;
    }

    .p-auth-password .p-auth__title {
        font-size: var(--font-size-base);
    }

    .p-auth-password .p-auth__description {
        font-size: var(--font-size-small);
    }

    .p-auth-password .c-form-field,
    .p-auth-password .p-auth__actions,
    .p-auth-password .p-auth__forgot-footer,
    .p-auth-password .p-auth__complete-actions {
        width: 100%;
        max-width: none;
    }
}
