/* =========================================================
   売却査定 提携パラメータ ポップアップ（ステップ式ウィザード）
   参考LP準拠：1問ずつ進む / 選択行 / 次へ進む・戻る
   既存LPの承認済みデザインには手を加えず、追加要素として被せる
   DOORブランドカラー（_variables.scss 準拠）
   ========================================================= */
:root {
  --sp-main: #2cbcd9;
  --sp-second: #257db7;
  --sp-emphasis: #ff8a00;
  --sp-emphasis-dark: #ed6103;
  --sp-navy: #254d85;      /* 次へ進むボタン */
  --sp-text: #333;
  --sp-border: #e8e8e8;
  --sp-light: #EDFCFF;
}

/* オーバーレイ */
.sp-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  padding: 16px;
}
.sp-modal-overlay.is-open { display: flex; animation: sp-fade 0.2s ease; }
@keyframes sp-fade { from { opacity: 0; } to { opacity: 1; } }

/* モーダル本体（固定高さ＋内部スクロール） */
.sp-modal {
  width: 100%;
  max-width: 460px;
  height: min(560px, calc(100vh - 32px));
  background: #f2f4f6;
  border-radius: 14px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
  font-family: 'Noto Sans JP', sans-serif;
  color: var(--sp-text);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: sp-pop 0.22s ease;
}
@keyframes sp-pop {
  from { transform: translateY(12px) scale(0.98); opacity: 0; }
  to   { transform: translateY(0) scale(1); opacity: 1; }
}

/* ヘッダー（オレンジ） */
.sp-modal__head {
  position: relative;
  background: var(--sp-emphasis);
  color: #fff;
  padding: 16px 52px;
  text-align: center;
  flex: 0 0 auto;
}
.sp-modal__title { margin: 0; font-size: 18px; font-weight: 700; line-height: 1.4; }

.sp-modal__back,
.sp-modal__close {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 34px;
  height: 34px;
  border: none;
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.sp-modal__back { left: 12px; }
.sp-modal__close { right: 12px; font-size: 24px; }
.sp-modal__back:hover,
.sp-modal__close:hover { background: rgba(255, 255, 255, 0.32); }
.sp-modal__back[hidden] { display: none; }

/* ステップインジケータ */
.sp-steps {
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 12px 0 4px;
  flex: 0 0 auto;
}
.sp-steps__dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: #cfd6dc;
}
.sp-steps__dot.is-active { background: var(--sp-emphasis); }
.sp-steps__dot.is-done { background: var(--sp-main); }

/* ボディ（スクロール領域） */
.sp-modal__body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 12px 16px 16px;
  -webkit-overflow-scrolling: touch;
}

