/* ================================================================
   ANIMATED PROCESS/METHODOLOGY DIAGRAMS - Phase 3
   ================================================================ */

/* ================================================================
   PROCESS TIMELINE CONTAINER
   ================================================================ */

.process-diagram-section {
  padding: 80px 0;
  background: var(--bg-body);
  position: relative;
  overflow: hidden;
}

.process-timeline {
  position: relative;
  max-width: 1200px;
  margin: 60px auto 0;
  padding: 0 20px;
}

/* ================================================================
   TIMELINE LINE (Connecting Path)
   ================================================================ */

.timeline-line {
  position: absolute;
  top: 80px;
  left: 50%;
  transform: translateX(-50%);
  width: 90%;
  height: 4px;
  background: var(--border-light);
  z-index: 1;
}

.timeline-line-progress {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--color-primary), var(--color-accent));
  transition: width 1.5s cubic-bezier(0.4, 0.0, 0.2, 1);
  animation: lineGlow 2s ease-in-out infinite alternate;
}

@keyframes lineGlow {
  from {
    box-shadow: 0 0 5px var(--color-primary-alpha-40);
  }
  to {
    box-shadow: 0 0 15px var(--color-primary-alpha-60);
  }
}

/* Animate progress line when visible */
.process-timeline.animated .timeline-line-progress {
  width: 100%;
}

/* ================================================================
   PHASE NODES
   ================================================================ */

.timeline-phases {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  position: relative;
  z-index: 2;
}

.timeline-phase {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  opacity: 0;
  transform: translateY(30px);
  transition: all 0.6s cubic-bezier(0.4, 0.0, 0.2, 1);
}

/* Stagger animation delays */
.timeline-phase:nth-child(1) { transition-delay: 0.1s; }
.timeline-phase:nth-child(2) { transition-delay: 0.3s; }
.timeline-phase:nth-child(3) { transition-delay: 0.5s; }
.timeline-phase:nth-child(4) { transition-delay: 0.7s; }
.timeline-phase:nth-child(5) { transition-delay: 0.9s; }

.process-timeline.animated .timeline-phase {
  opacity: 1;
  transform: translateY(0);
}

/* ================================================================
   PHASE CIRCLE (Node)
   ================================================================ */

.phase-circle {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 4px solid var(--color-primary);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.4s cubic-bezier(0.4, 0.0, 0.2, 1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  position: relative;
  z-index: 3;
}

.phase-circle:hover {
  transform: scale(1.15);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  border-width: 5px;
}

.phase-circle.active {
  background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
  border-color: var(--color-accent);
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1), 0 0 0 0 var(--color-primary-alpha-40);
  }
  50% {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2), 0 0 0 15px var(--color-primary-alpha-0);
  }
}

/* Phase icon */
.phase-icon {
  font-size: 36px;
  color: var(--color-primary);
  transition: color 0.3s;
}

.phase-circle.active .phase-icon {
  color: white;
}

/* Phase number */
.phase-number {
  position: absolute;
  top: -10px;
  right: -10px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--color-accent);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* ================================================================
   PHASE INFO
   ================================================================ */

.phase-info {
  margin-top: 24px;
  padding: 0 12px;
}

.phase-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 8px 0;
  line-height: 1.3;
}

.phase-duration {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 500;
  margin: 0 0 12px 0;
  padding: 4px 12px;
  background: var(--bg-elevated);
  border-radius: 16px;
  display: inline-block;
}

.phase-description {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin: 0;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s ease;
}

.timeline-phase:hover .phase-description,
.timeline-phase.active .phase-description {
  max-height: 200px;
}

/* ================================================================
   PHASE DETAILS (Expandable Cards)
   ================================================================ */

.phase-details {
  position: absolute;
  top: 200px;
  left: 50%;
  transform: translateX(-50%);
  width: 90%;
  max-width: 800px;
  background: var(--bg-card);
  border-radius: 16px;
  padding: 32px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
  opacity: 0;
  visibility: hidden;
  transition: all 0.4s cubic-bezier(0.4, 0.0, 0.2, 1);
  z-index: 10;
  border-left: 6px solid var(--color-primary);
}

.phase-details.active {
  opacity: 1;
  visibility: visible;
  top: 180px;
}

.phase-details-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 2px solid var(--border-light);
}

.phase-details-title {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.phase-details-title .material-icons {
  font-size: 32px;
  color: var(--color-primary);
}

.phase-details-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-elevated);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: all 0.3s;
}

.phase-details-close:hover {
  background: var(--color-primary);
  color: white;
  transform: rotate(90deg);
}

.phase-details-content h4 {
  color: var(--color-primary);
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0 0 12px 0;
}

.phase-details-content ul {
  margin: 0 0 24px 20px;
  padding: 0;
}

