/* ロータリークラブ — ログイン / 403 / ログアウト */

@import url('rotary-brand-colors.css');

:root {
    --auth-bg: #eef3f9;
    --auth-card: #ffffff;
    --auth-text: #1a2744;
    --auth-muted: var(--rotary-charcoal);
    --auth-accent: var(--rotary-royal-blue);
    --auth-accent-hover: #123a78;
    --auth-gold: var(--rotary-gold);
    --auth-error: #9b1c1c;
    --auth-banner: #6a4c0c;
    --auth-border: #b9d9eb;
    --auth-radius: 10px;
    --auth-shadow: 0 8px 24px rgba(23, 69, 143, 0.12);
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

.auth-body {
    margin: 0;
    min-height: 100vh;
    font-family: "Segoe UI", "Hiragino Sans", "Hiragino Kaku Gothic ProN", Meiryo, sans-serif;
    color: var(--auth-text);
    background: radial-gradient(circle at 20% 20%, #dce8f5 0, var(--auth-bg) 45%, #e8eef6 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
}

.auth-card {
    width: min(440px, 100%);
    background: var(--auth-card);
    border: 1px solid var(--auth-border);
    border-top: 4px solid var(--auth-gold);
    border-radius: var(--auth-radius);
    box-shadow: var(--auth-shadow);
    padding: 28px 26px 22px;
}

.auth-title {
    margin: 0 0 10px;
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.auth-lead {
    margin: 0 0 18px;
    color: var(--auth-muted);
    line-height: 1.6;
    font-size: 0.95rem;
}

.auth-banner {
    margin: 0 0 14px;
    padding: 10px 12px;
    border-radius: 8px;
    background: #fff7e6;
    border: 1px solid #f0d9a8;
    color: var(--auth-banner);
    font-size: 0.9rem;
}

.auth-error {
    margin: 0 0 14px;
    padding: 10px 12px;
    border-radius: 8px;
    background: #fdecec;
    border: 1px solid #f5c2c2;
    color: var(--auth-error);
    font-size: 0.9rem;
}

.auth-diag {
    margin: 0 0 14px;
    padding: 10px 12px;
    border-radius: 8px;
    background: #f0f4f2;
    border: 1px solid var(--auth-border);
    font-size: 0.82rem;
    color: var(--auth-muted);
}

.auth-diag__title {
    margin: 0 0 8px;
    font-weight: 700;
    color: var(--auth-text);
}

.auth-diag__list {
    margin: 0;
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 4px 10px;
}

.auth-diag__list dt {
    margin: 0;
    font-weight: 600;
}

.auth-diag__list dd {
    margin: 0;
    word-break: break-all;
}

.auth-diag__list code {
    font-size: 0.78rem;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.auth-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--auth-muted);
    margin-top: 6px;
}

.auth-input {
    width: 100%;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid var(--auth-border);
    font-size: 1rem;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.auth-input:focus {
    border-color: var(--auth-accent);
    box-shadow: 0 0 0 3px rgba(23, 69, 143, 0.18);
}

.auth-select {
    appearance: auto;
    cursor: pointer;
    background-color: #fff;
}

.auth-select:disabled {
    cursor: not-allowed;
    opacity: 0.7;
    background-color: #f3f4f6;
}

.auth-password-wrap {
    position: relative;
    width: 100%;
}

.auth-input--password {
    padding-right: 44px;
}

.auth-password-toggle {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--auth-muted);
    cursor: pointer;
    transition: color 0.15s ease, background 0.15s ease;
}

.auth-password-toggle:hover {
    color: var(--auth-accent);
    background: rgba(23, 69, 143, 0.08);
}

.auth-password-toggle:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(23, 69, 143, 0.35);
}

.auth-password-toggle:focus:not(:focus-visible) {
    box-shadow: none;
}

.auth-password-toggle:focus-visible {
    box-shadow: 0 0 0 2px rgba(23, 69, 143, 0.35);
}

.auth-password-toggle__icon {
    display: block;
    line-height: 0;
}

.auth-password-toggle__show,
.auth-password-toggle__hide {
    display: block;
}

.auth-password-toggle__hide {
    display: none;
}

.auth-password-toggle[aria-pressed="true"] .auth-password-toggle__show {
    display: none;
}

.auth-password-toggle[aria-pressed="true"] .auth-password-toggle__hide {
    display: block;
}

.auth-remember {
    margin-top: 10px;
}

.auth-remember__label {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--auth-text);
    cursor: pointer;
    line-height: 1.45;
}

