/* ═══════════════════════════════════════════════════════════════
   Sherlock – Timeline Tab
   timeline.css – Vertical event timeline
   ═══════════════════════════════════════════════════════════════ */

/* ── Wrapper ─────────────────────────────────────────────────── */

.timeline-wrap {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

/* ── Toolbar ─────────────────────────────────────────────────── */

.timeline-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  flex-shrink: 0;
}

.timeline-count {
  font-size: 12px;
  color: var(--text-muted);
}

.timeline-type-filter {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

.timeline-type-filter label {
  font-size: 11px;
  color: var(--text-muted);
}

.timeline-type-filter select {
  font-size: 11px;
  padding: 2px 6px;
  border: 1px solid var(--border-default);
  border-radius: 3px;
  background: var(--bg-surface);
  color: var(--text-primary);
}

/* ── Scrollable timeline body ────────────────────────────────── */

.timeline {
  flex: 1;
  overflow-y: auto;
  padding: 16px 16px 32px;
  position: relative;
}

/* ── Timeline item ───────────────────────────────────────────── */

.tl-item {
  display: grid;
  grid-template-columns: 148px 20px 1fr;
  gap: 0 0;
  position: relative;
  min-height: 40px;
}

/* Vertical connector between items */
.tl-item::before {
  content: '';
  position: absolute;
  left: calc(148px + 9px); /* center of the dot column */
  top: 20px;
  bottom: 0;
  width: 2px;
  background: var(--border-subtle);
  z-index: 0;
}

.tl-item:last-child::before {
  display: none;
}

/* ── Time column ─────────────────────────────────────────────── */

.tl-time {
  font-family: 'JetBrains Mono', 'Fira Mono', 'Cascadia Code', 'Roboto Mono', monospace;
  font-size: 10.5px;
  color: var(--text-muted);
  text-align: right;
  padding: 10px 10px 10px 0;
  white-space: nowrap;
  line-height: 1.3;
  user-select: text;
}

/* ── Dot column ──────────────────────────────────────────────── */

.tl-dot {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 12px;
}

.tl-dot::after {
  content: '';
  display: block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid currentColor;
  background: var(--bg-surface);
  flex-shrink: 0;
}

/* ── Content column ──────────────────────────────────────────── */

.tl-content {
  padding: 8px 0 8px 10px;
  min-width: 0;
}

.tl-type {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tl-desc {
  font-size: 11.5px;
  color: var(--text-secondary);
  line-height: 1.4;
}

/* ── Clickable items ─────────────────────────────────────────── */

.tl-item--clickable {
  cursor: pointer;
  border-radius: 4px;
  transition: background 0.1s;
}

.tl-item--clickable:hover {
  background: var(--bg-hover);
}

.tl-item--clickable:hover .tl-dot::after {
  background: currentColor;
}

.tl-item--clickable .tl-content::after {
  content: '→ Records';
  display: inline-block;
  font-size: 10px;
  color: var(--accent);
  margin-left: 6px;
  opacity: 0;
  transition: opacity 0.1s;
}

.tl-item--clickable:hover .tl-content::after {
  opacity: 1;
}

/* ── Severity colors (apply to .tl-dot and .tl-type) ────────── */

.tl-sev-info {
  color: var(--sev-info);
}
.tl-sev-info .tl-dot {
  color: var(--sev-info);
}

.tl-sev-notice {
  color: var(--sev-notice);
}
.tl-sev-notice .tl-dot {
  color: var(--sev-notice);
}
.tl-sev-notice .tl-type {
  color: var(--sev-notice);
}

.tl-sev-warning {
  color: var(--sev-warning);
}
.tl-sev-warning .tl-dot {
  color: var(--sev-warning);
}
.tl-sev-warning .tl-type {
  color: var(--sev-warning);
}

.tl-sev-critical {
  color: var(--sev-critical);
}
.tl-sev-critical .tl-dot {
  color: var(--sev-critical);
}
.tl-sev-critical .tl-type {
  color: var(--sev-critical);
}

.tl-sev-data-gap {
  color: var(--sev-data-gap);
}
.tl-sev-data-gap .tl-dot {
  color: var(--sev-data-gap);
}
.tl-sev-data-gap .tl-type {
  color: var(--sev-data-gap);
}

/* ── Highlight animation (jump from timeline) ────────────────── */

@keyframes tl-record-flash {
  0%   { background: rgba(0, 67, 206, 0.18); }
  100% { background: transparent; }
}

.tl-highlight {
  animation: tl-record-flash 1.4s ease-out forwards;
}

/* ── Group dividers (date changes) ───────────────────────────── */

.tl-date-divider {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 0 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.tl-date-divider::before,
.tl-date-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-subtle);
}

/* ── Type badge (icon prefix) ────────────────────────────────── */

.tl-type-badge {
  display: inline-block;
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 3px;
  background: currentColor;
  margin-right: 4px;
  opacity: 0.15;
}
