/* ========== Slack関連のメッセージスタイル ========== */
.message-header {
  margin-bottom: 4px;
}

.message-source {
  font-size: 0.75em;
  color: #666;
  font-weight: bold;
  opacity: 0.9;
}

.message-content {
  line-height: 1.4;
}

.message-content.supplement {
  font-size: 0.9em;
  opacity: 0.8;
}

.message-source.slack {
  color: #4A154B;
}

.message-source.calendar {
  color: #34A853;
}

.slack-message {
  border-left: 4px solid #4A154B;
  padding-left: 12px;
  background-color: rgba(74, 21, 75, 0.05);
}

.calendar-message {
  border-left: 4px solid #34A853;
  padding-left: 12px;
  background-color: rgba(52, 168, 83, 0.05);
}

.supplement-message {
  border-left: 4px solid #0084FF;
  padding-left: 12px;
  background-color: rgba(0, 132, 255, 0.05);
}

.fallback-message {
  border-left: 4px solid #FF9800;
  padding-left: 12px;
  background-color: rgba(255, 152, 0, 0.1);
}

/* 基本設定 */
body {
    font-family: 'Roboto', sans-serif;
    background-color: #121212;
    color: #FFFFFF;
    margin: 0;
    padding: 0; /* 修正: 上下paddingを外し、ヘッダー/フッターは固定 */
    height: 100%;
    overflow: hidden; /* 全体でスクロールせず内部でスクロール */
}

html {
    height: 100%;
}

/* ヘッダー */
header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 60px;
  background-color: #1F1F1F;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 999;
  box-shadow: 0 2px 4px rgba(0,0,0,0.5);
  padding: 0 20px;
  box-sizing: border-box; /* 追加：paddingを含む幅の計算 */
}


header .logo {
  display: flex;
  gap: 10px;
  color: #E0E0E0;
}
header .logo .main-title {
  font-size: 1.5em;
  font-weight: bold;
  color: #E0E0E0;
}
header .logo .sub-title {
  font-size: 0.9em;
  font-weight: 400;
  color: #B0B0B0;
}

/* 初期状態 */
#header-nav {
    display: none;
}
/* openクラスが付与されたとき */
  #header-nav.open {
    display: flex;
    flex-direction: column;
    align-items: flex-end;     /* 右揃えなら flex-end など */
    width: 100%;
    padding: 10px 20px;
    box-sizing: border-box;    /* ★ これでパディング込みでwidthを計算 */
    position: absolute;
    top: 60px;
    left: 0;
    /* 右寄せするために left: auto; right: 0; にしてもOK */
    /* left: auto; right: 0; width: 80%; などでも可 */
    background-color: #1F1F1F;
    z-index: 1000;
  }
  
  #header-nav.open a {
    display: block;
    width: 100%;
    text-align: right;
  }
header nav a {
  text-decoration: none;
  color: #E0E0E0;
  font-weight: 500;
  transition: color 0.3s;
}
header nav a:hover {
  color: #FFD700;
}

/* メニューアイコン(ヘッダー右) */
.menu-toggle {
  /* 以下の absolute 配置で header 内に収める */
  cursor: pointer;
  position: absolute;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  color: #CB6847;
  font-size: 24px;
  z-index: 10000;
  padding: 8px;
  border-radius: 4px;
}


/* サイドバー初期状態：表示（オーバーレイ） */
.sidebar {
  position: fixed;
  top: 60px;
  left: 0;               
  width: 240px;
  height: calc(100% - 60px);
  background-color: #333;
  padding: 10px 15px; /* 左右の隙間を設ける */
  box-sizing: border-box;
  transition: transform 0.3s ease; 
  transform: translateX(0);
  z-index: 999;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

/* トグルボタンを固定配置（初期はサイドバーが開いた状態を想定し、left:250pxなど） */
.sidebar-toggle {
  position: fixed;
  top: 100px; /* サイドバーの一覧と重ならないよう、適度に余裕をもつ */
  left: 250px; /* サイドバー幅240px + 10pxの余白 */
  z-index: 9999; 
  background: #444;
  color: #fff;
  border: none;
  font-size: 18px;
  padding: 6px 10px;
  border-radius: 4px;
  cursor: pointer;
  transition: left 0.3s ease; /* アニメーション */
}

/* 閉じた状態 */
.sidebar.collapsed {
  transform: translateX(-240px);
}

.sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.sidebar-header h2 {
  margin: 0;
  font-size: 1.2em;
  color: #fff;
}

#new-conversation-btn, #conversation-refresh {
  background: #444;
  color: #fff;
  border: none;
  padding: 6px 12px;
  cursor: pointer;
  border-radius: 4px;
  transition: background-color 0.3s;
}

