/* ─── Session recap — carte unique, viewport sans scroll ─────────────────── */

#main-layout.recap-mode #center-panel {
  overflow: hidden;
}

#main-layout.recap-mode #contact-nav-wrap {
  display: none;
}

/* Une seule vue au centre : pas de superposition avec la session ou l'historique */
#main-layout.recap-mode #home-screen,
#main-layout.recap-mode #prospecting-view,
#main-layout.recap-mode #sessions-view,
#main-layout.recap-mode #emails-view,
#main-layout.recap-mode #help-view,
#main-layout.recap-mode #import-view,
#main-layout.recap-mode #follow-ups-view {
  display: none !important;
}

#session-recap-view {
  display: none;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  padding: 16px 20px;
  background:
    radial-gradient(ellipse 70% 50% at 50% -10%, var(--srecap-accent-dim, var(--orange-dim)), transparent 65%),
    var(--bg-base);
}

#session-recap-view.visible {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

#session-recap-content {
  width: 100%;
  max-width: 560px;
  max-height: 100%;
  overflow: hidden;
}

/* ─── Carte principale ─────────────────────────────────────────────────────── */

.srecap {
  --srecap-accent: var(--orange);
  --srecap-accent-dim: var(--orange-dim);
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: srecap-enter 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

.srecap--legendary {
  --srecap-accent: #f59e0b;
  --srecap-accent-dim: rgba(245, 158, 11, 0.18);
}

.srecap--great {
  --srecap-accent: var(--green);
  --srecap-accent-dim: var(--green-dim);
}

.srecap--strong {
  --srecap-accent: var(--orange);
  --srecap-accent-dim: var(--orange-dim);
}

.srecap--good {
  --srecap-accent: var(--teal);
  --srecap-accent-dim: rgba(13, 148, 136, 0.15);
}

.srecap--warm {
  --srecap-accent: #a855f7;
  --srecap-accent-dim: rgba(168, 85, 247, 0.14);
}

.srecap--soft {
  --srecap-accent: var(--text-muted);
  --srecap-accent-dim: rgba(107, 101, 96, 0.12);
}

@keyframes srecap-enter {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.srecap-accent-bar {
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--srecap-accent), transparent);
  flex-shrink: 0;
}

.srecap-glow {
  position: absolute;
  inset: 0 0 auto;
  height: 120px;
  background: radial-gradient(ellipse 80% 100% at 50% 0%, var(--srecap-accent-dim), transparent 70%);
  pointer-events: none;
}

.srecap-confetti {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 3;
}

.srecap-confetti-piece {
  position: absolute;
  top: -8px;
  left: var(--x);
  width: 7px;
  height: 11px;
  border-radius: 2px;
  opacity: 0;
  animation: srecap-confetti-fall var(--dur) ease-in var(--delay) forwards;
}

@keyframes srecap-confetti-fall {
  0% {
    opacity: 1;
    transform: translateY(0) rotate(0deg);
  }
  100% {
    opacity: 0;
    transform: translateY(280px) rotate(var(--rot));
  }
}

.srecap-inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px 22px 16px;
}

/* ─── En-tête ──────────────────────────────────────────────────────────────── */

.srecap-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
}

.srecap-emoji-ring {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--srecap-accent-dim);
  border: 2px solid color-mix(in srgb, var(--srecap-accent) 35%, transparent);
  animation: srecap-emoji-pop 0.65s cubic-bezier(0.34, 1.56, 0.64, 1) 0.1s both;
}

.srecap-emoji {
  font-size: 28px;
  line-height: 1;
}

.srecap--legendary .srecap-emoji-ring {
  animation:
    srecap-emoji-pop 0.65s cubic-bezier(0.34, 1.56, 0.64, 1) 0.1s both,
    srecap-pulse 2.2s ease-in-out 0.8s infinite;
}

@keyframes srecap-emoji-pop {
  from {
    opacity: 0;
    transform: scale(0.5);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes srecap-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 color-mix(in srgb, var(--srecap-accent) 30%, transparent);
  }
  50% {
    box-shadow: 0 0 0 8px transparent;
  }
}

.srecap-kicker {
  margin: 0;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--srecap-accent);
}

