/* Spindle — email list rows, reading pane styles */

/* ─── Row entrance animations (staggered) ───────────────────────────────── */
.thread-row      { animation: rise 0.32s cubic-bezier(0.16,1,0.3,1) both; }
.thread-row-skel { animation: rise 0.28s cubic-bezier(0.16,1,0.3,1) both; }

.thread-row:nth-child(1),  .thread-row-skel:nth-child(1)  { animation-delay:   0ms; }
.thread-row:nth-child(2),  .thread-row-skel:nth-child(2)  { animation-delay:  35ms; }
.thread-row:nth-child(3),  .thread-row-skel:nth-child(3)  { animation-delay:  70ms; }
.thread-row:nth-child(4),  .thread-row-skel:nth-child(4)  { animation-delay: 105ms; }
.thread-row:nth-child(5),  .thread-row-skel:nth-child(5)  { animation-delay: 140ms; }
.thread-row:nth-child(6),  .thread-row-skel:nth-child(6)  { animation-delay: 175ms; }
.thread-row:nth-child(7),  .thread-row-skel:nth-child(7)  { animation-delay: 210ms; }
.thread-row:nth-child(8),  .thread-row-skel:nth-child(8)  { animation-delay: 245ms; }
.thread-row:nth-child(9),  .thread-row-skel:nth-child(9)  { animation-delay: 280ms; }
.thread-row:nth-child(10), .thread-row-skel:nth-child(10) { animation-delay: 315ms; }
.thread-row:nth-child(n+11){ animation-delay: 350ms; }

/* ─── Thread list rows ───────────────────────────────────────────────────── */
.thread-row {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line-2);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: background 0.1s;
  position: relative;
}
.thread-row:hover  { background: var(--bg-hover); }
.thread-row.active { background: var(--bg-active); }

.thread-row .tr-top {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
}
.thread-row .tr-from    { color: var(--fg); display: flex; align-items: center; gap: 6px; }
.thread-row .tr-time    { color: var(--fg-dim); font-size: 11px; flex-shrink: 0; }
.thread-row .tr-subj    { color: var(--fg); font-size: 12px; }
.thread-row .tr-preview {
  color: var(--fg-dim);
  font-size: 11.5px;
  line-height: 1.45;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Unread indicator */
.thread-row .pip {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: transparent;
  display: inline-block;
  flex-shrink: 0;
}
.thread-row.unread .pip      { background: var(--accent, var(--fg-bright)); }
.thread-row.unread .tr-from,
.thread-row.unread .tr-subj  { color: var(--fg-bright); font-weight: 600; }

/* ─── Row hover actions ──────────────────────────────────────────────────── */
.thread-row .tr-actions {
  position: absolute;
  bottom: 8px;
  right: 10px;
  display: none;
  gap: 4px;
  align-items: center;
}
.thread-row:hover .tr-actions { display: flex; }

.tr-action-btn {
  background: var(--bg-2);
  border: 1px solid var(--line-2);
  color: var(--fg-dim);
  font-family: inherit;
  font-size: 11.5px;
  padding: 2px 7px;
  cursor: pointer;
  line-height: 1.4;
  transition: color 0.1s, border-color 0.1s;
}
.tr-action-btn:hover { color: var(--fg-bright); border-color: var(--line); }
.tr-action-delete:hover { color: #d4736c; border-color: rgba(212,115,108,0.5); }

/* Per-account load failure note in unified inbox */
.list-warn-note {
  padding: 7px 16px;
  font-size: 11px;
  color: #c97a6c;
  border-bottom: 1px solid var(--line-2);
  letter-spacing: 0.04em;
}

/* ─── Header refresh button ──────────────────────────────────────────────── */
.hdr-refresh-btn {
  background: none;
  border: none;
  color: var(--fg-dim);
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
  padding: 0 2px;
  line-height: 1;
  transition: color 0.15s;
}
.hdr-refresh-btn:hover { color: var(--fg-bright); }

/* ─── Pagination ─────────────────────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-top: 1px solid var(--line-2);
  flex-shrink: 0;
}
.pagination .pg-info {
  font-size: 11px;
  color: var(--fg-dim);
  letter-spacing: 0.08em;
}
.pagination .chip:disabled {
  opacity: 0.3;
  cursor: default;
}

/* Skeleton thread rows */
.thread-row-skel {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line-2);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.thread-row-skel .sk-line { height: 11px; }

/* ─── Reading pane ───────────────────────────────────────────────────────── */
.thread-view {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  animation: rise 0.38s cubic-bezier(0.16,1,0.3,1) both;
}

.thread-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.thread-header .th-subj {
  font-size: 16px;
  color: var(--fg-bright);
  margin-bottom: 6px;
  line-height: 1.3;
}
.thread-header .th-meta {
  font-size: 11px;
  color: var(--fg-dim);
  letter-spacing: 0.06em;
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
}
.thread-header .th-meta .em { color: var(--fg-bright); }
.thread-header .th-actions {
  margin-top: 14px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.thread-msgs {
  padding: 18px 24px;
  overflow-y: auto;
  flex: 1;
}

.msg {
  border: 1px solid var(--line-2);
  padding: 18px;
  margin-bottom: 14px;
  animation: rise 0.28s cubic-bezier(0.16,1,0.3,1) both;
}
.msg .msg-head {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 11.5px;
  color: var(--fg-dim);
  margin-bottom: 12px;
}
.msg-head-info { flex: 1; min-width: 0; }
.msg .msg-head .msg-from { color: var(--fg-bright); }
.msg .msg-body {
  font-size: 13px;
  color: var(--fg);
  line-height: 1.65;
}
.msg .msg-body-html {
  width: 100%;
  border: none;
  display: block;
  background: transparent;
  color-scheme: dark;
}
.msg .msg-sig {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line-2);
  font-size: 11.5px;
  color: var(--fg-dim);
}

/* Attachments */
.msg-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line-2);
}
.attachment-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: var(--bg-3);
  border: 1px solid var(--line-2);
  color: var(--fg);
  font-size: 11.5px;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}
