/* THE CHATS MIRROR, DRESSED AS WHATSAPP.
 *
 * This screen shows an agent's own WhatsApp back to the office. Arjav asked
 * for it to look like the real thing, and that is the right instinct: the
 * people reading it have WhatsApp open on the next monitor, and a table of
 * rows with a "Last message" column makes them translate between two layouts
 * to answer one question. The closer this sits to what they already know, the
 * less they have to think.
 *
 * So the palette is WhatsApp's own, not an interpretation of it: #efeae2 for
 * the conversation, #d9fdd3 for what we sent, white for what they sent,
 * #667781 for every timestamp. Anything invented here would read as almost-
 * right, which is worse than either copying it or clearly not.
 *
 * ONE DELIBERATE DIFFERENCE. This is a record, not a client — nothing can be
 * sent from it. So there is no composer at the foot of the thread, and the
 * header carries a plain line saying it is a copy. Making it look sendable
 * and then not sending is the one way a faithful copy would do harm.
 */

/* ---------------------------------------------------------- the chat list */
.wa-list { background: #fff; }

.wa-row {
  display: flex; align-items: center; gap: 13px;
  padding: 10px 16px; cursor: pointer;
  border-bottom: 1px solid #f0f2f5;
}
.wa-row:hover { background: #f5f6f6; }
.wa-row:focus-visible { outline: 2px solid #00a884; outline-offset: -2px; }

/* No photos reach the desk, so the circle carries initials. WhatsApp's own
   placeholder grey, not a colour of our choosing. */
.wa-av {
  width: 49px; height: 49px; flex: none; border-radius: 50%;
  background: #dfe5e7; color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 17px; font-weight: 500; letter-spacing: .5px;
  user-select: none;
}
.wa-av.wa-av-lead { background: #b1b9bd; }
/* A group: WhatsApp's own grey-on-grey people mark, not a colour of ours. */
.wa-av.wa-av-group { background: #dfe5e7; font-size: 22px; }

/* The sender's name above a group message — one of the colours WhatsApp
   itself assigns, chosen from the name so the same person is the same colour
   throughout. Only on incoming: our own bubbles do not need a name. */
.wa-sender { font-size: 12.8px; font-weight: 600; color: #1f7aec; margin: 0 0 2px; }

.wa-mid { flex: 1; min-width: 0; }
.wa-name {
  font-size: 15.5px; color: #111b21; line-height: 20px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.wa-name .wa-num { color: #667781; font-size: 13px; margin-left: 7px; }
.wa-prev {
  display: flex; align-items: center; gap: 4px;
  font-size: 13.5px; color: #667781; line-height: 19px; margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.wa-prev .wa-dim { color: #8696a0; font-style: italic; }

.wa-right { text-align: right; flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.wa-when { font-size: 12px; color: #667781; white-space: nowrap; }
.wa-when.wa-waiting { color: #00a884; }

/* WhatsApp's unread pill. Here it means "they spoke last and nothing has gone
   back" — the same thing the old amber "waiting" tag meant, in the shape the
   reader already knows. */
.wa-pill {
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px;
  background: #25d366; color: #fff; font-size: 12px; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
}
.wa-tag {
  font-size: 11px; color: #667781; background: #f0f2f5;
  border-radius: 4px; padding: 1px 5px; white-space: nowrap;
}

/* ------------------------------------------------------- the conversation */
/* The doodle. A single tiled SVG at very low opacity — WhatsApp's wallpaper is
   a dense pattern of small marks, and a flat beige reads as a placeholder for
   it. Kept faint enough that message text never fights it. */
.wa-thread {
  background-color: #efeae2;
  background-image:
    radial-gradient(circle at 12px 10px, rgba(17,27,33,.045) 1.6px, transparent 1.7px),
    radial-gradient(circle at 46px 38px, rgba(17,27,33,.035) 2.2px, transparent 2.3px),
    radial-gradient(circle at 78px 16px, rgba(17,27,33,.04) 1.2px, transparent 1.3px);
  background-size: 96px 72px, 96px 72px, 96px 72px;
  padding: 12px 5% 18px;
}

.wa-daypill { text-align: center; margin: 16px 0 12px; }
.wa-daypill span {
  background: #fff; color: #54656f; font-size: 12.2px; font-weight: 500;
  padding: 5px 12px; border-radius: 7px; text-transform: uppercase;
  letter-spacing: .3px; box-shadow: 0 1px .5px rgba(11,20,26,.13);
}

.wa-line { display: flex; margin-bottom: 2px; }
.wa-line.out { justify-content: flex-end; }
.wa-line.in { justify-content: flex-start; }
/* A run of messages from the same side gets one tail, on the first — the way
   the app groups them. The gap widens when the side changes. */
.wa-line.turn { margin-top: 10px; }

.wa-bub {
  position: relative; max-width: min(65%, 520px);
  padding: 6px 9px 8px; border-radius: 7.5px;
  font-size: 14.2px; line-height: 19px; color: #111b21;
  box-shadow: 0 1px .5px rgba(11,20,26,.13);
  word-wrap: break-word;
}
.wa-line.out .wa-bub { background: #d9fdd3; }
.wa-line.in .wa-bub { background: #fff; }

/* The tail, drawn as a triangle on the first bubble of a run. */
.wa-line.turn .wa-bub::before {
  content: ""; position: absolute; top: 0; width: 0; height: 0;
  border: 10px solid transparent;
}
.wa-line.turn.out .wa-bub { border-top-right-radius: 0; }
.wa-line.turn.out .wa-bub::before {
  right: -9px; border-top-color: #d9fdd3; border-left-color: #d9fdd3;
  border-bottom: 0; border-right: 0;
}
.wa-line.turn.in .wa-bub { border-top-left-radius: 0; }
.wa-line.turn.in .wa-bub::before {
  left: -9px; border-top-color: #fff; border-right-color: #fff;
  border-bottom: 0; border-left: 0;
}

.wa-txt { white-space: pre-wrap; }
.wa-txt a { color: #027eb5; }
.wa-missing { color: #8696a0; font-style: italic; font-size: 13.5px; }

/* The time sits inside the bubble, bottom right, with room reserved so a
   short message does not wrap around it — the same trick the app uses. */
.wa-meta {
  float: right; margin: 8px -4px -4px 10px;
  font-size: 11px; color: #667781; line-height: 15px;
  display: flex; align-items: center; gap: 3px;
}
.wa-tick { color: #667781; font-size: 13px; line-height: 15px; }
.wa-tick.read { color: #53bdeb; }

/* A call is not a message. WhatsApp puts these in the middle of the thread
   with an icon, and so does this — a call in a green bubble would read as
   something somebody typed. */
.wa-event { display: flex; justify-content: center; margin: 10px 0; }
.wa-event span {
  background: #fff; color: #54656f; font-size: 12.5px;
  padding: 6px 12px; border-radius: 7px;
  box-shadow: 0 1px .5px rgba(11,20,26,.13);
  display: inline-flex; align-items: center; gap: 7px;
}
.wa-event .wa-ico { font-size: 13px; line-height: 1; }
.wa-event.missed span { color: #b02e2e; }

/* The header above a conversation. */
.wa-head {
  display: flex; align-items: center; gap: 12px;
  background: #f0f2f5; padding: 9px 16px;
  border-bottom: 1px solid #d1d7db;
}
.wa-head .wa-av { width: 40px; height: 40px; font-size: 15px; }
.wa-head-name { font-size: 15.5px; color: #111b21; line-height: 20px; }
.wa-head-sub { font-size: 12.5px; color: #667781; line-height: 17px; }

/* The one place this deliberately is not WhatsApp: it cannot send. Said in
   the footer where the composer would be, so nobody hunts for one. */
.wa-noreply {
  background: #f0f2f5; border-top: 1px solid #d1d7db;
  padding: 11px 16px; text-align: center;
  font-size: 12.5px; color: #667781;
}

@media (prefers-reduced-motion: reduce) {
  .wa-row { transition: none; }
}

/* An agent's own chat list, drawn on the page rather than in a pop-up (30 Sep).
   The pop-up's body scrolls inside a fixed-height panel; on the page it is the
   page that scrolls, so the list takes its natural height. */
.wa-inline .doc-body { overflow: visible; }
.wa-inline .doc-bar { background: #fff; }
