/*
================================================================
仕様: Connect-CMS フローティングチャットボット スタイルシート
================================================================
ファイル名 : cc-chat.css
設置場所   : /public/chatbot/cc-chat.css
             アクセスURL: https://bura3.info/chatbot/cc-chat.css

目的       : Connect-CMSのWYSIWYGエディタが<style>タグを
             削除してしまう問題を回避するため、CSSを
             外部ファイルとして分離して設置する。
             chatbot-floating.html から
             <link rel="stylesheet" href="https://bura3.info/chatbot/cc-chat.css">
             で読み込んで使用する。

依存関係   : chatbot-floating.html（HTMLを担当）
             cc-chat.js（JavaScriptを担当）

スコープ   : #cc-fab / #cc-badge / #cc-window 配下のみに適用
             既存CSSとの干渉を防ぐため全セレクタに
             #cc- プレフィックスを付与している

読み込み方 : Connect-CMS管理画面
             → サイト管理 → アクセス解析設定 に以下を登録
             <link rel="stylesheet" href="https://bura3.info/chatbot/cc-chat.css">

UI仕様     : - フローティングボタン: 直径73px・bottom:170px（上矢印と重ならない位置）
             - チャットウィンドウ  : bottom:236px
             - ボタン文字         : 「ご質問」（白文字）
             - 閉じるボタン       : 「×」テキスト
             - 送信ボタン         : 「送信」テキスト（SVGなし・幅44px固定）
             - ロゴ               : b
             - タイトル           : bura3 サポート
             - サブタイトル       : マニュアル v1.19.0
             - スマートフォン対応 : 画面幅420px以下でウィンドウサイズを自動調整
             　　　　　　　　　　　   ボタン bottom:160px・ウィンドウ bottom:230px

文字コード : UTF-8
================================================================
*/

/* ---- フローティングボタン ---- */
#cc-fab {
  position: fixed;
  bottom: 170px;
  right: 24px;
  width: 73px;
  height: 73px;
  border-radius: 50%;
  background: #1d9e75;
  box-shadow: 0 4px 16px rgba(0,0,0,0.22);
  cursor: pointer;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: transform 0.2s, box-shadow 0.2s;
}
#cc-fab:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 20px rgba(0,0,0,0.28);
}
#cc-fab svg { width: 26px; height: 26px; fill: #fff; }
#cc-fab .cc-icon-chat  { display: block; font-size: 14px; font-weight: bold; color: #fff !important; line-height: 1.3; text-align: center; }
#cc-fab .cc-icon-close { display: none;  font-size: 20px; font-weight: bold; color: #fff; }
#cc-fab.cc-open .cc-icon-chat  { display: none;  }
#cc-fab.cc-open .cc-icon-close { display: block; }

/* ---- 未読バッジ ---- */
#cc-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #e74c3c;
  color: #fff;
  font-size: 11px;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: sans-serif;
  animation: cc-pop 0.4s cubic-bezier(0.175,0.885,0.32,1.275);
}
#cc-badge.cc-hidden { display: none; }
@keyframes cc-pop {
  0%   { transform: scale(0); }
  100% { transform: scale(1); }
}

/* ---- チャットウィンドウ ---- */
#cc-window {
  position: fixed;
  bottom: 236px;
  right: 24px;
  width: 360px;
  height: 520px;
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 9998;
  font-family: sans-serif;
  background: #fff;
  /* 初期状態: 非表示・スライドイン準備 */
  opacity: 0;
  transform: translateY(16px) scale(0.97);
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}
/* 開いた状態 */
#cc-window.cc-open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}
/* スマートフォン対応 */
@media (max-width: 420px) {
  #cc-window {
    width: calc(100vw - 16px);
    right: 8px;
    bottom: 183px;
    height: 65vh;
  }
  #cc-fab { bottom: 100px; right: 16px; }
}

