/* Professional split-pane messenger (LinkedIn / Airbnb / Fiverr pattern) */

.account-messages-section {
  margin-bottom: 1.5rem;
}

.account-messages-section__head {
  margin-bottom: 1rem;
}

.account-messages-section__head h2 {
  margin: 0 0 0.35rem;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.account-messages-section__head p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-dim);
}

.dm-messenger {
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  background: linear-gradient(180deg, rgba(12, 18, 16, 0.95) 0%, rgba(6, 10, 9, 0.98) 100%);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
  overflow: hidden;
}

.dm-messenger__shell {
  display: flex;
  height: min(560px, 70vh);
  max-height: min(560px, 70vh);
  min-height: 400px;
}

/* ── Sidebar ── */
.dm-messenger__sidebar {
  flex: 0 0 300px;
  width: 300px;
  display: flex;
  flex-direction: column;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.25);
  min-height: 0;
}

.dm-messenger__sidebar-head {
  flex-shrink: 0;
  padding: 14px 14px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.dm-messenger__sidebar-head h3 {
  margin: 0 0 8px;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.dm-messenger__filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.dm-messenger__filter-btn {
  flex: 1 1 auto;
  min-width: 0;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-dim);
  font-size: 0.72rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
  white-space: nowrap;
}

.dm-messenger__filter-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.85);
}

.dm-messenger__filter-btn.is-active {
  background: rgba(16, 185, 129, 0.18);
  border-color: rgba(16, 185, 129, 0.45);
  color: #a7f3d0;
}

.dm-messenger__threads {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

.dm-messenger__list-empty {
  padding: 20px 14px;
  font-size: 0.85rem;
  color: var(--text-dim);
  line-height: 1.5;
  text-align: center;
}

.dm-messenger__list-empty a {
  color: #6ee7b7;
  text-decoration: none;
}

.dm-messenger__list-empty a:hover {
  text-decoration: underline;
}

/* ── Thread row ── */
.dm-thread {
  display: flex;
  align-items: stretch;
  width: 100%;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  transition: background 0.12s;
}

.dm-thread:hover {
  background: rgba(255, 255, 255, 0.04);
}

.dm-thread.is-active {
  background: rgba(16, 185, 129, 0.1);
}

.dm-thread__hit {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 8px 12px 14px;
  border: none;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
  font: inherit;
}

.dm-thread.is-active .dm-thread__hit {
  border-left: 3px solid #10b981;
  padding-left: 11px;
}

.dm-thread__delete {
  flex-shrink: 0;
  align-self: center;
  width: 34px;
  height: 34px;
  margin-right: 8px;
  padding: 0;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  opacity: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.12s, background 0.12s, color 0.12s;
}

.dm-thread:hover .dm-thread__delete,
.dm-thread:focus-within .dm-thread__delete {
  opacity: 1;
}

.dm-thread__delete:hover {
  background: rgba(239, 68, 68, 0.16);
  color: #f87171;
}

.dm-thread__delete:focus-visible {
  opacity: 1;
  outline: 2px solid rgba(239, 68, 68, 0.45);
  outline-offset: 1px;
}

@media (hover: none) {
  .dm-thread__delete {
    opacity: 0.75;
  }
}

.dm-thread__avatar {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(16, 185, 129, 0.2);
  color: #6ee7b7;
  font-size: 0.85rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.dm-thread__body {
  flex: 1;
  min-width: 0;
}

.dm-thread__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 2px;
}

.dm-thread__name {
  font-size: 0.88rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dm-thread__time {
  flex-shrink: 0;
  font-size: 0.68rem;
  color: var(--text-dim);
}

.dm-thread__preview {
  font-size: 0.8rem;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}

.dm-thread__tag {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-dim);
}

.dm-thread__tag--client {
  background: rgba(59, 130, 246, 0.15);
  color: #93c5fd;
}

.dm-thread__tag--artist {
  background: rgba(16, 185, 129, 0.15);
  color: #6ee7b7;
}

.dm-thread__unread {
  flex-shrink: 0;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ef4444;
  margin-top: 6px;
}

/* ── Chat panel ── */
.dm-messenger__chat {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: rgba(0, 0, 0, 0.15);
  padding: 0; /* global `section { padding: 96px 0 }` — must not inset messenger */
}

.dm-messenger__placeholder {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  text-align: center;
  color: var(--text-dim);
}

.dm-messenger__placeholder p {
  margin: 0 0 8px;
  font-size: 0.95rem;
  color: rgba(255, 255, 255, 0.7);
}

.dm-messenger__placeholder span {
  font-size: 0.82rem;
}

.dm-chat-header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.2);
}

