/* ============================================================
   Complis Workflow v2 — timeline / next-action / saved filters
   (BRIEF-workflow-v2.md, commit #3)

   Source visuelle : prototype-workflow-v2.html
   - 8 phases pipeline (.wf-timeline + .wf-phase)
   - Bloc prochaine action (.wf-next-action)
   - Mini-timeline pour la liste historique (.wf-mini-timeline)
   - Filtres sauvegardés (.wf-saved-filters)
   - Marqueur .deprecated pour l'ancienne barre #dos-statut-bar
     (le hide visuel sera activé au commit #12 — ici on ne fait que
     poser la classe pour permettre les sélecteurs ciblés)

   Toutes les classes sont préfixées "wf-" pour ne JAMAIS entrer en
   collision avec le legacy (.kpi, .card, .badge, .subtab, etc.) ni
   avec ui-v2.css (.v2-*). Cette feuille peut être chargée sans
   activer __WORKFLOW_V2__ — elle ne s'applique qu'aux nœuds qui
   portent explicitement les classes wf-*, injectés au commit #4.
   ============================================================ */

:root {
  --wf-success: #16A34A;
  --wf-success-soft: #DCFCE7;
  --wf-warning: #D97706;
  --wf-warning-soft: #FEF3C7;
  --wf-danger: #DC2626;
  --wf-info: #0891B2;
  --wf-info-soft: #CFFAFE;
  --wf-text: #0F172A;
  --wf-text-muted: #64748B;
  --wf-text-soft: #94A3B8;
  --wf-border: #E2E8F0;
  --wf-border-strong: #CBD5E1;
  --wf-surface: #FFFFFF;
  --wf-surface-alt: #F8FAFC;
  --wf-radius-sm: 6px;
  --wf-radius: 10px;
  --wf-shadow-sm: 0 1px 2px rgba(15,23,42,.05);
}

/* Suit l'accent v2 (bleu admin / vert HE / orange DR) en réutilisant
   les variables exposées par ui-v2.css. Fallback bleu si la feuille
   n'est pas chargée. */
.wf-timeline,
.wf-next-action,
.wf-saved-filter,
.wf-mini-dot,
.wf-mini-connector {
  --wf-accent: var(--v2-accent, #2563EB);
  --wf-accent-hover: var(--v2-accent-hover, #1D4ED8);
  --wf-accent-soft: #EFF6FF;
}
body.theme-he .wf-timeline,
body.theme-he .wf-next-action,
body.theme-he .wf-saved-filter,
body.theme-he .wf-mini-dot,
body.theme-he .wf-mini-connector {
  --wf-accent-soft: #DCFCE7;
}
body.theme-dr .wf-timeline,
body.theme-dr .wf-next-action,
body.theme-dr .wf-saved-filter,
body.theme-dr .wf-mini-dot,
body.theme-dr .wf-mini-connector {
  --wf-accent-soft: #FEF3C7;
}

/* ============================================================
   TIMELINE 8 PHASES
   ============================================================ */
.wf-timeline {
  background: var(--wf-surface);
  border: 1px solid var(--wf-border);
  border-radius: var(--wf-radius);
  padding: 10px 16px 8px;
  box-shadow: var(--wf-shadow-sm);
}
.wf-timeline-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  gap: 12px;
}
.wf-timeline-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--wf-text-muted);
  font-weight: 600;
}
.wf-timeline-phase-current {
  font-size: 12px;
  font-weight: 600;
  color: var(--wf-accent);
}
.wf-timeline-steps {
  display: flex;
  align-items: flex-start;
  position: relative;
  gap: 6px;
}
.wf-phase {
  flex: 1;
  min-width: 0;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 3px 2px 4px;
  cursor: pointer;
  background: none;
  border: none;
  border-radius: 8px;
  font: inherit;
  color: inherit;
  transition: background .15s ease, transform .15s ease;
}
.wf-phase.static { cursor: default; }
.wf-phase.clickable:hover {
  background: var(--wf-accent-soft);
  transform: translateY(-2px);
}
/* Variante navigation seule (phase courante ou rôle read-only) :
   hover plus léger, sans message implicite de "change de statut".
   On garde l'effet pour signaler la clickabilité, mais discret. */