#new-conversation-btn:hover, #conversation-refresh:hover {
  background: #555;
}

#conversation-list {
  list-style: none;
  margin: 10px 0;
  padding: 0;
  flex: 1;
  overflow-y: auto;
}

#conversation-list li {
  padding: 8px;
  border-bottom: 1px solid #444;
  cursor: pointer;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

#conversation-list li:hover {
  background-color: #444;
}

/* 更新ボタンを上に配置 */
#conversation-refresh {
  order: -1; /* 上側に移動 */
  margin-bottom: 10px;
}

/* 会話履歴の名前変更・削除機能のスタイル */
.conv-title {
  flex: 1;
  cursor: pointer;
}

.conv-menu-btn {
  all: unset;
  background: transparent;
  cursor: pointer;
  padding: 4px;
  margin-left: 8px;
  border-radius: 3px;
  color: #B0B0B0;
  font-size: 14px;
}

.conv-menu-btn:hover {
  background: #444;
  color: #fff;
}

.conv-context-menu {
  position: absolute;
  background: #2c2c2c;
  border: 1px solid #555;
  border-radius: 4px;
  padding: 4px 0;
  min-width: 140px;
  z-index: 3000;
  box-shadow: 0 2px 8px rgba(0,0,0,.4);
}

.conv-context-menu button {
  all: unset;
  display: block;
  width: 100%;
  padding: 6px 14px;
  font-size: 14px;
  color: #fff;
  text-align: left;
  cursor: pointer;
}

.conv-context-menu button:hover {
  background: #444;
}


/* メインチャット領域 */
.chat-main {
  position: fixed;      /* fixedに変更してスクロール時も固定 */
  top: 60px;
  left: 0;           /* サイドバーぶん動かさない */
  right: 0;
  bottom: 30px;      /* フッターの高さ分 */
  overflow: hidden;
  /* 余白を付けず常に全幅表示したいならここを固定 */
  margin-left: 0;
}

/* チャットコンテナ */
.chat-container {
  position:relative;
  display:flex;
  flex-direction:column;
  width:100%;
  height:100%;
  box-sizing:border-box;
}

/* チャット表示領域 */
.chat-messages{
  position:absolute;          /* ← .chat-container 基準 */
  left:0; right:0;
  bottom:100px;               /* 固定配置の入力欄分のマージン調整 */
  height:30vh;               /* 固定高さ（アバターを隠さない） */
  max-height:30vh;           /* 固定最大高さ */
  padding:0 20px 10px;       /* 下に少し余白 */
  overflow-y:auto;           /* 常にスクロール有効 */
  overflow-x:hidden;         /* 横スクロールを無効 */
  pointer-events:auto;
  display:flex;
  flex-direction:column;
  justify-content:flex-end;  /* 最新行を下へ詰める */
  gap: 8px;                  /* メッセージ間の統一スペース */
  z-index:6;                 /* 動画(0)＜メッセージ(6)＜モーダル等 */
  pointer-events:none;       /* クリック透過 */
  background:transparent;    /* 背景なしで動画が見える */
}
.chat-messages::-webkit-scrollbar{
  width:8px;
  background-color: rgba(255,255,255,0.15);
  border-radius: 4px;
}
.chat-messages::-webkit-scrollbar-thumb{
  background-color: rgba(255,255,255,0.4);
  border-radius: 4px;
  border: 1px solid rgba(255,255,255,0.1);
}
.chat-messages::-webkit-scrollbar-thumb:hover{
  background-color: rgba(255,255,255,0.6);
}
.chat-messages::-webkit-scrollbar-track{
  background-color: rgba(0,0,0,0.1);
  border-radius: 4px;
}

