/* ===== PHASE 6: Live Features & Social Integration ===== */

/* ── Live Counter Widget ─────────────────────────────────────── */
.p6-live-counter {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  background: var(--color-surface, rgba(240,240,245,0.03));
  border: 1px solid var(--color-divider, rgba(240,240,245,0.08));
  border-radius: 14px;
  position: relative;
  overflow: hidden;
}
.p6-live-counter.is-live {
  border-color: rgba(255, 45, 120, 0.3);
}
.p6-live-counter.is-live::before {
  content: 'LIVE';
  position: absolute;
  top: 8px;
  right: 12px;
  padding: 2px 8px;
  background: #ff2d78;
  color: white;
  font-size: 0.65rem;
  font-weight: 700;
  border-radius: 4px;
  letter-spacing: 0.08em;
  animation: p6livePulse 2s ease infinite;
}

.p6-live-pulse {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(255, 45, 120, 0.3);
  flex-shrink: 0;
}
.p6-live-counter.is-live .p6-live-pulse {
  background: #ff2d78;
  animation: p6livePulse 2s ease infinite;
}

@keyframes p6livePulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.p6-live-stats {
  display: flex;
  flex-direction: column;
}

.p6-live-count {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--color-text, #f0f0f5);
  line-height: 1.1;
  transition: transform 0.3s ease;
}
.p6-live-count.p6-bump {
  animation: p6bumpNum 0.5s ease;
}
@keyframes p6bumpNum {
  0% { transform: scale(1); }
  50% { transform: scale(1.2); color: #ff2d78; }
  100% { transform: scale(1); }
}

.p6-live-label {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.p6-live-contributors {
  font-size: 0.9rem;
  color: var(--color-text-muted);
  white-space: nowrap;
}

.p6-live-recent {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow: hidden;
}

.p6-recent-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
}
.p6-recent-name { color: var(--color-text); font-weight: 500; }
.p6-recent-time { color: var(--color-text-muted); font-size: 0.75rem; }

/* ── Mosaic Grid ─────────────────────────────────────────────── */
.p6-mosaic-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  border-radius: 12px;
  overflow: hidden;
}

.p6-mosaic-tile {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
}
.p6-mosaic-tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s;
}
.p6-mosaic-tile:hover img { transform: scale(1.05); }

.p6-mosaic-name {
  position: absolute;
  bottom: 4px;
  left: 4px;
  padding: 2px 6px;
  background: rgba(0,0,0,0.7);
  color: white;
  font-size: 0.65rem;
  border-radius: 4px;
}

.p6-mosaic-empty,
.p6-mosaic-loading {
  padding: 40px;
  text-align: center;
  color: var(--color-text-muted);
}

/* ── Processing Status Page ──────────────────────────────────── */
.p6-processing-page,
.p6-stats-page {
  max-width: 900px;
  margin: 0 auto;
  padding: 100px 24px 80px;
}

.p6-page-title {
  font-size: clamp(1.5rem, 4vw, 2.25rem);
  font-weight: 700;
  color: var(--color-text, #f0f0f5);
  margin: 16px 0 8px;
}

.p6-page-subtitle {
  color: var(--color-text-muted);
  margin: 0 0 28px;
}

.p6-progress-overview {
  margin-bottom: 28px;
}

.p6-progress-bar-wrap {
  width: 100%;
  height: 8px;
  background: rgba(240, 240, 245, 0.06);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 8px;
}

.p6-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #ff2d78, #ff6ba0);
  border-radius: 4px;
  transition: width 0.5s ease;
}

.p6-progress-stats {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

.p6-status-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 32px;
}

.p6-status-card {
  padding: 18px 14px;
  background: var(--color-surface, rgba(240,240,245,0.03));
  border: 1px solid var(--color-divider, rgba(240,240,245,0.08));
  border-radius: 12px;
  text-align: center;
}

.p6-status-num {
  display: block;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-text, #f0f0f5);
}

