/* 認証まわりの画面（_auth_base.html）: 左に GIGAMC の紹介、右にフォーム。
   フォームの部品（.auth-shell・.auth-field など）は main.css のものを、そのまま使う。
   紹介は、開くたびに 3 つのパターン（GIGAMC AI / 料金と期間 / 統合版）から 1 つを表示する（_auth_showcase.html）。 */

/* ── 枠 ─────────────────────────────────────────── */
/* このファイルは main.css より先に読み込まれるので、詳細度を上げて main.css の指定に勝たせる */
.layout.layout-auth.layout-auth-split .main {
  padding: 0;
  align-items: stretch;
  justify-content: stretch;
}

.auth-split {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  width: 100%;
}

.auth-split-form {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.5rem;
  min-width: 0;
}

.layout.layout-auth-split .auth-shell {
  width: min(100%, 25rem);
}

/* 本登録・メール変更の結果: 縦に長いので、上から並べる */
.layout.layout-auth-split.layout-auth-complete .auth-split-form {
  align-items: flex-start;
  padding-top: 2.5rem;
}

/* 横幅が広いときは、左の紹介にブランド名があるので、カードのロゴは出さない（狭いときは出す） */
@media (min-width: 961px) {
  .layout.layout-auth-split .auth-shell-logo {
    display: none;
  }
}

/* ── 右: フォーム（カードの枠を外して、右側全体をフォームの面にする） ─── */
.layout.layout-auth-split .auth-shell {
  width: min(100%, 24rem);
}

.layout.layout-auth-split .auth-shell-card {
  overflow: visible;
  padding: 0;
  border: none;
  border-radius: 0;
  background: none;
  box-shadow: none;
  backdrop-filter: none;
}

.layout.layout-auth-split .auth-shell-accent {
  display: none;
}

.layout.layout-auth-split .auth-shell-head {
  margin-bottom: 1.6rem;
  text-align: left;
}

.layout.layout-auth-split .auth-shell-logo {
  margin-bottom: 1.25rem;
  font-size: 1.35rem;
}

.auth-form-head {
  margin-bottom: 1.4rem;
}

.auth-form-title {
  margin: 0 0 0.45rem;
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: 0.01em;
  color: rgb(241, 245, 249);
}

.auth-form-desc {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.7;
  color: rgb(148, 163, 184);
}

.layout.layout-auth-split .auth-shell-tabs {
  margin-top: 0;
}

.layout.layout-auth-split .auth-complete-title {
  margin-top: 0;
  font-size: 1.6rem;
  font-weight: 800;
  color: rgb(241, 245, 249);
}

/* 入力欄のアイコン（左）と、パスワードの表示切替（右） */
.auth-field--icon .auth-field-input {
  padding-left: 2.6rem;
}

.auth-field--icon .auth-field-label {
  left: 2.6rem;
}

.auth-field-icon {
  position: absolute;
  left: 0.95rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1rem;
  color: rgb(100, 116, 139);
  pointer-events: none;
  transition: color 0.2s ease;
}

.auth-field-input:focus ~ .auth-field-icon {
  color: rgb(255, 160, 90);
}

.auth-field--toggle .auth-field-input {
  padding-right: 2.9rem;
}

.auth-field-toggle {
  position: absolute;
  right: 0.45rem;
  top: 50%;
  transform: translateY(-50%);
  display: inline-grid;
  place-items: center;
  width: 2.2rem;
  height: 2.2rem;
  padding: 0;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: rgb(120, 136, 158);
  font-size: 1.05rem;
  cursor: pointer;
  transition: color 0.18s ease, background 0.18s ease;
}

.auth-field-toggle:hover {
  color: rgb(226, 232, 240);
  background: rgba(148, 163, 184, 0.1);
}

.auth-field-toggle:focus-visible {
  outline: 2px solid rgba(238, 96, 15, 0.6);
  outline-offset: 1px;
}

/* 入力の注意（ログイン: メールアドレスの形式・パスワードの文字数） */
.auth-field-hint {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin: -0.35rem 0 0;
  font-size: 0.8rem;
  color: rgb(252, 165, 165);
}

.auth-field-hint[hidden] {
  display: none;
}

.auth-field-input[aria-invalid="true"] {
  box-shadow:
    0 0 0 1px rgba(248, 113, 113, 0.6) inset,
    0 6px 18px rgba(0, 0, 0, 0.18);
}

/* 自動入力の検知用（auth-form.js が animationstart を受け取る。見た目は変えない） */
@keyframes auth-autofill-start { from { opacity: 1; } to { opacity: 1; } }
.auth-field-input:-webkit-autofill { animation-name: auth-autofill-start; animation-duration: 0.01s; }
.auth-field-input:autofill { animation-name: auth-autofill-start; animation-duration: 0.01s; }

