/**
 * Infinite Scroll and Load More Styles
 *
 * @package Niche_Blog_Pro
 */

.load-more-container {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 40px 0;
  min-height: 60px;
}

.load-more-button {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 32px;
  background: linear-gradient(135deg, var(--primary-color, #007bff) 0%, var(--secondary-color, #6f42c1) 100%);
  color: white;
  border: none;
  border-radius: 50px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(0, 123, 255, 0.3);
  position: relative;
  overflow: hidden;
}

.load-more-button::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.5s ease;
}

.load-more-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 123, 255, 0.4);
}

.load-more-button:hover::before {
  left: 100%;
}

.load-more-button:active {
  transform: translateY(0);
}

.load-more-button.loading {
  pointer-events: none;
  opacity: 0.8;
}

.load-more-button .button-text {
  transition: opacity 0.3s ease;
}

.load-more-button.loading .button-text {
  opacity: 0.5;
}

.load-more-button .button-icon {
  display: inline-flex;
  transition: transform 0.3s ease;
}

.load-more-button:hover .button-icon {
  transform: translateY(2px);
}

.load-more-button .spinner {
  display: none;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.load-more-button.loading .spinner {
  display: inline-block;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.load-more-button.hidden {
  display: none;
}

/* Loading indicator for infinite scroll */
.infinite-scroll-loader {
  display: none;
  justify-content: center;
  align-items: center;
  padding: 40px 0;
}

.infinite-scroll-loader.active {
  display: flex;
}

.infinite-scroll-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--bg-tertiary);
  border-top-color: var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

/* End of posts message */
.no-more-posts {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-secondary);
  font-size: 16px;
  display: none;
}

.no-more-posts.show {
  display: block;
}

.no-more-posts::before {
  content: "";
  display: block;
  width: 60px;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--primary-color), transparent);
  margin: 0 auto 20px;
  border-radius: 2px;
}

/* New posts animation */
.blog-card {
  animation: fadeInUp 0.6s ease-out both;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Stagger animation for newly loaded posts */
.blog-card.new-post {
  opacity: 0;
}

.blog-card.new-post:nth-child(1) {
  animation-delay: 0.1s;
}

.blog-card.new-post:nth-child(2) {
  animation-delay: 0.2s;
}

.blog-card.new-post:nth-child(3) {
  animation-delay: 0.3s;
}

.blog-card.new-post:nth-child(4) {
  animation-delay: 0.4s;
}

.blog-card.new-post:nth-child(5) {
  animation-delay: 0.5s;
}

.blog-card.new-post:nth-child(n + 6) {
  animation-delay: 0.6s;
}

/* Back to top button for infinite scroll */
.scroll-to-top {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 50px;
  height: 50px;
  background: var(--primary-color);
  color: white;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
  transition: all 0.3s ease;
  z-index: 1000;
}

.scroll-to-top.show {
  display: flex;
}

.scroll-to-top:hover {
  transform: translateY(-5px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.scroll-to-top svg {
  width: 24px;
  height: 24px;
}

/* Dark mode adjustments */
.dark-mode .load-more-button {
  box-shadow: 0 4px 15px rgba(0, 123, 255, 0.4);
}

.dark-mode .load-more-button:hover {
  box-shadow: 0 6px 20px rgba(0, 123, 255, 0.5);
}

/* Mobile adjustments */
@media (max-width: 768px) {
  .load-more-button {
    padding: 12px 28px;
    font-size: 15px;
  }

  .load-more-container {
    margin: 30px 0;
  }

  .scroll-to-top {
    bottom: 20px;
    right: 20px;
    width: 45px;
    height: 45px;
  }

  .scroll-to-top svg {
    width: 20px;
    height: 20px;
  }
}
