/* Blog CSS - Only essential styles that can't be handled by Flowbite */

/* Line clamp for text truncation - Utility classes */
.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.line-clamp-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.line-clamp-4 {
    display: -webkit-box;
    -webkit-line-clamp: 4;
    line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Header image styling */
.blog-header-image-container {
    width: 100%;
    max-height: 500px;
    overflow: hidden;
    position: relative;
    margin-bottom: 0;
}

.blog-header-image {
    width: 100%;
    height: 400px;
    object-fit: cover;
    object-position: center;
    margin: 0;
    padding: 0;
    display: block;
}

/* Table of Contents styles */
.toc-container {
    position: sticky;
    top: 24px; /* Lower value for better stickiness */
    max-height: calc(100vh - 100px); /* More available height */
    overflow-y: auto;
}

/* Mobile TOC specific styles */
@media (max-width: 1023px) {
    .toc-container {
        position: relative;
        top: 0;
        max-height: none;
        margin-bottom: 2rem;
    }
}

.dark .toc-container {
    background-color: #1f2937;
    border-color: #374151;
}

.toc-author {
    display: flex;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e5e7eb;
}

.dark .toc-author {
    border-bottom-color: #374151;
}

.toc-author-icon {
    margin-right: 0.75rem;
}

.toc-author-info {
    line-height: 1.4;
}

.toc-author-name {
    font-weight: 600;
    color: #4b5563;
}

.dark .toc-author-name {
    color: #d1d5db;
}

.toc-author-date {
    font-size: 0.875rem;
    color: #6b7280;
}

.dark .toc-author-date {
    color: #9ca3af;
}

.toc-link.active {
    background-color: #eef2ff;
    color: #4f46e5;
    font-weight: bold;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.dark .toc-link.active {
    background-color: #312e81;
    color: #a5b4fc;
}

/* Styling for TOC and article content */
.blog-content h2, .blog-content h3, .blog-content h4 {
    scroll-margin-top: 100px; /* For smooth scrolling to anchors */
}

.blog-content h2 {
    font-size: 1.875rem;
    font-weight: 700;
    margin-top: 2rem;
    margin-bottom: 1rem;
    color: #1f2937;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #e5e7eb;
}

.blog-content h3 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    color: #374151;
}

.blog-content p {
    margin-bottom: 1.25rem;
    line-height: 1.7;
}

.blog-content ul, .blog-content ol {
    margin-bottom: 1.25rem;
    padding-left: 2.5rem;
}

.blog-content ul {
    list-style-type: disc;
}

.blog-content ol {
    list-style-type: decimal;
}

.blog-content a {
    color: #2563eb;
    text-decoration: underline;
}

.blog-content blockquote {
    border-left: 4px solid #3b82f6;
    padding-left: 1rem;
    margin: 1.5rem 0;
    color: #4b5563;
    font-style: italic;
}

.blog-content img {
    max-width: 100%;
    height: auto;
    border-radius: 0.5rem;
    margin: 1.5rem 0;
}

.blog-content pre {
    background-color: #f3f4f6;
    padding: 1rem;
    border-radius: 0.5rem;
    overflow-x: auto;
    margin: 1.5rem 0;
}

.blog-content code {
    background-color: #f3f4f6;
    padding: 0.2rem 0.4rem;
    border-radius: 0.25rem;
    font-family: monospace;
}

/* Dark mode styles */
.dark .blog-content h2 {
    color: #f3f4f6;
    border-bottom-color: #374151;
}

.dark .blog-content h3 {
    color: #e5e7eb;
}

.dark .blog-content blockquote {
    color: #d1d5db;
    border-left-color: #60a5fa;
}

.dark .blog-content pre, .dark .blog-content code {
    background-color: #1f2937;
}

/* Active TOC link styling */
.toc-link.active {
    background-color: #eef2ff;
    color: #4f46e5;
    font-weight: bold;
}

.dark .toc-link.active {
    background-color: #312e81;
    color: #a5b4fc;
}

/* Sticky TOC */
.toc-container {
    position: sticky;
    top: 2rem;
    max-height: calc(100vh - 4rem);
    overflow-y: auto;
}

/* Style fixes for TinyMCE content */
.blog-content div {
    margin-bottom: 1.25rem;
}

.blog-content iframe {
    max-width: 100%;
    margin: 1.5rem 0;
}

.blog-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
}

.blog-content td, .blog-content th {
    border: 1px solid #e5e7eb;
    padding: 0.75rem;
}

.blog-content th {
    background-color: #f9fafb;
    font-weight: 600;
}

.dark .blog-content th {
    background-color: #374151;
}

.dark .blog-content td, .dark .blog-content th {
    border-color: #4b5563;
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Improved breadcrumbs styling */
.breadcrumb-container {
  overflow-x: auto;
  white-space: nowrap;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none; /* Firefox */
}

.breadcrumb-container::-webkit-scrollbar {
  display: none; /* Chrome, Safari, and Opera */
}

/* Fix scrolling for the entire page */
html, body {
  scroll-behavior: smooth;
  scroll-padding-top: 100px; /* Ensures headings aren't hidden under fixed elements */
}

/* Ensure TOC links are properly visible in the container */
.toc-nav {
  overflow-y: auto;
  max-height: calc(100vh - 300px); /* Adjust based on your layout */
}

.toc-link.active {
  background-color: #eef2ff;
  color: #4f46e5;
  font-weight: bold;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  position: relative;
}

.dark .toc-link.active {
  background-color: #312e81;
  color: #a5b4fc;
}

/* Adjust main content area for better readability */
.blog-content {
  overflow-x: hidden;
  word-break: break-word;
}

/* Responsive improvements for mobile */
@media (max-width: 768px) {
  .blog-header-image {
    height: 300px;
  }
  
  .blog-title-container h1 {
    font-size: 2rem;
  }
  
  .toc-container {
    position: relative;
    max-height: none;
    margin-bottom: 2rem;
  }
}