/* メッセージバブル内スクロールバー */
.message.bot::-webkit-scrollbar,
.message.assistant::-webkit-scrollbar,
.message.system::-webkit-scrollbar {
  width: 6px;
  background-color: rgba(0,0,0,0.1);
  border-radius: 3px;
}
.message.bot::-webkit-scrollbar-thumb,
.message.assistant::-webkit-scrollbar-thumb,
.message.system::-webkit-scrollbar-thumb {
  background-color: rgba(0,0,0,0.3);
  border-radius: 3px;
}
.message.bot::-webkit-scrollbar-thumb:hover,
.message.assistant::-webkit-scrollbar-thumb:hover,
.message.system::-webkit-scrollbar-thumb:hover {
  background-color: rgba(0,0,0,0.5);
}
.message{
  margin:0;                  /* 上下余白を無くし 1 行化 */
  padding:8px 12px;          /* パディングを統一・調整 */
  border-radius:14px;
  font-size:1rem;
  line-height:1.4;           /* 読みやすさのため行間調整 */
  max-width:80%;             /* バブル幅を拡張（長文対応） */
  word-wrap:break-word;
  word-break:break-word;     /* 長い単語の強制改行 */
  overflow-wrap:break-word;  /* 最新の改行指定 */
  white-space:pre-wrap;      /* 改行を保持 */
  pointer-events:auto;       /* クリックは許可 */
  box-shadow: 0 1px 3px rgba(0,0,0,0.2); /* 軽い影で立体感 */
  flex-shrink:0;             /* 縮小を防ぐ */
}
.message.user {
  background:#fff;
  color:#000;
  align-self:flex-end;
}
/* 音声ボタン重ね配置例 */
.text-to-audio-btn {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background-color: #555;
  color: #fff;
  border: none;
  border-radius: 4px;
  padding: 6px;
  cursor: pointer;
  font-size: 0.9em;
  opacity: 0.8;
}
.text-to-audio-btn:hover {
  opacity: 1;
}

/* 入力エリア */
.chat-input{
  position:fixed;              /* fixedに変更してビューポート基準 */
  left:10px; right:10px;       /* 左右に少し余白 */
  bottom:40px;                 /* フッターの上に配置 */
  display:flex;
  gap:10px;
  padding:10px;
  background:rgba(31, 31, 31, 0.9);  /* 背景を濃くして見やすく */
  border:1px solid rgba(255, 255, 255, 0.2);
  z-index:1001;                /* より高いz-indexで確実に前面表示 */
  backdrop-filter:blur(8px);   /* 好みで薄いガラス効果 */
  border-radius:30px;
  box-shadow:0 4px 20px rgba(0, 0, 0, 0.3);
  max-width:calc(100% - 20px); /* 画面幅を超えないように */
  box-sizing:border-box;        /* paddingを含む幅計算 */
}
.chat-input textarea {
  flex: 1;
  background: rgba(255, 255, 255, 0.06);
  color: #E0E0E0;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 20px;
  resize: none;
  height: 40px;
  padding: 8px;
  box-sizing: border-box;
  backdrop-filter: blur(4px);
}
.chat-input button {
  background: #CB6847;
  border: none;
  color: #fff;
  padding: 10px 15px;
  border-radius: 50%;
  cursor: pointer;
}

/* 音声読み上げボタン(固定非表示) */
#text-to-audio-button {
  display: none;
}

/* モーダル等 共通 */
.modal-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: rgba(0,0,0,0.5);
  z-index: 2000;
}
.modal-content {
  position: relative;
  background: #fff;
  color: #333;
  padding: 20px;
  border-radius: 8px;
  max-width: 500px;
  width: 90%;
  box-shadow: 0 4px 6px rgba(0,0,0,0.2);
  max-height: 80vh;
  overflow-y: auto;
  animation: popupFadeIn 0.3s ease-in-out;
  text-align: left;
}
.modal-content h2 {
  margin-bottom: 20px;
  font-size: 1.2em;
}
.modal-content input[type="file"] {
  display: block;
  margin: 0 auto 20px auto;
}
.modal-buttons {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 20px;
}
.modal-buttons button {
  background-color: #CB6847;
  color: #fff;
  border: none;
  padding: 8px 12px;
  border-radius: 4px;
  cursor: pointer;
}