/* 条件を満たすまで押せないボタン（理由が分かるよう、カーソルで示す） */
.layout.layout-auth-split .auth-shell-submit:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}

/* Caps Lock の注意 */
.auth-capslock {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin: -0.35rem 0 0;
  font-size: 0.8rem;
  color: rgb(251, 191, 36);
}

.auth-capslock[hidden] {
  display: none;
}

/* 送信ボタン: 矢印（押せる感じ）と、送信中の回転 */
.auth-shell-submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.auth-submit-arrow {
  font-size: 1rem;
  transition: transform 0.2s ease;
}

.auth-shell-submit:hover .auth-submit-arrow {
  transform: translateX(3px);
}

.auth-shell-submit.is-loading {
  pointer-events: none;
  opacity: 0.85;
}

.auth-shell-submit.is-loading::before {
  content: "";
  width: 1rem;
  height: 1rem;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: auth-spin 0.7s linear infinite;
}

@keyframes auth-spin {
  to { transform: rotate(360deg); }
}

/* Discord のボタン: ロゴつき */
.auth-discord-login .bi-discord {
  font-size: 1.1rem;
}

/* ログイン ⇄ 登録の案内 */
.auth-form-switch {
  margin: 1.5rem 0 0;
  text-align: center;
  font-size: 0.875rem;
  color: rgb(148, 163, 184);
}

.auth-form-switch .auth-shell-link {
  font-weight: 700;
}

/* 明るいテーマ: 認証の画面は、右側も暗い面のまま（従来のカードと同じ配色）にする */
:root[data-theme="light"] .layout.layout-auth-split .auth-split-form {
  background:
    radial-gradient(ellipse 80% 50% at 50% 0%, rgba(238, 96, 15, 0.08), transparent 60%),
    rgb(11, 26, 47);
}

:root[data-theme="light"] .auth-form-title,
:root[data-theme="light"] .layout.layout-auth-split .auth-complete-title,
:root[data-theme="light"] .layout.layout-auth-split .auth-shell-logo { color: rgb(241, 245, 249); }
:root[data-theme="light"] .auth-form-desc,
:root[data-theme="light"] .auth-form-switch { color: rgb(148, 163, 184); }

/* ── 左: 紹介 ───────────────────────────────────── */
/* 画面のテーマ（明・暗）に関わらず、紹介の面は暗い色で固定する（ブランドの面） */
.auth-showcase {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  padding: 3rem clamp(2rem, 5vw, 4.5rem);
  color: rgb(226, 232, 240);
  background:
    radial-gradient(ellipse 70% 55% at 15% 10%, rgba(238, 96, 15, 0.22), transparent 60%),
    radial-gradient(ellipse 60% 50% at 90% 95%, rgba(56, 120, 220, 0.18), transparent 60%),
    linear-gradient(160deg, rgb(10, 24, 44), rgb(7, 16, 30));
  border-right: 1px solid rgba(148, 163, 184, 0.12);
}

.auth-showcase-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(148, 163, 184, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.06) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: radial-gradient(ellipse 80% 70% at 40% 45%, #000 30%, transparent 85%);
  -webkit-mask-image: radial-gradient(ellipse 80% 70% at 40% 45%, #000 30%, transparent 85%);
}

.auth-showcase-glow {
  position: absolute;
  width: 26rem;
  height: 26rem;
  right: -8rem;
  top: -6rem;
  border-radius: 50%;
  background: rgba(238, 96, 15, 0.16);
  filter: blur(90px);
  animation: auth-showcase-drift 14s ease-in-out infinite alternate;
}

.auth-showcase-inner {
  position: relative;
  width: 100%;
  max-width: 32rem;
  animation: auth-showcase-in 0.7s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.auth-showcase-brand {
  margin: 0 0 2.25rem;
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: 0.32em;
  color: rgb(255, 160, 90);
}

.auth-showcase-title {
  margin: 0 0 1rem;
  font-size: clamp(1.7rem, 2.6vw, 2.35rem);
  line-height: 1.35;
  font-weight: 800;
  letter-spacing: 0.01em;
  color: rgb(241, 245, 249);
}

.auth-showcase-lead {
  margin: 0 0 2rem;
  font-size: 0.98rem;
  line-height: 1.8;
  color: rgb(160, 174, 192);
}

/* 図のカード（各パターン共通の枠） */
.auth-showcase-card {
  margin-bottom: 2rem;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 14px;
  background: rgba(8, 18, 34, 0.72);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(6px);
  overflow: hidden;
}

.auth-showcase-card-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 0.95rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.12);
  background: rgba(15, 30, 52, 0.8);
  font-size: 0.8rem;
  font-weight: 700;
  color: rgb(203, 213, 225);
}

