/* チャットボットウィジェット スタイル */

/* チャットボタン（右下固定） */
#chatbot-button {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 60px;
  height: 60px;
  background: linear-gradient(135deg, #0d9488 0%, #14b8a6 100%);
  border-radius: 50%;
  box-shadow: 0 4px 12px rgba(13, 148, 136, 0.4);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  z-index: 9998;
  border: none;
}

#chatbot-button:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 20px rgba(13, 148, 136, 0.6);
}

#chatbot-button svg {
  width: 28px;
  height: 28px;
  color: white;
}

#chatbot-button .unread-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #ef4444;
  color: white;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  font-size: 11px;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid white;
}

/* チャットウィンドウ */
#chatbot-window {
  position: fixed;
  bottom: 100px;
  right: 24px;
  width: 380px;
  max-width: calc(100vw - 48px);
  height: 600px;
  max-height: calc(100vh - 150px);
  background: white;
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
  display: none;
  flex-direction: column;
  overflow: hidden;
  z-index: 9999;
  animation: slideUp 0.3s ease;
}

#chatbot-window.show {
  display: flex;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ヘッダー */
#chatbot-header {
  background: linear-gradient(135deg, #0d9488 0%, #14b8a6 100%);
  color: white;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

#chatbot-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

#chatbot-avatar {
  width: 40px;
  height: 40px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

#chatbot-title {
  font-size: 16px;
  font-weight: 600;
}

#chatbot-status {
  font-size: 12px;
  opacity: 0.9;
}

#chatbot-close {
  background: none;
  border: none;
  color: white;
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.9;
  transition: opacity 0.2s;
}

#chatbot-close:hover {
  opacity: 1;
}

#chatbot-close svg {
  width: 24px;
  height: 24px;
}

/* メッセージエリア */
#chatbot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  background: #f9fafb;
}

.chatbot-message {
  margin-bottom: 16px;
  display: flex;
  gap: 8px;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.chatbot-message.bot {
  flex-direction: row;
}

.chatbot-message.user {
  flex-direction: row-reverse;
}

.chatbot-message-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 16px;
}

.chatbot-message.bot .chatbot-message-avatar {
  background: linear-gradient(135deg, #0d9488 0%, #14b8a6 100%);
  color: white;
}

.chatbot-message.user .chatbot-message-avatar {
  background: #e5e7eb;
  color: #6b7280;
}

.chatbot-message-content {
  max-width: 75%;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.6;
}

.chatbot-message.bot .chatbot-message-content {
  background: white;
  color: #1f2937;
  border-bottom-left-radius: 4px;
}

.chatbot-message.user .chatbot-message-content {
  background: #0d9488;
  color: white;
  border-bottom-right-radius: 4px;
}

.chatbot-message-time {
  font-size: 11px;
  color: #9ca3af;
  margin-top: 4px;
  padding: 0 4px;
}

/* タイピングインジケーター */
.chatbot-typing {
  display: flex;
  gap: 4px;
  padding: 12px 16px;
}

.chatbot-typing-dot {
  width: 8px;
  height: 8px;
  background: #9ca3af;
  border-radius: 50%;
  animation: typing 1.4s infinite;
}

.chatbot-typing-dot:nth-child(2) {
  animation-delay: 0.2s;
}

.chatbot-typing-dot:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes typing {
  0%,
  60%,
  100% {
    transform: translateY(0);
    opacity: 0.4;
  }
  30% {
    transform: translateY(-10px);
    opacity: 1;
  }
}

/* クイック返信ボタン */
#chatbot-quick-replies {
  padding: 12px 20px 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chatbot-quick-reply {
  background: white;
  border: 1px solid #d1d5db;
  color: #374151;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}

.chatbot-quick-reply:hover {
  background: #f3f4f6;
  border-color: #0d9488;
  color: #0d9488;
}

/* メール問い合わせボタン */
.chatbot-email-cta {
  background: linear-gradient(135deg, #f59e0b 0%, #f97316 100%);
  color: white;
  padding: 12px 20px;
  border-radius: 8px;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  margin: 8px 0;
  transition: transform 0.2s;
  border: none;
  width: 100%;
}

.chatbot-email-cta:hover {
  transform: scale(1.02);
}

/* 入力エリア */
#chatbot-input-area {
  border-top: 1px solid #e5e7eb;
  padding: 16px 20px;
  background: white;
}

#chatbot-input-form {
  display: flex;
  gap: 8px;
}

#chatbot-input {
  flex: 1;
  border: 1px solid #d1d5db;
  border-radius: 24px;
  padding: 10px 16px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

#chatbot-input:focus {
  border-color: #0d9488;
}

#chatbot-send {
  background: linear-gradient(135deg, #0d9488 0%, #14b8a6 100%);
  color: white;
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

#chatbot-send:hover {
  transform: scale(1.05);
}

#chatbot-send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

#chatbot-send svg {
  width: 20px;
  height: 20px;
}

/* モバイル対応 */
@media (max-width: 640px) {
  #chatbot-window {
    bottom: 0;
    right: 0;
    left: 0;
    width: 100%;
    max-width: 100%;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
  }

  #chatbot-button {
    bottom: 20px;
    right: 20px;
    width: 56px;
    height: 56px;
  }
}

/* スクロールバー */
#chatbot-messages::-webkit-scrollbar {
  width: 6px;
}

#chatbot-messages::-webkit-scrollbar-track {
  background: #f3f4f6;
}

#chatbot-messages::-webkit-scrollbar-thumb {
  background: #d1d5db;
  border-radius: 3px;
}

#chatbot-messages::-webkit-scrollbar-thumb:hover {
  background: #9ca3af;
}
