/*------------------------------------
キャッシュが強いので即時反映はされません。
-------------------------------------*/
html, body {
  height: 100%;
  margin: 0;
  overflow: hidden;
  box-sizing: border-box;
}

body {
  background-color: #f7f7f7;
  color: black;
}

.chat-container {
  width: 100vw;
  height: 100vh;
  margin:  0px;
  background: #fff;
  border-radius: 0px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  background-color: #8CABD9;
  background-size: cover;
  background-position: center;
}

.chat-header {
  background-color: #2A3F54;
  color: #fff;
  padding: 10px 15px;
  font-size: 18px;
  font-weight: bold;
}

.chat-body {
  flex: 1;
  padding: 15px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.chat-message {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  max-width: 75%;
  overflow: visible;
  position: relative;
}

/* 右側メッセージは縦方向 */
.msg_rgt {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  margin-left: auto;
}

.chat-bubble {
  position: relative;
  z-index: 1;
  padding: 10px 15px;
  border-radius: 20px;
  word-wrap: break-word;
  white-space: pre-wrap;
  background-color: #f0f0f0;
  max-width:100%;
}

.msg_rgt .chat-bubble {
  background-color: rgb(220, 246, 206);
}

.chat-bubble::after {
  position: absolute;
  width: 0;
  height: 0;
  border-style: solid;
}

/* 左側吹き出しの矢印 */
.chat-message.msg_lft.msg_wrap .chat-bubble::after {
  content: "";
  position: absolute;
  left: -8px; /* 吹き出し左端から少し外に出す */
  top: 12px;
  border-width: 8px 10px 8px 0;
  border-style: solid;
  border-color: transparent #f0f0f0 transparent transparent;
}

/* 右側メッセージ矢印 */
.chat-message.msg_rgt .chat-bubble::after {
  content: "";
  position: absolute;
  right: -8px; /* 吹き出し右端から少し外に出す */
  top: 12px;
  border-width: 8px 0 8px 10px;
  border-style: solid;
  border-color: transparent transparent transparent rgb(220, 246, 206);
}

.chat-time {
  font-size: 12px;
  color: #f0f0f0;
  margin-top: 5px;
  margin-left: 5px;
  margin-right: 5px;
}

.msg_rgt .chat-time {
  text-align: right;
}

.chat-footer {
  background-color: #f9f9f9;
  padding: 10px;
  border-top: 1px solid #ddd;

  display: flex;       /* 横並びにする */
  align-items: center; /* 上下中央揃え */
  gap: 8px;            /* アイコン・テキスト・ボタンの間隔を確保 */
  /* justify-content: space-between; は削除 */
}


.chat-input {
  flex: 1;           /* ← 残り幅を全部占有するように変更 */
  border-radius: 10px;
  padding: 10px;
  height: 50px;
  resize: none;
  overflow-y: auto;
  min-width: 0;      /* ← flex時にはみ出さないように追加 */
}

.chat-input::-webkit-scrollbar {
  display: none;
}

.chat-footer button {
  width: 15%;
  border-radius: 10px;
  padding: 10px;
}

.chat-body::-webkit-scrollbar {
  width: 8px;
}

.chat-body::-webkit-scrollbar-track {
  background-color: #f0f0f0;
  border-radius: 10px;
}

.chat-body::-webkit-scrollbar-thumb {
  background-color: rgb(151, 156, 151);
  border-radius: 10px;
}

.chat-body::-webkit-scrollbar-thumb:hover {
  background-color: rgb(168, 172, 168);
}

.profile-icon {
  width:35px;
  height:35px;
  border-radius:50%;
  object-fit:cover;
}

.profile-icon.default {
  background:#ccc;
}
/* 左側吹き出し */
.chat-message.msg_lft {
  max-width: 85%;  /* アイコン分を考慮して少し狭め */
}

/* 右側吹き出し */
.chat-message.msg_rgt {
  max-width: 75%;  /* アイコンなしなので広く使える */
}

/* ================================
左側メッセージ：アイコン＋吹き出し横並び
================================ */
.chat-message.msg_lft.msg_wrap {
  display: flex;           /* 横並び */
  flex-direction: row;     /* アイコン→吹き出し */
  align-items: flex-start; /* 上揃え */
}

.chat-message.msg_lft.msg_wrap .profile-icon {
  margin-right: 10px; /* アイコンと吹き出しの間隔 */
  flex-shrink: 0;     /* アイコンを縮めない */
}

.chat-message.msg_lft.msg_wrap .chat-bubble {
  margin: 0; /* 横並び時の余白調整 */
}
.bubble-time-wrapper {
  display: flex;
  flex-direction: column; /* 垂直に並べる */
  position: relative; /* 矢印基準として安全 */
}

/* ================================
/* オーバーレイ
================================ */
.chatlist-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0,0,0,0.3);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  z-index: 998;
}

.chatlist-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

/* スライドメニュー */
.chatlist-menu {
  position: fixed;
  top: 0;
  left: -260px;
  width: 260px;
  height: 100%;
  background-color: white;
  box-shadow: 2px 0 8px rgba(0,0,0,0.2);
  transition: left 0.3s ease;
  z-index: 999;
  display: flex;
  flex-direction: column;
}

