/* Beebro Send — стили для интерфейса чатов */

.chats-body {
  overflow: hidden;
  height: 100vh;
}

.chats-layout {
  display: grid;
  grid-template-columns: 260px 340px minmax(0, 1fr);
  height: calc(100vh - 51px);
  background: var(--bg);
}

.pane {
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  min-width: 0;
  overflow: hidden;
}
.pane:last-child { border-right: none; }

.pane-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-2);
  height: 52px;
  flex-shrink: 0;
  gap: 8px;
}
.pane-header h2 {
  font-size: 14px;
  font-weight: 600;
  margin: 0;
  color: var(--fg-2);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.icon-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  font-size: 16px;
  line-height: 1;
  flex-shrink: 0;
}

.pane-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: var(--bg-3) transparent;
  min-height: 0;
}
.pane-body::-webkit-scrollbar { width: 6px; }
.pane-body::-webkit-scrollbar-thumb { background: var(--bg-3); border-radius: 3px; }

.empty {
  padding: 24px 16px;
  color: var(--fg-3);
  font-size: 13px;
  text-align: center;
}

/* Account / chat list items */
.list-item {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background .1s;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.list-item:hover { background: var(--bg-2); }
.list-item.active {
  background: rgba(245, 197, 66, 0.08);
  border-left: 3px solid var(--accent);
  padding-left: 13px;
}

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg-3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 13px;
  flex-shrink: 0;
  color: var(--fg-2);
}
.avatar.tg { background: linear-gradient(135deg, #2AABEE, #229ED9); color: white; }
.avatar.wa { background: linear-gradient(135deg, #25D366, #128C7E); color: white; }
.avatar.ig { background: linear-gradient(135deg, #FCAF45, #E1306C, #833AB4); color: white; }
.avatar.vb { background: linear-gradient(135deg, #7360F2, #5B45BA); color: white; }

.item-body { flex: 1; min-width: 0; }
.item-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--fg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.item-sub {
  font-size: 12px;
  color: var(--fg-2);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.item-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  font-size: 11px;
  color: var(--fg-3);
  flex-shrink: 0;
}
.unread-dot {
  background: var(--accent);
  color: #1a1a1a;
  font-weight: 600;
  border-radius: 10px;
  padding: 0 6px;
  min-width: 18px;
  height: 18px;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Conversation pane */
.pane-conv { background: var(--bg); }
.conv-header {
  background: var(--bg-2);
}
.conv-title {
  font-weight: 600;
  font-size: 15px;
  color: var(--fg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.conv-sub {
  font-size: 12px;
  color: var(--fg-2);
  margin-top: 2px;
}

.conv-body {
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* Сообщения */
.msg {
  width: fit-content;
  max-width: min(560px, 70%);
  padding: 7px 11px 5px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.4;
  position: relative;
}
.msg-text {
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-wrap: anywhere;
}
.msg.outbound,
.msg.outbound.failed {
  align-self: flex-end;
  background: var(--accent);
  color: #1a1a1a;
  border-bottom-right-radius: 4px;
}
.msg.inbound,
.msg.inbound.failed {
  align-self: flex-start;
  background: var(--bg-2);
  color: var(--fg);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}
.msg.failed {
  background: rgba(239, 68, 68, .12);
  border: 1px solid rgba(239, 68, 68, .35);
  color: var(--fg);
}
.msg.outbound.failed {
  background: rgba(239, 68, 68, .18);
  color: var(--fg);
}
.msg-meta {
  font-size: 10px;
  margin-top: 2px;
  opacity: 0.65;
  display: flex;
  gap: 5px;
  align-items: center;
  line-height: 1;
}
.msg.outbound .msg-meta { justify-content: flex-end; }
.msg-status { font-family: var(--mono); }
.msg.failed .msg-meta { color: var(--error); opacity: 1; }

.day-sep {
  align-self: center;
  font-size: 11px;
  color: var(--fg-3);
  background: var(--bg-2);
  border: 1px solid var(--border);
  padding: 4px 10px;
  border-radius: 999px;
  margin: 12px 0;
}

.conv-input {
  border-top: 1px solid var(--border);
  background: var(--bg-2);
  padding: 12px 16px;
  display: flex;
  gap: 10px;
  align-items: flex-end;
  flex-shrink: 0;
}
.conv-input textarea {
  flex: 1;
  resize: none;
  max-height: 120px;
  min-height: 38px;
  padding: 8px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--fg);
  font-family: inherit;
  font-size: 14px;
  line-height: 1.4;
  outline: none;
  transition: border-color .15s;
}
.conv-input textarea:focus { border-color: var(--accent); }

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}
.modal h3 { margin: 0 0 12px; font-size: 18px; }

/* Placeholder когда ничего не выбрано */
.placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  color: var(--fg-3);
  text-align: center;
  padding: 40px 20px;
  min-height: 200px;
}
.placeholder-icon { font-size: 48px; margin-bottom: 16px; opacity: 0.5; }

/* Спиннер */
.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Navbar для чатов — никаких pointer обрезаний */
.chats-body .nav {
  height: 51px;
  flex-shrink: 0;
}
.chats-body .nav-inner {
  height: 100%;
  padding-top: 0;
  padding-bottom: 0;
}

@media (max-width: 1100px) {
  .chats-layout {
    grid-template-columns: 220px 300px minmax(0, 1fr);
  }
}
@media (max-width: 900px) {
  .chats-layout {
    grid-template-columns: 190px 270px minmax(0, 1fr);
  }
  .msg { max-width: 85%; }
}
