/* =========================================================
   PAICON Timeline Styles 
   ========================================================= */

/* Timeline Card Spacing Enhancements */
.timeline-item .ti/* Add specific margins for timeline items to create better spacing from the vertical line */
.timeline-item:nth-child(odd) .timeline-card {
  margin-right: 1.5rem; /* Add right margin for left side cards */
}

.timeline-item:nth-child(even) .timeline-card {
  margin-left: 1.5rem; /* Add left margin for right side cards */
}

/* Timeline node alignment with vertical line */
.timeline-item .timeline-node {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  margin: 0;
}

.timeline-card {
  border-radius: 1rem;
  overflow: hidden;
}

/* Better spacing for timeline layout */
.timeline-section .timeline-container {
  padding: 0 1rem;
}

/* Add more space between cards and timeline */
.timeline-item .z-10.w-full.md\:w-5\/12.mb-8.md\:mb-0.md\:pr-16,
.timeline-item .z-10.w-full.md\:w-5\/12.mb-8.md\:mb-0.md\:pr-20 {
  padding-right: 4rem !important; /* More spacing on right side cards */
}

.timeline-item .z-10.w-full.md\:w-5\/12.mb-8.md\:mb-0.md\:pl-16,
.timeline-item .z-10.w-full.md\:w-5\/12.mb-8.md\:mb-0.md\:pl-20 {
  padding-left: 4rem !important; /* More spacing on left side cards */
}

/* Enhanced border radius */
.timeline-card {
  border-radius: 1.25rem !important; /* Increased border radius */
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.15), 0 10px 10px -5px rgba(0, 0, 0, 0.1);
  position: relative;
}

/* Add additional distance from the center line */
.timeline-container {
  --timeline-margin: 3rem; /* Variable for consistent margin */
}

/* Responsive margins for different screen sizes */
@media (min-width: 992px) {
  .timeline-container {
    --timeline-margin: 4rem;
  }
}

/* Improved timeline line appearance */
.timeline-line {
  width: 4px; /* Adjust line thickness */
  margin-left: -2px; /* Center the line properly */
  z-index: 5; /* Ensure proper layering */
}

/* Specific margins for timeline items to create better spacing from the vertical line */
.timeline-item:nth-child(odd) .timeline-card {
  margin-right: 1.5rem; /* Add right margin for left side cards */
}

.timeline-item:nth-child(even) .timeline-card {
  margin-left: 1.5rem; /* Add left margin for right side cards */
}

/* Add gap between timeline node and cards */
@media (min-width: 768px) {
  .timeline-item {
    gap: 2.5rem;
  }

  /* Add specific margins for timeline node */
  .timeline-node {
    margin: 0 1.5rem;
  }
}

/* =========================================================
   PAICON Timeline Styles timeline-node-circle.css)
   ========================================================= */

/* Ensure the timeline nodes are perfect circles and properly aligned */
.timeline-node {
  width: 56px !important;
  height: 56px !important;
  aspect-ratio: 1;
  border-radius: 50%;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  overflow: hidden; /* For filling animation */
  transition: background-color 0.5s ease-in-out;
}

/* Circle fill effect */
.timeline-node::before {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 0%;
  background-color: currentColor;
  opacity: 0.3;
  transition: height 0.6s ease-out;
  z-index: 1;
}

.timeline-node.filled::before {
  height: 100%;
  opacity: 1;
  animation: fillUp 0.6s ease-out forwards;
}

@keyframes fillUp {
  0% { 
    height: 0%; 
  }
  100% { 
    height: 100%; 
  }
}

/* Color animation for the numbers */
@keyframes numberColorChange {
  0% { color: white; }
  100% { color: #f97316; }
}

.timeline-node.filled span {
  animation: numberColorChange 0.5s ease-in-out forwards;
}

/* Center the numbers inside the timeline nodes */
.timeline-node span {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  width: 100%;
  font-size: 1.25rem;
  font-weight: 700;
  position: relative;
  z-index: 2;
  color: white; /* Default color */
  transition: color 0.4s ease-in-out, transform 0.3s ease;
}

/* Fill animation styles */
.timeline-node.filled {
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.8), 0 0 15px rgba(255, 255, 255, 0.5);
}

.timeline-node.filled span {
  transform: scale(1.1);
  transition: transform 0.3s ease, color 0.5s ease;
  color: #f97316 !important; /* Orange color for the number when filled */
}

/* Pulse animation when first filled */
.timeline-node.pulse {
  animation: node-pulse 0.8s ease-out;
}

@keyframes node-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.7);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(255, 255, 255, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(255, 255, 255, 0);
  }
}