.auth-remember__checkbox {
    width: 1.05rem;
    height: 1.05rem;
    margin: 0.15rem 0 0;
    flex-shrink: 0;
    accent-color: var(--auth-accent);
    cursor: pointer;
}

.auth-remember__hint {
    margin: 0.35rem 0 0 1.55rem;
    font-size: 0.78rem;
    color: var(--auth-muted);
    line-height: 1.45;
}

.auth-button {
    margin-top: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 12px 14px;
    border: 2px solid transparent;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--auth-accent), #1a5cb0);
    border-bottom: 3px solid var(--auth-gold);
    color: #fff;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    transition: transform 0.05s ease, filter 0.15s ease;
}

.auth-button:hover {
    filter: brightness(1.05);
}

.auth-button:active {
    transform: translateY(1px);
}

.auth-button--link {
    text-align: center;
}

.auth-button--secondary {
    background: #fff;
    color: var(--auth-accent);
    border: 2px solid var(--auth-accent);
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.04);
}

.auth-button--secondary:hover {
    filter: none;
    background: rgba(23, 69, 143, 0.07);
}

/* 関連ページナビ（テキストリンクではなくボタン横並び） */
.auth-nav-actions {
    margin: 1.25rem 0 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 10px 12px;
    justify-content: center;
    align-items: stretch;
}

.auth-nav-actions--after-title {
    margin-top: 4px;
    margin-bottom: 14px;
    justify-content: flex-start;
}

.auth-nav-actions--tight-top {
    margin-top: 0.5rem;
}

.auth-body--admin-wide .auth-card--wide .auth-nav-actions:not(.auth-nav-actions--after-title) {
    justify-content: flex-start;
}

.auth-nav-actions .auth-button {
    margin-top: 0;
    width: auto;
    min-width: 10.5rem;
    flex: 1 1 calc(50% - 6px);
    max-width: 100%;
}

@media (min-width: 520px) {
    .auth-nav-actions .auth-button {
        flex: 0 1 auto;
    }
}

.auth-actions {
    margin: 10px 0 0;
}

.auth-foot {
    margin: 18px 0 0;
    font-size: 0.9rem;
    text-align: center;
}

.auth-foot a {
    color: var(--auth-accent);
    font-weight: 600;
    text-decoration: none;
}

.auth-foot a:hover {
    text-decoration: underline;
    color: var(--auth-accent-hover);
}

.auth-signup-link {
    display: inline;
    padding: 0;
    border: none;
    background: none;
    color: var(--auth-accent);
    font-size: 0.92rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: underline;
}

.auth-signup-link:hover {
    color: var(--auth-accent-hover);
}

.auth-dialog {
    border: none;
    border-radius: var(--auth-radius);
    padding: 1.25rem;
    max-width: calc(100vw - 2rem);
    width: 22rem;
    box-shadow: var(--auth-shadow);
}

.auth-dialog::backdrop {
    background: rgba(0, 0, 0, 0.4);
}

.auth-dialog__title {
    margin: 0 0 1rem;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--auth-text);
}

.auth-dialog__message {
    margin: 0 0 0.85rem;
    padding: 0.55rem 0.75rem;
    border-radius: 6px;
    font-size: 0.88rem;
    line-height: 1.45;
}

.auth-dialog__message--success {
    background: #ecfdf5;
    color: #047857;
}

.auth-dialog__message--error {
    background: #fef2f2;
    color: #b91c1c;
}

.auth-dialog__form {
    margin: 0;
}

.auth-dialog__actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.25rem;
}

.auth-dialog__actions .auth-button {
    flex: 1;
    margin: 0;
}

.auth-dialog__success {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
    padding: 0.25rem 0;
}

.auth-dialog__success-text {
    margin: 0;
    padding: 0.85rem 0.75rem;
    border-radius: 6px;
    background: #ecfdf5;
    color: #047857;
    font-size: 0.95rem;
    line-height: 1.55;
    text-align: center;
}

.auth-dialog__success-btn {
    width: 100%;
    margin: 0;
}

.auth-muted {
    color: var(--auth-muted);
}