/* 右上の閉じるボタン */
.modal-close-button {
  position: absolute;
  top: 10px;
  right: 15px;
  background: transparent;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: #000;
}
.modal-close-button:hover {
  color: #666;
}
#file-list {
  list-style: none;
  padding-left: 0;
}
#file-list li {
  padding: 8px 0;
  border-bottom: 1px solid #ddd;
  cursor: pointer;
}
/* ポップアップ */
.popup-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 1000;
}
.popup-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 999;
}
.popup {
  position: relative;
  background-color: #ffffff;
  border-radius: 8px;
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
  padding: 20px;
  max-width: 500px;
  width: 80%;
  text-align: center;
  z-index: 1001;
  animation: popupFadeIn 0.3s ease-in-out;
}
#popup-text {
  font-size: 16px;
  color: #333333;
  margin-bottom: 20px;
}
.close-popup {
  background-color: #007BFF;
  color: #ffffff;
  border: none;
  border-radius: 4px;
  padding: 10px 20px;
  font-size: 14px;
  cursor: pointer;
  transition: background-color 0.3s ease;
}
.close-popup:hover {
  background-color: #0056b3;
}

/* ファイル詳細モーダルのベース */
.file-detail-modal-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 2000;
}
.file-detail-modal-content {
  position: relative;
  background: #fff;
  color: #333;
  padding: 20px;
  border-radius: 8px;
  width: 90%;
  max-width: 600px;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
  animation: popupFadeIn 0.3s ease-in-out;
}
.detail-close-button {
  position: absolute;
  top: 10px;
  right: 10px;
  background: none;
  border: none;
  font-size: 1.5rem;
  color: #000;
  cursor: pointer;
}
.file-detail-text {
  white-space: pre-wrap;
  line-height: 1.4;
}
.file-detail-textarea {
  width: 100%;
  height: 400px;
  padding: 10px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 14px;
  line-height: 1.5;
  resize: vertical;
  font-family: inherit;
  box-sizing: border-box;
}
/* 会話履歴モーダル */
#history-modal.modal-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: rgba(0,0,0,0.5);
  z-index: 2000;
}
#history-modal .modal-content {
  background: #ffffff;
  color: #333;
  padding: 20px;
  border-radius: 8px;
  width: 90%;
  max-width: 500px;
  box-shadow: 0 4px 6px rgba(0,0,0,0.2);
}
#history-list {
  list-style: none;
  padding-left: 0;
}
#history-list li {
  margin-bottom: 8px;
}

/* ボタンが読み込み中のとき */
#send-button.loading, #record-button.loading {
  opacity: 0.7;
  cursor: not-allowed;
  position: relative;
}
#send-button.loading::after, #record-button.loading::after {
  content: "";
  border: 3px solid #f3f3f3;
  border-top: 3px solid #007bff;
  border-radius: 50%;
  width: 16px;
  height: 16px;
  animation: spin 0.8s linear infinite;
  display: block;
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
}
#record-button.loading::after {
  border-top-color: red;
}

/* タイピングインジケータ */
.typing-indicator {
  display: inline-flex;
  gap: 3px;
  align-items: center;
  padding: 10px 15px;
  border-radius: 20px;
  background-color: #333333;
  color: #E0E0E0;
  margin-bottom: 15px;
  max-width: 80%;
  word-wrap: break-word;
  align-self: flex-start;
}
.bot-typing-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: #fff;
  animation: botTyping 1s infinite ease-in-out;
  display: inline-block;
}
.bot-typing-dot:nth-child(1) { animation-delay: 0s; }
.bot-typing-dot:nth-child(2) { animation-delay: 0.2s; }
.bot-typing-dot:nth-child(3) { animation-delay: 0.4s; }

/* フッター固定 (会社名) */
#site-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 30px;
  background: #1f1f1f;
  color: #eee;
  text-align: center;
  line-height: 30px;
  box-shadow: 0 -2px 4px rgba(0,0,0,0.5);
  z-index: 999;
}

