/* ========================================
   グローバルリゾート チャットボット スタイル
   全セレクタを #gr-chatbot-widget 内にスコープ
   ホストページのスタイルに影響しない
   ======================================== */

/* --- 起動：キャラクター＋吹き出し --- */
#gr-chatbot-widget #chatbot-trigger {
  position: fixed;
  bottom: 16px;
  right: 16px;
  display: flex;
  align-items: flex-end;
  gap: 0;
  cursor: pointer;
  z-index: 10000;
  transition: transform 0.2s;
  font-family: 'Hiragino Kaku Gothic ProN', 'メイリオ', Meiryo, sans-serif;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

#gr-chatbot-widget #chatbot-trigger:hover {
  transform: scale(1.03);
}

#gr-chatbot-widget #trigger-avatar {
  width: 100px;
  height: 100px;
  object-fit: cover;
  object-position: top center;
  border-radius: 50%;
  border: 3px solid #1a73a7;
  background: #fff;
  flex-shrink: 0;
  filter: drop-shadow(0 2px 8px rgba(0,0,0,0.15));
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

#gr-chatbot-widget #trigger-bubble {
  position: relative;
  background: #fff;
  border: 2px solid #1a73a7;
  border-radius: 16px;
  padding: 12px 16px;
  margin-bottom: 30px;
  margin-right: -8px;
  font-size: 13px;
  line-height: 1.6;
  color: #333;
  box-shadow: 0 4px 16px rgba(26, 115, 167, 0.15);
  max-width: 220px;
  animation: gr-bubbleBounce 2s ease-in-out infinite;
  box-sizing: border-box;
}

#gr-chatbot-widget #trigger-bubble strong {
  color: #1a73a7;
}

#gr-chatbot-widget #trigger-bubble .bubble-tail {
  position: absolute;
  right: -10px;
  bottom: 18px;
  width: 0;
  height: 0;
  border-left: 12px solid #fff;
  border-top: 8px solid transparent;
  border-bottom: 8px solid transparent;
  filter: drop-shadow(2px 0 0 #1a73a7);
}

@keyframes gr-bubbleBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

/* --- チャットボット本体 --- */
#gr-chatbot-widget #chatbot-container {
  position: fixed;
  bottom: 96px;
  right: 24px;
  width: 400px;
  max-width: calc(100vw - 32px);
  height: 600px;
  max-height: calc(100vh - 120px);
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 10001;
  transition: opacity 0.3s, transform 0.3s;
  font-family: 'Hiragino Kaku Gothic ProN', 'メイリオ', Meiryo, sans-serif;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-size: 14px;
  line-height: 1.6;
  color: #333;
}

#gr-chatbot-widget #chatbot-container.chatbot-hidden {
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  pointer-events: none;
}

/* --- ヘッダー --- */
#gr-chatbot-widget #chatbot-header {
  background: linear-gradient(135deg, #1a73a7, #2196F3);
  color: #fff;
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  margin: 0;
  box-sizing: border-box;
}

#gr-chatbot-widget .chatbot-header-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

#gr-chatbot-widget .chatbot-avatar-small {
  width: 40px;
  height: 40px;
  background: rgba(255,255,255,0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 14px;
  color: #fff;
}

#gr-chatbot-widget .chatbot-header-title {
  font-weight: bold;
  font-size: 15px;
  color: #fff;
}

#gr-chatbot-widget .chatbot-header-subtitle {
  font-size: 12px;
  opacity: 0.85;
  color: #fff;
}

#gr-chatbot-widget #chatbot-close {
  background: none;
  border: none;
  color: #fff;
  font-size: 28px;
  cursor: pointer;
  line-height: 1;
  padding: 0 4px;
  margin: 0;
}

/* --- メッセージエリア --- */
#gr-chatbot-widget #chatbot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #f7f8fa;
  margin: 0;
  box-sizing: border-box;
}

#gr-chatbot-widget #chatbot-messages::-webkit-scrollbar {
  width: 6px;
}

#gr-chatbot-widget #chatbot-messages::-webkit-scrollbar-thumb {
  background: #ccc;
  border-radius: 3px;
}

/* --- botメッセージ行（アバター＋吹き出し） --- */
#gr-chatbot-widget .chat-message-row.bot {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  align-self: flex-start;
  max-width: 90%;
  animation: gr-fadeIn 0.3s ease;
}

#gr-chatbot-widget .chat-bot-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  object-fit: cover;
  object-position: top center;
  flex-shrink: 0;
  margin-top: 2px;
  border: 2px solid #1a73a7;
  background: #fff;
}

/* --- メッセージ共通 --- */
#gr-chatbot-widget .chat-message {
  max-width: 85%;
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.6;
  word-wrap: break-word;
  animation: gr-fadeIn 0.3s ease;
  margin: 0;
  box-sizing: border-box;
}

/* アバター行内のbotメッセージはmax-width調整 */
#gr-chatbot-widget .chat-message-row.bot .chat-message.bot {
  max-width: 100%;
  animation: none;
}

@keyframes gr-fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

