/* ログアウトボタン */
#logoutWrapper {
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 1000;
}

#logoutBtn {
    background: #3f4041;
    color: #fff;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85em;
}

/* チャット全体ラッパー */
#chat-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 190px); /* ヘッダーとフッターの高さを差し引く */
    padding: 0 16px;  /* ← margin → padding に変更 */
    overflow: hidden;
    box-sizing: border-box;
}

/* メッセージエリア */
#messages {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    margin-bottom: 8px;
    border: 1px solid #ccc;
    background-color: #fff;
    border-radius: 8px;
}

/* 入力エリア */
.input-container {
    display: flex;
    align-items: flex-end;
    background: #fafafa;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 8px 16px;  /* ← 左右に余白追加 */
    gap: 8px;
    box-sizing: border-box; /* ← パディング込みで幅調整 */
    width: 100%;
}
  

.input-container textarea {
    flex: 1;
    resize: none;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid #ccc;
    font-size: 14px;
}

.input-container button {
    background-color: #3c8ade;
    color: white;
    border: none;
    border-radius: 8px;
    margin-bottom: 5px;
    padding: 10px 12px;
    font-weight: bold;
    cursor: pointer;
}

/* メッセージ表示 */
.message-wrapper {
  display: flex;
  align-items: flex-start;
  margin-bottom: 12px;
  width: 100%;;
}

/* AI は左寄せ */
.message-wrapper.ai {
  justify-content: flex-start;
  flex-direction: row;
}

/* ユーザーは左寄せ */
.message-wrapper.user {
  justify-content: flex-end;
  flex-direction: row;
}

/* ユーザーアバターは吹き出しの右側だけ余白を開ける */
.message-wrapper.user .avatar {
  margin: 0 0 0 8px;  /* 上 0／右 0／下 0／左 8px */
}

.message {
  max-width: 70%;
  margin-top: 10px;
  padding: 10px;
  border-radius: 18px;
  line-height: 1.4;
  word-wrap: break-word;
  overflow-wrap: anywhere;
}

/* AI の吹き出し（左側） */
.message.ai {
  margin-left: 5px;
  background-color: #f0f0f0;
  color: #333;
  /* 上左だけ丸めない */
  border-top-left-radius: 0;
  /* その他は丸める */
  border-top-right-radius: 18px;
  border-bottom-right-radius: 18px;
  border-bottom-left-radius: 18px;
  box-shadow: 0px 1px 3px rgba(0, 0, 0, 0.1);
}

/* ユーザーの吹き出し（右側） */
.message.user {
  background-color: #dcf8c6;
  color: #000;
  /* 上右だけ丸めない */
  border-top-right-radius: 0;
  /* その他は丸める */
  border-top-left-radius: 18px;
  border-bottom-left-radius: 18px;
  border-bottom-right-radius: 18px;
}
.message a {
  color: #1a0dab;          /* Google風の青リンク */
  text-decoration: underline;
  word-break: break-word;  /* 長いURLも折り返す */
  touch-action: manipulation; /* モバイルのタップ反応を向上 */
}

.message a:hover {
  color: #174ea6;
  text-decoration: underline;
}

/* アバター */
.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 5px;
}

/* === 吹き出しの考え中アニメーション === */
.bubble-thinking {
  background: #f0f8ff;
  border-radius: 1.2em;
  padding: 10px 14px;
  display: flex;
  gap: 6px;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: #333;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.dot {
  width: 8px;
  height: 8px;
  background: #888;
  border-radius: 50%;
  animation: blink 1.5s infinite;
}

.dot.one { animation-delay: 0s; }
.dot.two { animation-delay: 0.2s; }
.dot.three { animation-delay: 0.4s; }

@keyframes blink {
  0%, 80%, 100% { opacity: 0.3; transform: scale(0.8); }
  40% { opacity: 1; transform: scale(1); }
}

/* === キャラアイコンふわふわアニメーション === */
.animated-avatar {
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0%   { transform: translateY(0); }
  50%  { transform: translateY(-4px); }
  100% { transform: translateY(0); }
}
