/* Custom Blog Layout System - 78% Content, 20% Sidebar, 2% Gap */
.blog-container {
  max-width: 1200px;
  margin: 40px auto 0 auto;
}

.blog-layout {
  display: flex;
  gap: 2%;
  align-items: flex-start;
}

.blog-content {
  flex: 0 0 78%;
  width: 78%;
  min-width: 0; /* Prevent flex item from overflowing */
}

.blog-sidebar {
  flex: 0 0 20%;
  width: 20%;
  position: sticky;
  top: 20px;
}

.content-container {
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  padding: 40px;
  margin-bottom: 20px;
}

.content-container > section {
  background: none !important;
  border-radius: 0 !important;
  padding: 0 !important;
  margin-bottom: 0 !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  border: none !important;
  position: static !important;
  overflow: visible !important;
  z-index: auto !important;
}

.content-container h1 {
  color: #2c3e50;
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 30px;
  line-height: 1.2;
}

/* Mobile and Tablet Responsive Design */
@media (max-width: 992px) {
  .blog-layout {
    flex-direction: column;
    gap: 20px;
  }

  .blog-content {
    flex: 1;
    width: 100%;
    order: 1;
  }

  .blog-sidebar {
    flex: 1;
    width: 100%;
    position: static;
    max-height: none;
    overflow-y: visible;
    order: 2;
  }

  .content-container {
    padding: 25px;
  }

  .content-container h1 {
    font-size: 2rem;
  }
}

@media (max-width: 768px) {
  .blog-container {
    padding: 0 15px;
  }

  .content-container {
    padding: 20px;
    border-radius: 8px;
  }

  .content-container h1 {
    font-size: 1.8rem;
    margin-bottom: 20px;
  }

  .blog-layout {
    gap: 15px;
  }
}

/* Blog TOC and Sidebar Styles - Only for blog posts */
#post .sidebar-container {
  position: static; /* Changed from sticky since blog-sidebar handles it now */
  top: auto;
  max-height: none; /* Remove height constraint */
  overflow-y: visible; /* Remove scroll */
  z-index: 10;
  width: 100%;
}

#post .toc-container {
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  margin-bottom: 20px;
  padding: 24px;
  border: 1px solid #e8ecef;
  transition: all 0.3s ease;
}

#post .toc-container:hover {
  box-shadow: 0 6px 30px rgba(0, 0, 0, 0.12);
  transform: translateY(-2px);
}

#post .toc-container h4 {
  color: #2c3e50;
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 2px solid #3498db;
  display: flex;
  align-items: center;
  gap: 8px;
}

.toc-container h4:before {
  content: "📑";
  font-size: 16px;
}

/* Fix TOC list visibility - Override Bootstrap list-inline and WOW animations */
.toc-container .toc {
  list-style-type: none !important;
  padding: 0 !important;
  margin: 0 !important;
  margin-left: 0 !important;
}

.toc-container .toc > li,
.toc-container .toc li.list-inline-item,
.toc-container .toc li.wow,
.toc-container .toc li.fadeInRight {
  display: block !important;
  margin-bottom: 8px !important;
  padding-right: 0 !important;
  padding-left: 0 !important;
  opacity: 1 !important;
  visibility: visible !important;
  animation: none !important;
  animation-name: none !important;
  animation-duration: 0s !important;
  transform: none !important;
}

.toc-container .toc li a {
  color: #555 !important;
  text-decoration: none !important;
  font-size: 14px !important;
  line-height: 1.5 !important;
  padding: 8px 12px !important;
  border-radius: 6px !important;
  display: block !important;
  transition: all 0.3s ease !important;
  border-left: 3px solid transparent !important;
  opacity: 1 !important;
  visibility: visible !important;
  animation: none !important;
}

.toc-container .toc li a:hover {
  background-color: #f8f9fa !important;
  color: #3498db !important;
  border-left-color: #3498db !important;
  text-decoration: none !important;
  transform: translateX(4px) !important;
}

.toc-container .toc li a:active,
.toc-container .toc li a.active {
  background-color: #e3f2fd !important;
  color: #1976d2 !important;
  border-left-color: #1976d2 !important;
  font-weight: 500 !important;
}

/* Nested TOC items */
.toc-container .toc ul {
  list-style-type: none !important;
  padding-left: 20px !important;
  margin-top: 4px !important;
}

.toc-container .toc ul li a {
  font-size: 13px !important;
  color: #777 !important;
  padding: 6px 12px !important;
}

#post .categories-container {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 12px;
  padding: 24px;
  color: white;
  box-shadow: 0 4px 20px rgba(102, 126, 234, 0.2);
  transition: all 0.3s ease;
}