.auth-showcase-card-bar i {
  color: rgb(255, 160, 90);
}

.auth-showcase-mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

/* パターン: GIGAMC AI（やりとりの見本）。動きは auth-showcase.js が付ける */
.auth-showcase-chat-body {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 0.7rem;
  padding: 1.1rem;
  /* やりとりごとに、カードの高さが変わらないように（下の特長が動かない） */
  min-height: 11.5rem;
}

.auth-showcase-bubble {
  margin: 0;
  max-width: 88%;
  padding: 0.65rem 0.85rem;
  border-radius: 12px;
  font-size: 0.88rem;
  line-height: 1.65;
  transition:
    opacity 0.45s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

.auth-showcase-bubble--user {
  align-self: flex-end;
  background: rgba(238, 96, 15, 0.16);
  border: 1px solid rgba(238, 96, 15, 0.28);
  color: rgb(255, 214, 186);
  border-bottom-right-radius: 4px;
  transform-origin: right bottom;
}

.auth-showcase-bubble--ai {
  align-self: flex-start;
  background: rgba(30, 50, 80, 0.85);
  border: 1px solid rgba(148, 163, 184, 0.16);
  color: rgb(214, 224, 238);
  border-bottom-left-radius: 4px;
  transform-origin: left bottom;
}

.auth-showcase-bubble--ai strong {
  color: rgb(255, 160, 90);
}

.auth-showcase-bubble.is-entering {
  opacity: 0;
  transform: translateY(10px) scale(0.96);
}

.auth-showcase-bubble.is-leaving {
  opacity: 0;
  transform: translateY(-8px);
}

/* 考え中: 小さな吹き出しに、点が 3 つ */
.auth-showcase-bubble.is-thinking {
  padding: 0.75rem 0.9rem;
}

.auth-showcase-typing {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  height: 1.1em;
}

.auth-showcase-typing span {
  width: 0.42rem;
  height: 0.42rem;
  border-radius: 50%;
  background: rgb(148, 163, 184);
  animation: auth-showcase-dots 1.1s ease-in-out infinite;
}

.auth-showcase-typing span:nth-child(2) { animation-delay: 0.16s; }
.auth-showcase-typing span:nth-child(3) { animation-delay: 0.32s; }

/* 返事の 1 文字ずつ: ふわっと現れる */
.auth-showcase-char {
  animation: auth-showcase-char 0.32s ease-out both;
}

/* パターン: 料金と期間 */
.auth-showcase-periods-body {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.6rem;
  padding: 1.1rem 1.1rem 0.9rem;
}

.auth-showcase-period {
  display: grid;
  gap: 0.25rem;
  padding: 0.8rem 0.7rem;
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 10px;
  background: rgba(20, 38, 64, 0.6);
  text-align: center;
  animation: auth-showcase-select 7.5s ease-in-out infinite;
}

.auth-showcase-period:nth-child(2) { animation-delay: 2.5s; }
.auth-showcase-period:nth-child(3) { animation-delay: 5s; }

.auth-showcase-period-name {
  font-size: 1rem;
  font-weight: 800;
  color: rgb(241, 245, 249);
}

.auth-showcase-period-note {
  font-size: 0.72rem;
  color: rgb(140, 155, 178);
}

.auth-showcase-pay {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  padding: 0 1.1rem 1.1rem;
}

.auth-showcase-pay-label {
  margin-right: 0.25rem;
  font-size: 0.75rem;
  color: rgb(120, 136, 158);
}

.auth-showcase-chip {
  padding: 0.2rem 0.65rem;
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  color: rgb(214, 224, 238);
  background: rgba(30, 50, 80, 0.6);
}

/* パターン: 統合版（サーバーを追加する画面の見本） */
.auth-showcase-form-body {
  display: grid;
  gap: 0.65rem;
  padding: 1.1rem;
}

.auth-showcase-input {
  position: relative;
  display: grid;
  gap: 0.2rem;
  padding: 0.55rem 0.8rem;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 8px;
  background: rgba(4, 12, 24, 0.7);
}

.auth-showcase-input-label {
  font-size: 0.7rem;
  color: rgb(120, 136, 158);
}

.auth-showcase-input-value {
  font-size: 0.92rem;
  color: rgb(226, 232, 240);
}

.auth-showcase-input--focus {
  border-color: rgba(238, 96, 15, 0.6);
  box-shadow: 0 0 0 3px rgba(238, 96, 15, 0.12);
}

.auth-showcase-input--muted .auth-showcase-input-value {
  color: rgb(140, 155, 178);
}

.auth-showcase-caret {
  display: inline-block;
  width: 2px;
  height: 1em;
  margin-left: 2px;
  vertical-align: -0.15em;
  background: rgb(255, 160, 90);
  animation: auth-showcase-blink 1.1s steps(1) infinite;
}

.auth-showcase-ok {
  position: absolute;
  right: 0.7rem;
  top: 50%;
  transform: translateY(-50%);
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  background: rgba(16, 185, 129, 0.14);
  color: rgb(110, 231, 183);
  font-size: 0.72rem;
  font-weight: 700;
}

/* 特長 */
.auth-showcase-points {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.85rem;
}

.auth-showcase-points li {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  font-size: 0.92rem;
  line-height: 1.6;
  color: rgb(186, 198, 214);
}

.auth-showcase-points i {
  flex: none;
  display: inline-grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border-radius: 9px;
  background: rgba(238, 96, 15, 0.12);
  color: rgb(255, 160, 90);
  font-size: 1rem;
}

.auth-showcase-points strong {
  color: rgb(241, 245, 249);
  font-weight: 700;
}

/* 明るいテーマでも、紹介の面は暗いまま。サイト全体の明るいテーマの文字色を、ここでは打ち消す */
:root[data-theme="light"] .auth-showcase { color: rgb(226, 232, 240); }
:root[data-theme="light"] .auth-showcase-title { color: rgb(241, 245, 249); }
:root[data-theme="light"] .auth-showcase-lead { color: rgb(160, 174, 192); }
:root[data-theme="light"] .auth-showcase-brand { color: rgb(255, 160, 90); }
:root[data-theme="light"] .auth-showcase-card-bar { color: rgb(203, 213, 225); }
:root[data-theme="light"] .auth-showcase-bubble--user { color: rgb(255, 214, 186); }
:root[data-theme="light"] .auth-showcase-bubble--ai { color: rgb(214, 224, 238); }
:root[data-theme="light"] .auth-showcase-bubble--ai strong { color: rgb(255, 160, 90); }
:root[data-theme="light"] .auth-showcase-period-name { color: rgb(241, 245, 249); }
:root[data-theme="light"] .auth-showcase-period-note,
:root[data-theme="light"] .auth-showcase-input--muted .auth-showcase-input-value { color: rgb(140, 155, 178); }
:root[data-theme="light"] .auth-showcase-pay-label,
:root[data-theme="light"] .auth-showcase-input-label { color: rgb(120, 136, 158); }
:root[data-theme="light"] .auth-showcase-chip { color: rgb(214, 224, 238); }
:root[data-theme="light"] .auth-showcase-input-value { color: rgb(226, 232, 240); }
:root[data-theme="light"] .auth-showcase-ok { color: rgb(110, 231, 183); }
:root[data-theme="light"] .auth-showcase-points li { color: rgb(186, 198, 214); }
:root[data-theme="light"] .auth-showcase-points strong { color: rgb(241, 245, 249); }

/* ── 動き ───────────────────────────────────────── */
@keyframes auth-showcase-in {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}

@keyframes auth-showcase-drift {
  from { transform: translate(0, 0) scale(1); }
  to { transform: translate(-3rem, 2.5rem) scale(1.1); }
}

@keyframes auth-showcase-dots {
  0%, 80%, 100% { opacity: 0.3; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-3px); }
}

