/* conversations.css — layout of the Conversations page (conversations.js).
 * Page width, padding, title and empty state come from page.css (.page,
 * .page-title, .ui-empty). Colours, radii and shadows come from the shared
 * classes in ui.css
 * (.ui-panel, .ui-panel-floating, .field, .badge, .btn-ghost, .btn-secondary,
 * .btn-danger) and the tokens in base.css, so both themes apply as is. */

.conversations-panel {
  display: none;
  flex: 1;
  overflow-y: auto;
}
.conversations {
  display: flex; flex-direction: column; gap: 14px;
}
.conversations-head { margin-bottom: 12px; }

.conversations-filter {
  width: 100%;
  max-width: 420px;
  box-sizing: border-box;
  padding: 11px 14px;
  border: 1px solid;
  font: inherit; font-size: 15px;
}

.conversations-status { margin: 0; color: var(--text-dim); font-size: 13px; overflow-wrap: anywhere; }
.conversations-status:empty { display: none; }
.conversations-status.error { color: var(--error); }
.conversations-load-error { margin: 0; color: var(--error); font-size: 13px; overflow-wrap: anywhere; }
.conversations-load-error:empty { display: none; }

.conversations-groups { display: flex; flex-direction: column; gap: 24px; }
.conversations-group-head {
  margin: 0 0 10px;
  color: var(--text-dim);
  font-size: 11px; font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.conversations-list {
  list-style: none;
  margin: 0; padding: 0;
  display: flex; flex-direction: column; gap: 12px;
}

/* A row: the conversation's link, then its actions (shown on hover/focus).
   The link is three columns: title (with the summary under it), messages and
   time. The last two have fixed widths, so they line up across rows and day
   groups whatever the title's length; the actions float over them on hover
   instead of taking room of their own. */
.conversation-row {
  position: relative;
  display: flex; align-items: center;
  padding: 0;
  border: 1px solid;
  min-width: 0;
}
.conversation-row:focus-within,
.conversation-row.active { border-color: var(--accent); }
.conversation-link {
  flex: 1; min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 7.5em 5.5em;
  align-items: baseline;
  column-gap: 16px;
  padding: 16px 20px;
  color: var(--text);
  text-decoration: none;
  border-radius: inherit;
}
.conversation-link:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.conversation-main { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.conversation-line { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.conversation-title {
  flex: 0 1 auto; min-width: 0;
  font-size: 16px; font-weight: 700;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.conversation-row:hover .conversation-title { color: var(--accent); }
.conversation-open, .conversation-agent { flex-shrink: 0; }
.conversation-count,
.conversation-time {
  color: var(--text-dim);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.conversation-summary {
  color: var(--text-secondary, var(--text-dim));
  font-size: 14px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.conversation-actions {
  position: absolute;
  top: 50%; right: 12px;
  transform: translateY(-50%);
  display: flex; gap: 2px;
  padding: 2px;
  border-radius: var(--radius-md);
  background: var(--glass-bg-strong);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s ease;
}
.conversation-row:hover .conversation-actions,
.conversation-row:focus-within .conversation-actions { opacity: 1; pointer-events: auto; }
.conversation-action.btn-ghost { padding: 6px 10px; font-size: 13px; white-space: nowrap; }
.conversation-action.conversation-delete:hover:not(:disabled) { color: var(--tone-danger-text); }

/* A filter that matches nothing: one line (the empty page has .ui-empty). */
.conversations-empty:not(.ui-empty) { color: var(--text-dim); font-style: italic; }

/* Delete confirmation */
.conversations-confirm {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  background: var(--modal-overlay);
  z-index: 100;
}
.conversations-confirm-box {
  width: min(400px, 100%);
  box-sizing: border-box;
  padding: 24px;
  border: 1px solid;
  border-radius: var(--radius-lg);
}
.conversations-confirm-box h2 { margin: 0 0 8px; color: var(--text); font-size: 18px; font-weight: 800; }
.conversations-confirm-box p { margin: 0 0 20px; color: var(--text-secondary, var(--text-dim)); font-size: 14px; overflow-wrap: anywhere; }
.conversations-confirm-actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }

/* Touch screens have no hover, and narrow screens no room beside the text:
   the actions stay visible, under the text. */
@media (hover: none), (max-width: 700px) {
  .conversation-row { flex-direction: column; align-items: stretch; }
  .conversation-link { padding-bottom: 6px; }
  .conversation-actions {
    position: static;
    transform: none;
    flex-wrap: wrap;
    padding: 0 6px 6px;
    background: none;
    opacity: 1;
    pointer-events: auto;
  }
}
@media (max-width: 700px) {
  .conversations-filter { max-width: none; }
  /* No room beside the title: the messages and time make a second line under
     it, still in fixed columns, so they line up from row to row. */
  .conversation-link {
    padding: 14px 16px 6px;
    grid-template-columns: 7em 6em minmax(0, 1fr);
    column-gap: 10px; row-gap: 4px;
  }
  .conversation-main { grid-column: 1 / -1; }
  .conversation-count, .conversation-time { grid-row: 2; text-align: left; }
}