.wf-phase.clickable.nav-only:hover {
  background: var(--wf-surface-alt);
  transform: translateY(-1px);
}
.wf-phase.clickable:hover .wf-phase-circle {
  border-color: var(--wf-accent);
  color: var(--wf-accent);
  box-shadow: 0 4px 12px rgba(37,99,235,.18);
}
.wf-phase.clickable.nav-only:hover .wf-phase-circle {
  /* Pas d'altération forte du cercle quand on ne change pas de statut */
  box-shadow: 0 2px 6px rgba(15,23,42,.10);
}
.wf-phase.clickable:hover.done .wf-phase-circle {
  /* Sur une phase déjà faite : indique visuellement le "retour en arrière" */
  box-shadow: 0 4px 12px rgba(22,163,74,.30);
}
.wf-phase.clickable.nav-only:hover.done .wf-phase-circle {
  box-shadow: 0 2px 6px rgba(22,163,74,.18);
}
.wf-phase.clickable:focus-visible {
  outline: 2px solid var(--wf-accent);
  outline-offset: 2px;
}
.wf-phase-circle {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--wf-border-strong);
  display: grid;
  place-items: center;
  color: var(--wf-text-muted);
  font-weight: 700;
  font-size: 13px;
  line-height: 1;
  z-index: 2;
  position: relative;
  transition: all .2s ease;
}
.wf-phase-icon {
  font-size: 13px;
  line-height: 1;
}
.wf-phase-check {
  font-size: 13px;
  line-height: 1;
  font-weight: 800;
}
.wf-phase.done .wf-phase-circle {
  background: var(--wf-success);
  border-color: var(--wf-success);
  color: #fff;
}
.wf-phase.current .wf-phase-circle {
  background: var(--wf-accent);
  border-color: var(--wf-accent);
  color: #fff;
  box-shadow: 0 0 0 3px var(--wf-accent-soft);
  animation: wf-phase-pulse 2s ease-in-out infinite;
}
@keyframes wf-phase-pulse {
  0%,100% { box-shadow: 0 0 0 3px var(--wf-accent-soft); }
  50%     { box-shadow: 0 0 0 6px var(--wf-accent-soft); }
}
.wf-phase-num {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: .3px;
  color: var(--wf-text-soft);
  margin-top: 4px;
  font-weight: 600;
}
.wf-phase.done .wf-phase-num,
.wf-phase.current .wf-phase-num {
  color: var(--wf-text-muted);
}
.wf-phase-label {
  font-size: 11px;
  color: var(--wf-text-muted);
  margin-top: 1px;
  text-align: center;
  line-height: 1.2;
  max-width: 90px;
}
.wf-phase.done .wf-phase-label,
.wf-phase.current .wf-phase-label {
  color: var(--wf-text);
  font-weight: 600;
}
.wf-phase-sub {
  font-size: 10px;
  color: var(--wf-text-soft);
  margin-top: 2px;
}
.wf-phase-connector {
  position: absolute;
  top: 18px;
  left: calc(50% + 17px);
  right: calc(-50% + 17px);
  height: 2px;
  border-radius: 2px;
  background: var(--wf-border-strong);
  z-index: 1;
}
.wf-phase.done .wf-phase-connector {
  background: var(--wf-success);
}
.wf-phase:last-child .wf-phase-connector { display: none; }

.wf-timeline-hint {
  margin-top: 6px;
  padding-top: 5px;
  border-top: 1px dashed var(--wf-border);
  font-size: 10px;
  color: var(--wf-text-soft);
  text-align: center;
}

/* ============================================================
   PROCHAINE ACTION
   ============================================================ */
.wf-next-action {
  background: linear-gradient(135deg, var(--wf-accent-soft) 0%, #fff 100%);
  border: 1px solid var(--wf-accent);
  border-left: 4px solid var(--wf-accent);
  border-radius: var(--wf-radius);
  padding: 16px 20px;
  margin-top: 16px;
  display: flex;
  align-items: center;
  gap: 16px;
}
.wf-next-action-icon {
  width: 44px;
  height: 44px;
  background: var(--wf-accent);
  color: #fff;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 20px;
  flex-shrink: 0;
}
.wf-next-action-body { flex: 1; min-width: 0; }
.wf-next-action-label {
  font-size: 11px;
  text-transform: uppercase;
  color: var(--wf-accent);
  font-weight: 600;
  letter-spacing: .5px;
}
.wf-next-action-title {
  font-size: 16px;
  font-weight: 600;
  margin-top: 2px;
  color: var(--wf-text);
}
.wf-next-action-hint {
  font-size: 13px;
  color: var(--wf-text-muted);
  margin-top: 2px;
}
.wf-next-action-cta {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--wf-radius-sm);
  background: var(--wf-accent);
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  border: 1px solid transparent;
  transition: background .15s ease;
}
.wf-next-action-cta:hover { background: var(--wf-accent-hover); }

/* ============================================================
   MINI-TIMELINE (cellule liste historique)
   ============================================================ */
.wf-mini-timeline {
  display: inline-flex;
  gap: 2px;
  align-items: center;
}
.wf-mini-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--wf-border-strong);
  flex-shrink: 0;
}
.wf-mini-dot.done { background: var(--wf-success); }
.wf-mini-dot.current {
  background: var(--wf-accent);
  box-shadow: 0 0 0 2px var(--wf-accent-soft);
}
.wf-mini-connector {
  width: 8px;
  height: 2px;
  background: var(--wf-border-strong);
  flex-shrink: 0;
}
.wf-mini-connector.done { background: var(--wf-success); }

/* ============================================================
   FILTRES SAUVEGARDÉS (Historique)
   ============================================================ */
.wf-saved-filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.wf-saved-filter {
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--wf-border);
  background: var(--wf-surface);
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--wf-text-muted);
  cursor: pointer;
  transition: all .15s ease;
  font: inherit;
}
.wf-saved-filter:hover {
  border-color: var(--wf-border-strong);
  color: var(--wf-text);
}
.wf-saved-filter.active {
  border-color: var(--wf-accent);
  background: var(--wf-accent-soft);
  color: var(--wf-accent);
  font-weight: 600;
}
.wf-saved-filter-count {
  background: rgba(0,0,0,.08);
  padding: 1px 7px;
  border-radius: 10px;
  font-size: 11px;
}
.wf-saved-filter.active .wf-saved-filter-count {
  background: rgba(37,99,235,.15);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 767px) {
  .wf-timeline { padding: 14px; }
  .wf-phase-label { font-size: 10px; max-width: 64px; }
  .wf-phase-num { font-size: 9px; margin-top: 6px; }
  .wf-phase-circle { width: 34px; height: 34px; font-size: 14px; }
  .wf-phase-icon, .wf-phase-check { font-size: 16px; }
  .wf-phase-connector {
    top: 22px;
    left: calc(50% + 18px);
    right: calc(-50% + 18px);
  }
  .wf-next-action {
    flex-direction: column;
    text-align: center;
  }
  .wf-next-action-cta { width: 100%; justify-content: center; }
}