.srecap-title {
  margin: 0;
  font-size: clamp(20px, 4vw, 24px);
  font-weight: 800;
  line-height: 1.15;
  color: var(--text-primary);
}

.srecap-message {
  margin: 0;
  font-size: 14px;
  line-height: 1.45;
  color: var(--text-primary);
  max-width: 46ch;
}

.srecap-sub {
  margin: 0;
  font-size: 13px;
  line-height: 1.4;
  font-style: italic;
  color: var(--srecap-accent);
  max-width: 44ch;
  opacity: 0.92;
}

.srecap-session-name {
  margin: 0;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  padding: 3px 10px;
  background: var(--bg-card);
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
}

/* ─── KPI principaux ───────────────────────────────────────────────────────── */

.srecap-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.srecap-kpi {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 10px 4px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  text-align: center;
  animation: srecap-kpi-in 0.4s ease both;
}

.srecap-kpi:nth-child(1) { animation-delay: 0.05s; }
.srecap-kpi:nth-child(2) { animation-delay: 0.1s; }
.srecap-kpi:nth-child(3) { animation-delay: 0.15s; }
.srecap-kpi:nth-child(4) { animation-delay: 0.2s; }

@keyframes srecap-kpi-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.srecap-kpi--hero .srecap-kpi-value {
  color: var(--srecap-accent);
}

.srecap-kpi--green .srecap-kpi-value {
  color: var(--green);
}

.srecap-kpi-value {
  font-size: 22px;
  font-weight: 800;
  line-height: 1;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

.srecap-kpi-label {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

/* ─── Bandeau secondaire ───────────────────────────────────────────────────── */

.srecap-secondary {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 12px;
  padding: 8px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  animation: srecap-kpi-in 0.4s ease 0.25s both;
}

.srecap-secondary-item {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
}

.srecap-secondary-value {
  font-weight: 700;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

.srecap-secondary-sep {
  color: var(--border);
  user-select: none;
}

/* ─── Highlights ───────────────────────────────────────────────────────────── */

.srecap-highlights {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
}

.srecap-highlight {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 11px;
  background: color-mix(in srgb, var(--srecap-accent) 8%, var(--bg-card));
  border: 1px solid color-mix(in srgb, var(--srecap-accent) 25%, var(--border));
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
  animation: srecap-chip-in 0.4s ease both;
}

.srecap-highlight:nth-child(2) { animation-delay: 0.08s; }
.srecap-highlight:nth-child(3) { animation-delay: 0.16s; }

@keyframes srecap-chip-in {
  from {
    opacity: 0;
    transform: scale(0.92);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.srecap-highlight-emoji {
  font-size: 13px;
}

/* ─── Actions ──────────────────────────────────────────────────────────────── */

.srecap-actions {
  display: flex;
  gap: 8px;
  padding-top: 2px;
}

.srecap-btn-report {
  flex: 1;
}

.srecap-btn-home {
  flex: 0 0 auto;
  color: var(--text-muted);
  font-size: 13px;
}

/* ─── Responsive ───────────────────────────────────────────────────────────── */

@media (max-width: 480px) {
  #session-recap-view {
    padding: 12px 14px;
  }

  .srecap-inner {
    padding: 16px 16px 14px;
    gap: 12px;
  }

  .srecap-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .srecap-actions {
    flex-direction: column;
  }

  .srecap-btn-home {
    width: 100%;
  }
}

@media (max-height: 640px) {
  #session-recap-view {
    padding: 10px 16px;
  }

  .srecap-inner {
    gap: 10px;
    padding: 14px 18px 12px;
  }

  .srecap-emoji-ring {
    width: 48px;
    height: 48px;
  }

  .srecap-emoji {
    font-size: 24px;
  }

  .srecap-title {
    font-size: 18px;
  }

  .srecap-message {
    font-size: 13px;
  }

  .srecap-sub {
    font-size: 12px;
  }

  .srecap-kpi {
    padding: 8px 4px;
  }

  .srecap-kpi-value {
    font-size: 18px;
  }
}

@media (max-height: 480px) {
  #session-recap-view.visible {
    overflow-y: auto;
    justify-content: flex-start;
  }
}
