/* chat-messages */
.chat-messages {
  flex: 1; 
  flex-grow: 1;
  padding: 5px;
  padding-left: 20px;
  overflow-y: auto;/* 縦スクロールを有効 */
  overflow-x: hidden; /* 横スクロールは無効 */
  /*background-color: #eef1f5;*/
  /*display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: flex-start;
  gap: 1px;*/
   /* align-items: flex-end;  交差軸（縦方向）の終端に寄せる（右下隅にしたい場合） */
  /*max-height: 300px;
  height:100px;*/
  max-height: calc(100% - 80px); /* フォームの高さ分を差し引く */
}
.chat-message {
    margin-bottom: 0; /* gapで間隔を制御するためmarginを削除 */
    padding: 10px;
    border-radius: 5px;
    max-width: 80%; /* メッセージの最大幅を制限 */
    word-wrap: break-word; /* 長い文字列を折り返し */
    align-self: flex-start; /* 個別に左寄せを確実にする */
    flex-shrink: 0; /* メッセージが縮まないようにする */
}
/* chat-form */
.chat-form {
  margin: 0;
  display: flex;
  padding: 10px;
  border-top: 1px solid #ddd;
  background-color: #ffffff;
}
/* chat-input */
.chat-input {
  flex: 1;
  flex-grow: 1;
  padding: 10px 12px;
  border: 1px solid #c9c9c9;
  border-radius: 20px;
  font-size: 0.9rem;
  margin-right: 10px;
  outline: none;
}

.chat-input::placeholder {
  color: #a0a0a0;
}

/* chat-button */
.chat-button {
  padding: 10px 20px;
  background-color: #007bff;
  color: white;
  border: none;
  border-radius: 20px;
  font-size: 1rem;
  cursor: pointer;
  transition: background-color 0.2s ease-in-out;
}
.chat-button:hover {
  background-color: #0056b3;
}
.chat-button:active {
  background-color: #004085;
}


/* 非表示時のチャットコンテナのスタイル */
.chat-container.closed {
  transform: translateX(calc(100% - 20px)); /* 右端に隠れるように移動 (ボタンの幅に合わせて調整) */
  /*opacity: 0.5;  半透明にする */
  pointer-events: none; /* クリックイベントを無効にする */
}
/* 開閉ボタンのスタイル */
.chat-toggle-button {
  position: absolute;
  left: -15px;
  width: 32px;
  height: 32px;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  z-index: 10; /* メッセージより上に表示 */
  transition: background-color 0.2s;
  /*position: fixed; 
  bottom: 30px;   
  right: 20px;    
  background-color: #007bff;
  color: white;
  border: none;
  border-radius: 50%; 
  width: 40px;
  height: 40px;
  font-size: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
  z-index: 1001;*/ /* チャットコンテナ (z-index: 1000) より手前に */
}
/* ボタンがチャットコンテナの隣に位置する場合のスタイル調整 */
.chat-container.closed + .chat-toggle-button {
    right: 20px; /* チャットコンテナが閉じている時はボタンが右端に */
}
.chat-container:not(.closed) + .chat-toggle-button {
    /* チャットコンテナが開いている時はボタンをチャットコンテナの左端近くに */
    /* chat-containerの幅(20vw)からボタンの幅(40px)を引いて、右端からの位置を計算 */
    /*right: calc(20vw + 20px);*/
    right: calc(0vw + 20px);
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
.animate-fade-in {
  animation: fadeIn 0.8s ease-out forwards;
}