/* ============================================================
   emotion-heatmap.css — Conversation Emotion Timeline Styles
   Dark theme, smooth animations, accessibility-aware
   ============================================================ */

/* ── Collapsible panel at bottom of chat ───────────────────── */
.emotion-heatmap-panel {
  margin-top: 8px;
  border-top: 1px solid rgba(255 255 255 / 0.10);
  border-radius: 0 0 10px 10px;
  background: rgba(15, 15, 25, 0.85);
  font-family: inherit;
  overflow: hidden;
}

.heatmap-panel-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s;
}
.heatmap-panel-header:hover,
.heatmap-panel-header:focus-visible {
  background: rgba(255 255 255 / 0.06);
  outline: none;
}

.heatmap-panel-icon   { font-size: 1rem; flex-shrink: 0; }
.heatmap-panel-title  { font-size: 0.78rem; font-weight: 600; color: #c4c4d4; flex: 1; }
.heatmap-panel-toggle { font-size: 0.65rem; color: #6b7280; transition: transform 0.2s; }

.heatmap-panel-body {
  padding: 8px 14px 12px;
}

/* ── Stats row ─────────────────────────────────────────────── */
.heatmap-panel-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 10px;
}

.heatmap-stat {
  display: flex;
  flex-direction: column;
  font-size: 0.72rem;
}
.heatmap-stat-label {
  color: #6b7280;
  text-transform: uppercase;
  font-size: 0.62rem;
  letter-spacing: 0.04em;
}
.heatmap-stat-value {
  font-weight: 700;
  color: #e0e0f0;
}

.breakthrough-badge {
  align-self: center;
  background: rgba(250, 204, 21, 0.12);
  border: 1px solid rgba(250, 204, 21, 0.35);
  border-radius: 20px;
  padding: 2px 10px;
  font-size: 0.7rem;
  font-weight: 600;
  color: #facc15;
}

/* ── Timeline wrap + SVG ───────────────────────────────────── */
.heatmap-timeline-wrap {
  overflow-x: auto;
  overflow-y: hidden;
  padding: 4px 0 6px;
  position: relative;
}
.heatmap-timeline-svg {
  display: block;
  min-height: 56px;
  height: 56px;
}

.heatmap-baseline {
  stroke: rgba(255 255 255 / 0.12);
  stroke-width: 1;
  stroke-dasharray: 3 3;
}

/* ── Emotion dot ───────────────────────────────────────────── */
.emotion-dot {
  opacity: 0;
  animation: dotFadeIn 0.35s ease forwards;
  cursor: pointer;
  transition: r 0.2s ease, filter 0.2s;
}
.emotion-dot:hover,
.emotion-dot.breakthrough:hover {
  filter: brightness(1.35) drop-shadow(0 0 4px currentColor);
}

@keyframes dotFadeIn {
  from { opacity: 0; transform: scale(0.3); }
  to   { opacity: 1; transform: scale(1);   }
}

/* ── Breakthrough star burst ────────────────────────────────── */
.breakthrough-star {
  fill: rgba(250, 204, 21, 0.22);
  stroke: rgba(250, 204, 21, 0.55);
  stroke-width: 0.8;
  animation: starPulse 1.8s ease-in-out infinite;
}

@keyframes starPulse {
  0%, 100% { opacity: 0.6; transform: scale(1);    }
  50%       { opacity: 1.0; transform: scale(1.12); }
}

/* ── Tooltip ───────────────────────────────────────────────── */
.heatmap-tooltip {
  position: absolute;
  z-index: 100;
  display: none;
  max-width: 240px;
  padding: 5px 10px;
  border-radius: 6px;
  background: rgba(20, 20, 35, 0.96);
  border: 1px solid rgba(255 255 255 / 0.15);
  color: #e0e0f0;
  font-size: 0.72rem;
  line-height: 1.4;
  pointer-events: none;
  transform: translateX(-50%);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Dot group cursor ───────────────────────────────────────── */
.dot-group { cursor: default; }

/* ── "View Full Insights" button ───────────────────────────── */
.heatmap-fullscreen-btn {
  margin-top: 10px;
  padding: 5px 14px;
  border-radius: 20px;
  border: 1px solid rgba(255 255 255 / 0.18);
  background: transparent;
  color: #a0a0c0;
  font-size: 0.72rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.heatmap-fullscreen-btn:hover {
  background: rgba(255 255 255 / 0.08);
  color: #e0e0f0;
  border-color: rgba(255 255 255 / 0.35);
}

/* ── Empty state ───────────────────────────────────────────── */
.heatmap-empty {
  font-size: 0.75rem;
  color: #6b7280;
  text-align: center;
  padding: 12px 0;
}

/* ──────────────────────────────────────────────────────────── */
/* FULL-SCREEN INSIGHTS MODAL                                   */
/* ──────────────────────────────────────────────────────────── */

.insights-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0, 0, 0, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
  padding: 16px;
  animation: modalFadeIn 0.2s ease;
}

@keyframes modalFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.insights-modal-inner {
  position: relative;
  background: #0f0f1a;
  border: 1px solid rgba(255 255 255 / 0.14);
  border-radius: 14px;
  width: 100%;
  max-width: 620px;
  max-height: 85vh;
  overflow-y: auto;
  padding: 28px 28px 24px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
}

.insights-modal-close {
  position: absolute;
  top: 14px;
  right: 16px;
  background: transparent;
  border: none;
  color: #6b7280;
  font-size: 1.1rem;
  cursor: pointer;
  line-height: 1;
  padding: 4px 8px;
  border-radius: 6px;
  transition: color 0.15s, background 0.15s;
}
.insights-modal-close:hover {
  color: #e0e0f0;
  background: rgba(255 255 255 / 0.08);
}

.insights-modal-title {
  margin: 0 0 20px;
  font-size: 1.15rem;
  font-weight: 700;
  color: #e0e0f0;
}

/* ── Dominant emotion card ──────────────────────────────────── */
.insights-dominant {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  border-radius: 10px;
  border: 1px solid rgba(255 255 255 / 0.15);
  background: rgba(255 255 255 / 0.04);
  margin-bottom: 20px;
}
.insights-dominant-emoji  { font-size: 2rem; flex-shrink: 0; }
.insights-dominant-label  { font-size: 0.7rem; color: #6b7280; text-transform: uppercase; letter-spacing: 0.05em; }
.insights-dominant-value  { font-size: 1.1rem; font-weight: 700; text-transform: capitalize; }

/* ── Sections ───────────────────────────────────────────────── */
.insights-section {
  margin-bottom: 20px;
}
.insights-section-title {
  margin: 0 0 8px;
  font-size: 0.82rem;
  font-weight: 600;
  color: #a0a0c0;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.insights-journey {
  margin: 0;
  font-size: 0.88rem;
  color: #c4c4d4;
  line-height: 1.6;
}

/* ── Timeline in modal ─────────────────────────────────────── */
.insights-timeline-wrap {
  overflow-x: auto;
  padding: 4px 0 6px;
  position: relative;
}

/* ── Breakthrough list ──────────────────────────────────────── */
.insights-breakthroughs {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.insights-breakthrough-item {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 0.8rem;
  padding: 6px 10px;
  border-radius: 6px;
  background: rgba(255 255 255 / 0.04);
}
.bt-index   { color: #6b7280; font-size: 0.7rem; flex-shrink: 0; }
.bt-emotion { font-weight: 600; flex-shrink: 0; text-transform: capitalize; }
.bt-preview { color: #a0a0c0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Meta row ───────────────────────────────────────────────── */
.insights-meta-row {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid rgba(255 255 255 / 0.08);
}
.insights-meta {
  display: flex;
  flex-direction: column;
  font-size: 0.78rem;
}
.meta-label { color: #6b7280; font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.04em; }
.meta-val   { font-weight: 700; color: #e0e0f0; }

/* ── Loading / error states ─────────────────────────────────── */
.insights-loading,
.insights-error {
  font-size: 0.85rem;
  color: #6b7280;
  text-align: center;
  padding: 24px 0;
}

/* ── Reduced motion ─────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .emotion-dot       { animation: none; opacity: 1; }
  .breakthrough-star { animation: none; }
  .insights-modal    { animation: none; }
}

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 480px) {
  .insights-modal-inner { padding: 20px 16px 18px; }
  .heatmap-panel-body   { padding: 8px 10px 10px;  }
}
