/* Blog listing styles */
.blog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  gap: 30px;
  margin: 40px 0;
  padding: 0 20px;
}

.blog-card {
  background: white;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  border: 1px solid #f0f0f0;
}

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

.blog-image-container {
  position: relative;
  width: 100%;
  height: 250px;
  overflow: hidden;
  background-color: #f8f9fa;
  display: flex;
  align-items: center;
  justify-content: center;
}

.blog-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: transform 0.3s ease;
}

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

.blog-content {
  padding: 25px;
}

.blog-title {
  font-size: 1.4rem;
  font-weight: 600;
  color: #333;
  margin-bottom: 15px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.blog-excerpt {
  color: #666;
  font-size: 0.95rem;
  line-height: 1.6;
  margin-bottom: 20px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.blog-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 1px solid #eee;
}

.blog-date {
  color: #888;
  font-size: 0.85rem;
  font-weight: 500;
}

.blog-read-more {
  display: inline-flex;
  align-items: center;
  color: #007bff;
  font-weight: 600;
  text-decoration: none;
  font-size: 0.9rem;
  transition: color 0.3s ease;
  padding: 8px 16px;
  border: 2px solid #007bff;
  border-radius: 6px;
  background: transparent;
}

.blog-read-more:hover {
  color: white;
  background-color: #007bff;
  text-decoration: none;
}

.blog-read-more::after {
  content: '→';
  margin-left: 8px;
  transition: transform 0.3s ease;
}

.blog-read-more:hover::after {
  transform: translateX(3px);
}

/* Blog detail page styles */
.blog-detail-layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 40px;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  margin-top: 150px;
}

.blog-sidebar {
  background: rgba(255, 255, 255, 0.95);
  border-radius: 12px;
  padding: 25px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  height: fit-content;
  position: sticky;
  top: 100px;
}

.sidebar-header {
  margin-bottom: 30px;
  padding-bottom: 20px;
  border-bottom: 1px solid #eee;
}

.sidebar-section {
  margin-bottom: 30px;
}

.sidebar-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: #333;
  margin-bottom: 15px;
  padding-bottom: 8px;
  border-bottom: 2px solid #007bff;
}

.blog-main-content {
  min-width: 0; /* Prevent flex overflow */
}

.blog-reader-view {
  background: white;
  border-radius: 12px;
  padding: 40px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  border: 1px solid #f0f0f0;
}

/* Related Posts Styles */
.related-posts-list {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.related-post-item {
  border-radius: 8px;
  overflow: hidden;
  transition: transform 0.2s ease;
}

.related-post-item:hover {
  transform: translateY(-2px);
}

.related-post-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  text-decoration: none;
  color: inherit;
  border: 1px solid #eee;
  border-radius: 8px;
  transition: all 0.2s ease;
}

.related-post-link:hover {
  background: #f8f9fa;
  border-color: #007bff;
  text-decoration: none;
}

.related-post-image {
  width: 60px;
  height: 45px;
  overflow: hidden;
  border-radius: 6px;
  flex-shrink: 0;
}

.related-post-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.related-post-content {
  flex: 1;
  min-width: 0;
}

.related-post-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: #333;
  margin: 0 0 4px 0;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.related-post-date {
  font-size: 0.75rem;
  color: #666;
  margin: 0;
}

/* Table of Contents Styles */
.toc-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.toc-item {
  margin-bottom: 8px;
}

.toc-level-3 {
  padding-left: 0;
}

.toc-level-4 {
  padding-left: 15px;
}

.toc-level-5 {
  padding-left: 30px;
}

.toc-level-6 {
  padding-left: 45px;
}

.toc-link {
  display: block;
  padding: 6px 12px;
  color: #666;
  text-decoration: none;
  border-radius: 6px;
  font-size: 0.85rem;
  line-height: 1.4;
  transition: all 0.2s ease;
}

.toc-link:hover {
  background: #f8f9fa;
  color: #007bff;
  text-decoration: none;
}

.no-toc, .no-related {
  color: #888;
  font-size: 0.85rem;
  font-style: italic;
  text-align: center;
  padding: 20px 0;
}

/* Original blog detail styles with reader view context */
.blog-detail-container {
  max-width: 800px;
  margin: 0 auto;
  padding: 40px 20px;
}

.blog-detail-hero {
  text-align: center;
  margin-bottom: 40px;
}

.blog-detail-image {
  width: 100%;
  max-height: 500px;
  object-fit: contain;
  border-radius: 12px;
  margin-bottom: 30px;
  background-color: #f8f9fa;
}

