/* =============================================================================
 * FILE:      ES_Messages.css
 * LOCATION:  public_html/assets/CSS/ES_Messages.css (under the ease-see domain root)
 * PART OF:   ease-see (ease-see.com) - the customer message page
 * PURPOSE:   The message page (/{lang}/messages/{link}, Render/ES_Messages.php),
 *            WhatsApp-style - agreed 6 Nov 2026: a bar with who you are talking
 *            to (avatar, name), bubbles (yours on the right in green, ours on
 *            the left in white) on a soft background, the reply box pinned to
 *            the bottom on a phone. PIN / link cards in the same frame.
 *            Own file so ES_Core.css is not grown; linked only by this page.
 *            Every class is es-msg-*.
 * CREATED:   2026-11-06
 * UPDATED:   2026-11-06  First version.
 * UPDATED:   2026-11-06  "Messages" heading (.es-msg-h1) and "Me" on the right
 *            of the top bar (.es-msg-me).
 * UPDATED:   2026-11-06  The chats list (.es-msg-list, .es-msg-chat ...):
 *            beside the chat from 761px, instead of it below, with a back
 *            arrow (.es-msg-back) in the bar.
 * =============================================================================
 */
.es-msg-main { flex-direction: column; align-items: center; --m-bg: #efeae2; --m-mine: #d9fdd3; --m-ours: #ffffff; --m-ink: #111b21; --m-soft: #667781;
  --m-bar: #2f6f4f; --m-send: #2f6f4f; --m-line: #d1d7db; --m-err: #b3261e;
  display: flex; justify-content: center; padding: 1rem 0 2rem; }
.es-msg-app { width: 100%; max-width: 720px; background: var(--m-bg); border: 1px solid var(--m-line); border-radius: 14px;
  overflow: hidden; display: flex; flex-direction: column; min-height: 60vh; color: var(--m-ink); }