/* ボディのスライドアニメーション */
.sp-modal__body.sp-anim-next { animation: sp-slide-next 0.24s ease; }
.sp-modal__body.sp-anim-back { animation: sp-slide-back 0.24s ease; }
@keyframes sp-slide-next {
  from { opacity: 0; transform: translateX(28px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes sp-slide-back {
  from { opacity: 0; transform: translateX(-28px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ステップ上部のガイド文 */
.sp-lead { margin: 0 0 10px; font-size: 12px; color: #8a929b; text-align: center; }

/* 選択行リスト */
.sp-options { list-style: none; margin: 0; padding: 0; }
.sp-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  box-sizing: border-box;
  background: #fff;
  border: 1px solid var(--sp-border);
  border-radius: 8px;
  margin-bottom: 8px;
  padding: 16px 18px;
  font-size: 15px;
  font-weight: 700;
  color: var(--sp-text);
  cursor: pointer;
  text-align: left;
  transition: all 0.12s ease;
}
.sp-option:hover { border-color: var(--sp-main); }
.sp-option.is-selected {
  border-color: var(--sp-emphasis);
  background: #fff6ec;
  color: var(--sp-emphasis-dark);
}
.sp-option__chevron {
  color: var(--sp-emphasis);
  font-weight: 700;
  margin-left: 12px;
  flex: 0 0 auto;
}
.sp-option.is-selected .sp-option__chevron::before { content: "✓ "; }

/* 町名選択ステップ（検索＋行アコーディオン） */
.sp-town-wrap { padding: 2px 0; }
.sp-town-q { margin-bottom: 10px; }

.sp-acc { }
.sp-acc__group {
  border: 1px solid var(--sp-border);
  border-radius: 8px;
  margin-bottom: 8px;
  overflow: hidden;
  background: #fff;
}
.sp-acc__head {
  width: 100%;
  box-sizing: border-box;
  text-align: left;
  background: #f5f8fa;
  border: none;
  padding: 15px 16px;
  font-size: 15px;
  font-weight: 700;
  color: var(--sp-text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.sp-acc__head:hover { background: #eef2f6; }
.sp-acc__tri { color: #9aa3ab; font-size: 11px; transition: transform 0.15s ease; }
.sp-acc__group.is-open .sp-acc__tri { transform: rotate(90deg); }
.sp-acc__body { display: none; list-style: none; margin: 0; padding: 0; }
.sp-acc__group.is-open .sp-acc__body { display: block; }
/* アコーディオン内の町名行は枠線を内側寄せに */
.sp-acc__body .sp-option {
  border: none;
  border-top: 1px solid #f0f0f0;
  border-radius: 0;
  margin: 0;
  font-weight: 400;
}
.sp-town-label { font-size: 14px; font-weight: 700; margin: 0 0 10px; }
.sp-input {
  width: 100%;
  box-sizing: border-box;
  height: 52px;
  border: 2px solid var(--sp-border);
  border-radius: 10px;
  padding: 0 14px;
  font-size: 16px;
  font-family: inherit;
  color: var(--sp-text);
  background: #fff;
}
.sp-input:focus { outline: none; border-color: var(--sp-main); }
.sp-town-note { font-size: 12px; color: #888; margin: 10px 0 0; }

/* 準備中メッセージ */
.sp-empty {
  background: #fff;
  border: 1px dashed #c9ccd0;
  border-radius: 8px;
  padding: 20px 16px;
  text-align: center;
  font-size: 13px;
  color: #777;
  line-height: 1.6;
}

/* 選択サマリ（現在の入力内容） */
.sp-summary {
  font-size: 12px;
  color: #667;
  background: #eef1f4;
  border-radius: 6px;
  padding: 8px 10px;
  margin: 0 0 12px;
  line-height: 1.6;
}
.sp-summary b { color: var(--sp-second); }

/* フッター */
.sp-modal__foot {
  flex: 0 0 auto;
  padding: 12px 16px 16px;
  background: #f2f4f6;
  border-top: 1px solid #e3e7ea;
}
.sp-next {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  border: none;
  background: var(--sp-navy);
  color: #fff;
  font-size: 17px;
  font-weight: 700;
  border-radius: 8px;
  padding: 15px;
  cursor: pointer;
  transition: filter 0.1s ease, transform 0.08s ease;
}
.sp-next:hover { filter: brightness(1.08); }
.sp-next:active { transform: translateY(1px); }
.sp-next:disabled { background: #b7bfc7; cursor: not-allowed; }
.sp-next--submit { background: var(--sp-emphasis); box-shadow: 0 3px 0 var(--sp-emphasis-dark); }
.sp-next--submit:disabled { background: #ccc; box-shadow: 0 3px 0 #aaa; }

.sp-powered { text-align: center; font-size: 11px; color: #999; margin: 10px 0 0; }

/* デバッグ用の生成URL（?sp_debug=1） */
.sp-debug {
  display: none;
  margin: 10px 0 0;
  padding: 8px 10px;
  background: #fff;
  border: 1px dashed #bbb;
  border-radius: 6px;
  font-size: 10px;
  color: #444;
  word-break: break-all;
}
.sp-debug.is-on { display: block; }

@media (max-width: 767px) {
  .sp-modal { height: min(600px, calc(100vh - 24px)); }
  .sp-modal__title { font-size: 16px; }
}
