/* Blog Post Styles */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
    --primary-color: #3b82f6;
    --primary-dark: #1d4ed8;
    --secondary-color: #64748b;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --background: #ffffff;
    --surface: #f9fafb;
    --border: #e5e7eb;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] {
    --text-primary: #f9fafb;
    --text-secondary: #d1d5db;
    --background: #111827;
    --surface: #1f2937;
    --border: #374151;
}

/* Base Styles */
* {
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
}

/* Reading Progress Bar */
#reading-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, #3b82f6, #8b5cf6);
    transform-origin: left;
    z-index: 1000;
    transition: transform 0.1s ease-out;
}

/* Table of Contents Styles */
.toc-nav {
    max-height: 60vh;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 #f1f5f9;
}

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

.toc-nav::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 3px;
}

.toc-nav::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.toc-nav::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

.dark .toc-nav {
    scrollbar-color: #4b5563 #1f2937;
}

.dark .toc-nav::-webkit-scrollbar-track {
    background: #1f2937;
}

.dark .toc-nav::-webkit-scrollbar-thumb {
    background: #4b5563;
}

.dark .toc-nav::-webkit-scrollbar-thumb:hover {
    background: #6b7280;
}

.toc-nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.toc-nav li {
    margin: 0;
}

.toc-nav a {
    display: block;
    padding: 8px 12px;
    text-decoration: none;
    color: #6b7280;
    font-size: 14px;
    line-height: 1.4;
    border-radius: 6px;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
}

.dark .toc-nav a {
    color: #9ca3af;
}

.toc-nav a:hover {
    background-color: #f3f4f6;
    color: #374151;
}

.dark .toc-nav a:hover {
    background-color: #374151;
    color: #d1d5db;
}

.toc-nav a.active {
    background-color: #dbeafe;
    color: #1e40af;
    border-left-color: #3b82f6;
    font-weight: 600;
}

.dark .toc-nav a.active {
    background-color: #1e3a8a20;
    color: #60a5fa;
    border-left-color: #3b82f6;
}

/* Heading levels in TOC */
.toc-nav .toc-h1 { padding-left: 12px; font-weight: 600; }
.toc-nav .toc-h2 { padding-left: 24px; }
.toc-nav .toc-h3 { padding-left: 36px; font-size: 13px; }
.toc-nav .toc-h4 { padding-left: 48px; font-size: 13px; }
.toc-nav .toc-h5 { padding-left: 60px; font-size: 12px; }
.toc-nav .toc-h6 { padding-left: 72px; font-size: 12px; }

/* Blog Content Styles */
.blog-content {
    color: var(--text-primary);
    line-height: 1.7;
}

.blog-content h1,
.blog-content h2,
.blog-content h3,
.blog-content h4,
.blog-content h5,
.blog-content h6 {
    font-weight: 700;
    line-height: 1.3;
    margin-top: 2rem;
    margin-bottom: 1rem;
    scroll-margin-top: 100px;
}

.blog-content h1 {
    font-size: 2.25rem;
    border-bottom: 2px solid var(--border);
    padding-bottom: 0.5rem;
}

.blog-content h2 {
    font-size: 1.875rem;
}

.blog-content h3 {
    font-size: 1.5rem;
}

.blog-content h4 {
    font-size: 1.25rem;
}

.blog-content h5 {
    font-size: 1.125rem;
}

.blog-content h6 {
    font-size: 1rem;
}

.blog-content p {
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
    line-height: 1.8;
}