/* 登録済み写真プレビュー */
.auth-avatar-preview-wrap {
    margin: 0.5rem 0 0.65rem;
}

.auth-avatar-preview {
    display: block;
    width: 50%;
    max-width: 12rem;
    aspect-ratio: 1;
    object-fit: cover;
    border: 1px solid var(--auth-border);
    border-radius: 0.35rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    cursor: pointer;
    background: #f3f4f6;
}

.auth-avatar-preview:focus-visible {
    outline: 2px solid var(--auth-accent);
    outline-offset: 2px;
}

/* 登録済み写真ファイル名（クリックで調整画面） */
.auth-avatar-existing {
    margin: 0.4rem 0 0;
    font-size: 0.92rem;
    line-height: 1.5;
}

.auth-avatar-existing__link {
    display: inline;
    padding: 0;
    margin: 0 0 0 0.35rem;
    border: none;
    background: none;
    color: var(--auth-accent);
    font-weight: 700;
    text-decoration: underline;
    cursor: pointer;
    font: inherit;
}

.auth-avatar-existing__link:hover {
    color: var(--auth-accent-hover);
}

.auth-avatar-existing__link:focus-visible {
    outline: 2px solid var(--auth-accent);
    outline-offset: 2px;
    border-radius: 2px;
}

/* 顔写真：正方形トリミング調整 */
.auth-avatar-editor {
    margin-top: 0.75rem;
    padding: 1rem;
    border: 1px solid var(--auth-border);
    border-radius: var(--auth-radius);
    background: #f5f8fc;
}

.auth-avatar-editor__stage {
    display: flex;
    justify-content: center;
    margin: 0.5rem 0;
}

#auth_avatar_editor_canvas {
    display: block;
    border-radius: 0.35rem;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.12);
    cursor: grab;
    touch-action: none;
    max-width: 100%;
    height: auto;
}

#auth_avatar_editor_canvas:active {
    cursor: grabbing;
}

.auth-avatar-editor__controls {
    margin-top: 0.75rem;
}

.auth-avatar-editor__zoom {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--auth-text);
}

.auth-avatar-editor__zoom input[type="range"] {
    width: 100%;
    max-width: 20rem;
}

.auth-avatar-editor__pan {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 0.35rem;
    margin-top: 0.75rem;
    max-width: 12rem;
    margin-left: auto;
    margin-right: auto;
}

.auth-avatar-editor__panbtn {
    padding: 0.4rem 0.35rem;
    border: 1px solid var(--auth-border);
    border-radius: 6px;
    background: #fff;
    font-size: 1rem;
    cursor: pointer;
    color: var(--auth-text);
}

.auth-avatar-editor__panbtn:hover {
    background: rgba(23, 69, 143, 0.08);
}

/* 管理者：一覧・編集（モバイル縦以外は幅広） */
@media (min-width: 600px) {
    .auth-body.auth-body--admin-wide {
        align-items: flex-start;
        padding: 32px 20px 40px;
    }

    .auth-body.auth-body--admin-wide .auth-card.auth-card--wide {
        width: min(1100px, 96vw);
        max-width: 1100px;
        margin: 0 auto;
    }
}

.auth-fieldset {
    border: 0;
    padding: 0;
    margin: 0 0 1.15rem;
}

.auth-hint {
    margin: 0 0 0.5rem;
    font-size: 0.85rem;
    color: var(--auth-muted);
    line-height: 1.5;
}

.auth-hint a {
    color: var(--auth-accent);
    font-weight: 600;
}

.auth-radio {
    display: block;
    margin: 0.35rem 0;
    font-size: 0.95rem;
}

.auth-check {
    display: flex;
    align-items: flex-start;
    gap: 0.35rem;
    margin: 0.25rem 0;
    font-size: 0.88rem;
    line-height: 1.35;
}

.auth-committee-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.15rem 0.75rem;
    margin-top: 0.35rem;
}

