/* Modern Article Styles - Responsive Design */

/* Article Header */
.article-header {
  background: linear-gradient(135deg, var(--bf-primary) 0%, var(--bf-secondary) 100%);
  color: white;
  padding: 100px 0 40px; /* Account for navbar */
  margin-bottom: 2rem;
}

.article-header .breadcrumb {
  background: transparent;
  padding: 0;
  margin-bottom: 1rem;
}

.article-header .breadcrumb-item a {
  color: rgba(255, 255, 255, 0.8);
  text-decoration: none;
}

.article-header .breadcrumb-item a:hover {
  color: white;
}

.article-header .breadcrumb-item.active {
  color: white;
}

.article-header .breadcrumb-item + .breadcrumb-item::before {
  color: rgba(255, 255, 255, 0.6);
}

/* Article Layout - Responsive Grid */
.article-content {
  background: white;
  border-radius: 12px;
  padding: 2rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  margin-bottom: 2rem;
}

/* Table of Contents - Desktop */
.toc-sticky {
  position: sticky;
  top: 100px; /* Below navbar */
  max-height: calc(100vh - 120px);
  overflow-y: auto;
}

.toc-nav {
  display: flex;
  flex-direction: column;
}

.toc-link {
  padding: 0.5rem 0;
  color: var(--bf-dark);
  text-decoration: none;
  border-left: 3px solid transparent;
  padding-left: 0.75rem;
  transition: all 0.3s ease;
  font-size: 0.9rem;
}

.toc-link:hover {
  color: var(--bf-primary);
  border-left-color: var(--bf-primary);
}

.toc-link.active {
  color: var(--bf-primary);
  border-left-color: var(--bf-primary);
  font-weight: 500;
}

/* TOC Indentation Levels */
.toc-level-2 { padding-left: 1.5rem !important; }
.toc-level-3 { padding-left: 2.25rem !important; }
.toc-level-4 { padding-left: 3rem !important; }

/* Mobile TOC */
.toc-nav-mobile {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.toc-link-mobile {
  padding: 0.75rem;
  color: var(--bf-dark);
  text-decoration: none;
  border-left: 3px solid var(--bf-primary);
  background: var(--bf-light);
  border-radius: 4px;
  transition: all 0.3s ease;
}

.toc-link-mobile:hover {
  background: var(--bf-primary);
  color: white;
}

/* Reading Progress Bars */
.reading-progress-top {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: rgba(0,0,0,0.1);
  z-index: 1050;
}

.reading-progress-top .progress-bar {
  height: 100%;
  background: var(--bf-primary);
  width: 0;
  transition: width 0.2s ease;
}

.reading-progress-sidebar .progress {
  height: 6px;
}

.reading-progress-sidebar .progress-bar {
  background: var(--bf-primary);
  transition: width 0.2s ease;
}

/* Article Typography */
.article-body {
  font-size: 1.1rem;
  line-height: 1.8;
  color: #333;
}

.article-body h1,
.article-body h2,
.article-body h3,
.article-body h4,
.article-body h5,
.article-body h6 {
  margin-top: 2rem;
  margin-bottom: 1rem;
  font-weight: 600;
  scroll-margin-top: 100px; /* Account for sticky navbar */
}

.article-body h1 { font-size: 2.5rem; }
.article-body h2 { font-size: 2rem; }
.article-body h3 { font-size: 1.5rem; }
.article-body h4 { font-size: 1.25rem; }

.article-body p {
  margin-bottom: 1.25rem;
}

.article-body ul,
.article-body ol {
  margin-bottom: 1.25rem;
  padding-left: 2rem;
}

.article-body li {
  margin-bottom: 0.5rem;
}

.article-body blockquote {
  border-left: 4px solid var(--bf-primary);
  padding-left: 1.5rem;
  margin: 1.5rem 0;
  font-style: italic;
  color: #666;
}

.article-body code {
  background: #f5f5f5;
  padding: 0.2rem 0.4rem;
  border-radius: 3px;
  font-size: 0.9em;
}

.article-body pre {
  background: #f5f5f5;
  padding: 1rem;
  border-radius: 8px;
  overflow-x: auto;
  margin: 1.5rem 0;
}

.article-body pre code {
  background: transparent;
  padding: 0;
}

.article-body img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  margin: 1.5rem 0;
}

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

.article-body th,
.article-body td {
  padding: 0.75rem;
  border: 1px solid #dee2e6;
}

.article-body th {
  background: #f8f9fa;
  font-weight: 600;
}

/* Back to Top Button */
.btn-floating {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  z-index: 1040;
  transition: all 0.3s ease;
}

.btn-floating:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.2);
}

/* Share Section */
.share-section .btn-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* Article CTA */
.article-cta {
  margin-top: 3rem;
}

/* Related Articles */
.related-articles .card {
  transition: transform 0.3s ease;
}

