/* Components > Pipeline live section */
/* Markup and behaviour: _includes/sections/pipeline-live.html */

.pipeline-live-table {
  border: 1px solid #e9e9ef;
  border-radius: 0.5rem;
  background: #fff;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.04), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
  overflow: hidden;
}

.pipeline-live-table--head,
.pipeline-live-table--row {
  display: grid;
  grid-template-columns: 1fr 8.5rem 9.5rem;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem 1.25rem;
}

.pipeline-live-table--head {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: #94a3b8;
  background: #f9fafb;
  border-bottom: 1px solid #e9e9ef;
}

.pipeline-live-table--head span:nth-child(2),
.pipeline-live-table--head span:nth-child(3) {
  text-align: center;
}

/* Static, server-rendered conversations keep the preview stable. */
.pipeline-live-table--body {
  overflow: hidden;
  min-height: 23.75rem;
}

.pipeline-live-table--row {
  box-sizing: border-box;
  border-bottom: 1px solid #f1f5f9;
  font-size: 0.875rem;
  color: #6c757d;
  height: 4.75rem;
}

.pipeline-live-table--row:last-child {
  border-bottom: 0;
}

.pipeline-live-table--recipient {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  line-height: 1.5rem;
  color: #333;
  font-weight: 600;
}

.pipeline-live-table--date {
  flex: none;
  white-space: nowrap;
}

.pipeline-live-table--row.is-read .pipeline-live-table--recipient {
  font-weight: 400;
}

.pipeline-live-table--content {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  line-height: 1.5rem;
  min-width: 0;
}

.pipeline-live-table--subject,
.pipeline-live-table--snippet,
.pipeline-live-table--ellipsis {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.pipeline-live-table--sep {
  color: #cbd5e1;
}

.pipeline-live-table--badges {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  flex-wrap: wrap;
}

.pipeline-live-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.4rem 0.6rem;
  border-radius: 0.5rem;
  font-size: 75%;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}

