/* Timeline Styles */
.timeline-section {
  max-width: 1200px;
  margin: 40px auto;
  background: var(--bg-elevated);
  padding: 80px 32px;
  border-radius: 12px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.light-theme .timeline-section {
  border: 1px solid rgba(0, 0, 0, 0.05);
}

.timeline-section h2 {
  text-align: center;
  margin-bottom: 60px;
  color: var(--primary-color);
  font-size: 2.5rem;
  letter-spacing: 1px;
}

.timeline-container {
  position: relative;
  max-width: 1000px;
  margin: 0 auto;
  padding: 40px 0;
}

.timeline-line {
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(180deg, var(--primary-color) 0%, var(--secondary-color) 100%);
  transform: translateX(-50%);
}

.timeline-item {
  position: relative;
  margin: 120px 0; /* Increased to 120px for better spacing */
  opacity: 0;
  transform: translateY(50px);
  transition: all 0.6s ease;
  width: 100%;
  min-height: 200px; /* Increased to accommodate content */
  display: flex;
  align-items: center;
}

.timeline-item.animate {
  opacity: 1;
  transform: translateY(0);
}

.timeline-item:nth-child(odd) .timeline-content {
  position: absolute;
  left: 0;
  right: calc(50% + 40px);
  text-align: right;
  width: calc(50% - 40px);
  top: 50%;
  transform: translateY(-50%);
}

.timeline-item:nth-child(even) .timeline-content {
  position: absolute;
  right: 0;
  left: calc(50% + 40px);
  text-align: left;
  width: calc(50% - 40px);
  top: 50%;
  transform: translateY(-50%);
}

.timeline-content {
  background: var(--bg-higher);
  padding: 30px;
  border-radius: 12px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(255, 255, 255, 0.05);
  cursor: pointer;
  transition: all 0.3s ease;
  word-wrap: break-word;
  overflow-wrap: break-word;
  margin-bottom: 20px; /* Added margin bottom */
}

.light-theme .timeline-content {
  border: 1px solid rgba(0, 0, 0, 0.05);
}

.timeline-content:hover {
  transform: translateY(-5px) translateY(-60%) !important; /* Adjusted for new positioning */
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.4);
  border-color: var(--primary-color);
}

.light-theme .timeline-content:hover {
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.15);
}

.timeline-content::before {
  content: '';
  position: absolute;
  top: 50%;
  width: 0;
  height: 0;
  border: 12px solid transparent;
  transform: translateY(-50%);
}

.timeline-item:nth-child(odd) .timeline-content::before {
  right: -24px;
  border-left-color: var(--bg-higher);
}

.timeline-item:nth-child(even) .timeline-content::before {
  left: -24px;
  border-right-color: var(--bg-higher);
}

.timeline-marker {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 20px;
  height: 20px;
  background: var(--primary-color);
  border: 4px solid var(--bg-elevated);
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(138, 99, 255, 0.2);
  z-index: 10;
  transition: all 0.3s ease;
}

.timeline-item:hover .timeline-marker {
  transform: translate(-50%, -50%) scale(1.2);
  background: var(--secondary-color);
  box-shadow: 0 0 0 6px rgba(138, 99, 255, 0.3);
}

.timeline-date {
  display: inline-block;
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  color: white;
  padding: 8px 20px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 15px;
}

.timeline-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-color);
  margin-bottom: 8px;
  line-height: 1.3;
}

.timeline-company {
  font-size: 1.1rem;
  color: var(--accent-color);
  font-weight: 600;
  margin-bottom: 12px;
  line-height: 1.3;
}

.timeline-description {
  color: var(--text-light);
  line-height: 1.6;
  margin-bottom: 15px;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.timeline-skills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 15px;
}

.timeline-skill {
  background: rgba(138, 99, 255, 0.1);
  color: var(--accent-color);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  border: 1px solid rgba(138, 99, 255, 0.2);
}

.light-theme .timeline-skill {
  background: rgba(138, 99, 255, 0.08);
  border: 1px solid rgba(138, 99, 255, 0.15);
}

.timeline-item.timeline-collapsed {
  display: none !important;
}

.timeline-toggle-wrapper {
  display: flex;
  justify-content: center;
  padding: 20px 0 10px;
  position: relative;
  z-index: 1;
}

.timeline-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 28px;
  background: var(--bg-higher);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 24px;
  color: var(--text-light);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
}

.light-theme .timeline-toggle-btn {
  border-color: rgba(0, 0, 0, 0.1);
}

.timeline-toggle-btn:hover {
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
  box-shadow: 0 4px 15px rgba(138, 99, 255, 0.3);
}

/* Desktop specific spacing - Added this new media query */
@media (min-width: 769px) {
  .timeline-item {
    margin: 140px 0; /* Even more spacing for desktop */
    min-height: 220px; /* Ensure enough height for content */
  }
  
  .timeline-item:first-child {
    margin-top: 80px;
  }
  
  .timeline-item:last-child {
    margin-bottom: 80px;
  }

  /* Additional spacing adjustments for content positioning */
  .timeline-item:nth-child(odd) .timeline-content {
    top: 40%; /* Adjust vertical position */
  }

  .timeline-item:nth-child(even) .timeline-content {
    top: 40%; /* Adjust vertical position */
  }
}

/* Mobile Timeline */
@media (max-width: 768px) {
  .timeline-section {
    padding: 60px 20px;
    margin: 40px 20px;
  }

  .timeline-section h2 {
    font-size: 2rem;
    margin-bottom: 40px;
  }

  .timeline-container {
    padding: 20px 0;
  }

  .timeline-line {
    left: 30px;
    transform: none;
  }

  .timeline-item {
    margin: 40px 0;
    display: block;
    min-height: auto; /* Reset min-height for mobile */
  }

  .timeline-item:nth-child(odd) .timeline-content,
  .timeline-item:nth-child(even) .timeline-content {
    position: relative;
    left: 60px;
    right: 0;
    top: auto;
    transform: none;
    text-align: left;
    width: calc(100% - 80px);
    margin-top: 20px;
    margin-bottom: 0; /* Reset margin for mobile */
  }

  .timeline-item:nth-child(odd) .timeline-content::before,
  .timeline-item:nth-child(even) .timeline-content::before {
    left: -24px;
    right: auto;
    top: 20px;
    transform: none;
    border-right-color: var(--bg-higher);
    border-left-color: transparent;
  }

  .timeline-marker {
    left: 30px;
    top: 0;
    transform: translate(-50%, 0);
  }

  .timeline-content {
    padding: 25px;
  }

  .timeline-content:hover {
    transform: none !important;
  }

  .timeline-title {
    font-size: 1.2rem;
  }

  .timeline-company {
    font-size: 1rem;
  }
}

/* Small mobile devices */
@media (max-width: 480px) {
  .timeline-section {
    padding: 40px 16px;
    margin: 30px 10px;
  }

  .timeline-item:nth-child(odd) .timeline-content,
  .timeline-item:nth-child(even) .timeline-content {
    left: 50px;
    width: calc(100% - 70px);
  }

  .timeline-content {
    padding: 20px;
  }
}