/**
 * Enen AI Chatbot スタイルシート
 */

/* CSS変数 */
:root {
  --eac-primary-color: #007cba;
  --eac-primary-color-hover: #005a8a;
  --eac-primary-color-light: #e6f3fa;
  --eac-text-color: #333333;
  --eac-text-light: #666666;
  --eac-border-color: #e0e0e0;
  --eac-bg-color: #ffffff;
  --eac-bg-gray: #f5f5f5;
  --eac-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  --eac-shadow-hover: 0 4px 20px rgba(0, 0, 0, 0.15);
  --eac-radius: 12px;
  --eac-transition: all 0.3s ease;
}

/* コンテナ */
.eac-chatbot-container {
  position: fixed;
  z-index: 999999;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", "Hiragino Sans", "Yu Gothic", sans-serif;
}

/* チャットボタン */
.eac-chat-button {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--eac-primary-color);
  border: none;
  color: white;
  cursor: pointer;
  box-shadow: var(--eac-shadow);
  transition: var(--eac-transition);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  animation: eac-pulse 2s infinite;
}

.eac-chat-button:hover {
  background: var(--eac-primary-color-hover);
  box-shadow: var(--eac-shadow-hover);
  transform: scale(1.05);
}

.eac-chat-button svg {
  width: 28px;
  height: 28px;
}

/* バッジ */
.eac-chat-button-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  background: #ff4444;
  color: white;
  border-radius: 10px;
  padding: 2px 6px;
  font-size: 12px;
  font-weight: bold;
  min-width: 20px;
  text-align: center;
}

/* パルスアニメーション */
@keyframes eac-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(0, 124, 186, 0.4);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(0, 124, 186, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(0, 124, 186, 0);
  }
}

/* チャットウィンドウ */
.eac-chat-window {
  position: absolute;
  bottom: 80px;
  right: 0;
  width: 380px;
  height: 600px;
  background: var(--eac-bg-color);
  border-radius: var(--eac-radius);
  box-shadow: 0 5px 40px rgba(0, 0, 0, 0.16);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: eac-slideUp 0.3s ease;
  transform-origin: bottom right;
}

/* インラインチャット */
.eac-chat-window-inline {
  position: relative !important;
  bottom: auto !important;
  right: auto !important;
  width: 100% !important;
  box-shadow: 0 0 0 1px var(--eac-border-color);
}

/* スライドアップアニメーション */
@keyframes eac-slideUp {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* チャットヘッダー */
.eac-chat-header {
  background: var(--eac-primary-color);
  color: white;
  padding: 16px 20px;
  border-radius: var(--eac-radius) var(--eac-radius) 0 0;
}

.eac-chat-header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.eac-chat-status {
  display: flex;
  align-items: center;
  gap: 10px;
}

.eac-chat-status-dot {
  width: 10px;
  height: 10px;
  background: #4caf50;
  border-radius: 50%;
  animation: eac-blink 2s infinite;
}

@keyframes eac-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.eac-chat-title {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}

.eac-chat-close {
  background: none;
  border: none;
  color: white;
  cursor: pointer;
  padding: 4px;
  transition: var(--eac-transition);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
}

.eac-chat-close:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* メッセージエリア */
.eac-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  background: var(--eac-bg-gray);
  scroll-behavior: smooth;
}

.eac-chat-messages::-webkit-scrollbar {
  width: 6px;
}

.eac-chat-messages::-webkit-scrollbar-track {
  background: transparent;
}

.eac-chat-messages::-webkit-scrollbar-thumb {
  background: #c0c0c0;
  border-radius: 3px;
}

.eac-chat-messages::-webkit-scrollbar-thumb:hover {
  background: #a0a0a0;
}

/* メッセージ */
.eac-message {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
  animation: eac-fadeIn 0.3s ease;
}

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

.eac-message-user {
  flex-direction: row-reverse;
}