.blog-detail-title {
  font-size: 2.5rem;
  font-weight: 700;
  color: #333;
  margin-bottom: 20px;
  line-height: 1.3;
}

.blog-detail-meta {
  color: #666;
  font-size: 1rem;
  margin-bottom: 40px;
  padding: 20px;
  background: #f8f9fa;
  border-radius: 8px;
}

.blog-detail-content {
  font-size: 1.1rem;
  line-height: 1.8;
  color: #444;
}

.blog-detail-content h3 {
  color: #333;
  font-size: 1.5rem;
  margin: 30px 0 15px 0;
  font-weight: 600;
}

.blog-detail-content h4 {
  color: #333;
  font-size: 1.3rem;
  margin: 25px 0 12px 0;
  font-weight: 600;
}

.blog-detail-content h5 {
  color: #333;
  font-size: 1.2rem;
  margin: 20px 0 10px 0;
  font-weight: 600;
}

.blog-detail-content h6 {
  color: #333;
  font-size: 1.1rem;
  margin: 18px 0 8px 0;
  font-weight: 600;
}

.blog-detail-content p {
  margin-bottom: 20px;
}

.blog-detail-content ul, 
.blog-detail-content ol {
  margin: 20px 0;
  padding-left: 30px;
}

.blog-detail-content li {
  margin-bottom: 8px;
}

.blog-detail-content a {
  color: #007bff;
  text-decoration: underline;
}

.blog-detail-content a:hover {
  color: #0056b3;
  text-decoration: none;
}

.blog-detail-content blockquote {
  border-left: 4px solid #007bff;
  padding: 20px 25px;
  margin: 30px 0;
  background: #f8f9fa;
  border-radius: 0 8px 8px 0;
  font-style: italic;
}

.blog-detail-content code {
  background: #f1f3f4;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: 'Courier New', monospace;
  font-size: 0.9em;
}

.blog-detail-content pre {
  background: #f8f9fa;
  padding: 20px;
  border-radius: 8px;
  overflow-x: auto;
  margin: 20px 0;
}

.back-to-blogs {
  display: inline-flex;
  align-items: center;
  color: #007bff;
  text-decoration: none;
  font-weight: 600;
  margin-bottom: 30px;
  padding: 10px 20px;
  border: 2px solid #007bff;
  border-radius: 6px;
  transition: all 0.3s ease;
}

.back-to-blogs:hover {
  background-color: #007bff;
  color: white;
  text-decoration: none;
}

.back-to-blogs::before {
  content: '←';
  margin-right: 8px;
  transition: transform 0.3s ease;
}

.back-to-blogs:hover::before {
  transform: translateX(-3px);
}

/* Loading state */
.blog-loading {
  text-align: center;
  padding: 60px 20px;
  color: #666;
}

.blog-error {
  text-align: center;
  padding: 60px 20px;
  color: #dc3545;
  background: #f8d7da;
  border-radius: 8px;
  margin: 20px 0;
}

/* Responsive design */
@media (max-width: 1024px) {
  .blog-detail-layout {
    grid-template-columns: 250px 1fr;
    gap: 30px;
  }
  
  .blog-sidebar {
    padding: 20px;
  }
  
  .blog-reader-view {
    padding: 30px;
  }
}

@media (max-width: 768px) {
  .blog-grid {
    grid-template-columns: 1fr;
    gap: 20px;
    padding: 0 15px;
  }
  
  /* Mobile layout for blog detail */
  .blog-detail-layout {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  
  .blog-sidebar {
    order: 2;
    position: static;
    margin-top: 30px;
  }
  
  .blog-main-content {
    order: 1;
  }
  
  .blog-reader-view {
    padding: 25px 20px;
  }
  
  .blog-detail-title {
    font-size: 2rem;
  }
  
  .blog-detail-container {
    padding: 20px 15px;
  }
  
  .blog-card {
    margin-bottom: 20px;
  }
  
  .blog-title {
    font-size: 1.2rem;
    -webkit-line-clamp: 2;
    line-clamp: 2;
  }
  
  .blog-content {
    padding: 20px;
  }
  
  .blog-excerpt {
    -webkit-line-clamp: 3;
    line-clamp: 3;
  }
  
  .related-post-link {
    flex-direction: column;
    text-align: center;
  }
  
  .related-post-image {
    width: 100%;
    height: 120px;
  }
}

@media (max-width: 480px) {
  .blog-detail-title {
    font-size: 1.7rem;
  }
  
  .blog-title {
    font-size: 1.1rem;
  }
  
  .blog-content {
    padding: 15px;
  }
  
  .blog-grid {
    padding: 0 10px;
  }
}
