/* Reading Progress Bar */
#reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 0%;
  height: 3px;
  background: linear-gradient(90deg, #4CAF50, #2196F3, #9C27B0);
  z-index: 9999;
  transition: width 0.2s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Back to Top Button */
#back-to-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: var(--btn-backtotop-color, #4CAF50);
  color: var(--btn-backtotop-icon-color, white);
  border: none;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

#back-to-top.visible {
  opacity: 1;
  visibility: visible;
}

#back-to-top:hover {
  transform: translateY(-5px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

#back-to-top:active {
  transform: translateY(-2px);
}

/* Code Block Enhancements */
.code-header {
  position: relative;
  background: var(--code-header-bg, #2d2d2d);
  border-radius: 6px 6px 0 0;
  padding: 0.5rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.code-language {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--code-language-color, #888);
  letter-spacing: 0.5px;
}

.copy-code-button {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: var(--code-copy-color, #aaa);
  padding: 0.25rem 0.75rem;
  border-radius: 4px;
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.copy-code-button:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.3);
  color: white;
}

.copy-code-button.copied {
  background: #4CAF50;
  border-color: #4CAF50;
  color: white;
}

/* Smooth Scroll Animations */
.fade-in-up {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.fade-in-up.visible {
  opacity: 1;
  transform: translateY(0);
}

.fade-in-left {
  opacity: 0;
  transform: translateX(-30px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.fade-in-left.visible {
  opacity: 1;
  transform: translateX(0);
}

.fade-in-right {
  opacity: 0;
  transform: translateX(30px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.fade-in-right.visible {
  opacity: 1;
  transform: translateX(0);
}

/* Research Cards */
.research-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 2rem;
  margin: 2rem 0;
}

.research-card {
  background: var(--card-bg, white);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  display: flex;
  flex-direction: column;
}

.research-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.research-card-image {
  width: 100%;
  height: 200px;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.research-card:hover .research-card-image {
  transform: scale(1.05);
}

.research-card-content {
  padding: 1.5rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.research-card-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--heading-color);
}

.research-card-meta {
  font-size: 0.875rem;
  color: var(--text-muted-color, #666);
  margin-bottom: 1rem;
}

.research-card-description {
  flex: 1;
  margin-bottom: 1rem;
  line-height: 1.6;
}

.research-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.research-card-tag {
  background: var(--tag-bg, #e3f2fd);
  color: var(--tag-color, #1976d2);
  padding: 0.25rem 0.75rem;
  border-radius: 16px;
  font-size: 0.75rem;
  font-weight: 500;
}

.research-card-actions {
  display: flex;
  gap: 0.75rem;
}

.research-card-btn {
  flex: 1;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  text-align: center;
  text-decoration: none;
  font-weight: 500;
  transition: all 0.2s ease;
}

.research-card-btn-primary {
  background: var(--btn-primary-bg, #2196F3);
  color: white;
}

.research-card-btn-primary:hover {
  background: var(--btn-primary-hover, #1976D2);
  transform: translateY(-2px);
}

.research-card-btn-secondary {
  background: transparent;
  color: var(--btn-secondary-color, #2196F3);
  border: 1px solid var(--btn-secondary-border, #2196F3);
}

.research-card-btn-secondary:hover {
  background: var(--btn-secondary-hover-bg, #e3f2fd);
  transform: translateY(-2px);
}

/* Share Buttons */
.share-buttons {
  display: flex;
  gap: 0.75rem;
  margin: 2rem 0;
  flex-wrap: wrap;
}

.share-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.2s ease;
  color: white;
}

.share-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.share-btn.twitter {
  background: #1DA1F2;
}

.share-btn.linkedin {
  background: #0077B5;
}

.share-btn.email {
  background: #EA4335;
}

.share-btn.copy {
  background: #666;
}

.share-btn.copied {
  background: #4CAF50;
}

/* Timeline */
.timeline {
  position: relative;
  max-width: 1200px;
  margin: 2rem auto;
  padding: 2rem 0;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 2px;
  height: 100%;
  background: var(--timeline-line, #ddd);
}

.timeline-item {
  position: relative;
  margin-bottom: 3rem;
  display: flex;
  align-items: center;
}

.timeline-item:nth-child(odd) {
  flex-direction: row;
}

.timeline-item:nth-child(even) {
  flex-direction: row-reverse;
}

.timeline-content {
  width: 45%;
  padding: 1.5rem;
  background: var(--card-bg, white);
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.timeline-content:hover {
  transform: scale(1.02);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.timeline-marker {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--timeline-marker, #2196F3);
  border: 4px solid var(--timeline-marker-border, white);
  box-shadow: 0 0 0 4px var(--timeline-marker-shadow, #e3f2fd);
  z-index: 1;
}

.timeline-year {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  top: -10px;
  background: var(--timeline-year-bg, #2196F3);
  color: white;
  padding: 0.25rem 0.75rem;
  border-radius: 16px;
  font-weight: 600;
  font-size: 0.875rem;
}

/* Responsive Design */
@media (max-width: 768px) {
  .timeline::before {
    left: 20px;
  }

  .timeline-item {
    flex-direction: row !important;
  }

  .timeline-content {
    width: calc(100% - 60px);
    margin-left: 60px;
  }

  .timeline-marker {
    left: 20px;
  }

  .timeline-year {
    left: 20px;
  }

  .research-cards {
    grid-template-columns: 1fr;
  }

  #back-to-top {
    bottom: 1rem;
    right: 1rem;
    width: 45px;
    height: 45px;
  }
}

/* Loading Animation */
@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

.loading {
  animation: pulse 1.5s ease-in-out infinite;
}

/* Tooltip */
.tooltip {
  position: relative;
  display: inline-block;
}

.tooltip .tooltiptext {
  visibility: hidden;
  background-color: #555;
  color: #fff;
  text-align: center;
  border-radius: 6px;
  padding: 5px 10px;
  position: absolute;
  z-index: 1;
  bottom: 125%;
  left: 50%;
  transform: translateX(-50%);
  opacity: 0;
  transition: opacity 0.3s;
  white-space: nowrap;
  font-size: 0.875rem;
}

.tooltip .tooltiptext::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border-width: 5px;
  border-style: solid;
  border-color: #555 transparent transparent transparent;
}

.tooltip:hover .tooltiptext {
  visibility: visible;
  opacity: 1;
}