.custom-file-upload {
  display: inline-block;
  padding: 8px 12px;
  cursor: pointer;
  background-color: #CB6847; /* 他のボタンと同色 */
  color: #fff;
  border-radius: 4px;
  text-align: center;
  transition: background-color 0.3s ease;
}

.custom-file-upload:hover {
  background-color: #A9543A;
}

#login-modal {
  z-index: 99999 !important; /* 競合が疑われる場合、!important を付ける */
}

/* モーダルのメインコンテンツ */
.login-modal-content {
  color: black;
  position: relative;
  width: 90%;
  max-width: 400px; /* モーダルの横幅 */
  background: #fff;
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.3);
  animation: loginModalFadeIn 0.3s ease; /* フェードイン演出用 */
}

/* タイトル */
.modal-title {
  margin-bottom: 20px;
  font-size: 1.4rem;
  text-align: center;
}

/* 閉じるボタン */
.modal-close-button {
  position: absolute;
  top: 10px; 
  right: 10px;
  background: transparent;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: #666;
}
.modal-close-button:hover {
  color: #333;
}

/* 入力フォーム */
.login-form-group {
  display: flex;
  flex-direction: column;
  margin-bottom: 15px;
}
.login-form-group label {
  margin-bottom: 5px;
  font-weight: 500;
  color: #333;
}
.login-form-group input {
  padding: 8px 12px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.3s;
}
.login-form-group input:focus {
  border-color: #777;
}

/* Slack連携モーダル */
.slack-form {
  margin-bottom: 20px;
}

.slack-form .form-group {
  display: flex;
  flex-direction: column;
  margin-bottom: 15px;
}

.slack-form .form-group label {
  margin-bottom: 5px;
  font-weight: 500;
  color: #333;
}

.slack-form .form-group input {
  padding: 8px 12px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.3s;
}

.slack-form .form-group input:focus {
  border-color: #777;
}

.slack-form .form-group small {
  margin-top: 3px;
  font-size: 0.8rem;
  color: #666;
}

.status-display {
  margin-top: 15px;
  padding: 10px;
  background-color: #f5f5f5;
  border-radius: 4px;
  border: 1px solid #ddd;
}

.status-display p {
  margin: 0 0 10px 0;
  color: #333;
  font-size: 0.9rem;
}

.progress-bar {
  width: 100%;
  height: 8px;
  background-color: #e0e0e0;
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background-color: #4CAF50;
  width: 0%;
  transition: width 0.3s ease;
}

/* チャットモード切り替えタブ */
.chat-mode-tabs {
  display: flex;
  background-color: #2A2A2A;
  border-bottom: 1px solid #444;
  padding: 0;
  margin: 0;
}

.chat-tab {
  flex: 1;
  padding: 12px 20px;
  background-color: #2A2A2A;
  color: #B0B0B0;
  border: none;
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.chat-tab:hover {
  background-color: #3A3A3A;
  color: #E0E0E0;
}

.chat-tab.active {
  background-color: #444;
  color: #FFFFFF;
  border-bottom: 2px solid #4CAF50;
}

.chat-tab i {
  font-size: 1rem;
}

/* チャットコンテナの切り替え */
.chat-container {
  display: none;
  flex-direction: column;
  height: calc(100vh - 60px - 50px - 30px); /* ヘッダー、タブ、フッターの高さを引く */
  position: relative;
}

.chat-container.active {
  display: flex;
}

/* メインチャットコンテナの調整 */
#main-chat-container {
  height: calc(100vh - 60px - 50px - 30px);
}

/* Slackチャットコンテナの調整 */
#slack-chat-container {
  height: calc(100vh - 60px - 50px - 30px);
}

/* Slackチャットヘッダー */
.slack-chat-header {
  padding: 15px 20px;
  background-color: #2A2A2A;
  border-bottom: 1px solid #444;
  text-align: center;
  flex-shrink: 0; /* ヘッダーサイズ固定 */
}

.slack-chat-header h3 {
  margin: 0 0 5px 0;
  color: #E0E0E0;
  font-size: 1.1rem;
}

