/* =========================
   AIチャットボット
========================= */

.chatbot {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 1000;
}

/* チャット画面 */
.chatbot-panel {
  position: absolute;
  right: 0;
  bottom: 72px;
  width: 360px;
  max-width: calc(100vw - 32px);
  background: #fffdf7;
  border: 1px solid #d9c9a9;
  border-radius: 18px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
  overflow: hidden;

  /* 最初は閉じておく */
  display: none;
}

/* 開いた状態 */
.chatbot.is-open .chatbot-panel {
  display: flex;
  flex-direction: column;
  height: 650px;
  max-height: calc(100dvh - 120px);
}

/* ヘッダー */
.chatbot-header {
  padding: 16px 18px;
  background: #6b4b2a;
  color: white;
}

.chatbot-header h2 {
  margin: 0;
  font-size: 18px;
}

.chatbot-header p {
  margin: 4px 0 0;
  font-size: 12px;
}

/* 会話エリア */
.chatbot-messages {
  flex: 1;
  min-height: 0;
  padding: 16px;
  overflow-y: auto;
}

/* 入力欄 */
.chatbot-form {
  display: flex;
  flex-shrink: 0;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid #e5dccb;
  background: white;
}

.chatbot-form input {
  flex: 1;
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid #ccc;
  border-radius: 10px;
  font-size: 14px;
}

@media (max-width: 480px) {
  .chatbot-form input {
    font-size: 16px;
  }
}

.chatbot-form button {
  border: 0;
  border-radius: 10px;
  padding: 10px 14px;
  background: #6b4b2a;
  color: white;
  cursor: pointer;
}

/* 右下の起動ボタン */
.chatbot-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  padding: 12px 18px;
  border: 0;
  border-radius: 999px;
  background: #6b4b2a;
  color: white;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

/* スマホ */
@media (max-width: 480px) {
  .chatbot {
    right: 16px;
    bottom: 16px;
    left: 16px;
  }

  .chatbot-panel {
    position: fixed;
    top: 12px;
    right: 12px;
    bottom: 76px;
    left: 12px;

    width: auto;
    max-width: none;
    height: auto;
    max-height: none;

    display: none;
    flex-direction: column;
  }

  .chatbot.is-open .chatbot-panel {
    display: flex;
  }

  .chatbot-messages {
    flex: 1;
    height: auto;
    min-height: 0;
    max-height: none;
    overflow-y: auto;
  }

  .chatbot-form {
    flex-shrink: 0;
  }
}

/* =========================
   チャットメッセージ
   ========================= */

.chatbot-message {
  max-width: 85%;
  margin-bottom: 12px;
  padding: 10px 14px;
  border-radius: 14px;
  line-height: 1.6;
  font-size: 14px;
  overflow-wrap: break-word;
}

/* AI側 */
.chatbot-message--bot {
  margin-right: auto;
  background: #f1eadf;
  color: #3f3328;
  border-bottom-left-radius: 4px;
}

/* ユーザー側 */
.chatbot-message--user {
  margin-left: auto;
  background: #6b4b2a;
  color: #ffffff;
  border-bottom-right-radius: 4px;
}
/* =========================
   スマホ表示
   ========================= */
@media (max-width: 480px) {
  .chatbot {
    right: 12px;
    bottom: 12px;
    left: 12px;
  }

.chatbot-panel {
  box-sizing: border-box;
  width: calc(100% - 24px);
  max-width: calc(100vw - 24px);
  position: fixed;
  top: 12px;
  right: 12px;
  bottom: 12px;
  left: 12px;
  height: auto;
  max-height: none;
}
}
/* チャットを開いている間は起動ボタンを隠す */
.chatbot.is-open .chatbot-toggle {
  display: none;
}
/* 閉じるボタンを押しやすくする */
.chatbot-close {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  font-size: 20px;
}
/* =========================
   PC表示
   ========================= */
@media (min-width: 481px) {
 .chatbot-panel {
  position: fixed;
  top: 24px;
  right: 24px;
  bottom: 24px;

  width: 400px;
  height: auto;
  max-height: none;

  display: none;
  flex-direction: column;
}

  .chatbot-messages {
    height: auto;
    flex: 1;
    min-height: 0;
  }
}