/* ============================================================
   壁打ちくん — ログイン画面・ユーザー情報・共有管理
   ============================================================ */

/* --- ログイン画面 --- */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(circle at 20% 20%, rgba(59, 130, 246, 0.12), transparent 45%),
    radial-gradient(circle at 80% 70%, rgba(168, 85, 247, 0.10), transparent 45%),
    var(--bg-app);
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-sidebar);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 40px 32px;
  text-align: center;
}

.login-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 1.4rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 18px;
}

.login-lead {
  color: var(--text-muted);
  font-size: 0.88rem;
  line-height: 1.7;
  margin: 0 0 28px;
}

.login-google {
  display: flex;
  justify-content: center;
  min-height: 44px;
}

.login-status {
  margin-top: 14px;
  font-size: 0.83rem;
  color: var(--text-muted);
  min-height: 20px;
}
.login-status.is-error { color: #f87171; }

.login-note {
  margin: 24px 0 0;
  padding-top: 18px;
  border-top: 1px solid var(--border-color);
  font-size: 0.76rem;
  color: var(--text-muted);
  line-height: 1.7;
}

.login-error {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #fca5a5;
  border-radius: var(--radius-sm);
  padding: 16px;
  font-size: 0.83rem;
  line-height: 1.7;
  text-align: left;
}
.login-error code {
  background: rgba(0, 0, 0, 0.3);
  padding: 1px 5px;
  border-radius: 3px;
}

/* --- ヘッダーのユーザー情報 --- */
.header-note {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 6px 4px 4px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  border-radius: 999px;
}

.user-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.user-avatar-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary-gradient);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
}

.user-name {
  font-size: 0.82rem;
  color: var(--text-main);
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-role {
  font-size: 0.68rem;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.2);
  color: var(--text-muted);
  white-space: nowrap;
}
.user-role.is-admin {
  background: rgba(16, 185, 129, 0.18);
  color: #34d399;
}

.btn-logout {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-family: var(--font-main);
  cursor: pointer;
  padding: 3px 8px;
  border-radius: 999px;
  transition: all 0.15s;
}
.btn-logout:hover {
  background: rgba(239, 68, 68, 0.18);
  color: #f87171;
}

/* --- 共有ボタン --- */
.btn-share {
  position: relative;
  background: rgba(168, 85, 247, 0.15);
  border: 1px solid rgba(168, 85, 247, 0.4);
  color: #c084fc;
  padding: 7px 13px;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-family: var(--font-main);
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.btn-share:hover {
  background: rgba(168, 85, 247, 0.28);
}

.share-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
}

/* --- 共有モーダル --- */
.modal-wide { max-width: 560px; width: 100%; }

.share-count {
  font-size: 0.78rem;
  font-weight: 400;
  color: var(--text-muted);
  margin-left: 8px;
}

.share-link-row {
  display: flex;
  gap: 8px;
}
.share-link-row .form-input {
  flex: 1;
  font-size: 0.8rem;
}

.member-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  /* メンバー・招待リンク・作成フォームが縦に並ぶため、
     画面の高さに応じて広く取る */
  max-height: min(56vh, 520px);
  overflow-y: auto;
  padding-right: 2px;
}

.member-empty {
  padding: 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.83rem;
}

.member-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg-app);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
}
.member-item.is-pending {
  border-color: rgba(245, 158, 11, 0.45);
  background: rgba(245, 158, 11, 0.07);
}

.member-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--bg-sidebar);
}

.member-info {
  flex: 1;
  min-width: 0;
}

