/* チャットボット v2 — リード獲得ウィジェット */

/* ウィジェット本体 */
.chatbot__widget {
  position: fixed;
  bottom: 24px;
  right: 20px;
  z-index: 9999;
  width: 340px;
  max-width: calc(100vw - 40px);
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: 0 8px 32px rgba(12, 53, 71, 0.2);
  overflow: hidden;
  transform: translateY(110%);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease;
}

.chatbot__widget--open {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

/* ヘッダー */
.chatbot__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--primary-700);
  color: var(--white);
  padding: 14px 16px;
}

.chatbot__header-title {
  font-size: 15px;
  font-weight: 600;
}

.chatbot__close {
  background: none;
  border: none;
  color: var(--white);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
}

/* 本文 */
.chatbot__body {
  padding: 16px;
}

/* 吹き出し */
.chatbot__bubble {
  background: var(--primary-50);
  border-radius: 12px 12px 12px 0;
  padding: 14px 16px;
  font-size: 14px;
  line-height: 1.7;
  color: var(--neutral-900);
  margin-bottom: 14px;
}

/* 選択肢ボタン群 */
.chatbot__options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chatbot__option {
  display: block;
  width: 100%;
  padding: 12px 14px;
  background: var(--white);
  border: 1px solid var(--primary-300);
  border-radius: 8px;
  font-size: 14px;
  color: var(--neutral-900);
  cursor: pointer;
  text-align: left;
  transition: background var(--transition), border-color var(--transition);
}

.chatbot__option:hover {
  background: var(--primary-50);
  border-color: var(--primary-500);
}

/* フォーム */
.chatbot__form {
  display: flex;
  gap: 8px;
}

.chatbot__input {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid var(--neutral-300);
  border-radius: 8px;
  font-size: 15px;
  outline: none;
  transition: border-color var(--transition);
}

.chatbot__input:focus {
  border-color: var(--primary-500);
}

.chatbot__input--error {
  border-color: #e74c3c;
}

/* ボタン */
.chatbot__btn {
  background: var(--accent-warm);
  color: var(--white);
  border: none;
  border-radius: 8px;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--transition);
}

.chatbot__btn:hover {
  background: var(--accent-warm-hover);
}

.chatbot__btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* エラー表示 */
.chatbot__error {
  color: #e74c3c;
  font-size: 13px;
  margin-top: 10px;
  line-height: 1.5;
}

/* Step3 閉じるボタン */
.chatbot__close-final {
  width: 100%;
  margin-top: 8px;
}

/* v2: タイピングインジケーター */
.chatbot__typing {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 12px 16px;
  background: var(--primary-50);
  border-radius: 12px 12px 12px 0;
  width: fit-content;
  margin-bottom: 14px;
}

.chatbot__dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary-300);
  animation: chatbot-dot-bounce 1.2s infinite;
}

.chatbot__dot:nth-child(2) {
  animation-delay: 0.2s;
}

.chatbot__dot:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes chatbot-dot-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-6px); opacity: 1; }
}

/* v2: 選択肢アニメーション */
.chatbot__option--hidden {
  opacity: 0;
  transform: translateY(8px);
}

.chatbot__option--visible {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.chatbot__option--selected {
  background: var(--primary-500);
  color: var(--white);
  border-color: var(--primary-500);
}

.chatbot__option--fade {
  opacity: 0.3;
  pointer-events: none;
  transition: opacity 0.4s ease;
}

/* v2: 担当者カード */
.chatbot__specialist {
  background: var(--white);
  border: 1px solid var(--primary-200);
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 14px;
}

.chatbot__specialist-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 10px;
}

.chatbot__specialist-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--neutral-900);
}

.chatbot__specialist-title {
  font-size: 12px;
  color: var(--neutral-500);
}

.chatbot__specialist-stats {
  display: flex;
  gap: 12px;
  font-size: 12px;
  color: var(--neutral-600);
}

.chatbot__specialist-stats strong {
  color: var(--primary-700);
}

