/* Community messages — drawer + full-page chat polish */

.qp-nav-msg-btn {
  position: relative;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  padding: 0.4rem 0.55rem !important;
  border: 0 !important;
  border-radius: 0.45rem !important;
  background: transparent !important;
  color: rgba(240, 246, 252, 0.78) !important;
  margin-left: 0.15rem;
  line-height: 1;
  transition: background 0.15s ease, color 0.15s ease;
}
.qp-nav-msg-btn:hover,
.qp-nav-msg-btn:focus,
.qp-nav-msg-btn.active {
  background: rgba(255, 255, 255, 0.06) !important;
  color: #f0f6fc !important;
}
.qp-nav-msg-btn .bi {
  font-size: 1.15rem;
  margin: 0 !important;
}
.qp-nav-msg-btn .qp-nav-msg-badge {
  font-size: 0.62rem;
  min-width: 1.05rem;
  padding: 0.15rem 0.3rem;
  line-height: 1;
  top: 0.1rem !important;
  inset-inline-start: auto !important;
  inset-inline-end: -0.05rem;
  transform: none !important;
}

#qpMessagesDrawer.offcanvas {
  width: min(400px, 100vw);
  background:
    linear-gradient(180deg, rgba(28, 33, 40, 0.99) 0%, rgba(22, 27, 34, 0.99) 100%);
  color: var(--text-primary, #f0f6fc);
  border-left: 1px solid rgba(48, 54, 61, 0.95);
  box-shadow: -12px 0 40px rgba(0, 0, 0, 0.35);
}
#qpMessagesDrawer .offcanvas-header {
  border-bottom: 1px solid rgba(48, 54, 61, 0.85);
  padding: 0.85rem 1rem;
  background: rgba(13, 17, 23, 0.35);
}
#qpMessagesDrawer .offcanvas-title {
  font-weight: 650;
  letter-spacing: -0.01em;
}
#qpMessagesDrawer .qp-msg-pane {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 56px);
  max-height: calc(100dvh - 56px);
}
#qpMessagesDrawer .qp-msg-list {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 0.65rem 0.75rem;
  scrollbar-width: thin;
}
#qpMessagesDrawer .qp-msg-thread-row {
  display: flex;
  align-items: stretch;
  gap: 0.35rem;
  margin-bottom: 0.35rem;
}
#qpMessagesDrawer .qp-msg-thread-item {
  cursor: pointer;
  border: 1px solid rgba(48, 54, 61, 0.85) !important;
  background: rgba(13, 17, 23, 0.35);
  color: inherit;
  border-radius: 0.75rem !important;
  padding: 0.7rem 0.8rem !important;
  flex: 1 1 auto;
  min-width: 0;
  transition: background 0.15s ease, border-color 0.15s ease;
}
#qpMessagesDrawer .qp-msg-thread-item:hover {
  background: rgba(31, 111, 235, 0.12);
  border-color: rgba(121, 184, 255, 0.35) !important;
}
#qpMessagesDrawer .qp-msg-avatar {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #f0f6fc;
  background: linear-gradient(145deg, rgba(31, 111, 235, 0.55), rgba(15, 20, 25, 0.85));
  border: 1px solid rgba(121, 184, 255, 0.28);
}
#qpMessagesDrawer .qp-msg-thread-meta {
  min-width: 0;
  flex: 1 1 auto;
}
#qpMessagesDrawer .qp-msg-thread-name {
  font-size: 0.86rem;
  font-weight: 600;
  color: #f0f6fc;
}
#qpMessagesDrawer .qp-msg-thread-when {
  font-size: 0.68rem;
  color: rgba(240, 246, 252, 0.42);
  white-space: nowrap;
}
#qpMessagesDrawer .qp-msg-block-inbox {
  flex: 0 0 auto;
  align-self: center;
  border-radius: 999px;
  width: 2rem;
  height: 2rem;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
#qpMessagesDrawer .qp-msg-bubble {
  max-width: 85%;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.86rem;
  line-height: 1.45;
  border-radius: 1rem;
  padding: 0.55rem 0.8rem;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.12);
}
#qpMessagesDrawer .qp-msg-mine {
  background: linear-gradient(145deg, #1f6feb, #1a5fcf);
  color: #fff;
  margin-left: auto;
  border-bottom-right-radius: 0.35rem;
}
#qpMessagesDrawer .qp-msg-peer {
  background: rgba(45, 51, 59, 0.95);
  color: var(--text-primary, #f0f6fc);
  border: 1px solid rgba(48, 54, 61, 0.95);
  border-bottom-left-radius: 0.35rem;
}
#qpMessagesDrawer .qp-msg-compose {
  border-top: 1px solid rgba(48, 54, 61, 0.85);
  padding: 0.75rem;
  background: rgba(13, 17, 23, 0.45);
}
#qpMessagesDrawer .qp-msg-compose .form-control {
  border-radius: 0.85rem;
  background: rgba(13, 17, 23, 0.72);
  border-color: rgba(48, 54, 61, 0.95);
  color: #f0f6fc;
  resize: none;
}
#qpMessagesDrawer .qp-msg-compose .form-control:focus {
  border-color: rgba(31, 111, 235, 0.7);
  box-shadow: 0 0 0 0.15rem rgba(31, 111, 235, 0.18);
  background: rgba(13, 17, 23, 0.9);
}
#qpMessagesDrawer .qp-msg-compose .btn-primary {
  border-radius: 0.85rem;
  padding-left: 1rem;
  padding-right: 1rem;
}
#qpMessagesDrawer .qp-msg-empty {
  color: rgba(240, 246, 252, 0.45);
  font-size: 0.86rem;
  text-align: center;
  padding: 2.5rem 1.25rem;
}
#qpMessagesDrawer .qp-msg-peer-bar {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid rgba(48, 54, 61, 0.85);
  background: rgba(13, 17, 23, 0.28);
}

