/* ============================================================
   CorfuDiscovery  -  private messages
   The inbox in the dashboard and the "Send message" dialog on listing pages, profiles and the owners directory.
   ============================================================ */

/* ---------- the inbox ---------- */
.msgs { display: grid; grid-template-columns: minmax(220px, 320px) minmax(0, 1fr); background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-sm); overflow: hidden; min-height: 460px; }

.msgs-list { list-style: none; margin: 0; padding: 0; border-right: 1px solid var(--line); max-height: 640px; overflow-y: auto; }
.msgs-list li + li { border-top: 1px solid var(--line); }
.msgs-list a { display: flex; align-items: center; gap: 12px; padding: 14px 16px; color: var(--ink); text-decoration: none; }
.msgs-list a:hover, .msgs-list li.is-on a { background: var(--coral-soft); }
.msgs-list__body { display: flex; flex-direction: column; min-width: 0; flex: 1; gap: 2px; }
.msgs-list__body strong { color: var(--navy); line-height: 1.25; }
.msgs-list li.is-unread strong { color: var(--coral-deep); }
.msgs-list__about { color: var(--muted); font-size: 13px; }
.msgs-list__about a { display: inline; padding: 0; color: var(--coral-deep); }
.msgs-list__about a:hover { background: none; text-decoration: underline; }
.msgs-list__last { color: var(--body); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.msgs-list__time { color: var(--muted); font-size: 12px; flex: none; align-self: flex-start; }
.msgs-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--coral); vertical-align: middle; margin-left: 4px; }

