/* ==========================================================================
   AUTOMATION.CSS — Visuel hero spécifique pages Marketing Automation
   ========================================================================== */

/* ==========================================================================
   VARIANTE FOND AUTOMATION (orange/warm)
   ========================================================================== */
.at-presta--automation .at-presta-hero-bg {
  background:
    radial-gradient(rgba(249, 115, 22, 0.15) 1px, transparent 1px) 0 0 / 24px 24px,
    radial-gradient(rgba(249, 115, 22, 0.08) 1px, transparent 1px) 12px 12px / 24px 24px,
    repeating-linear-gradient(
      45deg,
      transparent,
      transparent 100px,
      rgba(249, 115, 22, 0.05) 100px,
      rgba(249, 115, 22, 0.07) 101px
    ),
    repeating-linear-gradient(
      -45deg,
      transparent,
      transparent 100px,
      rgba(234, 88, 12, 0.04) 100px,
      rgba(234, 88, 12, 0.06) 101px
    ),
    linear-gradient(160deg, rgba(249,115,22,0.20) 0%, rgba(234,88,12,0.08) 40%, transparent 70%),
    linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
}

/* ==========================================================================
   WORKFLOW
   ========================================================================== */
.at-presta-workflow {
  position: relative;
  width: 100%;
  max-width: 380px;
  perspective: 1000px;
}

.at-presta-workflow-glow {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 130%;
  height: 130%;
  background: radial-gradient(ellipse at center, 
    rgba(249, 115, 22, 0.25) 0%,
    rgba(234, 88, 12, 0.10) 50%,
    transparent 70%
  );
  filter: blur(50px);
  animation: at-workflow-glow-pulse 4s ease-in-out infinite;
  z-index: -1;
}

@keyframes at-workflow-glow-pulse {
  0%, 100% { opacity: 0.5; transform: translate(-50%, -50%) scale(1); }
  50% { opacity: 0.8; transform: translate(-50%, -50%) scale(1.05); }
}

/* ==========================================================================
   CONTAINER
   ========================================================================== */
.at-presta-workflow-container {
  position: relative;
  background: linear-gradient(180deg, rgba(255,255,255,0.98) 0%, rgba(255,255,255,0.95) 100%);
  border: 2px solid #1a1a1a;
  border-radius: 16px;
  box-shadow:
    0 4px 6px rgba(0,0,0,0.02),
    0 12px 24px rgba(0,0,0,0.06),
    0 24px 48px rgba(0,0,0,0.08),
    inset 0 1px 0 rgba(255,255,255,0.9);
  overflow: hidden;
  transform: rotateY(-5deg) rotateX(2deg);
  transform-style: preserve-3d;
  transition: transform 0.4s ease;
}

.at-presta-workflow:hover .at-presta-workflow-container {
  transform: rotateY(-2deg) rotateX(1deg);
}

/* ==========================================================================
   HEADER DARK
   ========================================================================== */
.at-presta-workflow-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: linear-gradient(180deg, #1a1a1a 0%, #0f0f0f 100%);
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.at-presta-workflow-dots {
  display: flex;
  gap: 6px;
}

.at-presta-workflow-dots span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.at-presta-workflow-dots span:nth-child(1) { background: #f87171; }
.at-presta-workflow-dots span:nth-child(2) { background: #fbbf24; }
.at-presta-workflow-dots span:nth-child(3) { background: #34d399; }

.at-presta-workflow-title {
  flex: 1;
  font-family: 'Oswald', sans-serif;
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: rgba(255,255,255,0.7);
}

.at-presta-workflow-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #22c55e;
}

.at-presta-workflow-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #22c55e;
  animation: at-workflow-status-pulse 1.5s ease-in-out infinite;
}

@keyframes at-workflow-status-pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(34,197,94,0.4); }
  50% { opacity: 0.8; box-shadow: 0 0 0 4px rgba(34,197,94,0); }
}

/* Body */
.at-presta-workflow-body {
  padding: 16px;
}

/* ==========================================================================
   FLOW
   ========================================================================== */
.at-presta-workflow-flow {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  margin-bottom: 16px;
  position: relative;
}

