/**
 * Marketplace Timeline — FR-016.5D
 *
 * Transforms the LIVE Feed from a debug log into a modern activity timeline.
 * Typography, badges, colors, spacing — everything for the marketplace story.
 *
 * @package XOS\Presentation
 * @version 1.0.0 — FR-016.5D
 */

/* ═══════════════════════════════════════════════════════════════
   TIMELINE CONTAINER
   ═══════════════════════════════════════════════════════════════ */

.timeline-feed {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0;
  max-width: 100%;
}

/* ═══════════════════════════════════════════════════════════════
   TIMELINE HEADER
   ═══════════════════════════════════════════════════════════════ */

.timeline-header {
  padding: 16px 0 12px;
  margin-bottom: 4px;
}

.timeline-header-top {
  display: flex;
  align-items: center;
  gap: 8px;
}

.timeline-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #10B981;
  flex-shrink: 0;
}

.timeline-dot--pulse {
  animation: tl-dot-pulse 1.2s ease-in-out infinite;
}

@keyframes tl-dot-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(1.3); }
}

.timeline-title {
  font-size: 0.9375rem;
  font-weight: 700;
  color: #111827;
  margin: 0;
  letter-spacing: 0.025em;
}

.timeline-subtitle {
  font-size: 0.75rem;
  color: #6B7280;
  margin: 2px 0 0 18px;
}

/* ═══════════════════════════════════════════════════════════════
   TIMELINE ITEM — Base
   ═══════════════════════════════════════════════════════════════ */

.tl-item {
  border-bottom: 1px solid #F3F4F6;
  padding: 14px 0;
}

.tl-item:last-child {
  border-bottom: none;
}

.tl-item--empty {
  text-align: center;
  padding: 24px 0;
  color: #9CA3AF;
}