.phase-details-content ul li {
  color: var(--text-secondary);
  line-height: 1.8;
  margin-bottom: 8px;
}

.phase-details-content ul li::marker {
  color: var(--color-primary);
}

/* ================================================================
   MOBILE TIMELINE (Vertical Layout)
   ================================================================ */

@media only screen and (max-width: 768px) {
  .timeline-line {
    top: 0;
    left: 60px;
    transform: none;
    width: 4px;
    height: 100%;
  }

  .timeline-line-progress {
    width: 100%;
    height: 0%;
    transition: height 1.5s cubic-bezier(0.4, 0.0, 0.2, 1);
  }

  .process-timeline.animated .timeline-line-progress {
    height: 100%;
    width: 100%;
  }

  .timeline-phases {
    flex-direction: column;
    gap: 60px;
  }

  .timeline-phase {
    flex-direction: row;
    align-items: flex-start;
    text-align: left;
    width: 100%;
    transform: translateX(-30px);
  }

  .process-timeline.animated .timeline-phase {
    transform: translateX(0);
  }

  .phase-circle {
    flex-shrink: 0;
    width: 80px;
    height: 80px;
  }

  .phase-icon {
    font-size: 28px;
  }

  .phase-number {
    width: 28px;
    height: 28px;
    font-size: 0.9rem;
  }

  .phase-info {
    margin-top: 0;
    margin-left: 24px;
    text-align: left;
    padding: 0;
  }

  .phase-title {
    font-size: 1.2rem;
  }

  .phase-description {
    max-height: none;
  }

  .phase-details {
    position: static;
    transform: none;
    width: 100%;
    margin-top: 24px;
    padding: 24px;
  }

  .phase-details.active {
    top: auto;
  }
}

@media only screen and (max-width: 480px) {
  .phase-circle {
    width: 70px;
    height: 70px;
  }

  .phase-icon {
    font-size: 24px;
  }

  .phase-title {
    font-size: 1rem;
  }

  .phase-details {
    padding: 20px;
  }

  .phase-details-title {
    font-size: 1.2rem;
  }
}

/* ================================================================
   DARK MODE ADJUSTMENTS
   ================================================================ */

[data-theme="dark"] .phase-circle {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .phase-circle:hover {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

[data-theme="dark"] .phase-details {
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

/* ================================================================
   PRINT STYLES
   ================================================================ */

@media print {
  .timeline-line-progress {
    width: 100%;
  }

  .timeline-phase {
    opacity: 1;
    transform: none;
  }

  .phase-details {
    display: none;
  }

  .phase-circle:hover {
    transform: none;
  }

  @keyframes pulse {
    0%, 100% {
      box-shadow: none;
    }
  }
}

/* ================================================================
   ACCESSIBILITY
   ================================================================ */

.phase-circle:focus {
  outline: 3px solid var(--color-primary);
  outline-offset: 4px;
}

.phase-circle[aria-expanded="true"] {
  border-color: var(--color-accent);
}

/* ================================================================
   REDUCED MOTION
   ================================================================ */

@media (prefers-reduced-motion: reduce) {
  .timeline-line-progress,
  .timeline-phase,
  .phase-circle,
  .phase-description,
  .phase-details {
    transition: none;
    animation: none;
  }

  .timeline-phase {
    opacity: 1;
    transform: none;
  }

  .phase-circle:hover,
  .phase-circle.active {
    transform: none;
  }
}

/* ================================================================
   LOADING STATE
   ================================================================ */

.process-timeline.loading .timeline-phase {
  opacity: 0.3;
  pointer-events: none;
}

/* ================================================================
   CUSTOM PHASE COLORS (Optional variants)
   ================================================================ */

.timeline-phase:nth-child(1) .phase-circle { border-color: #3f51b5; }
.timeline-phase:nth-child(2) .phase-circle { border-color: #2196f3; }
.timeline-phase:nth-child(3) .phase-circle { border-color: #00bcd4; }
.timeline-phase:nth-child(4) .phase-circle { border-color: #009688; }
.timeline-phase:nth-child(5) .phase-circle { border-color: #ff9800; }

.timeline-phase:nth-child(1) .phase-circle.active { background: linear-gradient(135deg, #3f51b5, #5c6bc0); }
.timeline-phase:nth-child(2) .phase-circle.active { background: linear-gradient(135deg, #2196f3, #42a5f5); }
.timeline-phase:nth-child(3) .phase-circle.active { background: linear-gradient(135deg, #00bcd4, #26c6da); }
.timeline-phase:nth-child(4) .phase-circle.active { background: linear-gradient(135deg, #009688, #26a69a); }
.timeline-phase:nth-child(5) .phase-circle.active { background: linear-gradient(135deg, #ff9800, #ffa726); }
