/* Conversations between employers and applicants - the thread both sides
   see (message-thread.js), the employer's inbox, and the counts on tabs and
   buttons that say something is waiting. Every colour is a token from
   styles.css. */

/* ---- Counts on tabs and buttons ---- */
.tab-badge, .application-unread {
  display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; padding: 0 5px;
  margin-left: 6px; border-radius: var(--radius-pill); background: var(--accent2); color: #FFFFFF;
  font-family: 'Inter', sans-serif; font-size: 11px; font-weight: 700; line-height: 1; vertical-align: 1px;
}
.tab-badge[hidden], .application-unread[hidden] { display: none; }

/* ---- A thread ---- */
.message-thread { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.message {
  max-width: 85%; padding: 9px 12px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface-soft);
  align-self: flex-start; min-width: 0;
}
.message.is-mine { align-self: flex-end; background: var(--accent2-soft); border-color: var(--accent2-border); }
.message-meta { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; font-size: 11.5px; color: var(--muted); margin-bottom: 3px; }
.message-author { font-weight: 700; color: var(--muted-strong); }
/* Exactly as typed: line breaks kept, long words and addresses broken rather than overflowing. */
.message-body { font-size: 13.5px; color: var(--ink); line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.message-read { margin-top: 3px; font-size: 11px; color: var(--accent2-dark); text-align: right; }
.message-report { margin-top: 4px; font-size: 11.5px; color: var(--muted); }
.message-empty { margin: 0 0 12px; font-size: 13px; color: var(--muted); }
.message-compose textarea { min-height: 72px; }
.message-compose-row { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.message-compose-row button { margin: 0 0 0 auto; }
.message-error { font-size: 12.5px; color: var(--danger); }

/* ---- The employer's inbox ---- */
.messages-split { display: grid; grid-template-columns: minmax(260px, 360px) minmax(0, 1fr); gap: 16px; align-items: start; }
.messages-inbox { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.messages-row {
  display: flex; flex-direction: column; align-items: stretch; gap: 2px; width: 100%; margin: 0; padding: 10px 12px; position: relative;
  text-align: left; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text);
  font-family: 'Inter', sans-serif; font-weight: 400;
}
.messages-row:hover { background: var(--surface-soft); opacity: 1; }
.messages-row.is-open { border-color: var(--accent2); box-shadow: 0 0 0 3px var(--accent2-soft); }
.messages-row-top { display: flex; justify-content: space-between; gap: 8px; padding-right: 26px; }
.messages-row-name { font-size: 14px; font-weight: 600; color: var(--ink); overflow-wrap: anywhere; }
.messages-row.is-unread .messages-row-name { font-weight: 800; }
.messages-row-time { flex: none; font-size: 11.5px; color: var(--muted); }
.messages-row-job { font-size: 12px; color: var(--muted); }
.messages-row-last { font-size: 13px; color: var(--muted-strong); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.messages-unread {
  position: absolute; top: 10px; right: 10px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: var(--radius-pill);
  background: var(--accent2); color: #FFFFFF; font-size: 11px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center;
}
.messages-thread-pane { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); padding: 16px 18px; min-width: 0; }
.messages-thread-pane:empty { display: none; }
.messages-thread-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.messages-thread-head h2 { margin: 0; font-size: 18px; overflow-wrap: anywhere; }
.messages-thread-head button { margin: 0; }
.messages-thread-job { font-size: 13px; color: var(--muted); }

/* ---- Several at once, from the applicant list ---- */
.applicants-bulk-compose { flex-basis: 100%; }
.applicants-bulk-compose[hidden] { display: none; }
.applicants-bulk-compose .employer-hint { margin: 4px 0 6px; }

/* ---- The student's side ---- */
.apply-messages { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--border); }
.apply-messages h4 { margin: 0 0 10px; font-size: 14px; color: var(--ink); font-family: 'Space Grotesk', sans-serif; }
.application-sent-actions .small-btn { display: inline-flex; align-items: center; }

@media (max-width: 960px) {
  .messages-split { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .message { max-width: 100%; }
}