.eac-message-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--eac-primary-color-light);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.eac-message-user .eac-message-avatar {
  background: var(--eac-bg-gray);
}

.eac-message-avatar svg {
  width: 18px;
  height: 18px;
  color: var(--eac-primary-color);
}

.eac-message-content {
  max-width: 70%;
}

.eac-message-bubble {
  background: white;
  padding: 12px 16px;
  border-radius: 18px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
  word-wrap: break-word;
  line-height: 1.5;
  font-size: 14px;
  color: var(--eac-text-color);
}

.eac-message-user .eac-message-bubble {
  background: var(--eac-primary-color);
  color: white;
}

.eac-message-time {
  font-size: 11px;
  color: var(--eac-text-light);
  margin-top: 4px;
  padding: 0 4px;
}

.eac-message-user .eac-message-time {
  text-align: right;
}

/* リンク */
.eac-message-bubble a {
  color: var(--eac-primary-color);
  text-decoration: underline;
}

.eac-message-user .eac-message-bubble a {
  color: white;
  text-decoration: underline;
}

.eac-contact-link {
  font-weight: 600;
}

/* クイックリプライ */
.eac-quick-replies {
  padding: 12px 20px;
  background: white;
  border-top: 1px solid var(--eac-border-color);
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.eac-quick-reply {
  padding: 6px 12px;
  border: 1px solid var(--eac-primary-color);
  background: white;
  color: var(--eac-primary-color);
  border-radius: 16px;
  font-size: 13px;
  cursor: pointer;
  transition: var(--eac-transition);
  white-space: nowrap;
}

.eac-quick-reply:hover {
  background: var(--eac-primary-color);
  color: white;
}

/* 入力エリア */
.eac-chat-input-container {
  padding: 16px 20px;
  background: white;
  border-top: 1px solid var(--eac-border-color);
}

.eac-chat-form {
  margin: 0;
}

.eac-chat-input-wrapper {
  display: flex;
  gap: 8px;
  align-items: center;
  background: var(--eac-bg-gray);
  border-radius: 24px;
  padding: 4px 4px 4px 16px;
}

.eac-chat-input {
  flex: 1;
  border: none;
  background: none;
  outline: none;
  font-size: 14px;
  color: var(--eac-text-color);
  padding: 8px 0;
}

.eac-chat-input::placeholder {
  color: #999;
}

.eac-chat-submit {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--eac-primary-color);
  border: none;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--eac-transition);
  flex-shrink: 0;
}

.eac-chat-submit:hover:not(:disabled) {
  background: var(--eac-primary-color-hover);
  transform: scale(1.05);
}

.eac-chat-submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.eac-chat-submit svg {
  width: 18px;
  height: 18px;
}

/* Powered by */
.eac-chat-powered {
  text-align: center;
  font-size: 11px;
  color: #999;
  margin-top: 8px;
}

/* タイピングインジケーター */
.eac-typing-indicator {
  position: absolute;
  bottom: 100px;
  left: 20px;
  display: flex;
  gap: 4px;
  padding: 12px;
  background: white;
  border-radius: 18px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

.eac-typing-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #999;
  animation: eac-typing 1.4s infinite ease-in-out;
}

.eac-typing-dot:nth-child(1) {
  animation-delay: -0.32s;
}

.eac-typing-dot:nth-child(2) {
  animation-delay: -0.16s;
}

@keyframes eac-typing {
  0%, 80%, 100% {
    transform: scale(1);
    opacity: 0.5;
  }
  40% {
    transform: scale(1.3);
    opacity: 1;
  }
}

/* レスポンシブ */
@media (max-width: 480px) {
  .eac-chat-window {
    width: 100vw;
    height: 100vh;
    bottom: 0;
    right: 0;
    border-radius: 0;
  }
  
  .eac-chat-header {
    border-radius: 0;
  }
  
  .eac-chat-button {
    width: 50px;
    height: 50px;
  }
  
  .eac-chat-button svg {
    width: 24px;
    height: 24px;
  }
}