.slack-chat-header p {
  margin: 0;
  color: #B0B0B0;
  font-size: 0.85rem;
}

.slack-chat-header i {
  color: #4A154B; /* Slackのブランドカラー */
}

/* Slack検索画面専用入力エリア */
#slack-chat-container .chat-input {
  /* 共通のchat-inputスタイルを継承 */
}

/* ボタン行 */
.modal-buttons {
  display: flex;
  justify-content: center;
  margin-top: 20px;
}

/* ログインボタン */
.login-submit-btn {
  background: #CB6847; /* 例: 青緑系 */
  color: #fff;
  border: none;
  border-radius: 4px;
  font-size: 1rem;
  padding: 10px 16px;
  cursor: pointer;
  transition: background-color 0.3s;
}
.login-submit-btn:hover {
  background: #CB6847;
}

/* ================================
   カスタムスクロールバー (グレー調)
================================ */
.chat-messages::-webkit-scrollbar,
.chat-input textarea::-webkit-scrollbar {
  width: 8px;
  background-color: #222;
}
.chat-messages::-webkit-scrollbar-thumb,
.chat-input textarea::-webkit-scrollbar-thumb {
  background-color: #555;
  border-radius: 4px;
}
.chat-messages::-webkit-scrollbar-thumb:hover,
.chat-input textarea::-webkit-scrollbar-thumb:hover {
  background-color: #666;
}
.chat-messages::-webkit-scrollbar-corner,
.chat-input textarea::-webkit-scrollbar-corner {
  background-color: #222;
}

/* スクロールバーのデザイン調整（Webkit系ブラウザ向け） */
::-webkit-scrollbar {
  width: 8px; /* スクロールバーの幅 */
}

::-webkit-scrollbar-track {
  background: #f1f1f1; /* スクロールバーの背景色 */
}

::-webkit-scrollbar-thumb {
  background: #bbb; /* スクロールバーの色 */
  border-radius: 4px; /* 丸みをつける */
}

::-webkit-scrollbar-thumb:hover {
  background: #999; /* ホバー時の色 */
}

/* ファイル一覧の削除ボタン */
.delete-file-btn {
  background: transparent;
  border: none;
  color: red;
  font-size: 1em;
  margin-left: 10px;
  cursor: pointer;
}

/* 録音中のスタイル */
#record-button.recording {
  background-color: #ff4136; /* 赤色 */
  animation: pulse 1.5s infinite;
}

/* ===== avatar video ===== */
.chat-container .avatar-container{   /* ← チャット内部だけに作用 */
  position:absolute;
  top:0; left:0; right:0; bottom:0;
  z-index:0;                 /* 背景層 */
  pointer-events:none;       /* クリック透過 */
  overflow:hidden;
  background:#000;
}
#avatar-video{
  position:absolute;
  top:50%; left:50%;                /* 中央基準点 */
  min-width:100%;                   /* 幅・高さ いずれかが常に100%超 */
  min-height:100%;
  width:100%;
  height:auto;
  transform:translate(-50%,-50%);   /* 基準点ぶんオフセット */
  object-fit:contain;                 /* 念のため（多くの端末で無視される） */
}

/* 点滅アニメーション */
@keyframes pulse {
  0% {
    opacity: 1;
  }
  50% {
    opacity: 0.7;
  }
  100% {
    opacity: 1;
  }
}

/* アニメーション */
@keyframes popupFadeIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}
@keyframes spin {
  0% { transform: translateY(-50%) rotate(0deg); }
  100% { transform: translateY(-50%) rotate(360deg); }
}
@keyframes botTyping {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1); }
}

/* アニメーション (フェードイン) */
@keyframes loginModalFadeIn {
  from { opacity: 0; transform: scale(0.98); }
  to   { opacity: 1; transform: scale(1);   }
}

