/*
 * Copyright © 2025 JQIT. All rights reserved.
 */

:root{
  --bg-start: #89C2F0;
  --bg-end: #5BADF0;
  --card-bg: #ffffff;
  --accent: #138CF0;
  --accent-2: #2396ff;
  --accent-rgb: 19,140,240;
  --muted: #6b6b6b;
  --muted-2: #4a4a4a;
  --input-border: #e1e6ee;
  --radius-lg: 1rem;
  --radius-pill: 999px;
  --shadow-1: 0 10px 25px rgba(0,0,0,0.08);
  --shadow-2: 0 6px 18px rgba(37,119,255,0.12);
  --max-card-width: 420px;
}

/* ベース */
html, body {
  height: 100%;
}

body {
  margin: 0;
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom) 0;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, var(--bg-start), var(--bg-end));
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* コンテナ: 幅・高さ・スクロール対応 */
.login-container {
  width: min(94%, var(--max-card-width));
  max-width: var(--max-card-width);
  margin: 4vh auto;
  padding: 2.2rem;
  background: var(--card-bg);
  border-radius: 18px;
  box-shadow: var(--shadow-1);
  text-align: center;
  box-sizing: border-box;
  max-height: calc(100vh - 8vh);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* スクロールバー */
.login-container::-webkit-scrollbar { width: 6px; }
.login-container::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.06); border-radius: 6px; }

/* ブランド */
.brand {
  margin-bottom: 8px;
}
.brand h1 {
  margin: 0 0 8px 0;
  font-size: 28px;
  line-height: 1;
  font-weight: 800;
  color: #111;
}
.logo {
  width: 96px;
  height: auto;
  display: block;
  margin: 8px auto 18px;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(var(--accent-rgb),0.06), rgba(0,0,0,0.02));
  padding: 10px;
}

/* サブタイトル */
h2 {
  margin: 0 0 1.25rem 0;
  color: #333;
  font-size: 20px;
  font-weight: 700;
}

/* フォーム */
.login-container form {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.input-wrapper {
  position: relative;
}
.login-container input[type="text"],
.login-container input[type="password"],
.login-container input[type="email"] {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid var(--input-border);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 15px;
  background: #fff;
  transition: box-shadow .12s ease, border-color .12s ease;
}

/* フォーカス・アクセシビリティ */
.login-container input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 6px 18px rgba(var(--accent-rgb),0.08);
}

/* エラーメッセージ */
.error-message {
  color: #ff0000;
  margin: 0 0 8px 0;
  font-size: 14px;
}

/* パスワードトグル */
.password-wrapper { position: relative; }
.password-wrapper .toggle-password {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  cursor: pointer;
  display:flex;
  align-items:center;
  justify-content:center;
  width: 34px;
  height: 34px;
  color: var(--muted);
  background: transparent;
  border: none;
}

/* ボタン */
button[type="submit"] {
  width: 100%;
  padding: 12px;
  font-size: 16px;
  color: white;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  border: none;
  border-radius: 10px;
  cursor: pointer;
  box-shadow: var(--shadow-2);
  transition: transform .12s ease, box-shadow .12s ease, opacity .12s ease;
}
button[type="submit"]:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(37,119,255,0.16);
}
button[type="submit"]:active {
  transform: translateY(0);
  opacity: 0.98;
}

/* リンク */
.link-row {
  margin-top: 1.1rem;
  text-align: center;
  padding: 0 4px;
}

/* リンク（下線） */
.link-ghost {
  position: relative;
  display: inline-block;
  padding: 2px 0;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
  transition: transform .18s ease, color .12s ease;
  font-size: 15px;
}
.link-ghost::after {
  content: "";
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: -4px;
  width: 0%;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
  transition: width .25s cubic-bezier(.2,.8,.2,1);
}
.link-ghost:hover { transform: translateY(-2px); color: var(--muted-2); }
.link-ghost:hover::after { width: 100%; }

/* ボタン風リンク */
.link-primary {
  display: inline-block;
  padding: 9px 20px;
  border-radius: var(--radius-pill);
  background: linear-gradient(90deg, var(--accent-2), var(--accent));
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  box-shadow: var(--shadow-2);
  transition: transform .14s ease, box-shadow .14s ease;
}
.link-primary:hover { transform: translateY(-3px); box-shadow: 0 10px 26px rgba(37,119,255,0.18); }

/* レスポンシブ調整 */
@media (max-width: 500px) {
  .login-container { margin: 3vh auto; padding: 1.6rem; border-radius: 14px; }
  .brand h1 { font-size: 24px; }
  .logo { width: 84px; margin-bottom: 14px; }
  h2 { font-size: 18px; margin-bottom: 0.9rem; }
  .login-container input { padding: 11px 12px; font-size: 15px; }
  button[type="submit"] { padding: 11px; font-size: 15px; border-radius: 9px; }
  .link-row { margin-top: 12px; }
}

/* 小型端末 */
@media (max-width: 360px) {
  .brand h1 { font-size: 20px; }
  .logo { width: 72px; }
  .login-container { padding: 14px; }
}

/* 大画面微調整 */
@media (min-width: 768px) {
  .login-container { padding: 2.6rem; border-radius: 20px; }
  .brand h1 { font-size: 34px; }
  .logo { width: 120px; }
}

/* 補助: フォーム要素が画面外に伸びないように */
img.logo { max-width: 100%; height: auto; display: block; }