/* Live Activity — realtime user activity monitoring */

.live-layout {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 16px;
}

/* Hero counters row */
.live-counters {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.live-counter {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  min-width: 140px;
  flex: 1;
}

.live-counter-value {
  font-size: 28px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.live-counter-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.live-counter-sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 6px;
}

.live-counter.pulse .live-counter-value {
  color: var(--success);
}

.live-counter.warn .live-counter-value {
  color: var(--warning);
}

.live-counter.error .live-counter-value {
  color: var(--error);
}

/* Grid layout for panels */
.live-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.live-grid-full {
  grid-column: 1 / -1;
}

@media (max-width: 900px) {
  .live-grid { grid-template-columns: 1fr; }
}

/* Panels */
.live-panel {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.live-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.live-panel-header h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.live-panel-body {
  padding: 0;
  max-height: 400px;
  overflow-y: auto;
}

.live-panel-body.padded {
  padding: 16px;
}

/* Event stream */
.live-event-row {
  display: grid;
  grid-template-columns: 90px 1fr 140px 90px;
  gap: 8px;
  padding: 8px 16px;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
  transition: background 0.3s;
  align-items: center;
}

.live-event-row:last-child {
  border-bottom: none;
}

.live-event-row.fresh {
  background: rgba(74, 222, 128, 0.06);
}

.live-event-time {
  color: var(--text-muted);
  font-size: 12px;
  font-family: var(--font-mono);
}

.live-event-name {
  font-weight: 500;
}

.live-event-user {
  color: var(--text-muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.live-event-badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
}

.live-event-badge.anon {
  background: rgba(251, 191, 36, 0.15);
  color: var(--warning);
}

.live-event-badge.auth {
  background: rgba(74, 222, 128, 0.15);
  color: var(--success);
}

/* Session cards */
.live-session-card {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
}

.live-session-card:last-child {
  border-bottom: none;
}

.live-session-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  flex-shrink: 0;
}

.live-session-dot.stale {
  background: var(--text-muted);
}

.live-session-info {
  flex: 1;
  min-width: 0;
}

.live-session-id {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
}

.live-session-events {
  font-size: 13px;
}

.live-session-events .event-pill {
  display: inline-block;
  background: var(--bg-hover);
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 11px;
  margin: 1px 2px;
}

.live-session-time {
  font-size: 12px;
  color: var(--text-muted);
  flex-shrink: 0;
}

/* Funnel bars */
.live-funnel-step {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
}

.live-funnel-label {
  width: 140px;
  font-size: 13px;
  text-align: right;
  flex-shrink: 0;
}

.live-funnel-bar-wrap {
  flex: 1;
  height: 28px;
  background: var(--bg-hover);
  border-radius: var(--radius-sm);
  overflow: hidden;
  position: relative;
}

.live-funnel-bar {
  height: 100%;
  border-radius: var(--radius-sm);
  transition: width 0.4s ease;
  display: flex;
  align-items: center;
  padding-left: 8px;
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  min-width: 30px;
}

.live-funnel-count {
  width: 50px;
  text-align: right;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

.live-funnel-pct {
  width: 40px;
  text-align: right;
  font-size: 12px;
  color: var(--text-muted);
  flex-shrink: 0;
}

/* Status indicator */
.live-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
}

.live-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
  animation: live-pulse 2s infinite;
}

@keyframes live-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* Paused state */
.live-status-dot.paused {
  background: var(--text-muted);
  animation: none;
}