.member-name {
  font-size: 0.85rem;
  color: var(--text-main);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.member-email {
  font-size: 0.72rem;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.member-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.member-status {
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
}
.member-status.is-pending {
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
}
.member-status.is-rejected {
  background: rgba(148, 163, 184, 0.18);
  color: var(--text-muted);
}

.member-select {
  background: var(--bg-sidebar);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 4px 6px;
  border-radius: var(--radius-sm);
  font-size: 0.76rem;
  font-family: var(--font-main);
  cursor: pointer;
}

.btn-mini {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-family: var(--font-main);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
}
.btn-mini:hover { background: rgba(255, 255, 255, 0.14); }

.btn-mini.is-approve {
  background: rgba(16, 185, 129, 0.18);
  border-color: rgba(16, 185, 129, 0.4);
  color: #34d399;
}
.btn-mini.is-approve:hover { background: rgba(16, 185, 129, 0.3); }

.btn-mini.is-danger {
  background: rgba(239, 68, 68, 0.14);
  border-color: rgba(239, 68, 68, 0.35);
  color: #f87171;
}
.btn-mini.is-danger:hover { background: rgba(239, 68, 68, 0.26); }

/* --- アクセス権が無いときの画面 --- */
.access-gate {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
}

.access-gate-card {
  max-width: 440px;
  text-align: center;
  background: var(--bg-sidebar);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 32px;
}

.access-gate-icon { font-size: 2.4rem; margin-bottom: 12px; }

.access-gate-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 10px;
}

.access-gate-text {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.8;
  margin-bottom: 22px;
}

/* 閲覧のみのゲスト向け表示 */
.badge-readonly {
  background: rgba(148, 163, 184, 0.2);
  color: #cbd5e1;
  border: 1px solid rgba(148, 163, 184, 0.35);
}

@media (max-width: 900px) {
  .user-name { display: none; }
  .header-note { display: none; }
}


/* ============================================================
   ログインフォーム（管理者ログイン / 初期設定 / 招待受け入れ）
   ============================================================ */
.login-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  text-align: left;
  margin-top: 6px;
}

.login-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.login-field span {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 500;
}

.login-submit {
  margin-top: 6px;
  width: 100%;
  justify-content: center;
  padding: 11px;
  font-size: 0.92rem;
}

.login-note code {
  background: rgba(0, 0, 0, 0.35);
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 0.9em;
}

.invite-perm {
  display: inline-block;
  margin-top: 8px;
  padding: 3px 12px;
  border-radius: 999px;
  background: rgba(59, 130, 246, 0.16);
  border: 1px solid rgba(59, 130, 246, 0.35);
  color: #93c5fd;
  font-size: 0.8rem;
}

/* --- 招待リンクの作成欄 --- */
.member-avatar-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(148, 163, 184, 0.22);
  color: var(--text-main);
  font-size: 0.85rem;
  font-weight: 600;
}

.invite-create {
  margin-top: 6px;
  padding: 14px;
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.02);
}

.invite-create-title {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 10px;
}

.invite-create-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.invite-create-row .form-input {
  flex: 1;
  min-width: 0;
  padding: 7px 10px;
  font-size: 0.82rem;
}

.invite-result {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border-color);
}

.invite-result-note {
  font-size: 0.76rem;
  color: #fbbf24;
  line-height: 1.7;
  margin: 0 0 8px;
}


/* ============================================================
   複数プロジェクト共有
   ============================================================ */

/* メンバー行（展開可能） */
.member-item.is-expandable { flex-direction: column; align-items: stretch; gap: 0; }

.member-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.member-projects-toggle {
  background: none;
  border: none;
  padding: 0;
  margin-top: 2px;
  color: var(--primary);
  font-size: 0.72rem;
  font-family: var(--font-main);
  cursor: pointer;
  text-align: left;
}
.member-projects-toggle:hover { text-decoration: underline; }

.member-projects {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--border-color);
}

.member-projects-title,
.invite-projects-title {
  font-size: 0.73rem;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.member-projects-list,
.invite-projects-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 180px;
  overflow-y: auto;
}

.member-projects-actions,
.invite-create-actions {
  margin-top: 10px;
  display: flex;
  justify-content: flex-end;
}

/* プロジェクト選択の1行 */
.pj-check {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s;
}
.pj-check:hover { background: rgba(255, 255, 255, 0.04); }

.pj-check input[type="checkbox"] {
  accent-color: var(--primary);
  cursor: pointer;
  flex-shrink: 0;
}

.pj-check-name {
  flex: 1;
  min-width: 0;
  font-size: 0.8rem;
  color: var(--text-main);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pj-perm { flex-shrink: 0; }

.pj-current,
.pj-full,
.pj-count {
  font-size: 0.66rem;
  padding: 1px 6px;
  border-radius: 999px;
  flex-shrink: 0;
  white-space: nowrap;
}
.pj-current { background: rgba(59, 130, 246, 0.2); color: #93c5fd; }
.pj-full    { background: rgba(239, 68, 68, 0.18); color: #f87171; }
.pj-count   { background: rgba(148, 163, 184, 0.15); color: var(--text-muted); }

.invite-projects { margin-top: 12px; }

.invite-create-row { margin-bottom: 4px; }

/* プロジェクト一覧の「共有」表示 */
.project-shared-tag {
  font-size: 0.66rem;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(59, 130, 246, 0.16);
  color: #93c5fd;
  white-space: nowrap;
}

.modal-wide { max-width: 620px; }