.tl-item-inner {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* ═══════════════════════════════════════════════════════════════
   TIMESTAMP — Small, grey, secondary
   ═══════════════════════════════════════════════════════════════ */

.tl-time {
  font-size: 0.6875rem;
  color: #9CA3AF;
  line-height: 1.4;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
  white-space: nowrap;
  user-select: none;
}

/* ═══════════════════════════════════════════════════════════════
   EVENT BADGE — Colored pill with icon
   ═══════════════════════════════════════════════════════════════ */

.tl-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.6;
  white-space: nowrap;
  align-self: flex-start;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

.tl-badge-icon {
  font-size: 0.75rem;
  line-height: 1;
}

.tl-badge-label {
  line-height: 1;
}

/* ═══════════════════════════════════════════════════════════════
   ACTOR — Name bold, info grey smaller
   ═══════════════════════════════════════════════════════════════ */

.tl-actor {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px;
  margin: 2px 0;
}

.tl-actor-name {
  font-size: 0.875rem;
  font-weight: 700;
  color: #1F2937;
  line-height: 1.4;
}

.tl-actor-info {
  font-size: 0.6875rem;
  color: #9CA3AF;
  line-height: 1.4;
}

/* ═══════════════════════════════════════════════════════════════
   ACTION — Normal weight, readable
   ═══════════════════════════════════════════════════════════════ */

.tl-action {
  font-size: 0.8125rem;
  color: #4B5563;
  line-height: 1.5;
}

/* ═══════════════════════════════════════════════════════════════
   ROUTE — Bold, prominent
   ═══════════════════════════════════════════════════════════════ */

.tl-route {
  margin: 2px 0;
}

.tl-route-text {
  font-size: 0.9375rem;
  font-weight: 700;
  color: #111827;
  line-height: 1.5;
}

/* ═══════════════════════════════════════════════════════════════
   VALUE — Seats, distance, price, stars
   ═══════════════════════════════════════════════════════════════ */

.tl-value {
  font-size: 0.75rem;
  color: #6B7280;
  line-height: 1.4;
  display: inline-block;
  margin-right: 12px;
}

.tl-value--price {
  color: #2563EB;
  font-weight: 600;
}

.tl-value--stars {
  color: #F59E0B;
  letter-spacing: 0.1em;
}

/* ═══════════════════════════════════════════════════════════════
   LEFT BORDER ACCENT by category
   ═══════════════════════════════════════════════════════════════ */

.tl-item[data-category="searching"] { border-left: 3px solid #F59E0B; padding-left: 12px; }
.tl-item[data-category="browsing"] { border-left: 3px solid #E5E7EB; padding-left: 12px; }
.tl-item[data-category="viewing"] { border-left: 3px solid #E5E7EB; padding-left: 12px; }
.tl-item[data-category="listing_created"] { border-left: 3px solid #2563EB; padding-left: 12px; }
.tl-item[data-category="cargo_created"] { border-left: 3px solid #F97316; padding-left: 12px; }
.tl-item[data-category="booking"] { border-left: 3px solid #10B981; padding-left: 12px; }
.tl-item[data-category="cargo_booking"] { border-left: 3px solid #F97316; padding-left: 12px; }
.tl-item[data-category="matched"] { border-left: 3px solid #8B5CF6; padding-left: 12px; }
.tl-item[data-category="in_progress"] { border-left: 3px solid #3B82F6; padding-left: 12px; }
.tl-item[data-category="completed"] { border-left: 3px solid #10B981; padding-left: 12px; }
.tl-item[data-category="review"] { border-left: 3px solid #8B5CF6; padding-left: 12px; }
.tl-item[data-category="online"] { border-left: 3px solid #10B981; padding-left: 12px; }
.tl-item[data-category="offline"] { border-left: 3px solid #9CA3AF; padding-left: 12px; }
.tl-item[data-category="contact"] { border-left: 3px solid #14B8A6; padding-left: 12px; }
.tl-item[data-category="vehicle_full"] { border-left: 3px solid #EF4444; padding-left: 12px; }
.tl-item[data-category="cargo_update"] { border-left: 3px solid #F97316; padding-left: 12px; }
.tl-item[data-category="listing_archived"] { border-left: 3px solid #E5E7EB; padding-left: 12px; }

/* No left border for empty */
.tl-item--empty {
  border-left: none !important;
  padding-left: 0 !important;
}

/* ═══════════════════════════════════════════════════════════════
   SPACING — Timestamp and actor must never touch
   ═══════════════════════════════════════════════════════════════ */

.tl-time + .tl-badge,
.tl-badge + .tl-actor,
.tl-actor + .tl-action,
.tl-action + .tl-route,
.tl-route + .tl-value {
  margin-top: 4px;
}

/* Ensure timestamp is first and has bottom margin */
.tl-time {
  margin-bottom: 6px;
  display: block;
}

/* ═══════════════════════════════════════════════════════════════
   MOBILE
   ═══════════════════════════════════════════════════════════════ */

@media (max-width: 639px) {
  .tl-item {
    padding: 12px 0 12px 12px;
  }

  .tl-actor {
    gap: 4px;
  }

  .tl-actor-name {
    font-size: 0.8125rem;
  }

  .tl-actor-info {
    font-size: 0.625rem;
  }

  .tl-route-text {
    font-size: 0.8125rem;
  }

  .tl-badge {
    font-size: 0.5625rem;
    padding: 2px 8px;
  }

  .tl-time {
    font-size: 0.625rem;
  }

  .tl-action {
    font-size: 0.75rem;
  }
}

/* ═══════════════════════════════════════════════════════════════
   DESKTOP — Resemble LinkedIn/Facebook activity
   ═══════════════════════════════════════════════════════════════ */

@media (min-width: 768px) {
  .timeline-feed {
    max-width: 680px;
  }

  .tl-item-inner {
    gap: 6px;
  }

  .tl-actor-name {
    font-size: 0.9375rem;
  }

  .tl-route-text {
    font-size: 1rem;
  }

  .tl-badge {
    padding: 3px 12px;
    font-size: 0.6875rem;
  }
}

/* ═══════════════════════════════════════════════════════════════
   HIDE LEGACY
   ═══════════════════════════════════════════════════════════════ */

.mp-event-item,
.mp-event-time,
.mp-event-msg,
.live-dot,
.live-title,
.live-header {
  /* Legacy classes still used by JS — keep but don't style */
}