/* Ensure orange color appears on all filled nodes */
.timeline-node.filled.bg-blue-500 span,
.timeline-node.filled.bg-green-500 span,
.timeline-node.filled.bg-purple-500 span,
.timeline-node.filled.bg-red-500 span,
.timeline-node.filled.bg-orange-500 span {
  color: #f97316 !important;
}

/* Make sure the timeline line is centered */
.timeline-line {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  height: 100%;
  z-index: 5;
}

/* Ensure proper positioning for timeline items */
.timeline-item {
  position: relative;
}


/* =========================================================
   PAICON Timeline Styles timeline-animation.css)
   ========================================================= */

/* Timeline Animation Styles */
.timeline-card {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.5s ease-out, transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275), border-radius 0.3s ease;
  will-change: opacity, transform;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  border-radius: 1.25rem !important;
}

.timeline-card.animate {
  opacity: 1;
  transform: translateY(0);
}

.timeline-node {
  opacity: 0;
  transform: scale(0.5);
  transition: opacity 0.3s ease-out, transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  will-change: opacity, transform;
  box-shadow: 0 0 0 4px white, 0 0 0 8px rgba(255, 255, 255, 0.2);
  width: 3.5rem !important; /* Fixed width for perfect circle */
  height: 3.5rem !important; /* Fixed height for perfect circle */
  aspect-ratio: 1; /* Ensure perfect circle */
  display: flex;
  align-items: center;
  justify-content: center;
}

.timeline-node.animate {
  opacity: 1;
  transform: scale(1);
}

.timeline-line {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 4px; /* Adjusted thickness */
  background-color: #f97316; /* Paicon orange theme color */
  height: 0; /* Start with height 0 */
  transition: height 0.2s ease-out, opacity 0.2s ease;
  box-shadow: 0 0 12px rgba(249, 115, 22, 0.5); /* Enhanced glow effect */
  border-radius: 2px;
  z-index: 5;
  top: 0;
  bottom: 0;
}

/* Custom node styling for better visibility */
.timeline-node {
  position: relative; /* For pseudo-element positioning */
  border-radius: 50%; /* Perfect circle */
  left: 50%; /* Center on the timeline */
  transform: translateX(-50%); /* Center alignment adjustment */
}

/* Center the number within the node */
.timeline-node span {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-size: 1.25rem;
  font-weight: 700;
}

.timeline-node::after {
  content: '';
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: transparent;
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.3);
  animation: pulse 2s infinite;
  z-index: -1;
}

@keyframes pulse {
  0% {
    transform: scale(1);
    opacity: 0.7;
  }
  70% {
    transform: scale(1.15);
    opacity: 0;
  }
  100% {
    transform: scale(1);
    opacity: 0;
  }
}

/* Animation delay for cards and nodes */
.timeline-item:nth-child(1) .timeline-card,
.timeline-item:nth-child(1) .timeline-node {
  transition-delay: 0.1s;
}

.timeline-item:nth-child(2) .timeline-card,
.timeline-item:nth-child(2) .timeline-node {
  transition-delay: 0.2s;
}

.timeline-item:nth-child(3) .timeline-card,
.timeline-item:nth-child(3) .timeline-node {
  transition-delay: 0.3s;
}

.timeline-item:nth-child(4) .timeline-card,
.timeline-item:nth-child(4) .timeline-node {
  transition-delay: 0.4s;
}

.timeline-item:nth-child(5) .timeline-card,
.timeline-item:nth-child(5) .timeline-node {
  transition-delay: 0.5s;
}

/* =========================================================
   PAICON Timeline Styles - Mobile Responsive Updates
   ========================================================= */