/* 768px以下（モバイル） */
@media (max-width: 768px) {
  header nav {
    display: none;
  }

  header .menu-toggle {
    display: block;
    cursor: pointer;
  }

  /* サイドバーをデフォルト非表示に */
  #sidebar {
    width: 100%;
    height: calc(100% - 60px);
    top: 60px;
    left: 0;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    z-index: 999;
    padding-top: 50px; /* トグルボタンのスペースを確保 */
  }

  /* collapsedクラスでサイドバーを表示 */
  #sidebar.collapsed {
    transform: translateX(0);
  }

  /* トグルボタンを常に固定位置に配置 */
  .sidebar-toggle {
    position: fixed;
    top: 70px;
    left: 10px;
    z-index: 1000; /* sidebarよりも前面に */
  }

  /* 更新ボタンの位置調整 */
  #conversation-refresh {
    margin-top: 40px; /* トグルボタンと被らないよう調整 */
  }

  /* メインチャット領域をフル幅に調整 */
  .chat-main {
    left: 0;
    right: 0;
    top: 60px;
    bottom: 30px;      /* フッター高さ分 */
    margin-left: 0;
  }
  
  /* モバイル時の入力欄調整 */
  .chat-input {
    bottom: 30px;       /* フッターの上に確実に配置 */
    left: 5px;
    right: 5px;
    padding: 8px;       /* パディングを少し減らす */
  }
  
  /* メッセージエリアの調整 */
  .chat-messages {
    bottom: 90px;       /* 入力欄の高さ分調整 */
    padding: 0 10px 10px;
  }
  
  /* 質問候補ボタンの位置調整 */
  .suggested-questions {
    bottom: 110px;      /* 入力欄の上に配置 */
    left: 5px;
    right: 5px;
  }
}



/* 769px以上（PC） */
@media (min-width: 769px) {
  /* ヘッダー全体をflexで横並びに */
  header {
    display: flex;         /* すでにfixed等は付いていると思うので省略 */
    align-items: center;   /* 高さ揃え */
    justify-content: flex-start;
    position: fixed;       /* すでにfixedなら重複OK */
    top: 0;
    left: 0;
    width: 100%;
    height: 60px;
    /* もともとのヘッダー設定があればそのまま書き換えor上書き */
  }

  /* ナビを右寄せ表示：flex＆margin-left: auto; */
  #header-nav {
    display: flex !important;     /* mobileのdisplay: noneを上書き */
    flex-direction: row;          /* 横並び */
    align-items: center;
    gap: 20px;                    /* リンク間の隙間 */
    position: static;             /* position: absolute; を解除 */
    width: auto;                  /* 100%ではなく必要最小限 */
    margin-left: auto;            /* これで右寄せ */
    background: none;             /* 背景が不要なら透過に */
  }

  /* メニューアイコンは非表示 */
  .menu-toggle {
    display: none;
  }
}


/* ================================
   質問候補ボタンのスタイル (グレー系統)
================================ */
.suggested-questions{
  display:none !important;           /* 完全に非表示 */
}
.suggested-questions button {
  background: #444;
  color: #fff;
  border: none;
  border-radius: 4px;
  padding: 6px 8px;
  cursor: pointer;
  transition: background 0.3s;
}
.suggested-questions button:hover {
  background: #555;
}

/* ==== 統一チャットバブルスタイル ==== */
.message{
  background:#fff !important;          /* 白背景 */
  color:#000 !important;               /* 黒文字 */
  display:inline-block;                /* 内容幅に合わせて可変 */
  max-width:80%;                       /* 長文は折り返し（上記と統一） */
  margin-bottom: 0;                    /* gapで統一管理するため個別マージン削除 */
  flex-shrink:0;                       /* 縮小を防ぐ */
}

/* 位置だけ変える */
.message.user   { 
  align-self:flex-end;
  width:auto;                          /* ユーザーメッセージは自動幅 */
  min-width:auto;                      /* 最小幅制限を解除 */
}
.message.bot,
.message.assistant,
.message.system { 
  align-self:flex-start;
  min-width:120px;                     /* ボット系は最小幅を保持 */
  max-height:20vh;                     /* アシスタントメッセージの最大高さ制限 */
  overflow-y:auto;                     /* 長文時は個別バブル内でスクロール */
  background:#fff !important;          /* 白背景 */
  color:#000 !important;               /* 黒文字 */
}

.chat-input textarea,
.chat-input input[type="text"]{
  font-size:16px;          /* iOS がズームしない安全域 */
  line-height:1.4;
}