/* who you are talking to */
.es-msg-bar { display: flex; align-items: center; gap: .7rem; padding: .7rem 1rem; background: var(--m-bar); color: #fff; }
.es-msg-avatar { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; flex: 0 0 auto; background: #fff; }
.es-msg-initial { display: grid; place-items: center; background: #fff; color: var(--m-bar); font-weight: 700; text-transform: uppercase; }
.es-msg-bar-who { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.es-msg-bar-who b { font-size: 1.05rem; overflow-wrap: anywhere; }
.es-msg-bar-who span { font-size: .85rem; opacity: .85; }
.es-msg-bar-who { flex: 1 1 auto; }
.es-msg-me { flex: 0 0 auto; font-weight: 700; font-size: 1.05rem; padding: .2rem .7rem; border-radius: 999px; background: rgba(255,255,255,.18); }
.es-msg-h1 { width: 100%; max-width: 720px; margin: 0 auto .6rem; font-size: 1.6rem; }

/* the conversation */
.es-msg-thread { flex: 1 1 auto; display: flex; flex-direction: column; gap: .4rem; padding: 1rem .8rem; }
.es-msg-row { display: flex; }
.es-msg-row.is-mine { justify-content: flex-end; }
.es-msg-bubble { max-width: 80%; padding: .45rem .7rem .3rem; border-radius: 10px; box-shadow: 0 1px .5px rgba(11,20,26,.13);
  overflow-wrap: anywhere; }
.is-mine .es-msg-bubble { background: var(--m-mine); border-top-right-radius: 2px; }
.is-ours .es-msg-bubble { background: var(--m-ours); border-top-left-radius: 2px; }
.es-msg-subj { margin: 0 0 .2rem; font-weight: 600; font-size: .9rem; }
.es-msg-text { line-height: 1.45; }
.es-msg-time { margin: .15rem 0 0; font-size: .72rem; color: var(--m-soft); text-align: right; }
.es-msg-note { align-self: center; margin: .4rem 0; padding: .35rem .8rem; border-radius: 8px; background: #fff7d6;
  font-size: .9rem; text-align: center; }

/* writing back - pinned to the bottom */
.es-msg-thread + .es-msg-form { display: flex; align-items: flex-end; gap: .5rem; padding: .6rem .7rem; background: #f0f2f5;
  border-top: 1px solid var(--m-line); position: sticky; bottom: 0; }
.es-msg-compose { flex: 1 1 auto; margin: 0; }
.es-msg-compose textarea { width: 100%; box-sizing: border-box; resize: none; min-height: 2.6rem; max-height: 9rem; padding: .6rem .8rem;
  border: 0; border-radius: 20px; font: inherit; background: #fff; }
.es-msg-send { flex: 0 0 auto; border: 0; border-radius: 20px; padding: .6rem 1.1rem; background: var(--m-send); color: #fff;
  font: inherit; font-weight: 600; cursor: pointer; }
.es-msg-send:hover { filter: brightness(1.08); }
.es-msg-soon { margin: 0; padding: .5rem 1rem .8rem; font-size: .8rem; color: var(--m-soft); text-align: center; background: #f0f2f5; }
.es-msg-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* PIN and link cards */
.es-msg-card { margin: 1.2rem auto; width: calc(100% - 2rem); max-width: 26rem; box-sizing: border-box; padding: 1.1rem 1.2rem;
  background: #fff; border-radius: 12px; box-shadow: 0 1px 2px rgba(11,20,26,.1); line-height: 1.45; }
.es-msg-card p { margin: 0 0 .8rem; }
.es-msg-card .es-msg-form { display: flex; flex-direction: column; gap: .7rem; }
.es-msg-card label { display: flex; flex-direction: column; gap: .3rem; font-size: .9rem; color: var(--m-soft); }
.es-msg-card input { font: inherit; font-size: 1.25rem; letter-spacing: .3em; padding: .55rem .7rem; border: 1px solid var(--m-line); border-radius: 8px; }
.es-msg-card .es-msg-send { align-self: flex-start; }
.es-msg-err { color: var(--m-err); font-weight: 600; }
.es-msg-link { margin-top: .4rem; padding: 0; border: 0; background: none; color: var(--m-bar); text-decoration: underline; font: inherit; cursor: pointer; }

/* 2026-11-06 the chats list - beside the chat on a computer */
.es-msg-h1.has-list { max-width: 1040px; }
.es-msg-app.has-list { max-width: 1040px; display: grid; grid-template-columns: minmax(240px, 320px) 1fr; }
.es-msg-pane { display: flex; flex-direction: column; min-width: 0; }
.es-msg-list { background: #fff; border-right: 1px solid var(--m-line); overflow-y: auto; }
.es-msg-chat { display: flex; gap: .7rem; align-items: center; padding: .7rem .9rem; color: var(--m-ink); text-decoration: none;
  border-bottom: 1px solid #eef0f2; }
.es-msg-chat:hover { background: #f5f6f6; }
.es-msg-chat.is-active { background: #ebeef0; }
.es-msg-chat .es-msg-initial { background: var(--m-bar); color: #fff; }
.es-msg-chat-body { display: flex; flex-direction: column; gap: .15rem; min-width: 0; flex: 1 1 auto; }
.es-msg-chat-top, .es-msg-chat-bottom { display: flex; align-items: baseline; gap: .5rem; min-width: 0; }
.es-msg-chat-top b { flex: 1 1 auto; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.es-msg-chat-time { flex: 0 0 auto; font-size: .75rem; color: var(--m-soft); }
.es-msg-chat-last { flex: 1 1 auto; font-size: .88rem; color: var(--m-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.es-msg-chat.is-unread .es-msg-chat-time { color: var(--m-send); font-weight: 600; }
.es-msg-chat-badge { flex: 0 0 auto; min-width: 1.25rem; padding: 0 .35rem; border-radius: 999px; background: var(--m-send); color: #fff;
  font-size: .75rem; font-weight: 700; line-height: 1.25rem; text-align: center; }
.es-msg-list-old { margin: 0; padding: .7rem .9rem .3rem; font-size: .78rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em;
  color: var(--m-soft); }
.es-msg-list-old ~ .es-msg-chat { opacity: .7; }
.es-msg-back { display: none; color: #fff; text-decoration: none; font-size: 2rem; line-height: 1; padding: 0 .3rem 0 0; }

/* phone: edge to edge, full height, like the app */
@media (max-width: 600px) {
  .es-msg-main { padding: 0; }
  .es-msg-h1 { padding: .6rem 1rem 0; box-sizing: border-box; font-size: 1.3rem; }
  .es-msg-app { border-radius: 0; border-left: 0; border-right: 0; min-height: calc(100vh - 4rem); min-height: calc(100dvh - 4rem); }
  .es-msg-bubble { max-width: 88%; }
}
/* phone and small tablet: the list OR the chat, with a back arrow */
@media (max-width: 760px) {
  .es-msg-app.has-list { display: flex; }
  .es-msg-app.has-list.view-thread .es-msg-list { display: none; }
  .es-msg-app.has-list.view-list .es-msg-pane { display: none; }
  .es-msg-app.has-list .es-msg-list { border-right: 0; flex: 1 1 auto; }
  .es-msg-app.has-list .es-msg-pane { flex: 1 1 auto; }
  .es-msg-back { display: inline-block; }
}