/* ============================================================
 * shareLoginModal.css
 * TORIAI 社内共有 / Phase 1.3 ログインモーダル
 *
 * 設計書: SHARING_DESIGN.md v0.3.1 §6.1, モック v0.2 §1〜§9
 * 実装方針 (v0.2 §8 / §9):
 *   - 絵文字なし (マスター指示)
 *   - PC: max-width 480px center modal
 *   - スマホ (<=720px): 100dvh full-screen
 *   - error area は min-height 固定でボタンが跳ねない
 *   - 6 桁コード入力は 6 分割 UI
 * ============================================================ */

/* === オーバーレイ === */
.share-login-overlay {
  position: fixed;
  inset: 0;
  background: rgba(17, 17, 24, .42);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 24px;
  box-sizing: border-box;
}
.share-login-overlay.is-open { display: flex; }
.share-login-overlay[aria-hidden="false"] { display: flex; }

/* === カード === */
.share-login-card {
  background: #ffffff;
  width: 100%;
  max-width: 480px;
  max-height: calc(100dvh - 48px);
  border-radius: 16px;
  box-shadow: 0 12px 48px rgba(0, 0, 0, .18);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-family: 'Space Grotesk', 'Noto Sans JP', sans-serif;
  color: #1a1a2e;
}

/* === ヘッダー === */
.share-login-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px 14px;
  border-bottom: 1px solid #f0f0f5;
}
.share-login-title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: .01em;
}
.share-login-close {
  background: transparent;
  border: 1px solid transparent;
  color: #888;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
  transition: background .12s, color .12s, border-color .12s;
}
.share-login-close:hover {
  background: #f4f4f5;
  color: #1a1a2e;
}

/* === ボディ (画面切替コンテナ) === */
.share-login-body {
  padding: 18px 22px 22px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  font-size: 14px;
  line-height: 1.55;
}

.share-login-lead {
  margin: 0 0 4px;
  color: #4b5563;
  font-size: 13px;
  line-height: 1.6;
}

/* === 戻るリンク === */
.share-login-back {
  align-self: flex-start;
  background: transparent;
  border: none;
  color: #71717a;
  cursor: pointer;
  font-size: 12px;
  padding: 4px 6px;
  border-radius: 6px;
  font-family: inherit;
  transition: background .12s, color .12s;
}
.share-login-back:hover { background: #f4f4f5; color: #1a1a2e; }

/* === セクション見出し (subtitle) === */
.share-login-subtitle {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  color: #1a1a2e;
}

/* === 3 択カードボタン (画面 1A) === */
.share-login-choice {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  text-align: left;
  background: #ffffff;
  border: 1.5px solid #e0e0e6;
  border-radius: 12px;
  padding: 14px 16px;
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  color: #1a1a2e;
  gap: 4px;
  transition: border-color .12s, background .12s, transform .08s;
}
.share-login-choice:hover {
  background: #f4f4f5;
}
.share-login-choice:active { transform: scale(.99); }
.share-login-choice-title {
  font-weight: 700;
  font-size: 14px;
}
.share-login-choice-desc {
  font-size: 12px;
  color: #6b7280;
  font-weight: 400;
}

/* === Skip リンク (画面 1A) === */
.share-login-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #9ca3af;
  font-size: 11px;
  margin: 4px 0;
}
.share-login-divider::before,
.share-login-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: #e5e7eb;
}
.share-login-skip {
  align-self: center;
  background: transparent;
  border: none;
  color: #6b7280;
  font-family: inherit;
  font-size: 12px;
  cursor: pointer;
  padding: 8px 12px;
  border-radius: 8px;
}
.share-login-skip:hover {
  color: #1a1a2e;
  background: #f4f4f5;
}

/* === セグメントタブ (画面 1B login/signup 切替) === */
.share-login-seg {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: #f3f3f7;
  border-radius: 10px;
  padding: 4px;
  gap: 2px;
}
.share-login-seg button {
  background: transparent;
  border: none;
  font-family: inherit;
  font-size: 13px;
  padding: 8px 4px;
  border-radius: 8px;
  cursor: pointer;
  color: #6b7280;
  font-weight: 600;
  transition: background .12s, color .12s;
}
.share-login-seg button.is-active {
  background: #ffffff;
  color: #1a1a2e;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .06);
}

/* === フォーム === */
.share-login-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.share-login-field label {
  font-size: 11px;
  font-weight: 600;
  color: #555;
}
.share-login-field input[type="text"],
.share-login-field input[type="email"],
.share-login-field input[type="password"] {
  padding: 10px 12px;
  border: 1.5px solid #e0e0e6;
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  color: #1a1a2e;
  background: #ffffff;
  outline: none;
  transition: border-color .12s, box-shadow .12s;
}
.share-login-field input:focus {
  border-color: #a1a1aa;
  box-shadow: none;
  background: #ffffff;
}
/* Chrome / Edge / Safari の autofill / 候補プレビューの薄紫背景を白に上書き
   - :-webkit-autofill = 既に値が入った state
   - :autofill         = 標準仕様 (Chrome 119+ / Safari 16.4+)
   - 候補ドロップダウン open 時の faint lavender bg は box-shadow 1000px inset で塗りつぶし */