/* Mobile specific styles for timeline */
@media (max-width: 767px) {
  /* Timeline structure adjustments */
  .timeline-item {
    padding-left: 0;
    margin-left: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
  }
  
  /* Proper vertical line alignment on mobile - centered through nodes */
  .timeline-line {
    left: 50% !important; /* Center the line */
    margin-left: 0;
    transform: translateX(-50%) !important;
    width: 4px;
  }
  
  /* Center the node circles on mobile */
  .timeline-node {
    left: 50% !important;
    transform: translateX(-50%) !important;
  }
  
  /* Full width cards centered on mobile */
  .timeline-card {
    width: 85% !important; /* Slightly narrower than full width for better spacing */
    margin-left: auto !important;
    margin-right: auto !important;
    margin-top: 2rem !important; /* Space above the cards, after nodes */
    margin-bottom: 3.5rem !important; /* Space below cards before next node */
  }
  
  /* Ensure cards have proper padding on mobile */
  .timeline-card {
    padding: 1.25rem !important;
  }
  
  /* Make all content visible on mobile */
  .timeline-item .hidden {
    display: block !important;
  }
  
  /* Center all content on mobile */
  .timeline-item .z-10.w-full {
    width: 100% !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    margin-top: 1rem;
    display: flex;
    justify-content: center;
  }
  
  /* Ensure cards stack properly with good spacing */
  .timeline-container .space-y-24 {
    --tw-space-y-reverse: 0;
    margin-top: calc(2rem * calc(1 - var(--tw-space-y-reverse)));
    margin-bottom: calc(2rem * var(--tw-space-y-reverse));
  }
  
  /* Force all content visible for all timeline items */
  .timeline-item .w-full.md\:w-5\/12.md\:pr-20.hidden.md\:block,
  .timeline-item .w-full.md\:w-5\/12.md\:pl-16.hidden.md\:block {
    display: none !important;
  }
  
  /* Make cards appear in a consistent layout */
  .timeline-item:nth-child(even) .z-10.w-full.md\:w-5\/12.mb-8.md\:mb-0.md\:pl-20.pl-16.md\:ml-auto,
  .timeline-item:nth-child(odd) .z-10.w-full.md\:w-5\/12.mb-8.md\:mb-0.md\:pr-20.pl-16.md\:pl-0 {
    padding-left: 0 !important;
    padding-right: 0 !important;
    width: 100% !important;
    display: flex;
    justify-content: center;
  }
  
  /* Improve card width and centering for better mobile layout */
  .timeline-item .timeline-card {
    max-width: 90%; 
    margin: 0 auto;
  }

  /* Hide all numbers inside the cards */
  .timeline-card span,
  .timeline-card .timeline-node,
  .timeline-card .z-20 {
    display: none !important;
  }
  
  /* Target specifically those numbers that overlap with content */
  .timeline-card .text-white.font-bold.text-xl {
    display: none !important;
  }
  
  /* Override any z-index or positioning that might make the numbers visible */
  .timeline-node {
    z-index: -1 !important; /* Push behind the cards */
  }
  
  /* Fix specific nodes for 1, 3, and 5 that are showing through */
  .timeline-item:nth-child(1) .timeline-card .timeline-node,
  .timeline-item:nth-child(3) .timeline-card .timeline-node,
  .timeline-item:nth-child(5) .timeline-card .timeline-node,
  .timeline-item:nth-child(1) .timeline-card span,
  .timeline-item:nth-child(3) .timeline-card span,
  .timeline-item:nth-child(5) .timeline-card span {
    opacity: 0 !important;
    visibility: hidden !important;
  }
  
  /* Additional fix for any overlapping circles */
  .timeline-card .w-14.h-14,
  .timeline-card .bg-blue-500, 
  .timeline-card .bg-green-500,
  .timeline-card .bg-purple-500,
  .timeline-card .bg-red-500,
  .timeline-card .bg-orange-500 {
    display: none !important;
  }
  
  /* Ensure timeline nodes are only visible on the vertical line */
  .timeline-item > .timeline-node {
    opacity: 0 !important; /* Make all nodes invisible */
  }
}

/* Additional fine-tuning for card appearance */
@media (max-width: 767px) {
  /* Ensure better card title display on mobile */
  .timeline-card h3 {
    font-size: 1.25rem;
    line-height: 1.4;
  }
  
  /* Make icons and titles wrap better on small screens */
  .timeline-card .flex.items-center {
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: center;
  }
  
  /* Better spacing between timeline items */
  .space-y-24 > * {
    margin-bottom: 4.5rem;
    position: relative;
  }
  
  .space-y-24 > *:last-child {
    margin-bottom: 1rem;
  }
  
  /* Make the vertical line visible with more padding */
  .timeline-section {
    padding-top: 3rem;
    padding-bottom: 3rem;
    position: relative;
  }
  
  /* Make sure node circles render properly */
  .timeline-node {
    margin: 0;
    position: absolute;
    z-index: 10;
  }
  
  /* Ensure cards stack properly */
  .timeline-container {
    padding-top: 1rem;
    padding-bottom: 1rem;
  }
  
  /* Ensure everything is centered */
  .timeline-item {
    text-align: center;
  }
  
  /* Make the timeline nodes slightly smaller on mobile */
  .timeline-node {
    width: 48px !important;
    height: 48px !important;
  }
  
  /* Better padding for card content */
  .timeline-card p {
    padding: 0 0.5rem;
  }
}