#gr-chatbot-widget .chat-message.bot {
  background: #fff;
  color: #333;
  align-self: flex-start;
  border-radius: 16px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  border: 1.5px solid #1a73a7;
  position: relative;
}

/* 漫画風吹き出ししっぽ（アバター側に向かって尖る） */
#gr-chatbot-widget .chat-message-row.bot .chat-message.bot::before {
  content: '';
  position: absolute;
  left: -10px;
  top: 18px;
  width: 0;
  height: 0;
  border-top: 7px solid transparent;
  border-bottom: 7px solid transparent;
  border-right: 11px solid #1a73a7;
}

#gr-chatbot-widget .chat-message-row.bot .chat-message.bot::after {
  content: '';
  position: absolute;
  left: -7px;
  top: 19px;
  width: 0;
  height: 0;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  border-right: 10px solid #fff;
}

#gr-chatbot-widget .chat-message.user {
  background: linear-gradient(135deg, #1a73a7, #2196F3);
  color: #fff;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

/* --- タイピングインジケーター --- */
#gr-chatbot-widget .typing-indicator {
  display: flex;
  gap: 4px;
  padding: 12px 16px;
  align-self: flex-start;
}

#gr-chatbot-widget .typing-indicator span {
  width: 8px;
  height: 8px;
  background: #bbb;
  border-radius: 50%;
  animation: gr-typing 1.2s infinite;
}

#gr-chatbot-widget .typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
#gr-chatbot-widget .typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

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

/* --- 選択肢ボタンエリア --- */
#gr-chatbot-widget #chatbot-options {
  padding: 0 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  flex-shrink: 0;
  max-height: 180px;
  overflow-y: auto;
  background: #f7f8fa;
  margin: 0;
  box-sizing: border-box;
}

#gr-chatbot-widget #chatbot-options:empty {
  padding: 0;
}

#gr-chatbot-widget .option-button {
  background: #fff;
  border: 1.5px solid #1a73a7;
  color: #1a73a7;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
  margin: 0;
  box-sizing: border-box;
}

#gr-chatbot-widget .option-button:hover {
  background: #1a73a7;
  color: #fff;
}

#gr-chatbot-widget .option-button.back-button {
  background: transparent;
  border: 1px solid #999;
  color: #666;
  font-size: 12px;
  padding: 6px 14px;
}

#gr-chatbot-widget .option-button.back-button:hover {
  background: #f0f0f0;
  color: #333;
}

/* --- 入力エリア --- */
#gr-chatbot-widget #chatbot-input-area {
  display: flex;
  padding: 12px 16px;
  gap: 8px;
  border-top: 1px solid #e8e8e8;
  background: #fff;
  flex-shrink: 0;
  margin: 0;
  box-sizing: border-box;
}

#gr-chatbot-widget #chatbot-input {
  flex: 1;
  border: 1.5px solid #ddd;
  border-radius: 24px;
  padding: 10px 16px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
  margin: 0;
  box-sizing: border-box;
}

#gr-chatbot-widget #chatbot-input:focus {
  border-color: #1a73a7;
}

#gr-chatbot-widget #chatbot-input:disabled {
  background: #f5f5f5;
  color: #999;
}

#gr-chatbot-widget #chatbot-send {
  width: 40px;
  height: 40px;
  border: none;
  background: linear-gradient(135deg, #1a73a7, #2196F3);
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.2s;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

#gr-chatbot-widget #chatbot-send:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* --- 施設カード --- */
#gr-chatbot-widget .facility-card {
  background: #f0f7ff;
  border: 1px solid #d0e3f5;
  border-radius: 12px;
  padding: 12px;
  margin-top: 8px;
  font-size: 13px;
  line-height: 1.6;
  box-sizing: border-box;
}

#gr-chatbot-widget .facility-card .facility-name {
  font-weight: bold;
  color: #1a73a7;
  font-size: 14px;
  margin-bottom: 4px;
}

#gr-chatbot-widget .facility-card .facility-detail {
  color: #555;
}

/* --- プランカード --- */
#gr-chatbot-widget .plan-card {
  background: linear-gradient(135deg, #f0f7ff, #e8f4fd);
  border: 1.5px solid #1a73a7;
  border-radius: 12px;
  padding: 16px;
  margin-top: 8px;
  box-sizing: border-box;
}

#gr-chatbot-widget .plan-card .plan-day {
  font-weight: bold;
  color: #1a73a7;
  font-size: 14px;
  margin-bottom: 4px;
}

#gr-chatbot-widget .plan-card .plan-content {
  color: #444;
  font-size: 13px;
  line-height: 1.7;
}

/* --- レスポンシブ --- */
@media (max-width: 480px) {
  #gr-chatbot-widget #chatbot-container {
    bottom: 0;
    right: 0;
    width: 100vw;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
  }

  #gr-chatbot-widget #chatbot-trigger {
    bottom: 8px;
    right: 8px;
  }

  #gr-chatbot-widget #trigger-avatar {
    width: 72px;
    height: 72px;
  }

  #gr-chatbot-widget #trigger-bubble {
    max-width: 180px;
    font-size: 12px;
    padding: 10px 12px;
    margin-bottom: 20px;
  }
}