.msg-avatar { display: inline-grid; place-items: center; flex: none; width: 38px; height: 38px; border-radius: 50%; background: var(--coral); color: var(--tc-messages-ffffff,#fff); font-weight: 700; }

/* ---------- a conversation ---------- */
.msgs-thread { display: flex; flex-direction: column; min-width: 0; }
.msgs-thread__empty { margin: auto; color: var(--muted); padding: 24px; }
.msgs-thread__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.msgs-thread__head > div { flex: 1; min-width: 0; }
.msgs-thread__head strong { display: block; color: var(--navy); font-family: var(--serif); font-size: 19px; }
.msgs-back { display: none; font-size: 14px; color: var(--coral-deep); }

.msgs-thread__body { flex: 1; padding: 18px; display: flex; flex-direction: column; gap: 14px; overflow-y: auto; max-height: 460px; background: var(--sand); }
.msg-bubble { display: flex; gap: 10px; max-width: 82%; align-items: flex-end; }
.msg-bubble .msg-avatar { width: 32px; height: 32px; font-size: 14px; background: var(--navy); }
.msg-bubble.me { align-self: flex-end; flex-direction: row-reverse; }
.msg-bubble.me .msg-avatar { background: var(--coral); }
.msg-text { background: var(--paper); border: 1px solid var(--line); border-radius: 14px 14px 14px 4px; padding: 10px 14px; min-width: 0; overflow-wrap: anywhere; }
.msg-bubble.me .msg-text { background: var(--coral-soft); border-color: transparent; border-radius: 14px 14px 4px 14px; }
.msg-text p { margin: 0; }
.msg-time { display: block; margin-top: 4px; font-size: 11.5px; color: var(--muted); }
.msg-attachment { display: inline-flex; gap: 6px; margin-top: 6px; font-size: 14px; color: var(--coral-deep); }

/* ---------- the reply ---------- */
.msgs-reply { border-top: 1px solid var(--line); padding: 14px 18px; background: var(--paper); }
.msgs-reply textarea { width: 100%; border: 1.5px solid var(--line-strong); border-radius: var(--r); padding: 11px 14px; font: inherit; background: var(--sand); resize: vertical; }
.msgs-reply__bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 10px; }
.msgs-reply__note { color: var(--tc-messages-b03a2a,#b03a2a); margin: 8px 0 0; font-size: 14px; padding: 0 18px 14px; }
.msgs-reply .msgs-reply__note { padding: 0; }
.msgs-attach { position: relative; cursor: pointer; color: var(--coral-deep); font-size: 14px; }
.msgs-attach input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }

@media (max-width: 760px) {
  .msgs { grid-template-columns: minmax(0, 1fr); }
  .msgs-list { border-right: 0; max-height: none; }
  .msgs--open .msgs-list { display: none; }
  .msgs:not(.msgs--open) .msgs-thread { display: none; }
  .msgs-back { display: inline-block; }
  .msg-bubble { max-width: 94%; }
}

/* ---------- the "Send message" dialog ---------- */
.cdf-message { position: fixed; inset: 0; margin: auto; width: min(500px, calc(100vw - 32px)); height: fit-content; padding: 26px 28px; border: 0; border-radius: var(--r-lg); box-shadow: var(--shadow-lg); }
.cdf-message::backdrop { background: var(--tc-messages-0a1e2b8c,rgba(10, 30, 43, .55)); backdrop-filter: blur(3px); }
.cdf-message h3 { margin: 0 0 12px; font-family: var(--serif); font-size: 24px; font-weight: 600; }
.cdf-message textarea { width: 100%; border: 1.5px solid var(--line-strong); border-radius: var(--r); padding: 12px 15px; font: inherit; background: var(--sand); resize: vertical; }
.cdf-message__btns { display: flex; justify-content: flex-end; gap: 10px; margin-top: 14px; }
.cdf-message [data-cdf-message-note] { margin: 8px 0 0; font-size: 14px; }
.cdf-message-btn { cursor: pointer; }
.cdf-message__about { margin: 0 0 12px; padding: 9px 12px; background: var(--sand); border-radius: var(--r-sm, 10px); font-size: 14px; color: var(--body); }
.cdf-message__field { display: block; }
.cdf-message__field > span { display: block; margin-bottom: 6px; font-weight: 600; font-size: 14px; color: var(--navy); }
.cdf-message__note { display: flex; align-items: center; gap: 7px; margin: 8px 0 0; font-size: 13px; color: var(--muted); }
.cdf-message__terms { margin-top: 16px; padding: 14px 16px; background: var(--sand); border: 1px solid var(--line); border-radius: var(--r); }
.cdf-message__terms h4 { margin: 0 0 8px; font-size: 14px; color: var(--navy); }
.cdf-message__terms ul { margin: 0 0 12px; padding-left: 18px; max-height: 220px; overflow-y: auto; font-size: 13px; line-height: 1.5; color: var(--body); }
.cdf-message__terms li + li { margin-top: 5px; }
.cdf-message__accept { display: flex; align-items: flex-start; gap: 9px; font-size: 13.5px; line-height: 1.45; cursor: pointer; color: var(--ink); }
.cdf-message__accept input { margin-top: 3px; flex: none; width: 17px; height: 17px; accent-color: var(--coral); }
.cdf-message__privacy { margin: 8px 0 0 26px; font-size: 12.5px; color: var(--muted); }
.cdf-message__privacy a { color: var(--coral-deep); text-decoration: underline; }

/* the quiet "Prefer to write privately?" box under a listing's contact form */
.cdf-pm-card { display: flex; gap: 14px; align-items: flex-start; margin: 20px 0 24px; padding: 24px 22px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-sm); }
.cdf-pm-card__icon { flex: none; display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; background: var(--coral-soft); color: var(--coral-deep); }
.cdf-pm-card__body { flex: 1; min-width: 0; }
.cdf-pm-card h3 { margin: 2px 0 4px; font-family: var(--serif); font-size: 18px; font-weight: 600; color: var(--navy); }
.cdf-pm-card p { margin: 0 0 12px; font-size: 14px; line-height: 1.5; color: var(--body); }
.cdf-pm-card .cdf-widget-heading { margin: 0 0 10px; }
.cdf-pm-card__btn { width: 100%; min-height: 48px; padding: 12px 16px; margin-top: 4px; justify-content: center; white-space: normal; line-height: 1.4; }
.cdf-pm-card__note { display: block; margin: 12px 0 0; font-size: 12.5px; line-height: 1.5; color: var(--muted); }
@media (max-width: 600px) {
  .cdf-pm-card { flex-direction: column; align-items: stretch; padding: 22px 20px; text-align: center; }
  .cdf-pm-card__icon { margin: 0 auto; }
}
