/**
 * Agent Steps - Styles pour le composant d'étapes agentic
 * Affiche les étapes de progression d'une tâche avec loaders et animations
 */

/* AGENT STEPS TRACK */
.agent-steps-track {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 12px 0 32px 0; /* Plus d'espace avant le rectangle */
}

/* Trait vertical gris */
.agent-steps-track::before {
  content: '';
  position: absolute;
  left: 11px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: rgba(0, 0, 0, 0.1);
}

/* Trait vert qui se remplit */
.agent-steps-track::after {
  content: '';
  position: absolute;
  left: 11px;
  top: 0;
  width: 2px;
  height: var(--progress-height, 0px);
  background: linear-gradient(to bottom, #bdf3d1, #a0e8b8, #8dd9a3);
  transition: height 0.5s ease;
  z-index: 0;
}

.agent-step {
  position: relative;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0;
  margin-bottom: 16px;
}

/* Mini loader styles */
mini-loader-egg {
  flex-shrink: 0;
  z-index: 10; /* AU-DESSUS du trait */
  position: relative;
  transition: all 0.3s ease;
}

mini-loader-egg[data-step-state="pending"] {
  opacity: 0.5;
}

mini-loader-egg[data-step-state="active"] {
  opacity: 1;
}

mini-loader-egg[data-step-state="completed"] {
  opacity: 1;
}

.step-content {
  flex: 1;
  background: var(--glass-bg);
  backdrop-filter: blur(25px);
  -webkit-backdrop-filter: blur(25px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--glass-shadow);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

.step-content.expanded {
  max-height: 400px;
}

.step-content.collapsed {
  max-height: 40px;
}

.step-content.collapsed .step-body {
  display: none;
}

.step-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  cursor: pointer;
  transition: background 0.2s ease;
  user-select: none;
}

.step-header:hover {
  background: rgba(255, 255, 255, 0.3);
}

.step-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.chevron {
  font-size: 12px;
  color: var(--text-muted);
  transition: transform 0.3s ease;
}

.step-content.expanded .chevron {
  transform: rotate(180deg);
}

.step-body {
  padding: 0 16px 16px 16px;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
  animation: fadeInStep 0.3s ease;
  max-height: calc(1.6em * 10); /* 10 lignes max */
  overflow-y: auto;
}

@keyframes fadeInStep {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Scrollbar */
.step-body::-webkit-scrollbar {
  width: 6px;
}

.step-body::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.05);
  border-radius: 3px;
}

.step-body::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 3px;
}

.step-body::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.3);
}

/* Effet néon pour le résultat final - 4 lignes qui glissent en boucle */
.content {
  flex: 1;
  padding: 20px;
  background: rgba(255, 255, 255, 0.5);
  border-radius: 12px;
  border: 1px solid rgba(0, 0, 0, 0.05);
  position: relative;
  overflow: hidden;
  z-index: 5;
}

.content.final-glow {
  border-color: rgba(189, 243, 209, 0.2);
}

/* Top border - glisse de gauche à droite */
.content.final-glow::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(189, 243, 209, 0.8), transparent);
  z-index: 1;
  animation: slideTopBorder 2s linear 2; /* 2 tours seulement */
}

/* Right border - glisse de haut en bas */
.content.final-glow::after {
  content: '';
  position: absolute;
  top: -100%;
  right: 0;
  width: 2px;
  height: 100%;
  background: linear-gradient(180deg, transparent, rgba(189, 243, 209, 0.8), transparent);
  z-index: 1;
  animation: slideRightBorder 2s linear 2; /* 2 tours seulement */
  animation-delay: 0.5s;
}

@keyframes slideTopBorder {
  0% { left: -100%; }
  100% { left: 100%; }
}

@keyframes slideRightBorder {
  0% { top: -100%; }
  100% { top: 100%; }
}

@keyframes slideBottomBorder {
  0% { right: -100%; }
  100% { right: 100%; }
}

@keyframes slideLeftBorder {
  0% { bottom: -100%; }
  100% { bottom: 100%; }
}

.content h3 {
  color: var(--text-primary);
  margin-bottom: 12px;
  font-size: 18px;
}

.content p {
  color: var(--text-secondary);
  line-height: 1.6;
  font-size: 14px;
}

/* Dark mode */
[data-theme="dark"] .step-header:hover {
  background: rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] .content {
  background: rgba(38, 38, 36, 0.5);
  border-color: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .content.final-glow {
  animation: neonPulseDark 2s ease-in-out;
}

@keyframes neonPulseDark {
  0%, 100% {
    box-shadow: 0 0 5px rgba(189, 243, 209, 0.4),
                0 0 10px rgba(189, 243, 209, 0.3),
                0 0 20px rgba(189, 243, 209, 0.2);
    border-color: rgba(189, 243, 209, 0.4);
  }
  50% {
    box-shadow: 0 0 10px rgba(189, 243, 209, 0.8),
                0 0 25px rgba(189, 243, 209, 0.6),
                0 0 50px rgba(189, 243, 209, 0.4),
                0 0 100px rgba(189, 243, 209, 0.2);
    border-color: rgba(189, 243, 209, 0.8);
  }
}