#post .categories-container:hover {
  box-shadow: 0 6px 30px rgba(102, 126, 234, 0.3);
  transform: translateY(-2px);
}

#post .categories-container h4 {
  color: white;
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 2px solid rgba(255, 255, 255, 0.3);
  display: flex;
  align-items: center;
  gap: 8px;
}

#post .categories-container h4:before {
  content: "🏷️";
  font-size: 16px;
}

#post .categories-container .toc {
  list-style-type: none;
  padding: 0;
  margin: 0;
}

#post .categories-container .toc li {
  margin-bottom: 8px;
}

#post .categories-container .toc li a {
  color: rgba(255, 255, 255, 0.9);
  text-decoration: none;
  font-size: 14px;
  padding: 8px 12px;
  border-radius: 6px;
  display: block;
  transition: all 0.3s ease;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

#post .categories-container .toc li a:hover {
  background-color: rgba(255, 255, 255, 0.15);
  color: white;
  text-decoration: none;
  transform: translateX(4px);
  border-color: rgba(255, 255, 255, 0.4);
}

.content-container,
#post .content-container {
  background: #ffffff;
  border-radius: 12px;
  padding: 32px;
  box-shadow: 0 2px 15px rgba(0, 0, 0, 0.06);
  margin-bottom: 30px;
  border: 1px solid #e8ecef;
  line-height: 1.7;
}

#post .content-container h1 {
  color: #2c3e50;
  font-size: 32px;
  font-weight: 700;
  margin-bottom: 24px;
  line-height: 1.3;
  border-bottom: 3px solid #3498db;
  padding-bottom: 16px;
}

/* Content styling for better readability */
#post .content-container h2 {
  color: #2c3e50;
  font-size: 24px;
  font-weight: 600;
  margin-top: 32px;
  margin-bottom: 16px;
  border-bottom: 2px solid #ecf0f1;
  padding-bottom: 8px;
}

#post .content-container h3 {
  color: #34495e;
  font-size: 20px;
  font-weight: 600;
  margin-top: 24px;
  margin-bottom: 12px;
}

#post .content-container h4 {
  color: #34495e;
  font-size: 18px;
  font-weight: 600;
  margin-top: 20px;
  margin-bottom: 10px;
}

#post .content-container p {
  color: #555;
  font-size: 16px;
  line-height: 1.8;
  margin-bottom: 16px;
}

/* List styling - FIX for invisible lists - BLOG POSTS ONLY */
#post .content-container ul,
#post .content-container ol {
  margin: 16px 0 24px 0 !important;
  padding-left: 24px !important;
  color: #555 !important;
  display: block !important;
}

#post .content-container ul li,
#post .content-container ol li {
  font-size: 16px !important;
  line-height: 1.7 !important;
  margin-bottom: 8px !important;
  color: #555 !important;
  list-style-position: outside !important;
  display: list-item !important;
}

#post .content-container ul li {
  list-style-type: disc !important;
}

#post .content-container ol li {
  list-style-type: decimal !important;
}

/* Ensure list markers are visible - BLOG POSTS ONLY */
#post .content-container ul li::before {
  display: none;
}

#post .content-container ol li::before {
  display: none;
}

/* Nested lists */
#post .content-container ul ul,
#post .content-container ol ol,
#post .content-container ul ol,
#post .content-container ol ul {
  margin: 8px 0;
  padding-left: 20px;
}

#post .content-container ul ul li {
  list-style-type: circle;
  margin-bottom: 4px;
}

#post .content-container ul ul ul li {
  list-style-type: square;
}

/* Blockquotes */
#post .content-container blockquote {
  border-left: 4px solid #3498db;
  margin: 24px 0;
  padding: 16px 20px;
  background: #f8f9fa;
  border-radius: 0 8px 8px 0;
  color: #555;
  font-style: italic;
}

#post .content-container blockquote p {
  margin-bottom: 0;
}

/* Code blocks */
#post .content-container pre {
  background: #f4f4f4;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 16px;
  margin: 20px 0;
  overflow-x: auto;
}

#post .content-container code {
  background: #f4f4f4;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: "Courier New", monospace;
  font-size: 14px;
}

#post .content-container pre code {
  background: none;
  padding: 0;
  border-radius: 0;
}

/* Tables */
#post .content-container table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
  border: 1px solid #ddd;
  border-radius: 8px;
  overflow: hidden;
}

#post .content-container th,
#post .content-container td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid #eee;
}

#post .content-container th {
  background: #f8f9fa;
  font-weight: 600;
  color: #2c3e50;
}

#post .content-container tr:hover {
  background: #f8f9fa;
}

/* Links */
#post .content-container a {
  color: #3498db;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: all 0.3s ease;
}

