/* =====================================================
   妙傳寺サポート AIチャットボット スタイル
   ===================================================== */

:root {
  --chat-gold: #E6B422;
  --chat-gold-dark: #cfa11d;
  --chat-cream: #FFFAF0;
  --chat-soft: #FFF9E5;
  --chat-pink: #FADADD;
  --chat-text: #333;
  --chat-gray: #888;
}

/* ====== 起動ボタン ====== */
.chatbot-launcher {
  position: fixed;
  right: 22px;
  bottom: 86px; /* back-to-top の上 */
  width: 58px;
  height: 58px;
  background: var(--chat-gold);
  color: #fff;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.22);
  z-index: 997;
  transition: transform 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
  font-family: 'Shippori Mincho', serif;
}
.chatbot-launcher:hover {
  background: var(--chat-gold-dark);
  transform: scale(1.05);
}
.chatbot-launcher:active { transform: scale(0.95); }
.chatbot-launcher svg { width: 26px; height: 26px; fill: #fff; }
.chatbot-launcher.is-hidden {
  opacity: 0;
  pointer-events: none;
  transform: scale(0.8);
}
.chatbot-launcher .pulse {
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid var(--chat-gold);
  animation: chatPulse 2.4s ease-out infinite;
  pointer-events: none;
}
@keyframes chatPulse {
  0% { transform: scale(0.95); opacity: 0.6; }
  70% { transform: scale(1.4); opacity: 0; }
  100% { transform: scale(1.4); opacity: 0; }
}
@media (max-width: 768px) {
  .chatbot-launcher { right: 16px; bottom: 70px; width: 52px; height: 52px; }
  .chatbot-launcher svg { width: 22px; height: 22px; }
}

/* ====== チャットウィンドウ ====== */
.chatbot-window {
  position: fixed;
  right: 22px;
  bottom: 22px;
  width: 380px;
  height: 560px;
  max-height: calc(100vh - 60px);
  background: var(--chat-cream);
  border-radius: 14px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.22);
  display: none;
  flex-direction: column;
  overflow: hidden;
  z-index: 1001;
  font-family: 'Shippori Mincho', serif;
  transform-origin: bottom right;
  animation: chatOpen 0.25s ease-out;
}
.chatbot-window.is-open { display: flex; }
@keyframes chatOpen {
  from { opacity: 0; transform: translateY(20px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@media (max-width: 600px) {
  .chatbot-window {
    right: 0; left: 0; bottom: 0; top: 0;
    width: 100%; height: 100%;
    max-height: 100%;
    border-radius: 0;
  }
}

/* ====== ヘッダー ====== */
.chatbot-header {
  background: linear-gradient(135deg, var(--chat-gold) 0%, var(--chat-gold-dark) 100%);
  color: #fff;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.chatbot-header-info {
  display: flex;
  align-items: center;
  gap: 12px;
}
.chatbot-header-icon {
  width: 38px;
  height: 38px;
  background: rgba(255,255,255,0.25);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  font-weight: bold;
}
.chatbot-header h3 {
  font-size: 1rem;
  margin: 0;
  font-weight: bold;
  letter-spacing: 0.05em;
}
.chatbot-header p {
  font-size: 0.75rem;
  margin: 2px 0 0;
  opacity: 0.9;
}
.chatbot-close {
  background: transparent;
  border: none;
  color: #fff;
  cursor: pointer;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  transition: background 0.2s ease;
  flex-shrink: 0;
  font-family: inherit;
}
.chatbot-close:hover { background: rgba(255,255,255,0.2); }

/* ====== メッセージ領域 ====== */
.chatbot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  background: var(--chat-cream);
  scrollbar-width: thin;
  scrollbar-color: var(--chat-gold) transparent;
}
.chatbot-messages::-webkit-scrollbar { width: 6px; }
.chatbot-messages::-webkit-scrollbar-thumb { background: var(--chat-gold); border-radius: 3px; }

.chat-msg {
  display: flex;
  margin-bottom: 14px;
  animation: msgIn 0.3s ease;
}
@keyframes msgIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.chat-msg-bubble {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 0.92rem;
  line-height: 1.55;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.chat-msg.user { justify-content: flex-end; }
.chat-msg.user .chat-msg-bubble {
  background: var(--chat-gold);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.chat-msg.bot { justify-content: flex-start; }
.chat-msg.bot .chat-msg-bubble {
  background: #fff;
  color: var(--chat-text);
  border: 1px solid var(--chat-pink);
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

/* タイピングインジケーター */
.chat-typing {
  display: inline-flex;
  gap: 4px;
  padding: 6px 0;
}
.chat-typing span {
  width: 7px; height: 7px;
  background: var(--chat-gold);
  border-radius: 50%;
  animation: typingDot 1.2s infinite ease-in-out;
}
.chat-typing span:nth-child(2) { animation-delay: 0.2s; }
.chat-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typingDot {
  0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-4px); }
}

/* おすすめ質問チップ */
.chat-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 0 4px;
}
.chat-chip {
  background: #fff;
  border: 1px solid var(--chat-gold);
  color: var(--chat-text);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.82rem;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.2s ease;
}
.chat-chip:hover { background: var(--chat-soft); }

/* ====== 入力欄 ====== */
.chatbot-input-area {
  display: flex;
  gap: 8px;
  padding: 12px;
  background: #fff;
  border-top: 1px solid #eee;
  align-items: flex-end;
  flex-shrink: 0;
}
.chatbot-input {
  flex: 1;
  border: 1px solid #ddd;
  border-radius: 20px;
  padding: 10px 16px;
  font-family: inherit;
  font-size: 0.95rem;
  resize: none;
  max-height: 120px;
  min-height: 40px;
  line-height: 1.4;
  outline: none;
  transition: border-color 0.2s ease;
}
.chatbot-input:focus {
  border-color: var(--chat-gold);
  box-shadow: 0 0 0 2px rgba(230, 180, 34, 0.15);
}
.chatbot-send {
  width: 40px;
  height: 40px;
  background: var(--chat-gold);
  color: #fff;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.2s ease;
  font-family: inherit;
}
.chatbot-send:hover { background: var(--chat-gold-dark); }
.chatbot-send:disabled { background: #ccc; cursor: not-allowed; }
.chatbot-send svg { width: 18px; height: 18px; fill: #fff; }

/* ====== フッター免責 ====== */
.chatbot-footer-note {
  font-size: 0.7rem;
  color: var(--chat-gray);
  text-align: center;
  padding: 6px 12px 10px;
  background: #fff;
}
.chatbot-footer-note a { color: var(--chat-gold-dark); text-decoration: none; }