@media (min-width: 600px) {
    .auth-committee-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 900px) {
    .auth-committee-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

.auth-table-wrap {
    overflow-x: auto;
    margin-top: 1rem;
}

.auth-table--wide {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}

.auth-table--wide th,
.auth-table--wide td {
    padding: 0.45rem 0.4rem;
    border-bottom: 1px solid var(--auth-border);
    text-align: left;
    vertical-align: top;
}

.auth-table--wide th {
    font-weight: 700;
    white-space: nowrap;
}

.auth-table__multiline {
    max-width: 14rem;
    white-space: normal;
    word-break: break-word;
}

/* メンバー一覧（写真列） */
.auth-table--members .auth-table__th-photo,
.auth-table--members .auth-table__td-photo {
    width: 4.5rem;
    vertical-align: middle;
    text-align: center;
}

.auth-member-photo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    overflow: hidden;
    background: #e8eef6;
    color: var(--auth-muted);
}

.auth-member-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.auth-member-photo--empty svg {
    display: block;
    opacity: 0.55;
}

/* メンバー — モバイル縦: カード式 */
@media (max-width: 599px) {
    .auth-body.auth-body--admin-wide {
        align-items: stretch;
        padding: calc(env(safe-area-inset-top, 0px) + 0.75rem) 0.85rem 2rem;
    }

    .auth-body.auth-body--admin-wide .auth-card.auth-card--wide {
        width: 100%;
        max-width: 100%;
        margin: 0;
        padding: 1rem 0.9rem 1.25rem;
    }

    .auth-table-wrap {
        overflow: visible;
        margin-top: 0.5rem;
    }

    .auth-table--members {
        display: block;
        width: 100%;
        border: none;
    }

    .auth-table--members thead {
        display: none;
    }

    .auth-table--members tbody {
        display: flex;
        flex-direction: column;
        gap: 0.75rem;
    }

    .auth-table--members .auth-table__member-row {
        display: grid;
        grid-template-columns: 3.75rem minmax(0, 1fr);
        grid-template-areas:
            "photo name"
            "photo company"
            "photo url"
            "photo joined";
        column-gap: 0.85rem;
        row-gap: 0.35rem;
        padding: 0.9rem 0.95rem;
        border: 1px solid var(--auth-border);
        border-radius: 0.65rem;
        background: #fff;
        box-shadow: 0 2px 10px rgba(17, 24, 39, 0.06);
    }

    .auth-table--members.auth-table--members-with-club .auth-table__member-row {
        grid-template-areas:
            "photo name"
            "photo company"
            "photo url"
            "photo club"
            "photo joined";
    }

    .auth-table--members .auth-table__member-row td {
        display: block;
        padding: 0;
        border: none;
        vertical-align: top;
        max-width: none;
        white-space: normal;
    }

    .auth-table--members .auth-table__td-photo {
        grid-area: photo;
        align-self: start;
        padding-top: 0.1rem;
    }

    .auth-table--members .auth-table__td-name {
        grid-area: name;
        font-size: 1.02rem;
        font-weight: 700;
        line-height: 1.4;
        color: var(--auth-text);
    }

    .auth-table--members .auth-table__td-company {
        grid-area: company;
        font-size: 0.92rem;
        line-height: 1.45;
        color: #374151;
    }

    .auth-table--members .auth-table__td-url {
        grid-area: url;
        font-size: 0.88rem;
        line-height: 1.4;
    }

    .auth-table--members .auth-table__td-club {
        grid-area: club;
        font-size: 0.85rem;
        line-height: 1.4;
        color: var(--auth-muted);
    }

    .auth-table--members .auth-table__td-joined {
        grid-area: joined;
        font-size: 0.85rem;
        line-height: 1.4;
        color: var(--auth-muted);
    }

    .auth-table--members .auth-table__td-company::before,
    .auth-table--members .auth-table__td-url::before,
    .auth-table--members .auth-table__td-club::before,
    .auth-table--members .auth-table__td-joined::before {
        display: block;
        margin-bottom: 0.12rem;
        font-size: 0.72rem;
        font-weight: 700;
        color: var(--auth-muted);
        letter-spacing: 0.02em;
    }

    .auth-table--members .auth-table__td-company::before {
        content: "会社名";
    }

    .auth-table--members .auth-table__td-url::before {
        content: "会社HP";
    }

    .auth-table--members .auth-table__td-club::before {
        content: "所属クラブ";
    }

    .auth-table--members .auth-table__td-joined::before {
        content: "入会年月";
    }

    .auth-table--members .auth-member-photo {
        width: 3.75rem;
        height: 3.75rem;
    }

    .auth-nav-actions--after-title {
        flex-wrap: wrap;
    }
}