/* ---- ヘッダー ---- */
#cc-window #cc-header {
  padding: 12px 14px;
  background: #1d9e75;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
#cc-window .cc-header-left {
  display: flex;
  align-items: center;
  gap: 9px;
}
#cc-window .cc-logo {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: rgba(255,255,255,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: bold;
  flex-shrink: 0;
}
#cc-window .cc-title { font-size: 13px; font-weight: bold; }
#cc-window .cc-sub   { font-size: 10px; opacity: 0.8; }
#cc-close-btn {
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.7;
  transition: opacity 0.15s;
}
#cc-close-btn:hover { opacity: 1; }
#cc-close-btn svg { width: 16px; height: 16px; fill: #fff; }
#cc-close-btn { font-size: 18px; font-weight: bold; color: #fff; }

/* ---- メッセージエリア ---- */
#cc-window #cc-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #f7f7f7;
}

/* メッセージ行 */
#cc-window .cc-msg { display: flex; gap: 7px; max-width: 92%; }
#cc-window .cc-msg.cc-user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

/* 吹き出し */
#cc-window .cc-bubble {
  padding: 9px 12px;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.65;
}
#cc-window .cc-msg.cc-bot .cc-bubble {
  background: #fff;
  border: 1px solid #e8e8e8;
  border-radius: 4px 14px 14px 14px;
  color: #333;
}
#cc-window .cc-msg.cc-user .cc-bubble {
  background: #1d9e75;
  color: #fff;
  border-radius: 14px 4px 14px 14px;
}

/* アバター */
#cc-window .cc-av {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: bold;
  flex-shrink: 0;
  margin-top: 2px;
}
#cc-window .cc-msg.cc-bot  .cc-av { background: #1d9e75; color: #fff; }
#cc-window .cc-msg.cc-user .cc-av { background: #ddd;    color: #555; }

/* 入力中ドットアニメーション */
#cc-window .cc-dots {
  display: flex;
  gap: 4px;
  padding: 9px 12px;
  background: #fff;
  border: 1px solid #e8e8e8;
  border-radius: 4px 14px 14px 14px;
}
#cc-window .cc-dots span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #bbb;
  animation: cc-blink 1.2s infinite;
}
#cc-window .cc-dots span:nth-child(2) { animation-delay: 0.2s; }
#cc-window .cc-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes cc-blink { 0%,80%,100%{opacity:.3} 40%{opacity:1} }

/* サジェストボタン */
#cc-window .cc-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 5px;
}
#cc-window .cc-chip {
  font-size: 11px;
  padding: 4px 9px;
  border: 1px solid #ccc;
  border-radius: 20px;
  cursor: pointer;
  background: #fff;
  color: #555;
  transition: background 0.15s;
}
#cc-window .cc-chip:hover { background: #f0f0f0; }

/* ---- 入力エリア ---- */
#cc-window #cc-input-area {
  padding: 10px 12px;
  border-top: 1px solid #eee;
  display: flex;
  gap: 8px;
  align-items: flex-end;
  background: #fff;
  flex-shrink: 0;
}
#cc-window #cc-input {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  font-family: sans-serif;
  resize: none;
  border: 1px solid #ccc;
  border-radius: 18px;
  padding: 7px 12px;
  min-height: 34px;
  max-height: 90px;
  outline: none;
  background: #f8f8f8;
  color: #333;
}
#cc-window #cc-input:focus { border-color: #1d9e75; }

/* 送信ボタン */
#cc-window #cc-send {
  height: 34px;
  width: 44px;
  min-width: 44px;
  max-width: 44px;
  padding: 0;
  border-radius: 18px;
  background: #1d9e75;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: opacity 0.15s;
  font-size: 11px;
  font-weight: bold;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
}
#cc-window #cc-send:hover { opacity: 0.85; }
#cc-window #cc-send svg { display: none; }

/* 吹き出し内リンク */
#cc-window .cc-bubble a { color: #0f6e56; }