#post .content-container a:hover {
  color: #2980b9;
  border-bottom-color: #2980b9;
  text-decoration: none;
}

/* Images */
#post .content-container img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  margin: 16px 0;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

#post .cta-container {
  margin-top: 30px;
  max-height: none; /* Remove height constraint */
  overflow-y: visible; /* Remove scroll */
}

#post .cta-container.mobile-cta {
  position: static;
  margin-top: 30px;
  max-height: none;
  overflow-y: visible;
  display: block; /* Always show in new layout */
}

.cta {
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  border: none;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 10px;
  display: block;
  color: white;
  text-align: center;
  box-shadow: 0 4px 20px rgba(245, 87, 108, 0.2);
  transition: all 0.3s ease;
}

.cta:hover {
  box-shadow: 0 6px 30px rgba(245, 87, 108, 0.3);
  transform: translateY(-2px);
}

li.sidelist {
  list-style-type: none;
  padding: 0;
}

/* Responsive behavior for blog layout */
@media (max-width: 1199px) {
  .content-container {
    padding: 24px;
  }

  .content-container h1 {
    font-size: 28px;
  }

  .content-container h2 {
    font-size: 22px;
  }

  .content-container p,
  .content-container ul li,
  .content-container ol li {
    font-size: 15px;
  }
}

@media (max-width: 991px) {
  .sidebar-container {
    position: static;
    margin-bottom: 30px;
    max-height: none;
    overflow-y: visible;
  }

  .cta-container:not(.mobile-cta) {
    display: none !important;
  }

  .cta-container.mobile-cta {
    display: block !important;
    margin-top: 30px;
  }

  .toc-container,
  .categories-container {
    margin-bottom: 20px;
  }

  .content-container {
    padding: 20px;
    margin-bottom: 20px;
  }

  .content-container h1 {
    font-size: 24px;
  }

  .content-container h2 {
    font-size: 20px;
  }

  .content-container ul,
  .content-container ol {
    padding-left: 20px;
  }
}

@media (max-width: 767px) {
  .sidebar-container {
    order: 2;
  }
  #post .content-container {
    order: 1;
    padding: 16px;
    margin-bottom: 20px;
  }

  .cta-container.mobile-cta {
    order: 3;
    margin-top: 20px;
  }

  #post .content-container h1 {
    font-size: 22px;
    padding-bottom: 12px;
  }

  #post .content-container h2 {
    font-size: 18px;
    margin-top: 24px;
  }

  #post .content-container h3 {
    font-size: 16px;
    margin-top: 20px;
  }

  #post .content-container p,
  #post .content-container ul li,
  #post .content-container ol li {
    font-size: 14px;
    line-height: 1.6;
  }

  #post .content-container ul,
  #post .content-container ol {
    padding-left: 18px;
    margin: 12px 0 20px 0;
  }

  #post .content-container ul li,
  #post .content-container ol li {
    margin-bottom: 6px;
  }

  .toc-container,
  .categories-container {
    padding: 16px;
    margin-bottom: 16px;
  }

  .toc-container h4,
  .categories-container h4 {
    font-size: 16px;
    margin-bottom: 12px;
  }

  .toc li a,
  .categories-container .toc li a {
    font-size: 13px;
    padding: 6px 10px;
  }
  /* Better spacing for mobile content */
  #post .content-container table {
    font-size: 13px;
  }

  #post .content-container th,
  #post .content-container td {
    padding: 8px 12px;
  }

  #post .content-container blockquote {
    margin: 16px 0;
    padding: 12px 16px;
  }
}

/* Smooth scrolling for anchor links */
html {
  scroll-behavior: smooth;
}

/* Active state for TOC links when scrolling */
.toc li a.current {
  background-color: #e3f2fd;
  color: #1976d2;
  border-left-color: #1976d2;
  font-weight: 500;
}

/* Custom scrollbar for sidebar */
.sidebar-container::-webkit-scrollbar {
  width: 4px;
}

.sidebar-container::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 2px;
}

.sidebar-container::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 2px;
}

.sidebar-container::-webkit-scrollbar-thumb:hover {
  background: #a8a8a8;
}

