/* =========================================================
   サブスク最適化ナビ — スタイルシート
   ========================================================= */

/* ---- ラッパー ---- */
.so-wrapper {
  max-width: 720px;
  margin: 0 auto;
  padding: 24px 16px 40px;
  font-family: -apple-system, BlinkMacSystemFont, 'Hiragino Sans', 'Meiryo', sans-serif;
  color: #111827;
}

/* ---- ステップインジケーター ---- */
.so-step-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 32px;
  gap: 0;
}
.so-step-dot {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #e5e7eb;
  color: #9ca3af;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
  transition: background 0.25s, color 0.25s;
}
.so-step-dot.active   { background: #3b82f6; color: #fff; }
.so-step-line         { flex: 1; height: 2px; background: #e5e7eb; max-width: 56px; }

/* ---- パネル表示切り替え ---- */
.so-panel { display: none; }
.so-panel.active { display: block; }

/* ---- 見出し・補足 ---- */
.so-heading { font-size: 20px; font-weight: 700; margin: 0 0 6px; }
.so-sub     { font-size: 13px; color: #6b7280; margin: 0 0 20px; }

/* =========================================================
   Step 1 — ジャンル
   ========================================================= */
.so-genre-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 28px;
}
.so-genre-btn {
  padding: 20px 12px;
  border: 2px solid #e5e7eb;
  border-radius: 12px;
  background: #fff;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 600;
  transition: border-color 0.2s, background 0.2s;
}
.so-genre-btn .so-icon { font-size: 28px; }
.so-genre-btn small    { font-size: 11px; font-weight: 400; color: #9ca3af; }
.so-genre-btn.active   { border-color: #3b82f6; background: #eff6ff; color: #1d4ed8; }
.so-genre-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* =========================================================
   Step 2 — サービス選択
   ========================================================= */
.so-service-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 24px;
}
@media (min-width: 480px) {
  .so-service-grid { grid-template-columns: repeat(3, 1fr); }
}
.so-svc-btn {
  padding: 12px 10px;
  border: 2px solid #e5e7eb;
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s, background 0.15s;
  position: relative;
}
.so-svc-btn:hover   { border-color: #93c5fd; background: #f0f9ff; }
.so-svc-btn.selected { border-color: #3b82f6; background: #eff6ff; }
.so-svc-btn.selected::after {
  content: '✓';
  position: absolute;
  top: 8px; right: 8px;
  color: #3b82f6;
  font-weight: 700;
  font-size: 14px;
}
.so-svc-name  { font-size: 12px; font-weight: 700; color: #111827; margin-bottom: 3px; line-height: 1.3; }
.so-svc-price { font-size: 11px; color: #6b7280; }
.so-svc-stars { font-size: 10px; color: #f59e0b; margin-top: 3px; }
.so-svc-stars small { color: #9ca3af; margin-left: 2px; }
.so-svc-note  { font-size: 10px; color: #9ca3af; margin-top: 3px; line-height: 1.3; }

/* =========================================================
   Step 3 — 利用状況
   ========================================================= */
.so-usage-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid #f3f4f6;
  gap: 12px;
}
.so-usage-name { font-size: 13px; font-weight: 500; flex: 1; }
.so-freq-group { display: flex; gap: 6px; }
.so-freq-btn {
  padding: 4px 11px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background: #fff;
  font-size: 12px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.so-freq-btn.active { background: #3b82f6; border-color: #3b82f6; color: #fff; }

/* 設定エリア */
.so-prefs { margin-top: 24px; }
.so-prefs h3 { font-size: 15px; font-weight: 700; margin: 0 0 16px; color: #374151; }
.so-pref-row { margin-bottom: 16px; }
.so-pref-row--inline { display: flex; align-items: center; gap: 12px; }
.so-pref-label { display: block; font-size: 13px; font-weight: 500; color: #374151; margin-bottom: 8px; }
.so-pref-row--inline .so-pref-label { margin-bottom: 0; }

/* タグ */
.so-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.so-tag {
  padding: 5px 12px;
  border: 1px solid #d1d5db;
  border-radius: 20px;
  background: #fff;
  font-size: 12px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.so-tag.active { background: #3b82f6; border-color: #3b82f6; color: #fff; }

/* ラジオ */
.so-radio-row { display: flex; gap: 16px; }
.so-radio-row label { font-size: 13px; display: flex; align-items: center; gap: 4px; cursor: pointer; }

/* トグル */
.so-toggle { position: relative; display: inline-block; width: 44px; height: 24px; cursor: pointer; }
.so-toggle input { opacity: 0; width: 0; height: 0; }
.so-toggle-track {
  position: absolute; inset: 0;
  background: #d1d5db; border-radius: 24px;
  transition: background 0.2s;
}
.so-toggle-track::before {
  content: '';
  position: absolute;
  width: 18px; height: 18px;
  left: 3px; bottom: 3px;
  background: #fff; border-radius: 50%;
  transition: transform 0.2s;
}
.so-toggle input:checked + .so-toggle-track { background: #3b82f6; }
.so-toggle input:checked + .so-toggle-track::before { transform: translateX(20px); }

/* 予算 */
.so-budget { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.so-budget input {
  width: 110px; padding: 6px 10px;
  border: 1px solid #d1d5db; border-radius: 6px; font-size: 13px;
}

/* 分析ボタン */
.so-btn-analyze {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 28px;
  background: #3b82f6; color: #fff;
  border: none; border-radius: 8px;
  font-size: 15px; font-weight: 700;
  cursor: pointer;
  transition: background 0.2s;
}
.so-btn-analyze:hover    { background: #2563eb; }
.so-btn-analyze:disabled { background: #93c5fd; cursor: not-allowed; }

/* スピナー */
.so-spin {
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: so-spin 0.7s linear infinite;
}
.hidden { display: none !important; }
@keyframes so-spin { to { transform: rotate(360deg); } }

/* =========================================================
   Step 4 — 結果
   ========================================================= */
.so-card {
  padding: 20px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  margin-bottom: 16px;
}

/* スコアカード + チャートカード: 横並び */
.so-score-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}
@media (max-width: 480px) { .so-score-row { grid-template-columns: 1fr; } }

.so-score-card { display: flex; flex-direction: column; justify-content: center; }
.so-card-label { font-size: 12px; font-weight: 700; color: #9ca3af; text-transform: uppercase; margin-bottom: 6px; }
.so-score-num  { font-size: 64px; font-weight: 800; line-height: 1; color: #111827; }
.so-score-denom { font-size: 14px; color: #9ca3af; margin-bottom: 10px; }
.so-waste {
  display: none;
  padding: 6px 10px;
  background: #fee2e2; color: #dc2626;
  border-radius: 6px; font-size: 12px; font-weight: 600;
}
.so-waste.show { display: inline-block; }

.so-chart-card { display: flex; align-items: center; justify-content: center; min-height: 180px; }

/* サマリー */
.so-summary-card { font-size: 14px; color: #374151; line-height: 1.7; }

/* 推奨カード */
.so-rec-card h3 { font-size: 16px; font-weight: 700; margin: 0 0 12px; }

.so-saving {
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 13px;
  background: #f3f4f6;
  margin-bottom: 14px;
}
.so-saving.positive        { background: #dcfce7; color: #15803d; }
.so-saving strong          { font-size: 18px; display: block; margin-bottom: 2px; }

.so-rec-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.so-tag-chip {
  display: inline-block;
  padding: 4px 10px;
  background: #eff6ff; border: 1px solid #bfdbfe; color: #1d4ed8;
  border-radius: 6px; font-size: 12px;
}
.so-rec-total { font-size: 13px; font-weight: 700; color: #374151; margin-bottom: 12px; }

.so-reasons { margin: 0 0 0 18px; padding: 0; }
.so-reasons li { font-size: 13px; color: #374151; margin-bottom: 4px; }

.so-cautions {
  margin-top: 12px; padding: 12px;
  background: #fffbeb; border-radius: 8px;
}
.so-cautions-label { font-size: 12px; font-weight: 700; color: #d97706; margin-bottom: 4px; }
.so-cautions ul { margin: 0 0 0 16px; padding: 0; }
.so-cautions li { font-size: 12px; color: #92400e; margin-bottom: 3px; }

/* =========================================================
   Step 5 — シミュレーション
   ========================================================= */
.so-sim-track { margin-bottom: 24px; }
.so-sim-labels {
  display: flex; justify-content: space-between;
  font-size: 12px; font-weight: 600; color: #6b7280; margin-bottom: 8px;
}
.so-slider {
  width: 100%; height: 6px;
  -webkit-appearance: none;
  background: linear-gradient(to right, #22c55e, #3b82f6, #8b5cf6);
  border-radius: 6px; outline: none; cursor: pointer;
}
.so-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: #fff; border: 3px solid #3b82f6;
  box-shadow: 0 1px 4px rgba(0,0,0,.2);
  cursor: pointer;
}
.so-sim-scenario {
  text-align: center; margin-top: 8px;
  font-size: 13px; font-weight: 700; color: #3b82f6;
}

.so-sim-card { }
.so-sim-kpi {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 12px;
}
.so-sim-score { font-size: 20px; font-weight: 800; color: #111827; }
.so-sim-price { font-size: 18px; font-weight: 700; color: #15803d; }
.so-sim-note  { font-size: 13px; color: #6b7280; margin-top: 8px; line-height: 1.6; }

/* =========================================================
   共通: ナビゲーション・ボタン
   ========================================================= */
.so-nav {
  display: flex; align-items: center; gap: 12px;
  margin-top: 28px;
}
.so-nav--right { justify-content: flex-end; }

.so-btn-primary,
.so-btn-ghost {
  padding: 10px 20px;
  border-radius: 8px; font-size: 13px; font-weight: 600;
  cursor: pointer; transition: background 0.15s, border-color 0.15s;
}
.so-btn-primary {
  background: #3b82f6; color: #fff; border: none;
}
.so-btn-primary:hover    { background: #2563eb; }
.so-btn-primary:disabled { background: #e5e7eb; color: #9ca3af; cursor: not-allowed; }
.so-btn-ghost {
  background: #fff; color: #374151;
  border: 1px solid #d1d5db;
}
.so-btn-ghost:hover { background: #f9fafb; }

/* エラーバナー */
.so-error {
  margin-top: 16px; padding: 12px 16px;
  background: #fee2e2; border: 1px solid #fca5a5;
  border-radius: 8px; color: #dc2626; font-size: 13px;
}