.dm-chat-back {
  display: none;
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.05);
  color: inherit;
  font-size: 1rem;
  cursor: pointer;
  line-height: 1;
}

@media (max-width: 768px) {
  .dm-chat-back {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
}

.dm-chat-header__avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(16, 185, 129, 0.2);
  color: #6ee7b7;
  font-size: 0.8rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.dm-chat-header__info {
  flex: 1;
  min-width: 0;
}

.dm-chat-header__info h4 {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 600;
}

.dm-chat-header__meta {
  margin: 2px 0 0;
  font-size: 0.75rem;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dm-chat-header__design {
  flex-shrink: 0;
}

.dm-chat-header__design img {
  width: 36px;
  height: 36px;
  object-fit: cover;
  border-radius: 6px;
  display: block;
}

.dm-chat-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  -webkit-overflow-scrolling: touch;
}

.dm-bubble-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  max-width: 78%;
}

.dm-bubble-row.is-mine {
  align-self: flex-end;
  flex-direction: row-reverse;
  margin-left: auto;
}

.dm-bubble {
  padding: 9px 13px;
  border-radius: 16px 16px 16px 4px;
  background: rgba(255, 255, 255, 0.08);
  font-size: 0.9rem;
  line-height: 1.45;
  word-break: break-word;
}

.dm-bubble-row.is-mine .dm-bubble {
  background: rgba(16, 185, 129, 0.22);
  border-radius: 16px 16px 4px 16px;
}

.dm-bubble__time {
  font-size: 0.68rem;
  color: var(--text-dim);
  margin-top: 4px;
}

.dm-chat-compose {
  flex-shrink: 0;
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.25);
  align-items: flex-end;
}

.dm-chat-compose textarea {
  flex: 1;
  margin: 0;
  min-height: 40px;
  max-height: 100px;
  resize: none;
  padding: 10px 12px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.05);
  color: inherit;
  font-family: inherit;
  font-size: 0.88rem;
}

.dm-chat-compose textarea:focus {
  outline: none;
  border-color: rgba(16, 185, 129, 0.4);
}

.dm-chat-send {
  flex-shrink: 0;
  padding: 10px 18px;
  border-radius: 20px;
  border: none;
  background: #10b981;
  color: #022c22;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: opacity 0.15s;
}

.dm-chat-send:hover:not(:disabled) {
  opacity: 0.9;
}

.dm-chat-send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.dm-chat-feedback {
  padding: 0 16px 8px;
  font-size: 0.8rem;
}

.dm-chat-feedback:empty {
  display: none;
}

.dm-chat-feedback.is-error {
  color: #f87171;
}

@media (max-width: 768px) {
  .dm-messenger__shell {
    flex-direction: column;
    height: auto;
    max-height: none;
  }

  .dm-messenger__sidebar {
    flex: none;
    width: 100%;
    height: 220px;
    border-right: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  }

  .dm-messenger__shell.is-chat-open .dm-messenger__sidebar {
    display: none;
  }

  .dm-messenger__chat {
    height: 400px;
    max-height: min(400px, 55vh);
  }

  .dm-messenger__shell.is-chat-open .dm-messenger__chat {
    height: 460px;
    max-height: min(460px, 65vh);
  }
}