/* ==========================================================================
   NODES — BASE
   ========================================================================== */
.at-presta-workflow-node {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: #fff;
  border: 2px solid rgba(0,0,0,0.08);
  border-radius: 10px;
  min-width: 180px;
  position: relative;
  opacity: 0;
  transform: translateY(-10px);
  animation: at-workflow-node-appear 0.4s ease forwards;
  transition: box-shadow 0.3s ease, border-color 0.3s ease;
}

.at-presta-workflow-node:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0,0,0,0.1);
}

@keyframes at-workflow-node-appear {
  to { opacity: 1; transform: translateY(0); }
}

/* Couleurs par type */
.at-presta-workflow-node--trigger { 
  animation-delay: 0.2s; 
  border-color: rgba(249,115,22,0.3); 
  background: linear-gradient(135deg, rgba(249,115,22,0.05) 0%, #fff 100%); 
}
.at-presta-workflow-node--delay { 
  animation-delay: 0.5s; 
  border-color: rgba(59,130,246,0.3); 
  background: linear-gradient(135deg, rgba(59,130,246,0.05) 0%, #fff 100%); 
}
.at-presta-workflow-node--condition { 
  animation-delay: 0.8s; 
  border-color: rgba(168,85,247,0.3); 
  background: linear-gradient(135deg, rgba(168,85,247,0.05) 0%, #fff 100%); 
}
.at-presta-workflow-node--email { 
  animation-delay: 1.2s; 
  border-color: rgba(34,197,94,0.3); 
  background: linear-gradient(135deg, rgba(34,197,94,0.05) 0%, #fff 100%); 
}
.at-presta-workflow-node--email-vip { 
  animation-delay: 1.2s;
  border-color: rgba(234,179,8,0.4); 
  background: linear-gradient(135deg, rgba(234,179,8,0.1) 0%, #fff 100%); 
}

.at-presta-workflow-node-icon {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  background: rgba(0,0,0,0.03);
  border-radius: 8px;
}

.at-presta-workflow-node-content {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.at-presta-workflow-node-type {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--trafic-dark);
  opacity: 0.5;
}

.at-presta-workflow-node-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--trafic-dark);
}

.at-presta-workflow-node-meta {
  font-size: 10px;
  color: #22c55e;
  font-weight: 500;
}

/* ==========================================================================
   CASCADE LUMINEUSE — NODES
   Animation 6s : chaque étape ~0.6s, pause 1.2s à la fin
   ========================================================================== */

/* Étape 1 : Trigger (0-10%) */
.at-presta-workflow-node--trigger {
  animation: 
    at-workflow-node-appear 0.4s ease forwards 0.2s,
    at-workflow-cascade-trigger 6s ease-in-out infinite 2s;
}

@keyframes at-workflow-cascade-trigger {
  0%, 2% { box-shadow: none; border-color: rgba(249,115,22,0.3); }
  5%, 10% { box-shadow: 0 0 25px rgba(249,115,22,0.5); border-color: #f97316; }
  15%, 100% { box-shadow: none; border-color: rgba(249,115,22,0.3); }
}

/* Étape 3 : Delay (20-30%) */
.at-presta-workflow-node--delay {
  animation: 
    at-workflow-node-appear 0.4s ease forwards 0.5s,
    at-workflow-cascade-delay 6s ease-in-out infinite 2s;
}

@keyframes at-workflow-cascade-delay {
  0%, 17% { box-shadow: none; border-color: rgba(59,130,246,0.3); }
  20%, 28% { box-shadow: 0 0 25px rgba(249,115,22,0.5); border-color: #f97316; }
  33%, 100% { box-shadow: none; border-color: rgba(59,130,246,0.3); }
}

/* Étape 5 : Condition (40-50%) */
.at-presta-workflow-node--condition {
  animation: 
    at-workflow-node-appear 0.4s ease forwards 0.8s,
    at-workflow-cascade-condition 6s ease-in-out infinite 2s;
}

@keyframes at-workflow-cascade-condition {
  0%, 37% { box-shadow: none; border-color: rgba(168,85,247,0.3); }
  40%, 48% { box-shadow: 0 0 25px rgba(249,115,22,0.5); border-color: #f97316; }
  53%, 100% { box-shadow: none; border-color: rgba(168,85,247,0.3); }
}

/* Étape 8 : Email VIP (70-82%) */
.at-presta-workflow-node--email-vip {
  animation: 
    at-workflow-node-appear 0.4s ease forwards 1.2s,
    at-workflow-cascade-vip 6s ease-in-out infinite 2s;
}

@keyframes at-workflow-cascade-vip {
  0%, 67% { box-shadow: none; border-color: rgba(234,179,8,0.4); }
  70%, 82% { box-shadow: 0 0 25px rgba(249,115,22,0.5); border-color: #f97316; }
  87%, 100% { box-shadow: none; border-color: rgba(234,179,8,0.4); }
}

/* Email standard (branche Non) - pas d'animation cascade */
.at-presta-workflow-branch-path--no .at-presta-workflow-node--email {
  animation: at-workflow-node-appear 0.4s ease forwards 1.2s;
}

/* ==========================================================================
   CONNECTORS — BASE
   ========================================================================== */
.at-presta-workflow-connector {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2px;
  height: 20px;
}

.at-presta-workflow-connector--branch {
  height: 16px;
}

.at-presta-workflow-connector-line {
  width: 2px;
  height: 100%;
  background: linear-gradient(180deg, #e2e8f0 0%, #cbd5e1 100%);
  border-radius: 1px;
  position: relative;
  overflow: hidden;
}

/* ==========================================================================
   CASCADE LUMINEUSE — CONNECTORS
   ========================================================================== */

/* Étape 2 : Connecteur 1 (10-20%) */
.at-presta-workflow-connector--v1 .at-presta-workflow-connector-line {
  animation: at-workflow-cascade-line-v1 6s ease-in-out infinite 2s;
}

@keyframes at-workflow-cascade-line-v1 {
  0%, 10% { 
    background: linear-gradient(180deg, #e2e8f0 0%, #cbd5e1 100%);
    box-shadow: none;
  }
  12% { 
    background: linear-gradient(180deg, #f97316 0%, #e2e8f0 100%);
    box-shadow: 0 0 10px rgba(249,115,22,0.5);
  }
  17% { 
    background: linear-gradient(180deg, #e2e8f0 0%, #f97316 100%);
    box-shadow: 0 0 10px rgba(249,115,22,0.5);
  }
  20%, 100% { 
    background: linear-gradient(180deg, #e2e8f0 0%, #cbd5e1 100%);
    box-shadow: none;
  }
}

/* Étape 4 : Connecteur 2 (30-40%) */
.at-presta-workflow-connector--v2 .at-presta-workflow-connector-line {
  animation: at-workflow-cascade-line-v2 6s ease-in-out infinite 2s;
}

@keyframes at-workflow-cascade-line-v2 {
  0%, 30% { 
    background: linear-gradient(180deg, #e2e8f0 0%, #cbd5e1 100%);
    box-shadow: none;
  }
  32% { 
    background: linear-gradient(180deg, #f97316 0%, #e2e8f0 100%);
    box-shadow: 0 0 10px rgba(249,115,22,0.5);
  }
  37% { 
    background: linear-gradient(180deg, #e2e8f0 0%, #f97316 100%);
    box-shadow: 0 0 10px rgba(249,115,22,0.5);
  }
  40%, 100% { 
    background: linear-gradient(180deg, #e2e8f0 0%, #cbd5e1 100%);
    box-shadow: none;
  }
}

/* Étape 7 : Connecteur branche OUI (60-70%) */
.at-presta-workflow-connector--branch-yes .at-presta-workflow-connector-line {
  animation: at-workflow-cascade-line-yes 6s ease-in-out infinite 2s;
}

@keyframes at-workflow-cascade-line-yes {
  0%, 60% { 
    background: linear-gradient(180deg, #e2e8f0 0%, #cbd5e1 100%);
    box-shadow: none;
  }
  62% { 
    background: linear-gradient(180deg, #f97316 0%, #e2e8f0 100%);
    box-shadow: 0 0 10px rgba(249,115,22,0.5);
  }
  67% { 
    background: linear-gradient(180deg, #e2e8f0 0%, #f97316 100%);
    box-shadow: 0 0 10px rgba(249,115,22,0.5);
  }
  70%, 100% { 
    background: linear-gradient(180deg, #e2e8f0 0%, #cbd5e1 100%);
    box-shadow: none;
  }
}

/* Connecteur branche NON - pas d'animation */
.at-presta-workflow-connector--branch-no .at-presta-workflow-connector-line {
  animation: none;
}

/* ==========================================================================
   BRANCH
   ========================================================================== */
.at-presta-workflow-branch {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

.at-presta-workflow-branches {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-top: 8px;
  width: 100%;
}

.at-presta-workflow-branch-path {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
}

.at-presta-workflow-branch-label {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 8px;
  border-radius: 4px;
  margin-bottom: 4px;
  opacity: 0;
  animation: at-workflow-label-appear 0.3s ease forwards 1s;
  transition: box-shadow 0.3s ease, background 0.3s ease;
}

@keyframes at-workflow-label-appear {
  to { opacity: 1; }
}

.at-presta-workflow-branch-path--yes .at-presta-workflow-branch-label {
  background: rgba(34,197,94,0.1);
  color: #22c55e;
}

.at-presta-workflow-branch-path--no .at-presta-workflow-branch-label {
  background: rgba(100,116,139,0.1);
  color: #64748b;
}

/* Étape 6 : Label OUI (50-60%) */
.at-presta-workflow-branch-path--yes .at-presta-workflow-branch-label {
  animation: 
    at-workflow-label-appear 0.3s ease forwards 1s,
    at-workflow-cascade-label-yes 6s ease-in-out infinite 2s;
}

@keyframes at-workflow-cascade-label-yes {
  0%, 50% { 
    background: rgba(34,197,94,0.1);
    box-shadow: none;
  }
  53%, 58% { 
    background: rgba(249,115,22,0.2);
    box-shadow: 0 0 15px rgba(249,115,22,0.4);
  }
  63%, 100% { 
    background: rgba(34,197,94,0.1);
    box-shadow: none;
  }
}

.at-presta-workflow-branch-path .at-presta-workflow-node--email {
  min-width: 130px;
  padding: 8px 12px;
}

/* ==========================================================================
   STATS
   ========================================================================== */
.at-presta-workflow-stats {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 14px;
  background: linear-gradient(135deg, rgba(249,115,22,0.05) 0%, rgba(234,88,12,0.02) 100%);
  border: 1px solid rgba(249,115,22,0.1);
  border-radius: 10px;
}

.at-presta-workflow-stat {
  display: flex;
  align-items: center;
  gap: 8px;
  opacity: 0;
  animation: at-workflow-stat-appear 0.4s ease forwards;
}

.at-presta-workflow-stat:nth-child(1) { animation-delay: 1.6s; }
.at-presta-workflow-stat:nth-child(2) { animation-delay: 1.8s; }
.at-presta-workflow-stat:nth-child(3) { animation-delay: 2s; }

@keyframes at-workflow-stat-appear {
  to { opacity: 1; }
}

.at-presta-workflow-stat-icon {
  font-size: 18px;
}

.at-presta-workflow-stat-content {
  display: flex;
  flex-direction: column;
}

.at-presta-workflow-stat-value {
  font-family: 'Oswald', sans-serif;
  font-size: 16px;
  font-weight: 700;
  color: var(--trafic-dark);
}

.at-presta-workflow-stat--highlight .at-presta-workflow-stat-value {
  background: linear-gradient(135deg, #f97316, #ea580c);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.at-presta-workflow-stat-label {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--trafic-dark);
  opacity: 0.5;
}

/* ==========================================================================
   REFLET
   ========================================================================== */
.at-presta-workflow-reflection {
  position: absolute;
  bottom: -50%;
  left: 5%;
  right: 5%;
  height: 50%;
  background: linear-gradient(180deg, rgba(0,0,0,0.05) 0%, transparent 100%);
  transform: rotateX(180deg) rotateY(-5deg);
  opacity: 0.3;
  filter: blur(3px);
  mask-image: linear-gradient(180deg, rgba(0,0,0,0.3) 0%, transparent 50%);
  -webkit-mask-image: linear-gradient(180deg, rgba(0,0,0,0.3) 0%, transparent 50%);
  pointer-events: none;
}

/* ==========================================================================
   ÉLÉMENTS ORBITANTS
   ========================================================================== */
.at-presta-workflow-orbit {
  position: absolute;
  inset: -30px;
  pointer-events: none;
}

.at-presta-workflow-orbit-item {
  position: absolute;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, rgba(255,255,255,0.95), rgba(255,255,255,0.85));
  border: 1px solid rgba(0,0,0,0.06);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.1);
  font-size: 20px;
  animation: at-workflow-orbit-float 4s ease-in-out infinite;
}

.at-presta-workflow-orbit-item--tr {
  top: 5%;
  right: -12%;
  animation-delay: 0s;
}

.at-presta-workflow-orbit-item--ml {
  top: 40%;
  left: -12%;
  animation-delay: 1s;
}

.at-presta-workflow-orbit-item--bl {
  bottom: 8%;
  left: -14%;
  animation-delay: 2s;
}

.at-presta-workflow-orbit-item--br {
  bottom: 5%;
  right: -10%;
  animation-delay: 2.5s;
}

@keyframes at-workflow-orbit-float {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  25% { transform: translateY(-8px) rotate(3deg); }
  75% { transform: translateY(4px) rotate(-2deg); }
}

.at-presta-workflow-orbit-item--tag {
  width: auto;
  padding: 0 14px;
  min-width: 44px;
}

.at-presta-workflow-orbit-item--tag span {
  font-family: 'Oswald', sans-serif;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: #f97316;
}

.at-presta-workflow-orbit-item--img {
  width: 52px;
  height: 52px;
  padding: 6px;
  background: #fff;
}

.at-presta-workflow-orbit-item--img img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* ==========================================================================
   NOTIFICATIONS FLOTTANTES
   ========================================================================== */
.at-presta-workflow-notif {
  position: absolute;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: linear-gradient(135deg, rgba(255,255,255,0.98), rgba(255,255,255,0.92));
  border: 1px solid rgba(0,0,0,0.06);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  font-size: 12px;
  font-weight: 600;
  color: var(--trafic-dark);
  opacity: 0;
  animation: at-workflow-notif-appear 0.5s ease forwards, at-workflow-notif-float 3s ease-in-out infinite;
}

.at-presta-workflow-notif--tl {
  top: 8%;
  left: -22%;
  animation-delay: 1.5s, 2s;
}

.at-presta-workflow-notif--mr {
  top: 45%;
  right: -24%;
  animation-delay: 2.2s, 2.7s;
}

@keyframes at-workflow-notif-appear {
  to { opacity: 1; }
}

@keyframes at-workflow-notif-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

.at-presta-workflow-notif-icon {
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #f97316, #ea580c);
  border-radius: 6px;
  font-size: 11px;
  color: #fff;
}

.at-presta-workflow-notif-text {
  white-space: nowrap;
}

/* ==========================================================================
   A11Y : Reduced motion
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  .at-presta-workflow-glow,
  .at-presta-workflow-status-dot,
  .at-presta-workflow-orbit-item,
  .at-presta-workflow-notif {
    animation: none;
  }

  .at-presta-workflow-node,
  .at-presta-workflow-branch-label,
  .at-presta-workflow-stat,
  .at-presta-workflow-notif {
    opacity: 1;
    transform: none;
  }

  .at-presta-workflow-node--trigger,
  .at-presta-workflow-node--delay,
  .at-presta-workflow-node--condition,
  .at-presta-workflow-node--email-vip {
    animation: at-workflow-node-appear 0.4s ease forwards;
    box-shadow: none;
  }

  .at-presta-workflow-connector-line {
    animation: none;
  }

  .at-presta-workflow-branch-path--yes .at-presta-workflow-branch-label {
    animation: at-workflow-label-appear 0.3s ease forwards 1s;
  }
}