.p6-status-label {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.p6-status-complete .p6-status-num { color: #10b981; }
.p6-status-active .p6-status-num { color: #00e5ff; }
.p6-status-failed .p6-status-num { color: #ef4444; }

.p6-section-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--color-text, #f0f0f5);
  margin: 0 0 16px;
}

/* ── Job List ────────────────────────────────────────────────── */
.p6-jobs-list {
  margin-top: 32px;
}

.p6-job-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-radius: 10px;
  margin-bottom: 4px;
  transition: background 0.15s;
}
.p6-job-row:hover { background: rgba(240,240,245,0.04); }

.p6-job-type {
  flex: 1;
  font-weight: 500;
  color: var(--color-text, #f0f0f5);
}

.p6-job-status-badge {
  padding: 3px 10px;
  border-radius: 10px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: capitalize;
}
.p6-job-completed .p6-job-status-badge { background: rgba(16,185,129,0.12); color: #10b981; }
.p6-job-processing .p6-job-status-badge,
.p6-job-running .p6-job-status-badge { background: rgba(0,229,255,0.12); color: #00e5ff; }
.p6-job-pending .p6-job-status-badge { background: rgba(240,240,245,0.06); color: var(--color-text-muted); }
.p6-job-failed .p6-job-status-badge { background: rgba(239,68,68,0.12); color: #ef4444; }

.p6-job-progress {
  width: 80px;
  height: 4px;
  background: rgba(240,240,245,0.08);
  border-radius: 2px;
  overflow: hidden;
}
.p6-job-progress-fill {
  height: 100%;
  background: #00e5ff;
  border-radius: 2px;
}

.p6-job-time {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  white-space: nowrap;
}

.p6-job-error {
  width: 100%;
  font-size: 0.8rem;
  color: #ef4444;
  margin-top: 4px;
}

/* ── Stats Dashboard ─────────────────────────────────────────── */
.p6-metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 32px;
}

.p6-metric-card {
  padding: 20px 16px;
  background: var(--color-surface, rgba(240,240,245,0.03));
  border: 1px solid var(--color-divider, rgba(240,240,245,0.08));
  border-radius: 12px;
  text-align: center;
}

.p6-metric-num {
  display: block;
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--color-text, #f0f0f5);
  line-height: 1.2;
}

.p6-metric-label {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ── Bar Chart ───────────────────────────────────────────────── */
.p6-timeline-section {
  margin-bottom: 32px;
}

.p6-bar-chart {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 160px;
  padding: 16px;
  background: var(--color-surface, rgba(240,240,245,0.03));
  border: 1px solid var(--color-divider, rgba(240,240,245,0.08));
  border-radius: 12px;
}

.p6-bar-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  justify-content: flex-end;
}

.p6-bar {
  width: 100%;
  max-width: 40px;
  background: linear-gradient(180deg, #ff2d78, rgba(255,45,120,0.4));
  border-radius: 4px 4px 0 0;
  min-height: 2px;
  position: relative;
  transition: height 0.3s ease;
}

.p6-bar-val {
  position: absolute;
  top: -18px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.7rem;
  color: var(--color-text-muted);
  white-space: nowrap;
}

.p6-bar-label {
  font-size: 0.65rem;
  color: var(--color-text-muted);
  margin-top: 6px;
  white-space: nowrap;
}

/* ── Contributors List ───────────────────────────────────────── */
.p6-contributors-section {
  margin-bottom: 32px;
}

.p6-contributor-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  border-radius: 8px;
  transition: background 0.15s;
}
.p6-contributor-row:hover { background: rgba(240,240,245,0.04); }

.p6-contributor-rank {
  width: 28px;
  font-size: 0.85rem;
  font-weight: 700;
  color: #ff2d78;
}

.p6-contributor-name {
  flex: 1;
  font-weight: 500;
  color: var(--color-text, #f0f0f5);
}

.p6-contributor-count {
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

.p6-contributor-dur {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  font-variant-numeric: tabular-nums;
}

/* ── Content Status Grid ─────────────────────────────────────── */
.p6-content-status-section { margin-bottom: 32px; }

.p6-content-status-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.p6-content-stat {
  padding: 18px;
  background: var(--color-surface, rgba(240,240,245,0.03));
  border: 1px solid var(--color-divider, rgba(240,240,245,0.08));
  border-radius: 12px;
  text-align: center;
}
.p6-cs-num { display: block; font-size: 1.5rem; font-weight: 700; color: var(--color-text); }
.p6-cs-label { font-size: 0.75rem; color: var(--color-text-muted); text-transform: uppercase; letter-spacing: 0.04em; }

/* ── Follow Button ───────────────────────────────────────────── */
.p6-follow-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border: 1px solid var(--color-divider, rgba(240,240,245,0.12));
  border-radius: 20px;
  background: none;
  color: var(--color-text);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}
.p6-follow-btn:hover {
  border-color: #ff2d78;
  background: rgba(255,45,120,0.06);
}
.p6-follow-btn.following {
  background: rgba(255,45,120,0.12);
  border-color: #ff2d78;
  color: #ff2d78;
}
.p6-follow-btn.following .p6-follow-icon { fill: #ff2d78; stroke: #ff2d78; }

/* ── Embed Modal ─────────────────────────────────────────────── */
.p6-embed-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0,0,0,0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s;
}
.p6-embed-modal.open { opacity: 1; }

.p6-embed-dialog {
  width: 90%;
  max-width: 560px;
  background: var(--color-surface, #1a1a20);
  border: 1px solid var(--color-divider);
  border-radius: 16px;
  overflow: hidden;
}

.p6-embed-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--color-divider, rgba(240,240,245,0.08));
}
.p6-embed-header h3 { margin: 0; font-size: 1.1rem; color: var(--color-text); }

.p6-embed-body {
  padding: 20px;
}

.p6-embed-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}

.p6-embed-code {
  width: 100%;
  padding: 12px;
  background: rgba(0,0,0,0.3);
  border: 1px solid var(--color-divider);
  border-radius: 8px;
  color: var(--color-text);
  font-family: monospace;
  font-size: 0.8rem;
  resize: none;
  margin-bottom: 12px;
}

.p6-embed-input {
  width: 100%;
  padding: 10px 12px;
  background: rgba(0,0,0,0.3);
  border: 1px solid var(--color-divider);
  border-radius: 8px;
  color: var(--color-text);
  font-size: 0.85rem;
}

.p6-embed-preview { margin-top: 20px; }
.p6-embed-preview h4 { font-size: 0.85rem; color: var(--color-text-muted); margin: 0 0 8px; }

/* ── Downloads Breakdown ─────────────────────────────────────── */
.p6-downloads-section { margin-bottom: 32px; }
.p6-downloads-breakdown { display: flex; gap: 12px; flex-wrap: wrap; }
.p6-dl-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 14px 20px;
  background: var(--color-surface, rgba(240,240,245,0.03));
  border: 1px solid var(--color-divider);
  border-radius: 10px;
}
.p6-dl-type { font-size: 0.8rem; color: var(--color-text-muted); text-transform: capitalize; }
.p6-dl-count { font-size: 1.25rem; font-weight: 700; color: var(--color-text); }

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 640px) {
  .p6-processing-page,
  .p6-stats-page { padding: 80px 16px 60px; }

  .p6-status-cards { grid-template-columns: repeat(2, 1fr); }

  .p6-metrics-grid { grid-template-columns: repeat(2, 1fr); }

  .p6-content-status-grid { grid-template-columns: 1fr; }

  .p6-mosaic-grid { grid-template-columns: repeat(3, 1fr); }

  .p6-bar-chart { height: 120px; padding: 10px; }

  .p6-live-counter { flex-wrap: wrap; }

  .p6-live-recent { display: none; }

  .p6-job-row { flex-wrap: wrap; gap: 8px; }
  .p6-job-progress { width: 100%; }
}
