@charset "utf-8";

/* ========== /login 固定ページ（.auth-wrap 以下） ========== */
.auth-wrap { max-width: 420px; margin: 48px auto 72px; padding: 0 16px; }

/* 共通ヘッダー（/login でもモーダルでも使うので下で #spb-auth-overlay にも適用） */
.auth-header { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.auth-back { border: 0; background: transparent; font-size: 20px; line-height: 1; cursor: pointer; padding: 6px 8px; border-radius: 8px; }
.auth-back:hover { background: #f3f4f6; }
.auth-title { font-size: 20px; font-weight: 700; margin: 0; }
.auth-header [hidden] { display: none !important; }

/* ビュー切替（/login 固定ページ） */
.auth-view { display: none; }                         /* デフォルト隠す */
.auth-view:not([hidden]) { display: block; }          /* hidden が外れたものだけ表示 */

/* 入力系（/login 固定ページ専用にスコープ） */
.auth-wrap .field { margin: 12px 0; }
.auth-wrap .field label { display: block; margin-bottom: 6px; font-weight: 600; }
.auth-wrap .field input[type="text"],
.auth-wrap .field input[type="email"],
.auth-wrap .field input[type="password"] { width: 100%; padding: 10px 12px; border: 1px solid #ddd; border-radius: 8px; }
.auth-wrap .field .hint { display: block; color: #6b7280; font-size: 12px; margin-top: 6px; }
.auth-wrap .field.check label { font-weight: 400; }

.auth-wrap .primary { width: 100%; padding: 12px; border-radius: 10px; border: 0; background: #111827; color: #fff; font-weight: 700; cursor: pointer; }
.auth-wrap .primary:hover { opacity: .95; }
.auth-wrap .link { background: none; border: 0; color: #111827; text-decoration: underline; cursor: pointer; padding: 0; }

.auth-links, .auth-switch { margin-top: 14px; }
.auth-switch .muted { color: #6b7280; margin-right: 6px; }
.req { color: #c00; }

.auth-links{text-align: right;}



.spb-flash { padding: 10px 12px; border-radius: 8px; margin-bottom: 12px; font-size: 14px; }
.spb-flash-info { background: #eef5ff; border: 1px solid #c8dcff; }
.spb-flash-success { background: #e7f7ee; border: 1px solid #b7e3c8; }
.spb-flash-error { background: #ffecec; border: 1px solid #f5b5b5; }

.spb-disclaimer { margin-top: 16px; color: #6b7280; font-size: 12px; line-height: 1.6; }
.auth-mini { margin-top: 16px; }

/* ========== モーダル（#spb-auth-overlay 以下） ========== */
/* オーバーレイ本体：常に DOM に置いて、opacity / pointer-events で開閉 */
#spb-auth-overlay{
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 2147483646 !important;

  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;

  opacity: 0;
  pointer-events: none;
  transition: opacity .22s ease;
}
#spb-auth-overlay.is-open{
  opacity: 1;
  pointer-events: auto;
}

/* 背景スクロール抑止（JS で html/body にクラス付与） */
html.spb-modal-open,
body.spb-modal-open{
  overflow: hidden !important;
}

/* モーダル本体（PC 基本カード） */
.spb-auth-modal{
  background: #fff;
  max-width: 420px;
  width: 100%;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 10px 28px rgba(0,0,0,.25);
  position: relative;

  /* 検索オーバーレイと似た「少し上からスッと」 */
  transform: translate3d(0, -12%, 0);  /* ★ ここを 12% → -12% にする */
  opacity: .98;
  transition: transform .26s ease, opacity .26s ease;
  will-change: transform, opacity;
}

/* 開いているとき：上から少しスライドしながらフェードイン */
#spb-auth-overlay.is-open .spb-auth-modal{
  transform: translate3d(0, 0, 0);
  opacity: 1;
}


.spb-auth-title{
  font-size: 18px;
  font-weight: 700;
  margin: 0 0 10px;
}

/* 閉じるボタン：検索オーバーレイと同じルック（✕ボタン） */
.spb-auth-close{
  position: absolute;
  top: 12px;
  right: 12px;

  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;

  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
  color: #0f172a;
  cursor: pointer;

  font-size: 0; /* 中の「×」テキストは視覚的に消し、aria-label で読ませる */
}
.spb-auth-close::before,
.spb-auth-close::after{
  content: "";
  position: absolute;
  width: 18px;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
}
.spb-auth-close::before{ transform: rotate(45deg); }
.spb-auth-close::after { transform: rotate(-45deg); }


/* 入力系（モーダル専用にスコープ） */
#spb-auth-overlay .field{ margin: 12px 0; }
#spb-auth-overlay .field input{
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 8px;
}
#spb-auth-overlay .hint{
  display: block;
  color: #6b7280;
  font-size: 12px;
  margin-top: 6px;
}
#spb-auth-overlay .check{
  display: block;
  margin: 8px 0;
}

#spb-auth-overlay .primary{
  width: 100%;
  padding: 12px;
  border-radius: 10px;
  border: 0;
  background: #111827;
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}
#spb-auth-overlay .primary:hover{ opacity: .95; }

#spb-auth-overlay .link{
  background: none;
  border: 0;
  color: #111827;
  text-decoration: underline;
  cursor: pointer;
  padding: 0;
}
#spb-auth-overlay .auth-links,
#spb-auth-overlay .auth-switch{
  margin-top: 14px;
}
#spb-auth-overlay .muted{
  color: #6b7280;
  margin-right: 6px;
}
#spb-auth-overlay .req{ color: #c00; }

/* フラッシュ */
.spb-auth-flash{
  padding: 10px 12px;
  border-radius: 8px;
  margin-bottom: 10px;
  font-size: 14px;
  border: 1px solid transparent;
  display: none;
}
.spb-auth-flash.info{
  display: block;
  background: #eef5ff;
  border-color: #c8dcff;
}
.spb-auth-flash.success{
  display: block;
  background: #e7f7ee;
  border-color: #b7e3c8;
}
.spb-auth-flash.error{
  display: block;
  background: #ffecec;
  border-color: #f5b5b5;
}

/* モーダルのビュー切替 */
#spb-auth-overlay .spb-view{
  display: none !important;
}
#spb-auth-overlay.is-open .spb-view.is-active{
  display: block !important;
}
#spb-auth-overlay .auth-mini[hidden]{
  display: none !important;
}

