/* ===============================
   Messaging Layout & Chat Styles
   =============================== */

/* Overall chat container (two-column layout) */
.chat-container {
  display: flex;
  height: calc(100vh - 100px);
  background-color: #f7f8fa;
}

/* Sidebar with threads */
.chat-sidebar {
  width: 30%;
  min-width: 250px;
  background-color: #fff;
  border-right: 1px solid #ddd;
  overflow-y: auto;
}

.chat-sidebar h5 {
  padding: 15px 20px;
  border-bottom: 1px solid #eee;
  background-color: #f8f9fa;
  color: #075e54;
}

.thread-item {
  padding: 12px 16px;
  border-bottom: 1px solid #f0f0f0;
  cursor: pointer;
  transition: background 0.3s ease;
}

.thread-item:hover {
  background-color: #f0f0f0;
}

.thread-item.active-thread {
  background-color: #e6f7ff;
}

.thread-name {
  font-weight: 600;
  color: #075e54;
}

.thread-meta {
  font-size: 0.85rem;
  color: #888;
}

/* Chat main area */
.chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.chat-header {
  background-color: #075e54;
  color: #fff;
  padding: 15px 20px;
  font-weight: 600;
}

.message-box {
  display: flex;
  flex-direction: column;
  padding: 10px;
  overflow-y: auto;
  height: 75vh;
}

.message {
  margin: 6px 0;
  padding: 8px 12px;
  border-radius: 10px;
  max-width: 70%;
  word-wrap: break-word;
}

.message.inbound {
  background-color: #ffffff;
  align-self: flex-start;
  border: 1px solid #e2e2e2;
}

.message.outbound {
  background-color: #dcf8c6;
  align-self: flex-end;
}

.message-media img.chat-img,
.message-media video.chat-video {
  max-width: 200px;
  border-radius: 8px;
  margin-top: 5px;
}

.timestamp {
  font-size: 0.75em;
  color: #777;
  margin-top: 3px;
}


/* Input area */
.chat-input {
  border-top: 1px solid #ddd;
  background-color: #fff;
  padding: 10px;
  display: flex;
  align-items: center;
}

.chat-input input {
  flex: 1;
  border: 1px solid #ccc;
  border-radius: 20px;
  padding: 10px 15px;
  outline: none;
}

.chat-input button {
  background-color: #075e54;
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  margin-left: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chat-input button:hover {
  background-color: #128c7e;
}

/* Unread badge */
.unread-badge {
  background-color: #25d366;
  color: #fff;
  border-radius: 10px;
  font-size: 0.7rem;
  padding: 2px 6px;
  margin-left: 6px;
}

/* Responsive tweaks */
@media (max-width: 768px) {
  .chat-container {
    flex-direction: column;
  }
  .chat-sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid #ddd;
  }
}

.img-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  background: rgba(0,0,0,0.8);
  z-index: 2000;
}

.img-preview {
  max-width: 90%;
  max-height: 90%;
  border-radius: 10px;
}

.preview-box {
  text-align: center;
}
.preview-thumb {
  max-width: 100px;
  max-height: 100px;
  border-radius: 8px;
}
