/* ═══════════════════════════════════════════════════════════
   COMPOSANT GLOBAL — Timeline universelle
   Usage : timeline_render(containerId, filtres)
   Ref design : mockup éditeur devis (header + historique)
   ═══════════════════════════════════════════════════════════ */

/* ── Container ── */
.tl-wrap {
  padding-left: 28px;
  position: relative;
}

/* Ligne verticale */
.tl-wrap::before {
  content: '';
  position: absolute;
  left: 11px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: rgba(200, 220, 200, .4);
  border-radius: 1px;
}

/* ── Header section ── */
.tl-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.tl-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 18px;
  font-weight: 600;
  color: var(--text, #0D1B0F);
}

.tl-count {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted, #7A9480);
  background: rgba(200, 220, 200, .2);
  padding: 2px 10px;
  border-radius: 100px;
}

/* ── Item ── */
.tl-item {
  position: relative;
  margin-bottom: 16px;
  padding-bottom: 2px;
}

.tl-item:last-child {
  margin-bottom: 0;
}

/* ── Dot ── */
.tl-dot {
  position: absolute;
  left: -28px;
  top: 2px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  flex-shrink: 0;
  border: 2px solid var(--bg, #EFF4EF);
  box-shadow: 0 1px 4px rgba(0, 0, 0, .08);
}

/* Couleurs par type */
.tl-dot-green {
  background: var(--green, #1A6E3C);
  color: #fff;
}

.tl-dot-blue {
  background: #2563EB;
  color: #fff;
}

.tl-dot-red {
  background: var(--red, #E02020);
  color: #fff;
}

.tl-dot-yellow {
  background: var(--yellow, #C97800);
  color: #fff;
}

.tl-dot-purple {
  background: #7C3AED;
  color: #fff;
}

.tl-dot-muted {
  background: var(--muted, #7A9480);
  color: #fff;
}

.tl-dot-gray {
  background: rgba(200, 220, 200, .5);
  color: var(--muted, #7A9480);
}

/* Dot vivant (en cours) */
.tl-dot-alive {
  background: var(--yellow, #C97800);
  color: #fff;
  box-shadow: 0 0 12px 4px rgba(201, 120, 0, .2), 0 1px 4px rgba(0, 0, 0, .08);
  animation: tl-pulse 3s ease-in-out infinite;
}

@keyframes tl-pulse {
  0%, 100% { box-shadow: 0 0 12px 4px rgba(201, 120, 0, .2), 0 1px 4px rgba(0, 0, 0, .08); }
  50% { box-shadow: 0 0 6px 2px rgba(201, 120, 0, .1), 0 1px 4px rgba(0, 0, 0, .08); }
}

/* ── Contenu ── */
.tl-date {
  font-size: 10px;
  color: var(--muted, #7A9480);
  margin-bottom: 2px;
}

.tl-text {
  font-size: 13px;
  font-weight: 600;
  color: var(--text, #0D1B0F);
  line-height: 1.4;
}

.tl-text a {
  color: var(--green, #1A6E3C);
  text-decoration: none;
}

.tl-text a:hover {
  text-decoration: underline;
}

.tl-sub {
  font-size: 11px;
  color: var(--muted, #7A9480);
  margin-top: 2px;
  line-height: 1.4;
}

/* Tracking inline */
.tl-tracking {
  display: inline-flex;
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 4px;
  margin-left: 4px;
}

.tl-tracking-ouvert {
  background: var(--green-light, rgba(237, 250, 243, .85));
  color: var(--green, #1A6E3C);
}

.tl-tracking-non-ouvert {
  background: rgba(224, 32, 32, .06);
  color: var(--red, #E02020);
}

/* ── Prochaine étape (dernier item spécial) ── */
.tl-item-next .tl-date {
  font-style: italic;
  color: var(--muted, #7A9480);
}

.tl-item-next .tl-text {
  font-weight: 500;
  color: var(--text2, #3A4D3C);
  font-style: italic;
}

/* ── État alerte (aujourd'hui / en attente) ── */
.tl-item-alert .tl-text {
  color: var(--red, #E02020);
  font-weight: 700;
}

/* ── Empty state ── */
.tl-empty {
  font-size: 12px;
  color: var(--muted, #7A9480);
  padding: 12px 0;
  font-style: italic;
}

/* ── Compact mode (pour panneaux latéraux étroits) ── */
.tl-compact .tl-item {
  margin-bottom: 10px;
}

.tl-compact .tl-dot {
  width: 18px;
  height: 18px;
  font-size: 8px;
  left: -24px;
}

.tl-compact .tl-wrap {
  padding-left: 24px;
}

.tl-compact .tl-wrap::before {
  left: 8px;
}

.tl-compact .tl-text {
  font-size: 12px;
}

.tl-compact .tl-sub {
  font-size: 10px;
}
