/* ═══════════════════════════════════════
   Rétention — Dashboard créateur, règles de réengagement
   ═══════════════════════════════════════ */

/* ─── KPI Cards ─── */
.retention-kpis {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-md);
  margin-bottom: var(--space-xl);
}

.kpi-card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  text-align: center;
}

.kpi-card__value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--color-primary);
  line-height: 1;
}

.kpi-card__value--warning {
  color: var(--color-warning, #e17055);
}

.kpi-card__value--success {
  color: var(--color-success, #00b894);
}

.kpi-card__label {
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
  margin-top: var(--space-xs);
}

/* ─── Section titres ─── */
.retention__section-title {
  font-size: var(--font-size-lg);
  font-weight: 700;
  margin: var(--space-xl) 0 var(--space-md);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.retention__section-title i {
  color: var(--color-primary);
}

/* ─── Courbe de rétention (barres CSS) ─── */
.retention-curve {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  margin-bottom: var(--space-xl);
}

.retention-bar {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.retention-bar__label {
  width: 60px;
  flex-shrink: 0;
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
  text-align: right;
}

.retention-bar__track {
  flex: 1;
  height: 24px;
  background: var(--color-border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  position: relative;
}

.retention-bar__fill {
  height: 100%;
  border-radius: var(--radius-sm);
  transition: width 0.6s ease;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: var(--space-xs);
  min-width: 32px;
}

.retention-bar__fill--high {
  background: linear-gradient(90deg, #00b894, #55efc4);
}

.retention-bar__fill--medium {
  background: linear-gradient(90deg, #fdcb6e, #e17055);
}

.retention-bar__fill--low {
  background: linear-gradient(90deg, #e17055, #d63031);
}

.retention-bar__pct {
  font-size: var(--font-size-xs);
  font-weight: 700;
  color: white;
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

/* ─── Points de friction (abandon par module) ─── */
.friction-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  margin-bottom: var(--space-xl);
}

.friction-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  background: var(--color-surface);
  border-radius: var(--radius-md);
  padding: var(--space-md);
}

.friction-item--worst {
  border-left: 3px solid var(--color-error, #d63031);
}

.friction-item__info {
  flex: 1;
  min-width: 0;
}

.friction-item__title {
  font-weight: 600;
  font-size: var(--font-size-sm);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.friction-item__stats {
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
  margin-top: 2px;
}

.friction-item__bar {
  width: 80px;
  flex-shrink: 0;
}

.friction-item__bar-track {
  height: 8px;
  background: var(--color-border);
  border-radius: 4px;
  overflow: hidden;
}

.friction-item__bar-fill {
  height: 100%;
  border-radius: 4px;
  background: var(--color-error, #d63031);
}

.friction-item__pct {
  font-size: var(--font-size-xs);
  font-weight: 700;
  color: var(--color-error, #d63031);
  text-align: center;
  margin-top: 2px;
}

/* ─── Liste apprenants inactifs ─── */
.inactive-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-md);
  flex-wrap: wrap;
  gap: var(--space-sm);
}

.inactive-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  margin-bottom: var(--space-xl);
}

.inactive-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  background: var(--color-surface);
  border-radius: var(--radius-md);
  padding: var(--space-md);
}

.inactive-item__avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--color-primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: var(--font-size-sm);
  flex-shrink: 0;
}

.inactive-item__info {
  flex: 1;
  min-width: 0;
}

.inactive-item__name {
  font-weight: 600;
  font-size: var(--font-size-sm);
}

.inactive-item__meta {
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
  margin-top: 2px;
}

.inactive-item__days {
  flex-shrink: 0;
  text-align: center;
}

.inactive-item__days-num {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--color-error, #d63031);
}

.inactive-item__days-label {
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
}

.inactive-item__actions {
  flex-shrink: 0;
}

.btn--nudge {
  padding: var(--space-xs) var(--space-sm);
  font-size: var(--font-size-xs);
  border-radius: var(--radius-md);
  background: var(--color-primary);
  color: white;
  border: none;
  cursor: pointer;
  font-weight: 600;
  transition: opacity var(--transition-fast);
}

.btn--nudge:hover {
  opacity: 0.85;
}

.btn--nudge:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ─── Règles de réengagement (onglet éditeur) ─── */
.reengagement-rules {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

.reengagement-rule {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
}

.reengagement-rule__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-sm);
}

.reengagement-rule__threshold {
  font-weight: 700;
  font-size: var(--font-size-md);
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.reengagement-rule__threshold i {
  color: var(--color-warning, #e17055);
}

.reengagement-rule textarea {
  width: 100%;
  min-height: 60px;
  resize: vertical;
  margin-top: var(--space-sm);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-sm);
  font-family: inherit;
  font-size: var(--font-size-sm);
  background: var(--color-bg);
  color: var(--color-text);
}

.reengagement-rule textarea:focus {
  outline: none;
  border-color: var(--color-primary);
}

/* ─── Empty state ─── */
.retention-empty {
  text-align: center;
  padding: var(--space-2xl) 0;
  color: var(--color-text-muted);
}

.retention-empty__icon {
  font-size: 3rem;
  opacity: 0.4;
  margin-bottom: var(--space-md);
}

/* ─── Responsive ─── */
@media (min-width: 768px) {
  .retention-kpis {
    grid-template-columns: repeat(4, 1fr);
  }

  .inactive-item {
    padding: var(--space-md) var(--space-lg);
  }
}