@keyframes auth-showcase-char {
  from { opacity: 0; filter: blur(2px); }
  to { opacity: 1; filter: none; }
}

@keyframes auth-showcase-select {
  0%, 30% { border-color: rgba(238, 96, 15, 0.7); background: rgba(238, 96, 15, 0.14); box-shadow: 0 0 0 3px rgba(238, 96, 15, 0.1); }
  36%, 100% { border-color: rgba(148, 163, 184, 0.16); background: rgba(20, 38, 64, 0.6); box-shadow: none; }
}

@keyframes auth-showcase-blink {
  0%, 50% { opacity: 1; }
  50.01%, 100% { opacity: 0; }
}

/* ログイン ⇄ 登録の切り替えなど、2 ページ目以降は、入場の動きを再生しない（base.html の no-entry-anim） */
.no-entry-anim .auth-showcase-inner {
  animation: none;
}

@media (prefers-reduced-motion: reduce) {
  .auth-showcase-inner,
  .auth-showcase-glow,
  .auth-showcase-typing span,
  .auth-showcase-period,
  .auth-showcase-caret {
    animation: none;
  }
  .auth-showcase-period:first-child { border-color: rgba(238, 96, 15, 0.7); background: rgba(238, 96, 15, 0.14); }
}

/* ── 幅が狭いとき: 紹介を隠して、フォームだけ ─────────────── */
@media (max-width: 960px) {
  .auth-split {
    grid-template-columns: minmax(0, 1fr);
  }
  .auth-showcase {
    display: none;
  }
  .auth-split-form {
    padding: 1.5rem 1rem;
  }
}
