/* ============================================
   X-mobile 料金シミュレーター - Stylesheet
   フローティングボタン + モーダル + シミュレーター UI
   ============================================ */

/* ─── フローティングボタン（モバイル: 左寄せ） ─── */
.floating-sim-btn {
  position: fixed;
  bottom: 88px; /* fixed-ctaの上 */
  left: 16px;
  right: auto;
  z-index: 140;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 12px 18px;
  background: linear-gradient(135deg, #8CC63F 0%, #6db52e 100%);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
  font-family: 'Noto Sans JP', sans-serif;
  border: none;
  border-radius: 9999px;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(140,198,63,0.4), 0 2px 8px rgba(0,0,0,0.1);
  transition: all 0.3s ease;
  -webkit-tap-highlight-color: transparent;
  min-height: 48px;
  animation: simBtnPulse 3s ease-in-out infinite;
}

/* ─── ページトップに戻るボタン（モバイル: 右寄せ） ─── */
.scroll-top-btn {
  position: fixed;
  bottom: 88px;
  right: 16px;
  left: auto;
  z-index: 140;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  background: rgba(255,255,255,0.95);
  color: var(--primary-green, #8CC63F);
  border: 2px solid var(--primary-green, #8CC63F);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0,0,0,0.1);
  transition: all 0.3s ease;
  -webkit-tap-highlight-color: transparent;
  font-size: 1.1rem;
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
}

.scroll-top-btn.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.scroll-top-btn:hover {
  background: var(--primary-green, #8CC63F);
  color: #fff;
  box-shadow: 0 6px 20px rgba(140,198,63,0.4);
}

.scroll-top-btn:active {
  transform: scale(0.92);
}

.floating-sim-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(140,198,63,0.5), 0 4px 12px rgba(0,0,0,0.15);
}

.floating-sim-btn:active {
  transform: scale(0.96);
}

.floating-sim-btn .sim-btn-icon {
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.floating-sim-btn .sim-btn-icon svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

@keyframes simBtnPulse {
  0%, 100% { box-shadow: 0 4px 20px rgba(140,198,63,0.4), 0 2px 8px rgba(0,0,0,0.1); }
  50% { box-shadow: 0 4px 28px rgba(140,198,63,0.55), 0 2px 12px rgba(0,0,0,0.12); }
}

/* PC/タブレット (768px+): 左サイドの背景エリアに大きく表示
   ブランドパネルの下付近に固定配置 */
@media (min-width: 768px) {
  .floating-sim-btn {
    right: auto;
    bottom: auto;
    left: var(--sim-btn-left-x, 40px);
    top: auto;
    bottom: 60px;
    /* 大きめサイズ */
    padding: 28px 52px;
    font-size: 1.5rem;
    gap: 16px;
    min-height: 80px;
    border-radius: 24px;
    box-shadow: 0 10px 40px rgba(140,198,63,0.5), 0 6px 20px rgba(0,0,0,0.14);
    transform: none;
    letter-spacing: 0.05em;
  }
  .floating-sim-btn .sim-btn-icon {
    width: 40px;
    height: 40px;
  }
  .floating-sim-btn .sim-btn-icon svg {
    width: 36px;
    height: 36px;
  }
  .floating-sim-btn:hover {
    transform: translateY(-4px);
    box-shadow: 0 14px 48px rgba(140,198,63,0.6), 0 8px 24px rgba(0,0,0,0.18);
  }
  .floating-sim-btn:active {
    transform: scale(0.97);
  }

  /* PCではトップに戻るボタン非表示 */
  .scroll-top-btn {
    display: none;
  }
}

/* 1200px+: さらに大きく */
@media (min-width: 1200px) {
  .floating-sim-btn {
    padding: 32px 60px;
    font-size: 1.65rem;
    min-height: 90px;
    border-radius: 26px;
    gap: 18px;
    letter-spacing: 0.06em;
  }
  .floating-sim-btn .sim-btn-icon {
    width: 46px;
    height: 46px;
  }
  .floating-sim-btn .sim-btn-icon svg {
    width: 42px;
    height: 42px;
  }
}

/* 1600px+: 最大サイズ */
@media (min-width: 1600px) {
  .floating-sim-btn {
    padding: 36px 68px;
    font-size: 1.8rem;
    min-height: 100px;
    border-radius: 28px;
    gap: 20px;
  }
  .floating-sim-btn .sim-btn-icon {
    width: 50px;
    height: 50px;
  }
  .floating-sim-btn .sim-btn-icon svg {
    width: 46px;
    height: 46px;
  }
}

/* ─── モーダルオーバーレイ ─── */
.sim-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0, 0, 0, 0.55);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.sim-modal-overlay.open {
  display: flex;
}

/* ─── モーダル本体 ─── */
.sim-modal {
  background: #fff;
  border-radius: 20px;
  width: 100%;
  max-width: 440px;
  max-height: 90vh;
  max-height: 90dvh;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
  display: flex;
  flex-direction: column;
  animation: simModalIn 0.3s ease;
}

@keyframes simModalIn {
  from { opacity: 0; transform: translateY(30px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ─── モーダルヘッダー ─── */
.sim-modal-header {
  background: linear-gradient(135deg, #8CC63F 0%, #6db52e 100%);
  color: #fff;
  padding: 20px 20px 16px;
  position: relative;
  flex-shrink: 0;
}

.sim-modal-header h2 {
  font-size: 1.1rem;
  font-weight: 800;
  color: #fff;
  margin-bottom: 4px;
  padding-right: 36px;
}

.sim-modal-header p {
  font-size: 0.75rem;
  color: rgba(255,255,255,0.85);
  line-height: 1.5;
}

.sim-modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 32px;
  height: 32px;
  background: rgba(255,255,255,0.2);
  border: none;
  border-radius: 50%;
  color: #fff;
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  -webkit-tap-highlight-color: transparent;
}

.sim-modal-close:hover {
  background: rgba(255,255,255,0.35);
}

/* ─── モーダルボディ（スクロール可能） ─── */
.sim-modal-body {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 20px;
  flex: 1;
}

/* ─── ステップナビゲーション ─── */
.sim-steps-nav {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
}

.sim-step-indicator {
  flex: 1;
  height: 4px;
  border-radius: 2px;
  background: #e8ece5;
  transition: background 0.3s;
}

.sim-step-indicator.active {
  background: #8CC63F;
}

.sim-step-indicator.done {
  background: #74a832;
}

/* ─── ステップヘッダー ─── */
.sim-step-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.sim-step-num {
  width: 28px;
  height: 28px;
  min-width: 28px;
  background: #8CC63F;
  color: #fff;
  border-radius: 50%;
  font-family: 'Montserrat', sans-serif;
  font-size: 0.8rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sim-step-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #333;
}

/* ─── フォームグループ（シミュレーター用） ─── */
.sim-form-group {
  margin-bottom: 14px;
}

.sim-form-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: #333;
  margin-bottom: 4px;
}

.sim-form-label .sim-hint {
  font-weight: 400;
  color: #999;
  font-size: 0.7rem;
  margin-left: 4px;
}

.sim-form-input,
.sim-form-select {
  width: 100%;
  padding: 10px 12px;
  font-size: 0.95rem;
  font-family: 'Noto Sans JP', sans-serif;
  border: 2px solid #e8ece5;
  border-radius: 12px;
  background: #fff;
  color: #333;
  transition: border-color 0.2s;
  -webkit-appearance: none;
  appearance: none;
}

.sim-form-input:focus,
.sim-form-select:focus {
  outline: none;
  border-color: #8CC63F;
  box-shadow: 0 0 0 3px rgba(140,198,63,0.12);
}

.sim-form-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23777' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

.sim-form-input::placeholder {
  color: #bbb;
}

/* 数字入力の単位つき */
.sim-input-with-unit {
  position: relative;
}

.sim-input-with-unit .sim-form-input {
  padding-right: 40px;
}

.sim-input-with-unit .sim-unit {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.8rem;
  color: #999;
  pointer-events: none;
}

/* ─── プラン選択カード ─── */
.sim-plan-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}

.sim-plan-card {
  padding: 10px;
  background: #f9faf8;
  border: 2px solid #e8ece5;
  border-radius: 12px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  -webkit-tap-highlight-color: transparent;
}

.sim-plan-card:hover {
  border-color: #b8d98a;
}

.sim-plan-card.selected {
  border-color: #8CC63F;
  background: rgba(140,198,63,0.06);
  box-shadow: 0 0 0 2px rgba(140,198,63,0.15);
}

.sim-plan-data {
  font-family: 'Montserrat', sans-serif;
  font-size: 1.1rem;
  font-weight: 800;
  color: #333;
  margin-bottom: 2px;
}

.sim-plan-price {
  font-family: 'Montserrat', sans-serif;
  font-size: 0.85rem;
  font-weight: 700;
  color: #8CC63F;
}

.sim-plan-price .sim-plan-unit {
  font-size: 0.65rem;
  font-weight: 500;
  color: #999;
}

/* ─── 通話オプション ─── */
.sim-call-options {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.sim-call-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: #f9faf8;
  border: 2px solid #e8ece5;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s;
  -webkit-tap-highlight-color: transparent;
}

.sim-call-card:hover {
  border-color: #b8d98a;
}

.sim-call-card.selected {
  border-color: #8CC63F;
  background: rgba(140,198,63,0.06);
}

.sim-call-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: #333;
}

.sim-call-note {
  font-size: 0.65rem;
  color: #999;
}

.sim-call-price {
  font-family: 'Montserrat', sans-serif;
  font-size: 0.85rem;
  font-weight: 700;
  color: #555;
  white-space: nowrap;
}

.sim-call-card.selected .sim-call-price {
  color: #8CC63F;
}

/* ─── 追加オプション ─── */
.sim-extra-options {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.sim-extra-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: #f9faf8;
  border: 2px solid #e8ece5;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s;
  -webkit-tap-highlight-color: transparent;
}

.sim-extra-card:hover {
  border-color: #b8d98a;
}

.sim-extra-card.selected {
  border-color: #8CC63F;
  background: rgba(140,198,63,0.06);
}

.sim-extra-check {
  width: 22px;
  height: 22px;
  min-width: 22px;
  border: 2px solid #ccc;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  font-size: 0.75rem;
  color: transparent;
}

.sim-extra-card.selected .sim-extra-check {
  background: #8CC63F;
  border-color: #8CC63F;
  color: #fff;
}

.sim-extra-info {
  flex: 1;
}

.sim-extra-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: #333;
}

.sim-extra-desc {
  font-size: 0.65rem;
  color: #999;
}

.sim-extra-price {
  font-family: 'Montserrat', sans-serif;
  font-size: 0.82rem;
  font-weight: 700;
  color: #555;
  white-space: nowrap;
}

.sim-extra-card.selected .sim-extra-price {
  color: #8CC63F;
}

/* ─── 診断（使い方質問） ─── */
.sim-diag-question {
  margin-bottom: 14px;
}

.sim-diag-question-text {
  font-size: 0.85rem;
  font-weight: 600;
  color: #333;
  margin-bottom: 6px;
}

.sim-diag-choices {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sim-diag-choice {
  padding: 10px 12px;
  background: #f9faf8;
  border: 2px solid #e8ece5;
  border-radius: 10px;
  font-size: 0.82rem;
  cursor: pointer;
  transition: all 0.2s;
  color: #555;
  -webkit-tap-highlight-color: transparent;
}

.sim-diag-choice:hover {
  border-color: #b8d98a;
}

.sim-diag-choice.selected {
  border-color: #8CC63F;
  background: rgba(140,198,63,0.06);
  color: #333;
  font-weight: 600;
}

.sim-diag-result {
  background: linear-gradient(135deg, rgba(140,198,63,0.08), rgba(140,198,63,0.04));
  border: 1px solid rgba(140,198,63,0.2);
  border-radius: 14px;
  padding: 14px;
  text-align: center;
  margin-top: 12px;
}

.sim-diag-result-label {
  font-size: 0.75rem;
  color: #777;
  margin-bottom: 4px;
}

.sim-diag-result-value {
  font-family: 'Montserrat', sans-serif;
  font-size: 1.2rem;
  font-weight: 800;
  color: #8CC63F;
}

.sim-diag-apply-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 10px;
  padding: 8px 16px;
  background: #8CC63F;
  color: #fff;
  border: none;
  border-radius: 9999px;
  font-size: 0.78rem;
  font-weight: 700;
  font-family: 'Noto Sans JP', sans-serif;
  cursor: pointer;
  transition: background 0.2s;
  -webkit-tap-highlight-color: transparent;
}

.sim-diag-apply-btn:hover {
  background: #74a832;
}

/* ─── リアルタイム合計表示 ─── */
.sim-realtime-total {
  background: linear-gradient(135deg, #8CC63F, #6db52e);
  border-radius: 14px;
  padding: 14px;
  color: #fff;
  text-align: center;
  margin: 16px 0;
  position: sticky;
  bottom: 0;
  z-index: 2;
}

.sim-realtime-label {
  font-size: 0.7rem;
  opacity: 0.85;
  margin-bottom: 2px;
}

.sim-realtime-amount {
  font-family: 'Montserrat', sans-serif;
  font-size: 1.8rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.sim-realtime-amount .sim-yen {
  font-size: 1rem;
  font-weight: 600;
}

.sim-realtime-breakdown {
  font-size: 0.65rem;
  opacity: 0.8;
  margin-top: 2px;
}

/* ─── 結果画面 ─── */
.sim-result-section {
  margin-bottom: 20px;
}

.sim-result-card {
  background: #f9faf8;
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 12px;
}

.sim-result-card--highlight {
  background: linear-gradient(135deg, rgba(140,198,63,0.08), rgba(140,198,63,0.03));
  border: 2px solid rgba(140,198,63,0.2);
}

.sim-result-card--warn {
  background: #fff8e6;
  border: 2px solid #FFCB05;
}

.sim-result-label {
  font-size: 0.72rem;
  color: #999;
  margin-bottom: 4px;
}

.sim-result-value {
  font-family: 'Montserrat', sans-serif;
  font-size: 1.4rem;
  font-weight: 800;
  color: #333;
}

.sim-result-value.positive {
  color: #8CC63F;
}

.sim-result-value.negative {
  color: #e74c3c;
}

.sim-result-sub {
  font-size: 0.72rem;
  color: #777;
  margin-top: 2px;
}

.sim-result-row {
  display: flex;
  gap: 8px;
}

.sim-result-row > * {
  flex: 1;
}

/* ─── 判定メッセージ ─── */
.sim-judgment {
  padding: 16px;
  border-radius: 14px;
  text-align: center;
  margin-bottom: 16px;
}

.sim-judgment--green {
  background: linear-gradient(135deg, rgba(140,198,63,0.12), rgba(140,198,63,0.06));
  border: 2px solid #8CC63F;
}

.sim-judgment--yellow {
  background: #fff8e6;
  border: 2px solid #FFCB05;
}

.sim-judgment--gray {
  background: #f5f5f5;
  border: 2px solid #ccc;
}

.sim-judgment-icon {
  font-size: 2rem;
  margin-bottom: 6px;
}

.sim-judgment-text {
  font-size: 0.9rem;
  font-weight: 700;
  color: #333;
  margin-bottom: 4px;
}

.sim-judgment-sub {
  font-size: 0.75rem;
  color: #777;
}

/* ─── 24ヶ月比較テーブル ─── */
.sim-table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 16px -20px;
  padding: 0 20px;
}

.sim-compare-table {
  width: 100%;
  min-width: 360px;
  border-collapse: collapse;
  font-size: 0.72rem;
}

.sim-compare-table th,
.sim-compare-table td {
  padding: 6px 8px;
  text-align: right;
  border-bottom: 1px solid #e8ece5;
  white-space: nowrap;
}

.sim-compare-table th {
  background: #f4f7f2;
  font-weight: 600;
  color: #555;
  position: sticky;
  top: 0;
}

.sim-compare-table th:first-child,
.sim-compare-table td:first-child {
  text-align: center;
  font-weight: 600;
  color: #333;
}

.sim-compare-table tbody tr:hover {
  background: rgba(140,198,63,0.04);
}

.sim-compare-table .sim-tbl-highlight {
  background: rgba(140,198,63,0.06);
  font-weight: 700;
}

/* ─── アクションボタン ─── */
.sim-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 16px;
}

.sim-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 14px;
  border: none;
  border-radius: 9999px;
  font-size: 0.9rem;
  font-weight: 700;
  font-family: 'Noto Sans JP', sans-serif;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}

.sim-btn--primary {
  background: #8CC63F;
  color: #fff;
  box-shadow: 0 4px 12px rgba(140,198,63,0.3);
}

.sim-btn--primary:hover {
  background: #74a832;
  color: #fff;
}

.sim-btn--outline {
  background: #fff;
  color: #8CC63F;
  border: 2px solid #8CC63F;
}

.sim-btn--outline:hover {
  background: rgba(140,198,63,0.06);
  color: #74a832;
}

.sim-btn--secondary {
  background: #f4f7f2;
  color: #555;
}

.sim-btn--secondary:hover {
  background: #e8ece5;
}

/* ステップ切り替えボタン */
.sim-nav-buttons {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}

.sim-nav-buttons .sim-btn {
  flex: 1;
}

/* ─── セクション区切り ─── */
.sim-divider {
  height: 1px;
  background: #e8ece5;
  margin: 16px 0;
}

/* ─── 注意書き ─── */
.sim-note {
  font-size: 0.68rem;
  color: #999;
  line-height: 1.6;
  margin-top: 8px;
}

/* ─── ステップ表示/非表示 ─── */
.sim-step-content {
  display: none;
}

.sim-step-content.active {
  display: block;
}

/* ─── スクロールヒント ─── */
.sim-scroll-hint {
  text-align: center;
  font-size: 0.68rem;
  color: #bbb;
  margin-top: 4px;
}

.sim-scroll-hint::before {
  content: '← ';
}

.sim-scroll-hint::after {
  content: ' →';
}
