/* === F&Iクリエイト AI相談チャットウィジェット スタイル === */
:root {
  --primary-color: #0f172a;
  --accent-color: #2563eb;
  --accent-hover: #1d4ed8;
  --bg-color: #ffffff;
  --bubble-user: #2563eb;
  --bubble-ai: #f1f5f9;
  --text-main: #1e293b;
  --text-muted: #64748b;
  --border-color: #e2e8f0;
  --shadow: 0 12px 36px rgba(0, 0, 0, 0.15), 0 4px 12px rgba(0, 0, 0, 0.08);
  --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Hiragino Sans', 'Noto Sans JP', sans-serif;
}

/* ウィジェット全体のコンテナ（右下固定） */
.ats-chat-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  font-family: var(--font-family);
}

/* 案C: くるくる切り替わる吹き出しティザー */
.ats-chat-teaser {
  background: #ffffff;
  color: var(--text-main);
  padding: 8px 14px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
  border: 1px solid var(--border-color);
  position: relative;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  animation: floatTeaser 3s infinite ease-in-out;
  transition: opacity 0.3s, transform 0.3s;
}

.ats-chat-teaser:hover {
  transform: translateY(-2px);
  border-color: var(--accent-color);
}

/* 吹き出しの三角の矢印 */
.ats-chat-teaser::after {
  content: '';
  position: absolute;
  bottom: -6px;
  right: 24px;
  width: 10px;
  height: 10px;
  background: #ffffff;
  border-right: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
  transform: rotate(45deg);
}

.ats-teaser-text {
  display: inline-block;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.ats-teaser-text.is-changing {
  opacity: 0;
  transform: translateY(-4px);
}

@keyframes floatTeaser {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

/* フローティング起動ボタン */
.ats-chat-trigger {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--primary-color);
  color: #fff;
  padding: 12px 20px;
  border-radius: 9999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: var(--shadow);
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
}

.ats-chat-trigger:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.2);
  background: #1e293b;
}

.ats-trigger-icon {
  width: 28px;
  height: 28px;
  background: var(--accent-color);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
}

.ats-trigger-badge {
  background: #10b981;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  position: absolute;
  top: 10px;
  right: 14px;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* チャットウィンドウ本体 */
.ats-chat-window {
  position: fixed;
  bottom: 88px;
  right: 24px;
  width: 380px;
  height: 600px;
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 110px);
  background: var(--bg-color);
  border-radius: 20px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 99999;
  font-family: var(--font-family);
  border: 1px solid var(--border-color);
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.ats-chat-window.is-active {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* ヘッダー */
.ats-chat-header {
  background: var(--primary-color);
  color: #fff;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.ats-chat-title-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.ats-chat-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #334155;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  border: 2px solid rgba(255, 255, 255, 0.2);
}

.ats-chat-header-text h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: #fff;
}

.ats-chat-header-text p {
  margin: 0;
  font-size: 11px;
  color: #94a3b8;
}

.ats-chat-close-btn {
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 20px;
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s;
}

.ats-chat-close-btn:hover {
  color: #fff;
}

/* メッセージエリア */
.ats-chat-messages {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: #f8fafc;
}

.ats-message {
  display: flex;
  flex-direction: column;
  max-width: 85%;
  animation: fadeIn 0.25s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.ats-message.ai {
  align-self: flex-start;
}

.ats-message.user {
  align-self: flex-end;
}

.ats-bubble {
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 13.5px;
  line-height: 1.55;
  word-break: break-word;
}

.ats-message.ai .ats-bubble {
  background: #ffffff;
  color: var(--text-main);
  border: 1px solid var(--border-color);
  border-bottom-left-radius: 4px;
}

.ats-message.user .ats-bubble {
  background: var(--bubble-user);
  color: #ffffff;
  border-bottom-right-radius: 4px;
}

/* 選択肢ボタン群 */
.ats-options-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

.ats-option-btn {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  color: var(--text-main);
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.ats-option-btn:hover {
  background: #eff6ff;
  border-color: var(--accent-color);
  color: var(--accent-color);
  transform: translateX(3px);
}

/* CTA カード */
.ats-cta-card {
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  color: #fff;
  padding: 16px;
  border-radius: 14px;
  margin-top: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.ats-cta-card h4 {
  margin: 0 0 6px 0;
  font-size: 14px;
  color: #38bdf8;
}

.ats-cta-card p {
  margin: 0 0 12px 0;
  font-size: 12px;
  color: #cbd5e1;
  line-height: 1.4;
}

.ats-cta-btn {
  display: block;
  text-align: center;
  background: var(--accent-color);
  color: #fff;
  text-decoration: none;
  padding: 10px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  transition: background 0.2s;
}

.ats-cta-btn:hover {
  background: var(--accent-hover);
}

/* フッター入力エリア */
.ats-chat-footer {
  padding: 12px 16px;
  background: #ffffff;
  border-top: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ats-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ats-chat-input {
  flex: 1;
  padding: 10px 14px;
  border-radius: 20px;
  border: 1px solid #cbd5e1;
  font-size: 13px;
  outline: none;
  font-family: inherit;
  transition: border-color 0.2s;
}

.ats-chat-input:focus {
  border-color: var(--accent-color);
}

.ats-chat-send-btn {
  background: var(--accent-color);
  color: #fff;
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s;
}

.ats-chat-send-btn:hover {
  background: var(--accent-hover);
}

/* ハニーポット（不可視） */
.ats-hp-field {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  position: absolute !important;
  left: -9999px !important;
}

/* タイピングアニメーション */
.ats-typing-dots {
  display: flex;
  gap: 4px;
  padding: 8px 12px;
}

.ats-dot {
  width: 6px;
  height: 6px;
  background: #94a3b8;
  border-radius: 50%;
  animation: typing 1.4s infinite ease-in-out;
}

.ats-dot:nth-child(1) { animation-delay: 0s; }
.ats-dot:nth-child(2) { animation-delay: 0.2s; }
.ats-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
  0%, 80%, 100% { transform: translateY(0); }
  40% { transform: translateY(-6px); }
}
