/* =========================
   チャット起動ボタン
========================= */

.chat-widget-button {
  position: fixed;
  right: 24px;
  bottom: 24px;

  width: 64px;
  height: 64px;

  border: none;
  border-radius: 50%;

  background: #111;
  color: #fff;

  font-size: 28px;

  cursor: pointer;

  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);

  z-index: 9999;

  transition:
    transform 0.2s ease,
    opacity 0.2s ease;
}

.chat-widget-button:hover {
  transform: scale(1.05);
}

.chat-widget-icon {
  display: block;
}

/* =========================
   チャットパネル
========================= */

.chat-widget-panel {
  position: fixed;

  right: 24px;
  bottom: 100px;

  width: min(360px, calc(100vw - 32px));

  background: #fff;

  border-radius: 16px;

  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.22);

  overflow: hidden;

  opacity: 0;
  visibility: hidden;

  transform: translateY(16px);

  transition:
    opacity 0.25s ease,
    transform 0.25s ease,
    visibility 0.25s ease;

  z-index: 9998;
}

.chat-widget-panel.is-open {
  opacity: 1;
  visibility: visible;

  transform: translateY(0);
}


/* =========================
   ヘッダー
========================= */

.chat-widget-header {
  display: flex;
  align-items: center;
  justify-content: space-between;

  padding: 18px 20px;

  background: #111;
  color: #fff;
}

.chat-widget-title {
  margin: 0;

  font-size: 16px;
  font-weight: 700;
}

.chat-widget-close {
  border: none;
  background: transparent;

  color: #fff;

  font-size: 28px;
  line-height: 1;

  cursor: pointer;
}


/* =========================
   本文
========================= */

.chat-widget-body {
  padding: 20px;
}

.chat-widget-message {
  margin-bottom: 18px;

  padding: 12px 14px;

  background: #f3f3f3;

  border-radius: 12px;

  font-size: 14px;
  line-height: 1.6;
}


/* =========================
   メニューボタン
========================= */

.chat-widget-menu {
  display: flex;
  flex-direction: column;

  gap: 10px;
}

.chat-widget-menu-button {
  display: block;

  padding: 12px 14px;

  border: 1px solid #ddd;
  border-radius: 10px;

  background: #fff;
  color: #222;

  text-decoration: none;

  font-size: 14px;
  font-weight: 600;

  transition:
    background 0.2s ease,
    transform 0.2s ease;
}

.chat-widget-menu-button:hover {
  background: #f5f5f5;

  transform: translateX(2px);
}

/* =========================
   会話表示エリア
========================= */

.chat-widget-conversation {
  display: flex;
  flex-direction: column;

  gap: 10px;

  margin-top: 18px;

  max-height: 180px;

  overflow-y: auto;
}

.chat-widget-chat-message {
  max-width: 80%;

  padding: 10px 12px;

  border-radius: 12px;

  font-size: 14px;
  line-height: 1.5;
}

.chat-widget-user-message {
  align-self: flex-end;

  background: #111;
  color: #fff;
}


/* =========================
   入力エリア
========================= */

.chat-widget-input-area {
  display: flex;

  gap: 8px;

  margin-top: 16px;
}

.chat-widget-input {
  flex: 1;

  min-width: 0;

  padding: 10px 12px;

  border: 1px solid #ddd;
  border-radius: 10px;

  font-size: 14px;
}

.chat-widget-input:focus {
  outline: none;

  border-color: #111;
}

.chat-widget-send {
  padding: 10px 16px;

  border: none;
  border-radius: 10px;

  background: #111;
  color: #fff;

  font-size: 14px;
  font-weight: 600;

  cursor: pointer;
}

.chat-widget-send:hover {
  opacity: 0.85;
}

.chat-widget-bot-message {
  align-self: flex-start;
  background: #f3f3f3;
  color: #222;
  white-space: pre-wrap;
}

/* =========================
   スマホ対応
========================= */

@media (max-width: 600px) {
  .chat-widget-button {
    right: 16px;
    bottom: 16px;

    width: 58px;
    height: 58px;
  }

  .chat-widget-panel {
    right: 16px;
    bottom: 86px;

    width: calc(100vw - 32px);
  }
}