/* ── Product Analytics Dashboard ──────────────────────────── */

.pa-section { margin-bottom: 32px; }
.pa-section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px; padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.pa-section-title {
  font-size: 14px; font-weight: 600; color: var(--text-1); margin: 0;
  display: flex; align-items: center; gap: 8px;
}
.pa-controls { display: flex; gap: 8px; align-items: center; }
.pa-select {
  padding: 5px 10px; font-size: 11px; font-family: var(--font-body);
  background: var(--bg-3); border: 1px solid var(--border); border-radius: var(--r);
  color: var(--text-1); cursor: pointer; outline: none;
}
.pa-select:focus { border-color: var(--accent); }
.pa-select option { background: var(--bg-3); color: var(--text-1); }

.pa-card {
  background: var(--bg-3); border: 1px solid var(--border); border-radius: var(--r);
  padding: 20px; margin-bottom: 12px;
  animation: paFadeIn 0.4s ease both;
}
@keyframes paFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── Retention Heatmap ──────────────────────────────────── */
.pa-heatmap-wrap { overflow-x: auto; }
.pa-heatmap { border-collapse: collapse; width: 100%; min-width: 700px; }
.pa-heatmap th {
  font-size: 10px; font-weight: 500; color: var(--text-3);
  text-transform: uppercase; letter-spacing: 0.5px;
  padding: 6px 8px; text-align: center;
  border-bottom: 1px solid var(--border);
}
.pa-heatmap th:first-child { text-align: left; width: 120px; }
.pa-heatmap th:nth-child(2) { text-align: right; width: 60px; }
.pa-heatmap td {
  padding: 4px 6px; text-align: center;
  font-family: var(--font-mono); font-size: 11px;
  position: relative; cursor: default;
  transition: transform 0.1s ease;
}
.pa-heatmap td:first-child {
  text-align: left; font-family: var(--font-body);
  font-size: 11px; color: var(--text-2); font-weight: 500;
}
.pa-heatmap td:nth-child(2) {
  text-align: right; font-family: var(--font-mono);
  font-size: 11px; color: var(--text-3);
}
.pa-heatmap-cell {
  display: inline-block; padding: 4px 8px; border-radius: 3px;
  min-width: 48px; transition: all 0.15s ease;
  color: var(--text-1);
}
.pa-heatmap-cell:hover { transform: scale(1.1); z-index: 2; }
.pa-heatmap tr { animation: paSlideUp 0.3s ease both; }
.pa-heatmap tr:nth-child(1) { animation-delay: 0.05s; }
.pa-heatmap tr:nth-child(2) { animation-delay: 0.1s; }
.pa-heatmap tr:nth-child(3) { animation-delay: 0.15s; }
.pa-heatmap tr:nth-child(4) { animation-delay: 0.2s; }
.pa-heatmap tr:nth-child(5) { animation-delay: 0.25s; }
.pa-heatmap tr:nth-child(6) { animation-delay: 0.3s; }
.pa-heatmap tr:nth-child(7) { animation-delay: 0.35s; }
.pa-heatmap tr:nth-child(8) { animation-delay: 0.4s; }
.pa-heatmap tr:nth-child(9) { animation-delay: 0.45s; }
.pa-heatmap tr:nth-child(10) { animation-delay: 0.5s; }
.pa-heatmap tr:nth-child(11) { animation-delay: 0.55s; }
.pa-heatmap tr:nth-child(12) { animation-delay: 0.6s; }
@keyframes paSlideUp {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── Funnel ─────────────────────────────────────────────── */
.pa-funnel-step {
  display: flex; align-items: center; gap: 16px;
  padding: 10px 0;
  animation: paFadeIn 0.5s ease both;
}
.pa-funnel-step:nth-child(1) { animation-delay: 0.1s; }
.pa-funnel-step:nth-child(2) { animation-delay: 0.2s; }
.pa-funnel-step:nth-child(3) { animation-delay: 0.3s; }
.pa-funnel-step:nth-child(4) { animation-delay: 0.4s; }
.pa-funnel-label {
  width: 140px; flex-shrink: 0;
  font-size: 12px; font-weight: 500; color: var(--text-2);
  text-align: right;
}
.pa-funnel-bar-wrap {
  flex: 1; height: 36px; background: var(--bg-4); border-radius: 4px;
  overflow: hidden; position: relative;
}
.pa-funnel-bar {
  height: 100%; border-radius: 4px;
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
  min-width: 4px;
}
.pa-funnel-bar-animated { width: 0 !important; }
.pa-funnel-dropoff {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  font-size: 10px; color: var(--text-3); font-family: var(--font-mono);
}
.pa-funnel-meta {
  width: 120px; flex-shrink: 0;
  font-family: var(--font-mono); font-size: 12px;
}
.pa-funnel-count { color: var(--text-1); font-weight: 500; }
.pa-funnel-conv { color: var(--text-3); font-size: 11px; display: block; }
.pa-funnel-arrow {
  display: flex; align-items: center; gap: 8px;
  padding: 2px 0 2px 156px;
  font-size: 10px; color: var(--text-3);
}
.pa-funnel-arrow svg { width: 12px; height: 12px; fill: var(--text-3); }

/* ── Event Explorer ─────────────────────────────────────── */
.pa-events-table { width: 100%; border-collapse: collapse; }
.pa-events-table th {
  text-align: left; padding: 8px 12px; font-size: 10px; font-weight: 500;
  color: var(--text-3); border-bottom: 1px solid var(--border);
  text-transform: uppercase; letter-spacing: 0.5px;
}
.pa-events-table td {
  padding: 10px 12px; border-bottom: 1px solid var(--border);
  font-size: 12px; vertical-align: middle;
}
.pa-events-table tr { cursor: pointer; transition: background 0.1s; }
.pa-events-table tr:hover { background: var(--bg-4); }
.pa-events-table .pa-event-name { font-weight: 500; color: var(--text-1); }
.pa-events-table .pa-num {
  font-family: var(--font-mono); text-align: right; color: var(--text-1);
}
.pa-sparkline-cell { text-align: center; }

/* Expandable row */
.pa-event-details {
  display: none; padding: 12px 16px;
  background: var(--bg-2); border-bottom: 1px solid var(--border);
}
.pa-event-details.open { display: table-row; }
.pa-detail-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px;
}
.pa-detail-block h4 {
  font-size: 10px; font-weight: 500; color: var(--text-3);
  text-transform: uppercase; margin-bottom: 8px; letter-spacing: 0.5px;
}
.pa-detail-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 3px 0; font-size: 11px;
}
.pa-detail-item-label { color: var(--text-2); max-width: 70%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pa-detail-item-value { font-family: var(--font-mono); color: var(--text-1); }

/* ── Paths ──────────────────────────────────────────────── */
.pa-paths-table { width: 100%; border-collapse: collapse; }
.pa-paths-table th {
  text-align: left; padding: 8px 12px; font-size: 10px; font-weight: 500;
  color: var(--text-3); border-bottom: 1px solid var(--border);
  text-transform: uppercase; letter-spacing: 0.5px;
}
.pa-paths-table td {
  padding: 10px 12px; border-bottom: 1px solid var(--border);
  font-size: 12px; vertical-align: top;
}
.pa-path-string {
  font-family: var(--font-mono); font-size: 11px; color: var(--text-2);
  word-break: break-all; line-height: 1.6;
}
.pa-path-string .pa-path-arrow { color: var(--text-3); margin: 0 2px; }
.pa-path-count { font-family: var(--font-mono); font-weight: 500; color: var(--text-1); text-align: right; }
.pa-path-duration { font-family: var(--font-mono); color: var(--text-3); text-align: right; }

/* ── Empty state ────────────────────────────────────────── */
.pa-empty {
  text-align: center; padding: 40px 20px;
  color: var(--text-3); font-size: 13px;
}

/* ═══════════════════════════════════════════════════════════ */
/* FEATURE 6: Live Dashboard                                  */
/* ═══════════════════════════════════════════════════════════ */
.pa-live-dot {
  display: inline-block; width: 8px; height: 8px;
  background: #2ecc71; border-radius: 50%;
  animation: paPulse 2s ease-in-out infinite;
}
@keyframes paPulse {
  0%, 100% { transform: scale(1); opacity: 1; box-shadow: 0 0 0 0 rgba(46, 204, 113, 0.4); }
  50% { transform: scale(1.3); opacity: 0.8; box-shadow: 0 0 8px 4px rgba(46, 204, 113, 0.2); }
}
.pa-live-timestamp {
  font-size: 10px; color: var(--text-3); font-family: var(--font-mono);
}
.pa-live-grid {
  display: grid; grid-template-columns: 160px 1fr 1fr; gap: 12px;
}
.pa-live-card {
  background: var(--bg-3); border: 1px solid var(--border); border-radius: var(--r);
  padding: 16px; animation: paFadeIn 0.4s ease both;
}
.pa-live-card-glow {
  border-color: rgba(46, 204, 113, 0.3);
  box-shadow: 0 0 12px rgba(46, 204, 113, 0.08);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.pa-live-big-num {
  font-family: var(--font-mono); font-size: 36px; font-weight: 700;
  color: #2ecc71; line-height: 1;
}
.pa-live-label {
  font-size: 10px; color: var(--text-3); margin-top: 6px;
  text-transform: uppercase; letter-spacing: 0.5px;
}
.pa-live-card-title {
  font-size: 10px; font-weight: 500; color: var(--text-3);
  text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 10px;
}
.pa-live-page-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 4px 0; font-size: 12px;
  border-bottom: 1px solid var(--border);
}
.pa-live-page-row:last-child { border-bottom: none; }
.pa-live-page-name {
  color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  max-width: 70%;
}
.pa-live-page-count {
  font-family: var(--font-mono); color: var(--text-1); font-weight: 500;
}
.pa-live-feed-card { max-height: 200px; overflow: hidden; }
.pa-live-feed { overflow-y: auto; max-height: 170px; }
.pa-live-event {
  display: grid; grid-template-columns: 90px 1fr 60px 60px;
  gap: 8px; padding: 4px 0; font-size: 11px;
  border-bottom: 1px solid var(--border);
  animation: paSlideUp 0.2s ease both;
}
.pa-live-event:last-child { border-bottom: none; }
.pa-live-event-type {
  font-family: var(--font-mono); color: #5b8def; font-weight: 500;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.pa-live-event-page {
  color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.pa-live-event-device { color: var(--text-3); font-size: 10px; }
.pa-live-event-time {
  font-family: var(--font-mono); color: var(--text-3); font-size: 10px;
  text-align: right;
}
.pa-live-empty {
  color: var(--text-3); font-size: 11px; text-align: center; padding: 12px;
}

/* ═══════════════════════════════════════════════════════════ */
/* FEATURE 5: User Segments                                   */
/* ═══════════════════════════════════════════════════════════ */
.pa-segments-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px;
}
.pa-segment-card {
  background: var(--bg-3); border: 1px solid var(--border); border-radius: var(--r);
  padding: 16px; animation: paFadeIn 0.4s ease both;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.pa-segment-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}
.pa-segment-header { margin-bottom: 12px; }
.pa-segment-badge {
  display: inline-block; padding: 3px 10px; border-radius: 10px;
  font-size: 11px; font-weight: 600; color: #fff;
}
.pa-segment-metrics {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
}
.pa-segment-metric { text-align: center; padding: 6px 0; }
.pa-segment-metric-value {
  display: block; font-family: var(--font-mono); font-size: 16px;
  font-weight: 600; color: var(--text-1);
}
.pa-segment-metric-label {
  display: block; font-size: 9px; color: var(--text-3);
  text-transform: uppercase; letter-spacing: 0.5px; margin-top: 2px;
}
.pa-metric-good { color: #2ecc71 !important; }
.pa-metric-bad { color: #e74c3c !important; }

/* Segment comparison bars */
.pa-compare-row {
  display: flex; align-items: center; gap: 16px;
  padding: 8px 0; border-bottom: 1px solid var(--border);
}
.pa-compare-row:last-child { border-bottom: none; }
.pa-compare-label {
  width: 140px; flex-shrink: 0;
  font-size: 11px; font-weight: 500; color: var(--text-2);
  text-align: right;
}
.pa-compare-bars {
  flex: 1; display: flex; flex-direction: column; gap: 3px;
}
.pa-compare-bar-wrap {
  height: 16px; background: var(--bg-4); border-radius: 3px;
  overflow: hidden; position: relative;
}
.pa-compare-bar {
  height: 100%; border-radius: 3px;
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
  min-width: 2px; position: relative;
}
.pa-compare-bar-val {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  font-family: var(--font-mono); font-size: 9px; color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

/* ═══════════════════════════════════════════════════════════ */
/* FEATURE 8: JS Errors                                       */
/* ═══════════════════════════════════════════════════════════ */
.pa-errors-table { width: 100%; border-collapse: collapse; }
.pa-errors-table th {
  text-align: left; padding: 8px 12px; font-size: 10px; font-weight: 500;
  color: var(--text-3); border-bottom: 1px solid var(--border);
  text-transform: uppercase; letter-spacing: 0.5px;
}
.pa-errors-table td {
  padding: 10px 12px; border-bottom: 1px solid var(--border);
  font-size: 12px; vertical-align: middle;
}
.pa-errors-table tr { cursor: pointer; transition: background 0.1s; }
.pa-errors-table tr:hover { background: var(--bg-4); }

.pa-error-critical td:first-child { border-left: 3px solid #e74c3c; }
.pa-error-warning td:first-child { border-left: 3px solid #f1c40f; }
.pa-error-info td:first-child { border-left: 3px solid var(--border); }

.pa-error-message {
  font-weight: 500; color: var(--text-1); font-size: 12px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  max-width: 400px;
}
.pa-error-source {
  font-family: var(--font-mono); font-size: 10px; color: var(--text-3);
  margin-top: 2px;
}
.pa-error-detail-row {
  background: var(--bg-2); border-bottom: 1px solid var(--border);
}
.pa-stack-trace {
  font-family: var(--font-mono); font-size: 10px; color: var(--text-2);
  background: var(--bg-1); border: 1px solid var(--border); border-radius: var(--r);
  padding: 12px; overflow-x: auto; max-height: 200px; overflow-y: auto;
  white-space: pre-wrap; word-break: break-all; line-height: 1.5;
  margin: 0;
}
.pa-resolve-btn {
  background: transparent; border: 1px solid var(--border); border-radius: var(--r);
  color: var(--text-3); cursor: pointer; padding: 4px 8px; font-size: 12px;
  transition: all 0.15s ease;
}
.pa-resolve-btn:hover {
  background: #2ecc71; color: #fff; border-color: #2ecc71;
}

/* ═══════════════════════════════════════════════════════════ */
/* FEATURE 7: Feature Flags / Experiments                     */
/* ═══════════════════════════════════════════════════════════ */
.pa-flag-form-row {
  display: flex; gap: 8px; align-items: center;
}
.pa-input {
  padding: 6px 12px; font-size: 12px; font-family: var(--font-body);
  background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--r);
  color: var(--text-1); outline: none; min-width: 180px;
}
.pa-input:focus { border-color: var(--accent); }
.pa-input::placeholder { color: var(--text-3); }
.pa-btn {
  padding: 6px 16px; font-size: 11px; font-weight: 500;
  background: var(--accent); color: #fff; border: none; border-radius: var(--r);
  cursor: pointer; transition: opacity 0.15s; white-space: nowrap;
}
.pa-btn:hover { opacity: 0.85; }

.pa-flags-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px;
}
.pa-flag-card {
  background: var(--bg-3); border: 1px solid var(--border); border-radius: var(--r);
  padding: 16px; animation: paFadeIn 0.4s ease both;
}
.pa-flag-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 8px;
}
.pa-flag-name {
  font-family: var(--font-mono); font-size: 13px; font-weight: 600;
  color: var(--text-1);
}
.pa-flag-toggle {
  padding: 3px 10px; border-radius: 10px; font-size: 10px; font-weight: 500;
  border: none; cursor: pointer; transition: all 0.15s;
  text-transform: uppercase; letter-spacing: 0.5px;
}
.pa-flag-active { background: rgba(46, 204, 113, 0.2); color: #2ecc71; }
.pa-flag-active:hover { background: rgba(46, 204, 113, 0.3); }
.pa-flag-paused { background: rgba(241, 196, 15, 0.2); color: #f1c40f; }
.pa-flag-paused:hover { background: rgba(241, 196, 15, 0.3); }

.pa-flag-meta {
  display: flex; gap: 16px; font-size: 11px; color: var(--text-3);
  margin-bottom: 10px;
}
.pa-flag-dist {
  display: flex; height: 8px; border-radius: 4px; overflow: hidden;
  background: var(--bg-4); margin-bottom: 10px;
}
.pa-flag-variant-bar {
  height: 100%; transition: width 0.6s ease;
}
.pa-flag-variants { }
.pa-flag-variant-row {
  display: flex; align-items: center; gap: 8px;
  padding: 3px 0; font-size: 11px;
}
.pa-flag-variant-dot {
  display: inline-block; width: 8px; height: 8px;
  border-radius: 50%; flex-shrink: 0;
}
.pa-flag-variant-name {
  font-family: var(--font-mono); color: var(--text-2);
}
.pa-flag-variant-count {
  font-family: var(--font-mono); color: var(--text-1); font-weight: 500;
  margin-left: auto;
}
.pa-flag-variant-conv {
  font-family: var(--font-mono); font-size: 10px; color: var(--text-3);
}

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 1200px) {
  .pa-segments-grid { grid-template-columns: repeat(2, 1fr); }
  .pa-live-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 900px) {
  .pa-detail-grid { grid-template-columns: 1fr; }
  .pa-funnel-label { width: 100px; font-size: 11px; }
  .pa-funnel-meta { width: 90px; }
  .pa-segments-grid { grid-template-columns: 1fr; }
  .pa-live-grid { grid-template-columns: 1fr; }
  .pa-flags-grid { grid-template-columns: 1fr; }
}
