/* ===================================================
   AJTC Chatbot Widget — chatbot.css
   ブランドカラー: ゴールド #c8a45c / ダーク #0a0a0a
   =================================================== */

/* --- Turnstile widget container --- */
#ajtc-cf-turnstile-container {
  padding: 8px 12px 4px;
  display: flex;
  justify-content: center;
}
#ajtc-cf-turnstile-container:empty {
  display: none;
}

/* --- フローティングボタン --- */
#ajtc-chat-toggle {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #c8a45c;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(200, 164, 92, 0.4);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

#ajtc-chat-toggle:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 20px rgba(200, 164, 92, 0.55);
}

#ajtc-chat-toggle:focus-visible {
  outline: 3px solid #c8a45c;
  outline-offset: 3px;
}

#ajtc-chat-toggle svg {
  width: 26px;
  height: 26px;
  fill: #0a0a0a;
  flex-shrink: 0;
}

/* --- チャットパネル --- */
#ajtc-chat-panel {
  position: fixed;
  bottom: 92px;
  right: 24px;
  z-index: 9998;
  width: 360px;
  height: 520px;
  background: #111111;
  border: 1px solid rgba(200, 164, 92, 0.25);
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  /* 初期状態: 非表示 */
  opacity: 0;
  transform: translateY(16px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

#ajtc-chat-panel.is-open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

/* prefers-reduced-motion: アニメーション無効化 */
@media (prefers-reduced-motion: reduce) {
  #ajtc-chat-panel,
  #ajtc-chat-toggle {
    transition: none;
  }
}

/* --- パネルヘッダー --- */
#ajtc-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: #0a0a0a;
  border-bottom: 1px solid rgba(200, 164, 92, 0.2);
  flex-shrink: 0;
}

#ajtc-chat-header-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

#ajtc-chat-header-title span {
  color: #c8a45c;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.03em;
}

#ajtc-chat-header-title svg {
  width: 18px;
  height: 18px;
  fill: #c8a45c;
  flex-shrink: 0;
}

#ajtc-chat-close {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  color: #888;
  display: flex;
  align-items: center;
  border-radius: 4px;
  transition: color 0.15s ease;
}

#ajtc-chat-close:hover {
  color: #e8e8e8;
}

#ajtc-chat-close:focus-visible {
  outline: 2px solid #c8a45c;
  outline-offset: 2px;
}

#ajtc-chat-close svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
}

/* --- エスカレーションバナー（常時表示） --- */
#ajtc-chat-escalation {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: rgba(200, 164, 92, 0.08);
  border-bottom: 1px solid rgba(200, 164, 92, 0.15);
  flex-shrink: 0;
}

#ajtc-chat-escalation a {
  color: #c8a45c;
  font-size: 12px;
  text-decoration: none;
  font-weight: 500;
  white-space: nowrap;
  padding: 4px 10px;
  border: 1px solid rgba(200, 164, 92, 0.5);
  border-radius: 20px;
  transition: background 0.15s ease;
  flex-shrink: 0;
}

#ajtc-chat-escalation a:hover {
  background: rgba(200, 164, 92, 0.15);
}

#ajtc-chat-escalation-label {
  color: #999;
  font-size: 11px;
  line-height: 1.4;
}

/* エスカレーション強調状態 */
#ajtc-chat-escalation.is-highlighted {
  background: rgba(200, 164, 92, 0.18);
  border-color: rgba(200, 164, 92, 0.4);
}

#ajtc-chat-escalation.is-highlighted a {
  background: #c8a45c;
  color: #0a0a0a;
  border-color: #c8a45c;
}

#ajtc-chat-escalation.is-highlighted .ajtc-chat-escalation-label {
  color: #e8e8e8;
}

/* --- メッセージエリア --- */
#ajtc-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
}

/* スクロールバースタイリング */
#ajtc-chat-messages::-webkit-scrollbar {
  width: 4px;
}

#ajtc-chat-messages::-webkit-scrollbar-track {
  background: transparent;
}

#ajtc-chat-messages::-webkit-scrollbar-thumb {
  background: rgba(200, 164, 92, 0.3);
  border-radius: 2px;
}

/* メッセージバブル共通 */
.ajtc-msg {
  max-width: 85%;
  padding: 10px 13px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.6;
  word-break: break-word;
}

/* ユーザーメッセージ: 右寄せ・ゴールド背景 */
.ajtc-msg--user {
  align-self: flex-end;
  background: #c8a45c;
  color: #0a0a0a;
  border-bottom-right-radius: 3px;
}

/* AI メッセージ: 左寄せ・ダーク背景 */
.ajtc-msg--ai {
  align-self: flex-start;
  background: #1e1e1e;
  color: #e8e8e8;
  border: 1px solid rgba(200, 164, 92, 0.15);
  border-bottom-left-radius: 3px;
}

/* ローディングアニメーション */
.ajtc-msg--loading {
  align-self: flex-start;
  background: #1e1e1e;
  border: 1px solid rgba(200, 164, 92, 0.15);
  border-bottom-left-radius: 3px;
  padding: 12px 16px;
}

.ajtc-dots {
  display: flex;
  gap: 5px;
  align-items: center;
}

.ajtc-dots span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #c8a45c;
  opacity: 0.4;
  animation: ajtc-bounce 1.2s infinite ease-in-out;
}

.ajtc-dots span:nth-child(2) { animation-delay: 0.2s; }
.ajtc-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes ajtc-bounce {
  0%, 80%, 100% { opacity: 0.4; transform: scale(1); }
  40%            { opacity: 1;   transform: scale(1.25); }
}

@media (prefers-reduced-motion: reduce) {
  .ajtc-dots span { animation: none; opacity: 0.6; }
}

/* --- 入力エリア --- */
#ajtc-chat-input-area {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid rgba(200, 164, 92, 0.2);
  background: #0a0a0a;
  flex-shrink: 0;
}

#ajtc-chat-textarea {
  flex: 1;
  background: #1a1a1a;
  border: 1px solid rgba(200, 164, 92, 0.25);
  border-radius: 8px;
  color: #e8e8e8;
  font-size: 13px;
  line-height: 1.5;
  padding: 9px 11px;
  resize: none;
  min-height: 38px;
  max-height: 100px;
  overflow-y: auto;
  font-family: inherit;
  transition: border-color 0.15s ease;
}

#ajtc-chat-textarea::placeholder {
  color: #555;
}

#ajtc-chat-textarea:focus {
  outline: none;
  border-color: rgba(200, 164, 92, 0.6);
}

#ajtc-chat-send {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: #c8a45c;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s ease, transform 0.1s ease;
}

#ajtc-chat-send:hover {
  background: #d4b070;
}

#ajtc-chat-send:active {
  transform: scale(0.94);
}

#ajtc-chat-send:disabled {
  background: #555;
  cursor: not-allowed;
  transform: none;
}

#ajtc-chat-send:focus-visible {
  outline: 2px solid #c8a45c;
  outline-offset: 2px;
}

#ajtc-chat-send svg {
  width: 18px;
  height: 18px;
  fill: #0a0a0a;
}

/* --- モバイル対応 --- */
@media (max-width: 640px) {
  #ajtc-chat-panel {
    bottom: 0;
    right: 0;
    width: 100vw;
    height: 100dvh;
    border-radius: 0;
    border: none;
  }

  #ajtc-chat-toggle {
    bottom: 20px;
    right: 20px;
  }
}