.blog-content img {
    max-width: 100%;
    height: auto;
    border-radius: 12px;
    margin: 2rem auto;
    display: block;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.blog-content img:hover {
    transform: scale(1.02);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.blog-content blockquote {
    border-left: 4px solid var(--primary-color);
    padding: 1.5rem;
    margin: 2rem 0;
    background: linear-gradient(135deg, #f0f9ff, #e0f2fe);
    border-radius: 0 12px 12px 0;
    font-style: italic;
    position: relative;
}

.dark .blog-content blockquote {
    background: linear-gradient(135deg, #0c4a6e20, #0e749020);
}

.blog-content blockquote::before {
    content: '"';
    font-size: 4rem;
    color: var(--primary-color);
    position: absolute;
    top: -10px;
    left: 20px;
    opacity: 0.3;
    font-family: Georgia, serif;
}

.blog-content ul,
.blog-content ol {
    margin: 1.5rem 0;
    padding-left: 2rem;
}

.blog-content li {
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
}

.blog-content ul li {
    list-style-type: none;
    position: relative;
}

.blog-content ul li::before {
    content: '•';
    color: var(--primary-color);
    font-weight: bold;
    position: absolute;
    left: -1.5rem;
}

.blog-content code {
    background: #f1f5f9;
    color: #ef4444;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.9rem;
    font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
}

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

.blog-content pre {
    background: #1a1a1a;
    color: #f8f8f2;
    padding: 1.5rem;
    border-radius: 12px;
    overflow-x: auto;
    margin: 2rem 0;
    position: relative;
    box-shadow: var(--shadow);
}

.blog-content pre code {
    background: none;
    color: inherit;
    padding: 0;
    border-radius: 0;
    font-size: 0.875rem;
}

.blog-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 2rem 0;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.blog-content th,
.blog-content td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.blog-content th {
    background: var(--surface);
    font-weight: 600;
    color: var(--text-primary);
}

.blog-content tbody tr:nth-child(even) {
    background: var(--surface);
}

.blog-content tbody tr:hover {
    background: #f0f9ff;
}

.dark .blog-content tbody tr:hover {
    background: #1e3a8a20;
}

.blog-content a {
    color: var(--primary-color);
    text-decoration: underline;
    text-decoration-thickness: 2px;
    text-underline-offset: 3px;
    transition: color 0.2s ease;
}

.blog-content a:hover {
    color: var(--primary-dark);
    text-decoration-color: var(--primary-dark);
}

/* Responsive Design */
@media (max-width: 1024px) {
    .blog-content h1 { font-size: 2rem; }
    .blog-content h2 { font-size: 1.75rem; }
    .blog-content h3 { font-size: 1.375rem; }
    .blog-content p { font-size: 1.05rem; }
}

@media (max-width: 768px) {
    .blog-content h1 { font-size: 1.75rem; }
    .blog-content h2 { font-size: 1.5rem; }
    .blog-content h3 { font-size: 1.25rem; }
    .blog-content p { font-size: 1rem; }
    
    .blog-content img {
        margin: 1.5rem auto;
    }
    
    .blog-content table {
        font-size: 0.875rem;
    }
    
    .blog-content th,
    .blog-content td {
        padding: 0.75rem 0.5rem;
    }
    
    .blog-content pre {
        padding: 1rem;
        font-size: 0.8rem;
    }
    
    .blog-content blockquote {
        padding: 1rem;
        margin: 1.5rem 0;
    }
}

/* Print Styles */
@media print {
    .blog-content {
        font-size: 12pt;
        line-height: 1.5;
        color: black;
    }
    
    .blog-content h1,
    .blog-content h2,
    .blog-content h3 {
        page-break-after: avoid;
    }
    
    .blog-content blockquote,
    .blog-content pre,
    .blog-content table {
        page-break-inside: avoid;
    }
    
    .blog-content a {
        color: black;
        text-decoration: none;
    }
    
    .blog-content a::after {
        content: " (" attr(href) ")";
        font-size: 10pt;
        color: #666;
    }
}

/* Animation Classes */
.fade-in {
    animation: fadeIn 0.5s ease-in-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.slide-up {
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Copy Button for Code Blocks */
.copy-button {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    backdrop-filter: blur(10px);
}

.copy-button:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
}

.copy-button.copied {
    background: #10b981;
    border-color: #10b981;
}

/* Accessibility Improvements */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus Styles */
.blog-content a:focus,
button:focus,
[tabindex]:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
    border-radius: 4px;
}

/* Loading States */
.loading-skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Social Share Buttons Hover Effects */
.social-share-btn {
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.social-share-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.social-share-btn:hover::before {
    left: 100%;
}

/* Related Posts Card Effects */
.related-post-card {
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.related-post-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), #8b5cf6);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.related-post-card:hover::before {
    transform: scaleX(1);
}

.related-post-card:hover {
    transform: translateY(-4px);
}