/* Animation classes for TOC items */
@keyframes fadeInLeft {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.toc li a.wow.fadeInLeft {
  animation: fadeInLeft 0.6s ease forwards;
  opacity: 0;
}

/* Progress indicator for reading */
.reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 0%;
  height: 3px;
  background: linear-gradient(90deg, #3498db, #2ecc71);
  z-index: 1000;
  transition: width 0.3s ease;
}

/* Enhanced focus styles for accessibility */
.toc a:focus,
.categories-container .toc a:focus {
  outline: 2px solid #3498db;
  outline-offset: 2px;
}

/* Print styles */
@media print {
  .sidebar-container,
  .cta-container {
    display: none !important;
  }

  .content-container {
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
    box-shadow: none !important;
    border: none !important;
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .toc-container {
    border: 2px solid #000;
  }

  .categories-container {
    background: #000;
    color: #fff;
  }

  .toc li a {
    border: 1px solid #000;
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  .toc-container:hover,
  .categories-container:hover,
  .cta:hover {
    transform: none;
  }

  .toc li a:hover {
    transform: none;
  }

  html {
    scroll-behavior: auto;
  }

  .toc li a.wow.fadeInLeft {
    animation: none;
    opacity: 1;
  }
}

/* Dark mode support (optional) */
@media (prefers-color-scheme: dark) {
  .toc-container {
    background: #2c3e50;
    border-color: #34495e;
    color: #ecf0f1;
  }

  .toc-container h4 {
    color: #ecf0f1;
    border-bottom-color: #3498db;
  }

  .toc li a {
    color: #bdc3c7;
  }

  .toc li a:hover {
    background-color: #34495e;
    color: #3498db;
  }

  .content-container {
    background: #2c3e50;
    border-color: #34495e;
    color: #ecf0f1;
  }

  .content-container h1 {
    color: #ecf0f1;
  }
}

/* Blog Index Cards Styles */
.blog-card {
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.blog-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.blog-card .card-header {
  padding: 20px 20px 15px;
  border-bottom: 1px solid #eee;
}

.blog-card .card-header h3 {
  margin: 0 0 10px 0;
  font-size: 18px;
  line-height: 1.4;
}

.blog-card .card-header h3 a {
  color: #333;
  text-decoration: none;
  transition: color 0.3s ease;
}

.blog-card .card-header h3 a:hover {
  color: #007bff;
}

.blog-card .card-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
}

.blog-card .card-meta .date {
  color: #666;
  font-size: 14px;
  font-weight: 500;
}

.blog-card .card-meta .categories {
  color: #007bff;
  font-size: 12px;
  background: #e3f2fd;
  padding: 4px 8px;
  border-radius: 12px;
  font-weight: 500;
}

.blog-card .card-body {
  padding: 15px 20px 20px;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.blog-card .card-body p {
  color: #666;
  font-size: 14px;
  line-height: 1.6;
  margin: 0 0 15px 0;
  flex-grow: 1;
}

.blog-card .card-body .read-more {
  color: #007bff;
  text-decoration: none;
  font-weight: 500;
  font-size: 14px;
  transition: color 0.3s ease;
  align-self: flex-start;
}

.blog-card .card-body .read-more:hover {
  color: #0056b3;
  text-decoration: none;
}

/* Blog Index Specific Styles */
#blog-index {
  background: #f8f9fa;
  min-height: 70vh;
  padding: 40px 0;
}

#blog-index h1 {
  color: #333;
  margin-bottom: 20px;
  font-weight: 600;
}

#blog-index .lead {
  color: #666;
  font-size: 18px;
  margin-bottom: 40px;
}

#blog-index h2 {
  color: #333;
  margin-bottom: 30px;
  font-weight: 600;
}

/* Blog Index Cards Equal Height Fix */
.blog-card-col {
  display: flex !important;
}

.blog-card-col .blog-card {
  height: 100% !important;
  display: flex !important;
  flex-direction: column !important;
  min-height: 350px !important; /* Ensure consistent minimum height */
  width: 100% !important;
}

.blog-card-col .card-header {
  flex-shrink: 0;
}

.blog-card-col .card-body {
  flex-grow: 1 !important;
  display: flex !important;
  flex-direction: column !important;
  justify-content: space-between !important;
}

.blog-card-col .card-body p {
  flex-grow: 1 !important;
  margin-bottom: 15px !important;
}

.blog-card-col .read-more {
  margin-top: auto !important;
  align-self: flex-start !important;
}

/* Force 3 columns per row on desktop and tablet */
@media (min-width: 768px) {
  .blog-card-col {
    width: 33.333333% !important;
    flex: 0 0 33.333333% !important;
    max-width: 33.333333% !important;
  }
}

/* Stack on mobile */
@media (max-width: 767px) {
  .blog-card-col {
    width: 100% !important;
    flex: 0 0 100% !important;
    max-width: 100% !important;
  }

  .blog-card-col .blog-card {
    min-height: auto !important;
    margin-bottom: 20px !important;
  }
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .blog-card .card-meta {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .blog-card .card-header h3 {
    font-size: 16px;
  }

  #blog-index {
    padding: 20px 0;
  }
}

/* Blog post specific container styles */
#post .container {
  max-width: 1170px;
  margin: 0 auto;
  padding-left: 15px;
  padding-right: 15px;
}
