/* ===================================
   Related Posts - Compact Sidebar Design
   =================================== */

/* Container - Compact for sidebar */
.related-posts-container {
  margin-top: 1.5rem;
  padding: 1.25rem;
  background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

/* Title - Smaller and cleaner */
.related-posts-title {
  font-size: 1.125rem;
  font-weight: 700;
  color: #1a202c;
  margin: 0 0 1rem 0;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid #667eea;
  position: relative;
}

.related-posts-title::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 40px;
  height: 2px;
  background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
  border-radius: 2px;
}

/* Grid Layout - Always single column for sidebar */
.related-posts-grid {
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
  margin-top: 1rem;
}

/* Card Design - Horizontal compact layout */
.related-post-card {
  background: #ffffff;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid #e2e8f0;
}

.related-post-card:hover {
  transform: translateX(4px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
  border-color: #667eea;
}

/* Horizontal layout: image on left, content on right */
.related-post-link {
  display: flex;
  flex-direction: row;
  text-decoration: none;
  color: inherit;
  height: 100%;
  align-items: center;
  gap: 0.75rem;
}

/* Image Section - Small thumbnail */
.related-post-image {
  width: 80px;
  min-width: 80px;
  height: 80px;
  overflow: hidden;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  position: relative;
  flex-shrink: 0;
}

.related-post-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.related-post-card:hover .related-post-image img {
  transform: scale(1.1);
}

/* Placeholder for posts without images */
.related-post-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.related-post-placeholder svg {
  width: 32px;
  height: 32px;
  color: rgba(255, 255, 255, 0.7);
}

/* Content Section - Compact */
.related-post-content {
  padding: 0.625rem 0.75rem 0.625rem 0;
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  flex: 1;
  min-width: 0; /* Allow text truncation */
}

.related-post-title {
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.35;
  color: #1a202c;
  margin: 0;
  transition: color 0.2s ease;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.related-post-card:hover .related-post-title {
  color: #667eea;
}

/* Hide excerpt on small sidebar */
.related-post-excerpt {
  display: none;
}

/* Meta Information - Minimal */
.related-post-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  color: #94a3b8;
}

.related-post-date {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.related-post-date::before {
  content: '📅';
  font-size: 0.75rem;
}

/* Hide tags to save space */
.related-post-tag {
  display: none;
}

/* Mobile - Even more compact */
@media (max-width: 767px) {
  .related-posts-container {
    padding: 1rem;
    margin-top: 1.5rem;
    border-radius: 10px;
  }

  .related-posts-title {
    font-size: 1rem;
    margin-bottom: 0.75rem;
  }

  .related-posts-grid {
    gap: 0.75rem;
  }

  .related-post-card {
    border-radius: 6px;
  }

  .related-post-image {
    width: 70px;
    min-width: 70px;
    height: 70px;
  }

  .related-post-link {
    gap: 0.625rem;
  }

  .related-post-content {
    padding: 0.5rem 0.625rem 0.5rem 0;
    gap: 0.25rem;
  }

  .related-post-title {
    font-size: 0.8125rem;
    line-height: 1.3;
  }

  .related-post-meta {
    font-size: 0.6875rem;
  }

  .related-post-date::before {
    font-size: 0.6875rem;
  }
}

/* Tablet and larger - slightly more breathing room */
@media (min-width: 768px) {
  .related-posts-container {
    padding: 1.5rem;
  }

  .related-posts-title {
    font-size: 1.25rem;
  }

  .related-posts-grid {
    gap: 1rem;
  }

  .related-post-image {
    width: 90px;
    min-width: 90px;
    height: 90px;
  }

  .related-post-title {
    font-size: 0.9375rem;
  }
}

/* Dark mode support (optional) */
@media (prefers-color-scheme: dark) {
  .related-posts-container {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  }

  .related-posts-title {
    color: #f8fafc;
  }

  .related-post-card {
    background: #1e293b;
    border-color: #334155;
  }

  .related-post-card:hover {
    border-color: #667eea;
  }

  .related-post-title {
    color: #f8fafc;
  }

  .related-post-excerpt {
    color: #94a3b8;
  }

  .related-post-meta {
    color: #64748b;
    border-top-color: #334155;
  }
}

/* Animation on load */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.related-post-card {
  animation: fadeInUp 0.5s ease-out backwards;
}

.related-post-card:nth-child(1) { animation-delay: 0.05s; }
.related-post-card:nth-child(2) { animation-delay: 0.1s; }
.related-post-card:nth-child(3) { animation-delay: 0.15s; }
.related-post-card:nth-child(4) { animation-delay: 0.2s; }
.related-post-card:nth-child(5) { animation-delay: 0.25s; }
.related-post-card:nth-child(6) { animation-delay: 0.3s; }