.share-login-field input:-webkit-autofill,
.share-login-field input:-webkit-autofill:hover,
.share-login-field input:-webkit-autofill:focus,
.share-login-field input:-webkit-autofill:active,
.share-login-field input:autofill,
.share-login-field input:autofill:hover,
.share-login-field input:autofill:focus {
  -webkit-box-shadow: 0 0 0 1000px #ffffff inset !important;
  box-shadow: 0 0 0 1000px #ffffff inset !important;
  -webkit-text-fill-color: #1a1a2e !important;
  background-color: #ffffff !important;
  background-image: none !important;
  caret-color: #1a1a2e !important;
  transition: background-color 9999s ease-in-out 0s, color 9999s ease-in-out 0s;
}
/* 全インプット (focus/hover 含めて) 強制白背景 — Chrome の credential preview 対策 */
.share-login-field input[type="text"],
.share-login-field input[type="email"],
.share-login-field input[type="password"] {
  background-color: #ffffff !important;
  background-image: none !important;
}
.share-login-field input[type="text"]:hover,
.share-login-field input[type="text"]:focus,
.share-login-field input[type="email"]:hover,
.share-login-field input[type="email"]:focus,
.share-login-field input[type="password"]:hover,
.share-login-field input[type="password"]:focus {
  background-color: #ffffff !important;
  background-image: none !important;
}
.share-login-field-hint {
  font-size: 11px;
  color: #888;
}

/* === 6 桁コード === */
.share-login-code {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
}
.share-login-code input {
  width: 100%;
  height: 48px;
  padding: 0;
  border: 1.5px solid #e0e0e6;
  border-radius: 8px;
  text-align: center;
  font-size: 22px;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  color: #1a1a2e;
  background: #ffffff;
  outline: none;
  transition: border-color .12s, box-shadow .12s;
}
.share-login-code input:focus {
  border-color: #a1a1aa;
  box-shadow: none;
  background: #ffffff;
}

/* === PIN 入力 + 目アイコン トグル (master 仕様 2026-05-09) === */
.share-login-pin-wrap {
  position: relative;
  display: flex;
  align-items: stretch;
}
.share-login-pin-wrap input {
  flex: 1 1 auto;
  padding-right: 40px;
}
.share-login-pin-toggle {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  color: #71717a;
  transition: color .12s, background .12s;
}
.share-login-pin-toggle:hover { background: #f4f4f5; color: #18181b; }
.share-login-pin-toggle.is-shown { color: #4f46e5; }

/* === 主要ボタン (送信) === */
.share-login-submit {
  width: 100%;
  background: #1a1a2e;
  color: #ffffff;
  border: 1.5px solid #1a1a2e;
  border-radius: 10px;
  padding: 12px 16px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: background .12s, color .12s, opacity .12s;
}
.share-login-submit:hover:not(:disabled) {
  background: #2a2a3e;
}
.share-login-submit:disabled {
  opacity: .55;
  cursor: not-allowed;
}

/* === パスワード再設定リンク (画面 1B login のみ) === */
.share-login-forgot {
  align-self: center;
  background: transparent;
  border: none;
  color: #6b7280;
  font-family: inherit;
  font-size: 12px;
  cursor: pointer;
  padding: 4px 6px;
}
.share-login-forgot:hover { background: #f4f4f5; color: #1a1a2e; }

/* === エラー領域 (高さ固定でボタン跳ね防止、§9.1 #4) === */
.share-login-err {
  min-height: 36px;
  font-size: 12px;
  color: #b91c1c;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 8px;
  padding: 8px 10px;
  display: none;
  white-space: pre-wrap;
}
.share-login-err.is-shown { display: block; }

/* === レスポンシブ: スマホ 720px 未満 → full-screen === */
@media (max-width: 720px) {
  .share-login-overlay {
    padding: 0;
  }
  .share-login-card {
    max-width: 100vw;
    max-height: 100dvh;
    height: 100dvh;
    border-radius: 0;
  }
  .share-login-body {
    padding: 14px 16px 24px;
  }
  /* スマホで 6 桁コードを少し小さく (合計幅が画面に収まるよう) */
  .share-login-code input {
    height: 44px;
    font-size: 20px;
  }
}

/* === 印刷時は完全非表示 === */
@media print {
  .share-login-overlay { display: none !important; }
}
