/* ============================================================================
   運営⇔出展者チャットの共通スタイル（chat.html / admin/chat.html）
   ============================================================================ */
.chat-wrap {
  position: relative;
  max-width: 640px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  height: calc(100vh - 150px);      /* 古いブラウザ用のフォールバック */
  height: calc(100dvh - 150px);
  min-height: 320px;
}
.chat-head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 4px;
}
.chat-head__name {
  font-size: 15px;
  font-weight: 700;
  color: #17150f;
}
.chat-head__sub {
  font-size: 12px;
  color: #9b9691;
}
.chat-log {
  flex: 1 1 auto;
  min-height: 0;                    /* これが無いと中身が伸びてスクロールしない */
  overflow-y: auto;
  overscroll-behavior: contain;
  background: #f7f5f1;
  border: 1px solid #e7e4df;
  border-radius: 16px;
  padding: 16px 12px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: #c9c4bd transparent;
}

/* スクロールできることが分かるように、つまみを常に表示 */
.chat-log::-webkit-scrollbar {
  width: 10px;
}
.chat-log::-webkit-scrollbar-thumb {
  background: #c9c4bd;
  border: 3px solid #f7f5f1;
  border-radius: 999px;
}
.chat-log::-webkit-scrollbar-track {
  background: transparent;
}
.chat-empty {
  text-align: center;
  color: #9b9691;
  font-size: 13px;
  line-height: 2;
  padding: 48px 12px;
}
.chat-row {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  margin-bottom: 14px;
}
.chat-row--mine {
  align-items: flex-end;
}
.chat-bubble {
  max-width: 78%;
  background: #fff;
  border: 1px solid #e7e4df;
  border-radius: 16px 16px 16px 4px;
  padding: 10px 14px;
  font-size: 14px;
  line-height: 1.8;
  color: #17150f;
  word-break: break-word;
  white-space: pre-wrap;
}
.chat-bubble--mine {
  background: #17150f;
  border-color: #17150f;
  color: #fff;
  border-radius: 16px 16px 4px 16px;
}
.chat-bubble--img {
  padding: 4px;
  background: #fff;
  border-color: #e7e4df;
}
.chat-img {
  display: block;
  max-width: 100%;
  max-height: 320px;
  border-radius: 12px;
}
/* PDF添付 */
.chat-bubble--file {
  padding: 0;
  background: #fff;
  border-color: #e7e4df;
  overflow: hidden;
}
.chat-bubble--file.chat-bubble--mine {
  background: #fff;
  border-color: #17150f;
}
.chat-file {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px 10px 10px;
  text-decoration: none;
  color: #17150f;
  min-width: 190px;
}
.chat-file__icon {
  flex: 0 0 auto;
  width: 38px;
  height: 46px;
  border-radius: 6px;
  background: #e0492f;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 6px;
}
.chat-file__body {
  min-width: 0;
  display: block;
}
.chat-file__name {
  display: block;
  font-size: 13.5px;
  font-weight: 700;
  line-height: 1.5;
  word-break: break-all;
}
.chat-file__size {
  display: block;
  font-size: 11.5px;
  color: #8a857f;
  margin-top: 2px;
}

.chat-meta {
  font-size: 10.5px;
  color: #b5b0aa;
  margin-top: 4px;
  padding: 0 4px;
}
.chat-input {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding-top: 10px;
}
.chat-input textarea {
  flex: 1;
  border: 1px solid #d9d6d1;
  border-radius: 14px;
  padding: 11px 14px;
  font-size: 16px;
  line-height: 1.6;
  resize: none;
  height: 44px;
  min-height: 44px;
  max-height: 140px;
  background: #fff;
}
.chat-input textarea:focus {
  border-color: #17150f;
  outline: none;
}
.chat-icon-btn {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid #d9d6d1;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #4c4844;
}
.chat-send-btn {
  flex: 0 0 auto;
  height: 44px;
  padding: 0 18px;
  border: none;
  border-radius: 999px;
  background: #17150f;
  color: #fff;
  font-size: 13.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  cursor: pointer;
}
.chat-send-btn:disabled {
  opacity: 0.5;
}
.chat-note {
  text-align: center;
  font-size: 11.5px;
  color: #b5b0aa;
  padding: 8px 0 2px;
}

/* 運営側：チャット一覧 */
.chat-list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #fff;
  border: 1px solid #e7e4df;
  border-radius: 14px;
  padding: 14px 16px;
  margin-bottom: 10px;
  color: inherit;
}
.chat-list-item__body { min-width: 0; flex: 1; overflow: hidden; }
.chat-list-item__name {
  display: block;
  font-size: 14.5px;
  font-weight: 700;
  color: #17150f;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-list-item__last {
  display: block;
  font-size: 12.5px;
  color: #8a857f;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}
.chat-list-item__time {
  flex: 0 0 auto;
  font-size: 11.5px;
  color: #b5b0aa;
}
.chat-unread-dot {
  flex: 0 0 auto;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #e0492f;
}

/* 未読のチャットをひと目で分かるように強調 */
.chat-list-item--unread {
  background: #fdf4ef;
  border-color: #ecd5c8;
}
.chat-list-item--unread .chat-list-item__name { color: #17150f; }
.chat-list-item--unread .chat-list-item__last {
  color: #17150f;
  font-weight: 700;
}
.chat-list-item--unread .chat-list-item__time {
  color: #b4552d;
  font-weight: 700;
}
.chat-unread-dot {
  width: 12px;
  height: 12px;
  box-shadow: 0 0 0 3px rgba(224, 73, 47, 0.15);
}
.chat-unread-badge {
  flex: 0 0 auto;
  background: #e0492f;
  color: #fff;
  font-size: 10.5px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  letter-spacing: 0.05em;
}

/* 「最新へ」ボタン：過去のやり取りを読んでいる間だけ表示されます */
.chat-jump {
  position: absolute;
  right: 16px;
  bottom: 74px;
  z-index: 5;
  border: 1px solid #e7e4df;
  background: rgba(255, 255, 255, 0.96);
  color: #17150f;
  font-size: 12px;
  font-weight: 700;
  padding: 8px 14px;
  border-radius: 999px;
  box-shadow: 0 4px 14px rgba(23, 21, 15, 0.14);
  cursor: pointer;
}
.chat-jump[hidden] {
  display: none;
}
.chat-jump::before {
  content: "↓ ";
}

/* 画面が低いときは、入力欄が画面の外に出ないように調整 */
@media (max-height: 560px) {
  .chat-wrap {
    height: auto;
    min-height: 0;
  }
  .chat-log {
    height: 46vh;
    flex: 0 0 auto;
  }
}