.pipeline-live-badge--to-reply { background: #d3f0e5; color: #13674a; }
.pipeline-live-badge--to-follow-up { background: #d1ddff; color: #0f3094; }
.pipeline-live-badge--waiting { background: #e2e3e5; color: #3f4449; }
.pipeline-live-badge--archived { background: #fdf1da; color: #8e6b28; }
.pipeline-live-badge--event { background: #d8e6fd; color: #224b8f; }
.pipeline-live-badge--bounced { background: #fcdada; color: #8b2727; }

@media (max-width: 767.98px) {
  .pipeline-live-table--head {
    grid-template-columns: 1fr auto auto;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
  }

  .pipeline-live-table--body {
    min-height: 36.25rem;
  }

  .pipeline-live-table--row:nth-child(n + 6) {
    display: none;
  }

  /* Stack the email on its own line, then keep status and events together
     on a single left aligned row instead of pushing them to both edges. */
  .pipeline-live-table--row {
    grid-template-columns: auto 1fr;
    gap: 0.5rem;
    padding: 0.85rem 1rem;
    height: 7.25rem;
  }

  .pipeline-live-table--email {
    grid-column: 1 / -1;
  }

  .pipeline-live-table--badges {
    flex-wrap: nowrap;
    justify-content: flex-start;
  }
}

/* A contained conversation preview overlays the table without moving the page. */
.pipeline-live-table { position: relative; text-align: left; }
.pipeline-live-table--email { min-width: 0; }
.pipeline-live-table--row.is-selected { background: #edf3ff; }
.pipeline-live-shade {
  position: absolute; inset: 0; background: rgba(4, 20, 58, 0.12);
  opacity: 0; visibility: hidden; pointer-events: none;
  padding: 0; border: 0; width: 100%; height: 100%; cursor: pointer;
}
.pipeline-live-sidebar {
  position: absolute; top: 0; right: 0; height: 100%;
  width: 66%; max-width: 740px;
  background: #fff; border-left: 1px solid #e6e7eb;
  box-shadow: -8px 0 24px rgba(4, 20, 58, .08);
  transform: translateX(105%); visibility: hidden;
  transition: transform 250ms ease-out, visibility 0s linear 250ms;
  display: flex; flex-direction: column; pointer-events: none;
  color: #343434; font-size: .875rem;
}
.pipeline-live-table.is-conversation-open .pipeline-live-sidebar {
  transform: translateX(0); visibility: visible; pointer-events: auto;
  transition-delay: 0s;
}
@media (prefers-reduced-motion: reduce) {
  .pipeline-live-sidebar { transition: none; }
}
.pipeline-live-table.is-conversation-open .pipeline-live-shade { opacity: 1; visibility: visible; pointer-events: auto; }
.pipeline-live-sidebar--bar {
  display: flex; justify-content: space-between; align-items: center;
  padding: .7rem 1.5rem; border-bottom: 1px solid #e6e7eb;
}
.pipeline-live-sidebar--close {
  display: inline-flex; align-items: center; justify-content: center;
  width: 2rem; height: 2rem; padding: 0; border: 0; border-radius: .4rem;
  background: transparent; color: #7a8292; font-size: 1.5rem; line-height: 1; cursor: pointer;
}
.pipeline-live-sidebar--close:hover { background: #edf3ff; color: #343434; }
.pipeline-live-sidebar--close:focus-visible { outline: 2px solid #3785fa; }
.pipeline-live-sidebar--summary { padding: .85rem 1.5rem; background: #f9fafb; border-bottom: 1px solid #e6e7eb; }
.pipeline-live-sidebar--summary h3 { font-size: 1.15rem; margin: 0 0 .5rem; color: #222; }
.pipeline-live-sidebar--activity { color: #7a8292; margin-left: .6rem; font-size: .75rem; }
.pipeline-live-sidebar--messages { padding: 0 1.5rem 1rem; overflow: auto; min-height: 0; }
.pipeline-live-message { padding: .85rem 0; }
.pipeline-live-message + .pipeline-live-message { border-top: 1px solid #e6e7eb; }
.pipeline-live-message--sender { display: flex; align-items: center; gap: .65rem; }
.pipeline-live-message--sender strong { font-size: .8rem; }
.pipeline-live-message--sender strong span { font-weight: 400; color: #7a8292; }
.pipeline-live-message--sender small { display: block; color: #7a8292; font-size: .7rem; }
.pipeline-live-message--date { margin-left: auto; white-space: nowrap; }
.pipeline-live-avatar {
  display: flex; align-items: center; justify-content: center; flex: 0 0 2rem;
  width: 2rem; height: 2rem; border-radius: 50%; background: #e5edff; color: #2862bc;
}
.pipeline-live-avatar--recipient { background: #f3e7df; color: #8a6552; }
.pipeline-live-message p { margin: .65rem 0 0; line-height: 1.55; font-size: .875rem; }
.pipeline-live-sidebar--actions { display: flex; gap: .75rem; }
.pipeline-live-sidebar--actions > span {
  display: inline-flex; gap: .4rem; align-items: center; padding: .4rem .65rem;
  border: 1px solid #3785fa; border-radius: .5rem; color: #3785fa; font-size: .8rem;
}
.pipeline-live-sidebar--actions svg { width: 1rem; height: 1rem; stroke: currentColor; stroke-width: 2; }
@media (max-width: 767.98px) {
  .pipeline-live-sidebar { width: calc(100% - 1.5rem); }
  .pipeline-live-sidebar--bar, .pipeline-live-sidebar--summary { padding-left: 1rem; padding-right: 1rem; }
  .pipeline-live-sidebar--messages { padding-left: 1rem; padding-right: 1rem; }
  .pipeline-live-sidebar--activity { display: block; margin: .5rem 0 0; }
}
.pipeline-live-table--row { position: relative; }
.pipeline-live-row-trigger {
  display: none;
  position: absolute; inset: 0; width: 100%; height: 100%;
  padding: 0; border: 0; background: transparent; cursor: pointer;
}
.has-conversation-demo .pipeline-live-row-trigger { display: block; }
.pipeline-live-row-trigger:focus-visible { outline: 2px solid #3785fa; outline-offset: -3px; }
.has-conversation-demo .pipeline-live-table--row:hover { background: #edf3ff; }
.pipeline-live-table.has-conversation-demo.is-conversation-open .pipeline-live-sidebar { pointer-events: auto; }