/* Full-page chat */
.qp-chat-shell {
  max-width: 820px;
  margin: 0 auto;
}
.qp-chat-inbox-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  border: 1px solid rgba(48, 54, 61, 0.85);
  border-radius: 0.85rem;
  background: rgba(22, 27, 34, 0.72);
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.qp-chat-inbox-item:hover {
  background: rgba(31, 111, 235, 0.1);
  border-color: rgba(121, 184, 255, 0.35);
  color: inherit;
}
.qp-chat-inbox-avatar {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 0.78rem;
  font-weight: 700;
  background: linear-gradient(145deg, rgba(31, 111, 235, 0.55), rgba(15, 20, 25, 0.85));
  border: 1px solid rgba(121, 184, 255, 0.28);
  color: #f0f6fc;
}
.qp-chat-bubble {
  max-width: 78%;
  white-space: pre-wrap;
  word-break: break-word;
  border: 1px solid transparent;
  font-size: 0.9rem;
  line-height: 1.45;
  border-radius: 1.05rem;
  padding: 0.65rem 0.9rem;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.12);
}
.qp-chat-mine {
  background: linear-gradient(145deg, #1f6feb, #1a5fcf);
  color: #ffffff !important;
  border-bottom-right-radius: 0.35rem;
  border-color: rgba(255, 255, 255, 0.08);
}
.qp-chat-peer {
  background: rgba(45, 51, 59, 0.95);
  color: var(--text-primary, #f0f6fc) !important;
  border-color: rgba(48, 54, 61, 0.95);
  border-bottom-left-radius: 0.35rem;
}
.qp-chat-thread-card {
  border: 1px solid rgba(48, 54, 61, 0.85);
  background: rgba(22, 27, 34, 0.85);
  border-radius: 1rem;
  overflow: hidden;
}
.qp-chat-thread-scroll {
  max-height: min(52vh, 480px);
  overflow-y: auto;
  padding: 1rem;
  background:
    radial-gradient(ellipse 60% 40% at 10% 0%, rgba(31, 111, 235, 0.08), transparent 55%),
    rgba(13, 17, 23, 0.35);
}
.qp-chat-compose-bar {
  border-top: 1px solid rgba(48, 54, 61, 0.85);
  padding: 0.85rem;
  background: rgba(13, 17, 23, 0.4);
}
.qp-chat-compose-bar .form-control {
  border-radius: 0.85rem;
  resize: none;
}
.qp-chat-compose-bar .btn {
  border-radius: 0.85rem;
}
.qp-chat-peer-card {
  border: 1px solid rgba(48, 54, 61, 0.85);
  background: rgba(22, 27, 34, 0.85);
  border-radius: 1rem;
  padding: 0.9rem 1rem;
  margin-bottom: 1rem;
}
.qp-chat-peer-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid rgba(48, 54, 61, 0.95);
  background: rgba(33, 38, 45, 0.95);
}
.qp-chat-peer-avatar-fallback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  font-weight: 600;
  color: #f0f6fc;
  background: linear-gradient(145deg, rgba(31, 111, 235, 0.55), rgba(15, 20, 25, 0.85));
}
.qp-chat-peer-card .qp-chat-peer-name {
  font-size: 1.05rem;
  font-weight: 650;
  margin: 0;
  color: #f0f6fc;
  text-decoration: none;
}
.qp-chat-peer-card .qp-chat-peer-name:hover {
  color: var(--brand, #4a90e2);
  text-decoration: underline;
}
.qp-chat-peer-card .qp-chat-peer-sub {
  font-size: 0.8rem;
  color: rgba(240, 246, 252, 0.55);
  margin-top: 0.15rem;
}
.qp-chat-peer-card .qp-chat-peer-bits {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.45rem;
}
.qp-chat-peer-card .qp-chat-peer-bit {
  font-size: 0.72rem;
  line-height: 1.2;
  padding: 0.2rem 0.45rem;
  border-radius: 999px;
  border: 1px solid rgba(48, 54, 61, 0.95);
  background: rgba(33, 38, 45, 0.9);
  color: rgba(240, 246, 252, 0.7);
}
a.qp-chat-peer-main {
  text-decoration: none;
  color: inherit;
  min-width: 0;
}
a.qp-chat-peer-main:hover .qp-chat-peer-name {
  color: var(--brand, #4a90e2);
  text-decoration: underline;
}