/* /login とモーダル両方で使うヘッダーを明示スコープ */
#spb-auth-overlay .auth-header{
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px 0;
}
#spb-auth-overlay .auth-back{
  appearance: none;
  border: 0;
  background: #f3f4f6;
  border-radius: 6px;
  padding: 6px 8px;
  line-height: 1;
  cursor: pointer;
  font-size: 14px;
}
#spb-auth-overlay .auth-back:hover{
  background: #e5e7eb;
}
#spb-auth-overlay .auth-title{
  margin: 0;
  font-size: 18px;
  line-height: 1.3;
}


/* ページ版／モーダル版のフラッシュを同じ見た目にそろえる（:root 不使用） */
.auth-flash-stack .spb-flash,
.spb-auth-flash{

  padding: 10px 12px;
  border-radius: 8px;
  margin-bottom: 12px;  /* ← モーダル側の 10px を 12px に合わせる */
  font-size: 14px;
  border: 1px solid transparent;
}

/* 状態色も共通化（クラス名は別のまま） */
.spb-flash-info,
.spb-auth-flash.info{
  background: #eef5ff;
  border-color: #c8dcff;
}
.spb-flash-success,
.spb-auth-flash.success{
  background: #e7f7ee;
  border-color: #b7e3c8;
}
.spb-flash-error,
.spb-auth-flash.error{
  background: #ffecec;
  border-color: #f5b5b5;
}


/* 汎用：hidden 属性の強制非表示（テーマ上書きを封じる） */
[hidden]{ display: none !important; }


/* ========== SPモバイル：ログインモーダルを全画面シート化 ========== */
/* ヘッダー検索やドロワーと同じく、SP(<960px)ではフルスクリーン表示に揃える */
@media (max-width: 959px){

  /* オーバーレイ自体は「全画面＋上詰め」配置に変更 */
  #spb-auth-overlay{
    align-items: stretch;        /* 中央寄せ → 縦方向いっぱい */
    justify-content: flex-start; /* 上側から配置 */
    padding: 0;                  /* 余白はモーダル側で管理 */
  }

  /* モーダル本体を“シート”として全画面化 */
  #spb-auth-overlay .spb-auth-modal{
    max-width: 100%;
    width: 100%;
    height: 100%;
    margin: 0;
    border-radius: 0;            /* 角丸カード → フラットなシート */
    box-shadow: none;            /* 影もOFF（下の画面との段差感をなくす） */

    display: flex;
    flex-direction: column;

    /* 上下の安全マージン＆セーフエリア考慮 */
    padding-top: calc(12px + env(safe-area-inset-top));
    padding-right: 16px;
    padding-left: 16px;
    padding-bottom: calc(16px + env(safe-area-inset-bottom));

    /* コンテンツが長い場合はモーダル内だけスクロール */
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* タイトルまわりの微調整（少しだけ余裕を持たせる） */
  #spb-auth-overlay .spb-auth-title{
    margin-top: 4px;
    margin-bottom: 12px;
    font-size: 18px;
  }

  /* 各ビュー（login/register/forgot）の下側がベタっと埋もれないように少し余白 */
  #spb-auth-overlay .spb-view{
    padding-bottom: 8px;
  }

  /* 閉じるボタン位置：右上固定（検索オーバーレイと揃える） */
  #spb-auth-overlay .spb-auth-close{
    top: 12px;
    right: 12px;
  }
}