.related-articles .card:hover {
  transform: translateY(-5px);
}

/* Responsive Design Breakpoints */

/* Extra Large Screens (1400px+) */
@media (min-width: 1400px) {
  .container-xxl {
    max-width: 1320px;
  }
  
  .article-body {
    font-size: 1.125rem;
  }
}

/* Large Screens (1200px-1399px) - Standard Desktop */
@media (min-width: 1200px) and (max-width: 1399px) {
  .container-xxl {
    max-width: 1140px;
  }
}

/* Medium Screens (992px-1199px) - Small Desktop/Large Laptop */
@media (min-width: 992px) and (max-width: 1199px) {
  .container-xxl {
    max-width: 960px;
  }
  
  /* Adjust TOC width */
  .toc-sticky .card {
    font-size: 0.9rem;
  }
}

/* Tablet Landscape (768px-991px) */
@media (min-width: 768px) and (max-width: 991px) {
  .container-xxl {
    max-width: 720px;
  }
  
  .article-content {
    padding: 1.5rem;
  }
  
  .article-body {
    font-size: 1.05rem;
  }
  
  .article-body h1 { font-size: 2rem; }
  .article-body h2 { font-size: 1.75rem; }
  .article-body h3 { font-size: 1.35rem; }
  
  /* Full width content on tablets */
  .col-lg-9 {
    max-width: 100%;
  }
}

/* Mobile Landscape & Small Tablet (576px-767px) */
@media (min-width: 576px) and (max-width: 767px) {
  .container-xxl {
    max-width: 540px;
  }
  
  .article-header {
    padding: 80px 0 30px;
  }
  
  .article-content {
    padding: 1.25rem;
    border-radius: 8px;
  }
  
  .article-body {
    font-size: 1rem;
  }
  
  .article-body h1 { font-size: 1.75rem; }
  .article-body h2 { font-size: 1.5rem; }
  .article-body h3 { font-size: 1.25rem; }
}

/* Mobile Portrait (up to 575px) */
@media (max-width: 575px) {
  .container-xxl {
    padding-left: 1rem;
    padding-right: 1rem;
  }
  
  .article-header {
    padding: 70px 0 20px;
  }
  
  .article-content {
    padding: 1rem;
    border-radius: 8px;
    box-shadow: none;
    border: 1px solid #e0e0e0;
  }
  
  .article-body {
    font-size: 0.95rem;
    line-height: 1.7;
  }
  
  .article-body h1 { 
    font-size: 1.5rem; 
    margin-top: 1.5rem;
  }
  .article-body h2 { 
    font-size: 1.35rem;
    margin-top: 1.5rem;
  }
  .article-body h3 { 
    font-size: 1.15rem;
    margin-top: 1.25rem;
  }
  
  .article-body ul,
  .article-body ol {
    padding-left: 1.5rem;
  }
  
  .article-body blockquote {
    padding-left: 1rem;
  }
  
  .article-body pre {
    padding: 0.75rem;
    font-size: 0.85rem;
  }
  
  /* Smaller CTA buttons on mobile */
  .article-cta .btn-lg {
    font-size: 1rem;
    padding: 0.5rem 1rem;
  }
  
  /* Stack related articles on mobile */
  .related-articles .row {
    gap: 1rem !important;
  }
  
  /* Smaller back to top button */
  .btn-floating {
    width: 40px;
    height: 40px;
    bottom: 1rem;
    right: 1rem;
  }
  
  /* Adjust share buttons */
  .share-section .btn {
    font-size: 0.9rem;
    padding: 0.375rem 0.75rem;
  }
}

/* Ultra-wide screens (2K, 4K monitors) */
@media (min-width: 1920px) {
  .container-xxl {
    max-width: 1400px;
  }
  
  .article-body {
    font-size: 1.2rem;
    max-width: 900px; /* Prevent lines from being too long */
  }
  
  .toc-sticky {
    font-size: 1rem;
  }
}

/* Print Styles */
@media print {
  .navbar,
  .toc-sticky,
  .reading-progress-top,
  .btn-floating,
  .share-section,
  .article-cta,
  .related-articles,
  .site-footer,
  #mobileToc {
    display: none !important;
  }
  
  .article-content {
    box-shadow: none;
    border: none;
    padding: 0;
  }
  
  .article-header {
    background: none;
    color: black;
    padding: 0;
  }
  
  .article-body {
    font-size: 12pt;
    line-height: 1.5;
  }
}

/* Accessibility - Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    animation: none !important;
  }
}

/* Dark Mode Support (if needed in future) */
@media (prefers-color-scheme: dark) {
  /* Dark mode styles can be added here */
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
  .article-body {
    color: #000;
  }
  
  .toc-link,
  .toc-link-mobile {
    border-width: 4px;
  }
  
  .article-content {
    border: 2px solid #000;
  }
}