/* Remora Messages — Slack-style layout (sidebar + chat pane) */

.messaging-main {
  padding: 0;
}

.messaging-app {
  display: flex;
  height: calc(100vh - 72px); /* below the navbar */
  min-height: 420px;
  background: #fff;
}

/* ── Sidebar ── */

.messaging-sidebar {
  flex: 0 0 280px;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: #04342c;
  color: rgba(255, 255, 255, 0.85);
}

.messaging-sidebar__header {
  padding: 0.9rem 1rem 0.6rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.messaging-sidebar__title {
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
  margin: 0;
}

.messaging-sidebar__scroll {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 0.75rem 0.5rem 1rem;
}

.messaging-sidebar__section {
  margin-bottom: 1.1rem;
}

.messaging-sidebar__section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 0.5rem;
  margin-bottom: 0.25rem;
}

.messaging-sidebar__section-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.55);
}

.messaging-new-dm-btn {
  width: 1.4rem;
  height: 1.4rem;
  line-height: 1;
  border: 0;
  border-radius: 0.25rem;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
}

.messaging-new-dm-btn:hover {
  background: rgba(255, 255, 255, 0.28);
}

.messaging-new-dm {
  padding: 0.25rem 0.5rem 0.5rem;
}

.messaging-new-dm .af-handle-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 60;
  max-height: 16rem;
  overflow-y: auto;
}

.messaging-sidebar__hint {
  padding: 0.25rem 0.5rem;
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.55);
}

.messaging-sidebar__hint a {
  color: #9fd6c9;
}

.messaging-conv-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.messaging-conv-btn {
  display: flex;
  align-items: center;
  width: 100%;
  gap: 0.5rem;
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.85);
  padding: 0.4rem 0.5rem;
  border-radius: 0.375rem;
  cursor: pointer;
  text-align: left;
}

.messaging-conv-btn:hover {
  background: rgba(255, 255, 255, 0.08);
}

.messaging-conv-btn.is-active {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
}

.messaging-conv-btn.has-unread .messaging-conv-btn__title {
  font-weight: 700;
  color: #fff;
}

.messaging-conv-btn__icon {
  flex: 0 0 auto;
  width: 1.1rem;
  text-align: center;
  opacity: 0.6;
  font-weight: 700;
}

.messaging-conv-btn__text {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.messaging-conv-btn__title {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.92rem;
}

.messaging-conv-btn__preview {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.5);
}

.messaging-conv-btn__badge {
  flex: 0 0 auto;
  min-width: 1.35rem;
  padding: 0.05rem 0.35rem;
  border-radius: 1rem;
  background: #e01e5a;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  text-align: center;
}

/* ── Chat pane ── */

.messaging-chat {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.messaging-chat__empty {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.messaging-chat__empty-inner {
  text-align: center;
  max-width: 26rem;
}

.messaging-chat__body {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.messaging-chat__header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1rem;
  border-bottom: 1px solid #dee2e6;
  background: #fff;
}

.messaging-chat__back-btn {
  display: none;
  border: 0;
  background: transparent;
  padding: 0.15rem;
  color: #04342c;
  cursor: pointer;
}

.messaging-chat__title {
  font-weight: 700;
  font-size: 1rem;
  color: #212529;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.messaging-chat__subtitle {
  font-size: 0.78rem;
  color: #6c757d;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.messaging-chat__messages {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 0.75rem 1rem 0.5rem;
  background: #f8f9fa;
}

.messaging-load-older-btn {
  display: block;
  margin: 0 auto 0.75rem;
  border: 1px solid #ced4da;
  background: #fff;
  color: #04342c;
  font-size: 0.8rem;
  padding: 0.25rem 0.9rem;
  border-radius: 2rem;
  cursor: pointer;
}

.messaging-load-older-btn:hover {
  background: #e9ecef;
}

/* ── Messages ── */

.messaging-msg {
  max-width: min(78%, 34rem);
  margin-bottom: 0.15rem;
}

.messaging-msg--block-start {
  margin-top: 0.75rem;
}

.messaging-msg--mine {
  margin-left: auto;
  text-align: right;
}

.messaging-msg__meta {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  margin-bottom: 0.15rem;
}

.messaging-msg--mine .messaging-msg__meta {
  justify-content: flex-end;
}

.messaging-msg__sender {
  font-size: 0.8rem;
  font-weight: 700;
  color: #212529;
}

.messaging-msg__time {
  font-size: 0.72rem;
  color: #868e96;
}

.messaging-msg__bubble {
  display: inline-block;
  text-align: left;
  padding: 0.45rem 0.7rem;
  border-radius: 0.9rem;
  background: #fff;
  border: 1px solid #e9ecef;
  color: #212529;
  font-size: 0.92rem;
  line-height: 1.35;
  word-wrap: break-word;
  overflow-wrap: anywhere;
}

.messaging-msg--mine .messaging-msg__bubble {
  background: #04342c;
  border-color: #04342c;
  color: #fff;
}

/* ── Composer ── */

.messaging-chat__composer {
  padding: 0.6rem 1rem 0.85rem;
  border-top: 1px solid #dee2e6;
  background: #fff;
}

.messaging-composer {
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
}

.messaging-composer__input {
  resize: none;
  max-height: 140px;
  border-radius: 0.75rem;
}

.messaging-composer__send {
  flex: 0 0 auto;
  border-radius: 0.75rem;
}

/* ── Mobile: show either sidebar or chat ── */

@media (max-width: 799.98px) {
  .messaging-app {
    height: calc(100vh - 58px);
  }

  .messaging-sidebar {
    flex: 1 1 auto;
  }

  .messaging-chat {
    display: none;
  }

  .messaging-app--chat-open .messaging-sidebar {
    display: none;
  }

  .messaging-app--chat-open .messaging-chat {
    display: flex;
  }

  .messaging-chat__back-btn {
    display: inline-flex;
    align-items: center;
  }

  .messaging-msg {
    max-width: 88%;
  }
}
