/* Impact Graph Styles */

.impact-section {
  padding: 4rem 1rem;
  text-align: center;
  background-color: var(--dark-secondary);
  border-radius: var(--border-radius);
  margin: 4rem auto;
  max-width: 1200px;
}

.section-description {
  color: var(--text-secondary);
  max-width: 800px;
  margin: 0 auto 3rem;
  font-size: 1.1rem;
}

.impact-graph-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2rem;
}

.graph-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1.5rem;
  margin-bottom: 1rem;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.legend-color {
  width: 15px;
  height: 15px;
  border-radius: 4px;
}

.graph-wrapper {
  display: flex;
  width: 100%;
  height: 300px;
  position: relative;
  margin-top: 1.5rem;
}

.graph-y-axis {
  display: flex;
  flex-direction: column; /* Changed from column-reverse */
  justify-content: space-between;
  padding-right: 1rem;
  color: var(--text-secondary);
  font-size: 0.8rem;
  width: 50px;
  text-align: right;
}

.graph-container {
  flex-grow: 1;
  position: relative;
  border-left: 1px solid rgba(255, 255, 255, 0.1);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.graph-grid {
  position: absolute;
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-rows: repeat(5, 1fr);
}

.graph-grid::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: repeating-linear-gradient(
    to top,
    rgba(255, 255, 255, 0.05) 0px,
    rgba(255, 255, 255, 0.05) 1px,
    transparent 1px,
    transparent 20%
  );
}

.graph-bars {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: space-around;
  align-items: flex-end;
  padding: 0 1rem; /* Reduced horizontal padding to allow more width for bars */
}

.graph-bar {
  width: 60px; /* Increased from 40px to make bars wider */
  background-color: var(--purple-primary);
  border-radius: 6px 6px 0 0;
  transition: height 1s cubic-bezier(0.165, 0.84, 0.44, 1);
  cursor: pointer;
  position: relative;
}

.graph-bar.animated {
  animation: graphBarGlow 2s infinite alternate;
}

@keyframes graphBarGlow {
  0% {
    box-shadow: 0 0 5px rgba(123, 104, 238, 0.2);
  }
  100% {
    box-shadow: 0 0 15px rgba(123, 104, 238, 0.6);
  }
}

.graph-labels {
  display: flex;
  justify-content: space-around;
  padding: 0 1rem; /* Match the padding of graph-bars */
  color: var(--text-secondary);
  font-size: 0.9rem;
  position: absolute;
  bottom: -2.5rem; /* Increased from -2rem to prevent overlap */
  left: 0;
  width: 100%;
}

.graph-labels span {
  width: 60px; /* Match the width of graph-bar */
  text-align: center; /* Center text below each bar */
  display: block; /* Ensure each label takes full width */
  white-space: nowrap; /* Keep text on single line */
  overflow: hidden; /* Hide overflow */
  text-overflow: ellipsis; /* Add ellipsis for overflow text */
}

.graph-info {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 2rem;
  margin-top: 3rem;
}

.info-card {
  background-color: rgba(255, 255, 255, 0.05);
  border-radius: var(--border-radius);
  padding: 1.5rem;
  text-align: center;
  width: 220px;
}

.info-card h3 {
  font-size: 1.1rem;
  margin: 0 0 1rem;
}

.stat-number {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--purple-primary);
  margin: 0 0 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.percentage, .plus {
  font-size: 1.5rem;
  margin-left: 0.2rem;
  font-weight: 600;
}

.stat-description {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin: 0;
}

.graph-tooltip {
  position: absolute;
  background-color: var(--dark-secondary);
  color: var(--text-primary);
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 0.9rem;
  z-index: 10;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
  text-align: center;
  min-width: 120px;
}

.graph-tooltip strong {
  display: block;
  margin-bottom: 4px;
  white-space: nowrap;
}

.graph-tooltip span {
  color: var(--purple-primary);
  font-weight: 600;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .graph-wrapper {
    height: 250px;
  }
  
  .graph-bar {
    width: 45px; /* Responsive width for medium screens */
  }
  
  .graph-labels span {
    width: 45px; /* Match graph-bar width */
  }
  
  .graph-info {
    gap: 1rem;
  }
  
  .info-card {
    width: 170px;
    padding: 1rem;
  }
  
  .stat-number {
    font-size: 1.8rem;
  }
  
  .percentage, .plus {
    font-size: 1.2rem;
  }
}

@media (max-width: 576px) {
  .impact-section {
    padding: 3rem 1rem;
  }
  
  .graph-wrapper {
    height: 200px;
  }
  
  .graph-bar {
    width: 30px; /* Smaller width for mobile screens */
  }
  
  .graph-labels span {
    width: 30px; /* Match graph-bar width */
    font-size: 0.8rem;
  }
  
  .info-card {
    width: 100%;
    max-width: 250px;
  }
}