.chatlist-menu.open {
  left: 0;
}
/* ================================
/* ヘッダー
================================ */
.chatlist-header {
    background-color: #2A3F54;
    color: #fff;
    padding: 10px 15px;
    font-size: 18px;
    font-weight: bold;
}

.close-btn, .gear-btn {
  cursor: pointer;
}

.title {
  font-weight: bold;
}

/* リスト本体 */
.chatlist-body {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.no-friends {
  color: #666;
  text-align: center;
  padding: 8px;
}

/* アイテム */
.chatlist-item {
  display: flex;
  align-items: center;
  cursor: pointer;
  padding: 8px 0;
  position: relative;
  min-height: 70px; /* 好きな高さに調整 */
}

.chatlist-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
}

.chatlist-name {
  flex: 1;
}

/* 未読バッジ */
.chatlist-unread {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background-color: red;
}
/* ヘッダー */
.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  padding: 8px 12px;
  background-color: #2A3F54;
  color: #fff;
  font-size: 18px;
  font-weight: bold;
}

/* 左 */
.header-left {
  display: flex;
  align-items: center;
  z-index: 2;
}

.list-button {
  cursor: pointer;
  position: relative;
}

.unread-dot {
  position: absolute;
  width: 10px;
  height: 10px;
  top: 0;
  right: 0;
  border-radius: 50%;
  background-color: red;
}

/* 中央タイトル */
.header-title {
  position: absolute;
  left: 0;
  right: 0;
  text-align: center;
  font-weight: bold;
  pointer-events: none; /* 中央をクリックしてもボタンに干渉しない */
  z-index: 1;
}

/* 右 */
.header-right {
  display: flex;
  align-items: center;
  z-index: 2;
}

.gear-btn {
  cursor: pointer;
}
.prof-container {
  width: 100vw;
  height: 100vh;
  margin:  0px;
  background: #fff;
  border-radius: 0px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  background-color: #f2f3f3;
  background-size: cover;
  background-position: center;
}

/* プロフィール画像 */
.profile-img-wrapper {
  position: relative;
  width: 150px;
  height: 150px;
}

.profile-img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #ccc;
}

/* カメラアイコン */
.camera-icon {
  position: absolute;
  bottom: 0;
  right: 0;
  background-color: #fff;
  border-radius: 50%;
  padding: 6px;
  cursor: pointer;
  border: 1px solid #ccc;
}

/* 隠しファイル入力 */
.file-input {
  display: none;
}
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0,0,0,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}

.modal-box {
  background-color: #fff;
  padding: 20px 30px;
  border-radius: 10px;
  font-weight: bold;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}
/* 画像送信 */
.image-upload-btn {
  cursor: pointer;
}
.image-upload-btn,
.chat-footer button {
  flex-shrink: 0; /* 幅を固定して折れないようにする */
}

/* チャット画像 */
.chat-image {
  max-width: 200px;
  border-radius: 8px;
  margin-bottom: 4px;
  cursor: pointer;
}

/* 画像拡大モーダル */
.image-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.7);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.image-modal-content {
  max-width: 90%;
  max-height: 90%;
  border-radius: 8px;
}

.image-modal-close {
  position: absolute;
  top: 20px;
  right: 20px;
  color: #fff;
  cursor: pointer;
}
.chat-link {
  color: #0d6efd;
  text-decoration: underline;
  word-break: break-all;
}
/* 友だちリスト */
.chatlist-bg {
  background-color: #f5f5f5;
}
.hover-bg:hover {
  background-color: #f0f0f0;
}

/* ヘッダー */
.chatlist-header-left img.chatlist-profile-img {
  width: 36px;
  height: 36px;
  border-radius: 50%;
}
.chatlist-app-icon-img {
  width: 24px;
  height: 24px;
  border-radius: 8px;
}
.chatlist-app-unread-dot {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 8px;
  height: 8px;
  background-color: red;
  border-radius: 50%;
}

.chatlist-friend-img {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  margin-right: 8px;
  background-color: #ccc;
}
.chatlist-friend-name {
  font-weight: bold;
}
.chatlist-friend-message {
  white-space: nowrap;  /* 改行させない */
  overflow: hidden;     /* はみ出した部分を隠す */
  text-overflow: ellipsis; /* 省略して「…」表示 */
  max-width: 200px;
  font-size: 0.9rem;
  color: #c5bebe;
}
.chatlist-right {
  display: flex;
  align-items: center;
  position: relative;
}
.chatlist-time {
  font-size: 0.75rem;
  color: #999;
  margin-right: 8px;
}
.chatlist-unread-dot {
  width: 18px;
  height: 18px;
  background-color: red;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;     /* flex で縮まないようにする */
}

/* 検索バー */
.input-group .form-control {
  border-radius: 10px;
}
.input-group-text {
  border-radius: 10px 0 0 10px;
}
.chatlist-empty {
  font-size: 0.9rem;
  color: #666;
}
.chatlist-gear-btn {
  cursor: pointer;

}