/* v2: 完了表示 */
.chatbot__complete {
  text-align: center;
  padding: 12px 0;
}

.chatbot__checkmark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--accent-warm);
  color: var(--white);
  font-size: 24px;
  margin-bottom: 14px;
  animation: chatbot-checkmark-pop 0.4s ease;
}

@keyframes chatbot-checkmark-pop {
  0% { transform: scale(0); }
  60% { transform: scale(1.2); }
  100% { transform: scale(1); }
}

.chatbot__complete .chatbot__bubble {
  text-align: center;
  border-radius: 12px;
}

/* v2: 縮小バッジ */
.chatbot__badge {
  position: fixed;
  bottom: 24px;
  right: 20px;
  z-index: 9999;
  background: var(--accent-warm);
  color: var(--white);
  border-radius: 20px;
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* v2: インラインCTA（記事内） */
.chatbot-inline {
  background: linear-gradient(135deg, var(--primary-50), var(--white));
  border: 1px solid var(--primary-200);
  border-radius: 12px;
  padding: 20px 24px;
  margin: 24px 0;
  text-align: center;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.chatbot-inline--visible {
  opacity: 1;
  transform: translateY(0);
}

.chatbot-inline__text {
  font-size: 15px;
  line-height: 1.7;
  color: var(--neutral-800);
  margin-bottom: 14px;
}

.chatbot-inline__btn {
  display: inline-block;
  background: var(--accent-warm);
  color: var(--white);
  border: none;
  border-radius: 8px;
  padding: 12px 28px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition), transform var(--transition);
}

.chatbot-inline__btn:hover {
  background: var(--accent-warm-hover);
  transform: translateY(-1px);
}

/* v2: 離脱オーバーレイ */
.chatbot__exit-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.chatbot__exit-overlay--visible {
  opacity: 1;
  pointer-events: auto;
}

.chatbot__exit-card {
  position: relative;
  background: var(--white);
  border-radius: 16px;
  padding: 32px 28px;
  max-width: 380px;
  width: calc(100vw - 40px);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.25);
  text-align: center;
}

.chatbot__exit-close {
  position: absolute;
  top: 12px;
  right: 16px;
  background: none;
  border: none;
  font-size: 28px;
  color: var(--neutral-400);
  cursor: pointer;
  line-height: 1;
}

.chatbot__exit-close:hover {
  color: var(--neutral-700);
}

.chatbot__exit-card .chatbot__bubble {
  text-align: center;
  border-radius: 12px;
  margin-bottom: 20px;
}

.chatbot__exit-card .chatbot__form {
  justify-content: center;
}

.chatbot__exit-line {
  display: inline-block;
  background: #06c755;
  color: var(--white);
  text-decoration: none;
  border-radius: 8px;
  padding: 12px 28px;
  font-size: 15px;
  font-weight: 600;
  transition: background 0.2s;
}

.chatbot__exit-line:hover {
  background: #05b34c;
}

.chatbot__exit-note {
  font-size: 12px;
  color: var(--neutral-500);
  margin-top: 10px;
}

/* v2: アクセシビリティ */
@media (prefers-reduced-motion: reduce) {
  .chatbot__widget,
  .chatbot__dot,
  .chatbot__checkmark { animation: none; }
  .chatbot__widget,
  .chatbot__option--hidden,
  .chatbot__option--visible,
  .chatbot__option--fade,
  .chatbot-inline,
  .chatbot__exit-overlay { transition: none; }
}

/* ===== チャットボット レスポンシブ 600px ===== */
@media (max-width: 600px) {
  .chatbot__widget {
    bottom: 0;
    right: 0;
    left: 0;
    width: 100%;
    max-width: 100%;
    border-radius: var(--radius) var(--radius) 0 0;
  }

  .chatbot__badge {
    bottom: 16px;
    right: 12px;
  }

  .chatbot-inline {
    padding: 16px;
    margin: 16px 0;
  }

  .chatbot__specialist-stats {
    flex-direction: column;
    gap: 4px;
  }

  .chatbot__exit-card {
    padding: 24px 20px;
  }
}