.attachment-chip:hover {
  background: var(--bg-hover);
  border-color: var(--line-hover);
  color: var(--fg-bright);
}
.attachment-size {
  color: var(--fg-dim);
  font-size: 11px;
}

/* Images toggle */
.msg-images-bar {
  padding: 10px 14px;
  background: var(--bg-3);
  border: 1px solid var(--line-2);
  font-size: 11.5px;
  color: var(--fg-dim);
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.msg-images-bar button {
  background: none;
  border: 1px solid var(--line);
  color: var(--fg-dim);
  font-family: inherit;
  font-size: 11px;
  padding: 4px 8px;
  cursor: pointer;
}
.msg-images-bar button:hover { color: var(--fg-bright); }

/* ─── Thread message states ─────────────────────────────────────────────── */
.msg-collapsed {
  padding: 9px 18px;
  cursor: pointer;
  margin-bottom: 6px;
}
.msg-collapsed:hover { background: var(--bg-hover); }

.msg-summary {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  overflow: hidden;
}
.msg-summary .msg-from {
  color: var(--fg-bright);
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
  min-width: 100px;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.msg-summary-preview {
  color: var(--fg-dim);
  font-size: 11.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}
.msg-summary-date {
  color: var(--fg-dim);
  font-size: 11px;
  white-space: nowrap;
  flex-shrink: 0;
}

.msg-head-clickable {
  cursor: pointer;
}
.msg-head-clickable:hover .msg-from { opacity: 0.75; }

.msg-head-to {
  font-size: 10.5px;
  color: var(--fg-dim);
  margin-top: 3px;
}

/* ─── Context menu ───────────────────────────────────────────────────────── */
.ctx-menu {
  position: fixed;
  z-index: 9000;
  background: var(--bg-2);
  border: 1px solid var(--line);
  min-width: 162px;
  padding: 4px 0;
  font-family: inherit;
  font-size: 11.5px;
  box-shadow: 0 6px 20px rgba(0,0,0,.4);
  user-select: none;
}

.ctx-item {
  padding: 7px 14px;
  color: var(--fg);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  white-space: nowrap;
}
.ctx-item:hover { background: var(--bg-hover); color: var(--fg-bright); }
.ctx-item-del   { color: #d4736c; }
.ctx-item-del:hover { background: rgba(212,115,108,.1); color: #e08580; }

.ctx-sep {
  height: 1px;
  background: var(--line-2);
  margin: 4px 0;
}

/* Submenu */
.ctx-has-sub::after { content: '›'; margin-left: auto; padding-left: 16px; color: var(--fg-dim); }

.ctx-sub {
  display: none;
  position: absolute;
  left: 100%;
  top: -4px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  min-width: 160px;
  max-height: 240px;
  overflow-y: auto;
  padding: 4px 0;
  box-shadow: 0 6px 20px rgba(0,0,0,.4);
  z-index: 9001;
}
.ctx-has-sub:hover > .ctx-sub { display: block; }

.ctx-sub-item {
  padding: 7px 14px;
  color: var(--fg);
  cursor: pointer;
  white-space: nowrap;
}
.ctx-sub-item:hover { background: var(--bg-hover); color: var(--fg-bright); }

/* ─── Empty states ───────────────────────────────────────────────────────── */
.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 40px;
  text-align: center;
  color: var(--fg-dim);
  animation: rise 0.42s cubic-bezier(0.16,1,0.3,1) both;
}
.empty .empty-greet {
  font-size: 28px;
  color: var(--fg);
  letter-spacing: -0.01em;
  margin-bottom: 8px;
  line-height: 1.2;
}
.empty .empty-greet .em { color: var(--fg-bright); }
.empty .empty-sub {
  font-size: 12px;
  color: var(--fg-dim);
  margin-bottom: 18px;
}
.empty .empty-hint {
  font-size: 11px;
  color: var(--fg-dimmer);
}

/* ─── Sender avatar initials / Gravatar photos ───────────────────────────── */
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  flex-shrink: 0;
  letter-spacing: 0;
  user-select: none;
  vertical-align: middle;
}
.avatar-sm  { width: 20px; height: 20px; font-size: 10px; }
.avatar-row { width: 16px; height: 16px; font-size: 9px;  }
img.avatar  { object-fit: cover; display: inline-block; }
