/* Modern Design Enhancements */

/* CSS Variables for consistent theming */
:root {
  --primary-color: #FE4D01;
  --primary-light: #FFFBF8;
  --primary-border: #FFE1CC;
  --text-primary: #1C1C1C;
  --text-secondary: #6B6D7A;
  --bg-sidebar: #FAFBFC;
  --border-color: #E2E2E2;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.05);
  --shadow-md: 0 2px 8px rgba(0,0,0,0.08);
  --shadow-lg: 0 10px 20px rgba(0,0,0,0.1);
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Improve overall page background */
body {
  background-color: #F8F9FA;
}

/* Progress Bar */
.reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: rgba(254, 77, 1, 0.1);
  z-index: 50;
}

.reading-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #FE4D01 0%, #FF7B47 100%);
  width: 0%;
  transition: width 0.2s ease-out;
  box-shadow: 0 0 10px rgba(254, 77, 1, 0.5);
}

/* Main Layout Grid */
.modern-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 3rem;
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem;
  align-items: start;
}

/* Sidebar Navigation */
.sidebar-nav {
  position: sticky;
  top: 20px;
  height: fit-content;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  background: var(--bg-sidebar);
  border-radius: 16px;
  padding: 1.5rem;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  align-self: start;
}

.sidebar-nav::-webkit-scrollbar {
  width: 6px;
}

.sidebar-nav::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar-nav::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 3px;
}

.sidebar-nav::-webkit-scrollbar-thumb:hover {
  background: var(--text-secondary);
}

.sidebar-nav h4 {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  margin: 0 0 1.5rem 0;
  padding-top: 0.5rem;
}

.nav-item {
  display: block;
  padding: 0.625rem 0.875rem;
  margin-bottom: 0.25rem;
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: 6px;
  font-size: 0.875rem;
  line-height: 1.4;
  transition: all 0.2s ease;
  position: relative;
  white-space: normal;
  word-wrap: break-word;
  border-left: 3px solid transparent;
}

.nav-item:hover {
  color: var(--text-primary);
  background: rgba(254, 77, 1, 0.05);
}

.nav-item.active {
  color: var(--primary-color);
  background: rgba(254, 77, 1, 0.08);
  font-weight: 500;
  border-left: 3px solid var(--primary-color);
  padding-left: calc(0.875rem - 3px);
}

.nav-item.h3-level {
  display: none;
}

/* Modern Content Styling */
.modern-content {
  background: white;
  border-radius: 16px;
  padding: 3rem;
  box-shadow: var(--shadow-md);
  margin-top: 0;
}

.modern-content h1 {
  font-size: 2.5rem;
  line-height: 1.2;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 2rem;
  letter-spacing: -0.02em;
}

.modern-content h2 {
  font-size: 1.875rem;
  line-height: 1.3;
  font-weight: 600;
  color: var(--text-primary);
  margin-top: 3rem;
  margin-bottom: 1.5rem;
  padding-top: 3rem;
  border-top: 1px solid var(--border-color);
  position: relative;
}

.modern-content h2:first-of-type {
  border-top: none;
  padding-top: 0;
  margin-top: 2rem;
}

.modern-content h3 {
  font-size: 1.375rem;
  line-height: 1.4;
  font-weight: 500;
  color: var(--text-primary);
  margin-top: 2.5rem;
  margin-bottom: 1.25rem;
}

.modern-content p {
  font-size: 1rem;
  line-height: 1.75;
  color: var(--text-primary);
  margin-bottom: 1.25rem;
}

.modern-content strong {
  color: var(--text-primary);
  font-weight: 600;
  background: linear-gradient(to bottom, transparent 60%, rgba(254, 77, 1, 0.2) 60%);
  padding: 0 2px;
}

/* Modern Image Styling */
.modern-content img {
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  margin: 2rem 0;
}

/* Removed stats cards for cleaner design */

/* Mobile Responsiveness */
@media (max-width: 1280px) {
  .modern-layout {
    grid-template-columns: 280px 1fr;
    gap: 2rem;
  }
  
  .sidebar-nav {
    padding: 1.25rem;
  }
}

@media (max-width: 1024px) {
  .modern-layout {
    grid-template-columns: 1fr;
  }
  
  .sidebar-nav {
    display: none;
  }
  
  .mobile-nav-toggle {
    display: block;
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 56px;
    height: 56px;
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    border: none;
    box-shadow: var(--shadow-lg);
    cursor: pointer;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  .sidebar-nav.mobile-active {
    display: block;
    position: fixed;
    left: 1rem;
    right: 1rem;
    top: 80px;
    height: calc(100vh - 100px);
    z-index: 99;
    background: white;
    box-shadow: var(--shadow-lg);
  }
}

@media (max-width: 768px) {
  .modern-content {
    padding: 2rem 1.5rem;
  }
  
  .modern-content h1 {
    font-size: 2rem;
  }
  
  .modern-content h2 {
    font-size: 1.75rem;
  }
  
  .modern-content h3 {
    font-size: 1.5rem;
  }
  
  .modern-content p {
    font-size: 1rem;
  }
}

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

/* Section Anchors Offset */
.modern-content h2[id],
.modern-content h3[id] {
  scroll-margin-top: 100px;
}

/* Hover Effects for Links */
.modern-content a {
  color: var(--primary-color);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  transition: var(--transition);
}

.modern-content a:hover {
  border-bottom-color: var(--primary-color);
}

/* Lists Styling */
.modern-content ul,
.modern-content ol {
  margin: 1.5rem 0;
  padding-left: 2rem;
}

.modern-content li {
  margin-bottom: 0.75rem;
  line-height: 1.8;
}

/* Share Button Modern Style */
.social-share-button {
  background: var(--primary-color);
  color: white;
  border: none;
  padding: 0.875rem 2rem;
  font-weight: 500;
  font-size: 0.9375rem;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.social-share-button:hover {
  background: #E54401;
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

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

.fade-in-up {
  animation: fadeInUp 0.6s ease-out;
}