/* ============================================
   MODERN BLOG UI - PHASE 1 ENHANCEMENTS
   Enhanced typography, code blocks, tables, callouts, progress bar
   ============================================ */

/* ============================================
   TYPOGRAPHY & READING EXPERIENCE
   ============================================ */

/* Import Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap');

/* CSS Variables */
:root {
    /* Colors */
    --primary-500: #6366f1;
    --primary-700: #4338ca;
    --accent-500: #f59e0b;
    --success-500: #10b981;
    --warning-500: #eab308;
    --danger-500: #ef4444;
    --info-500: #3b82f6;

    /* Neutral */
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;

    /* Typography */
    --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
    --reading-width: 750px;

    /* Spacing */
    --space-xs: 0.5rem;
    --space-sm: 1rem;
    --space-md: 1.5rem;
    --space-lg: 2rem;
    --space-xl: 3rem;
}

/* ============================================
   BLOG LISTING PAGE
   ============================================ */

.blog-listing {
    max-width: 1400px;
    margin: 0 auto;
    padding: 40px 20px;
    font-family: var(--font-primary);
}

.blog-listing h1 {
    font-size: 3rem;
    text-align: center;
    margin-bottom: 1rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary-500) 0%, var(--primary-700) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.blog-listing>p {
    text-align: center;
    font-size: 1.2rem;
    color: var(--gray-700);
    margin-bottom: 3rem;
}

/* Search and Filters */
.blog-controls {
    display: flex;
    gap: 1rem;
    margin-bottom: 3rem;
    flex-wrap: wrap;
    justify-content: center;
}

#blog-search {
    flex: 1;
    max-width: 500px;
    padding: 14px 20px;
    font-size: 1rem;
    font-family: var(--font-primary);
    border: 2px solid var(--gray-200);
    border-radius: 12px;
    transition: all 0.3s;
}

#blog-search:focus {
    outline: none;
    border-color: var(--primary-500);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

#category-filter {
    padding: 14px 20px;
    font-size: 1rem;
    font-family: var(--font-primary);
    border: 2px solid var(--gray-200);
    border-radius: 12px;
    background: white;
    cursor: pointer;
    transition: all 0.3s;
}

#category-filter:hover {
    border-color: var(--primary-500);
}

/* Blog Posts Container */
#blog-posts-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 2rem;
    margin-bottom: 4rem;
}

/* Blog Card */
.blog-card {
    background: white;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.07);
    transition: transform 0.3s, box-shadow 0.3s;
    border: 1px solid var(--gray-100);
}

.blog-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 24px rgba(99, 102, 241, 0.15);
}

.blog-card-link {
    text-decoration: none;
    color: inherit;
    display: block;
}

.blog-card-image {
    position: relative;
    width: 100%;
    height: 220px;
    overflow: hidden;
    background: linear-gradient(135deg, var(--primary-500), var(--primary-700));
}

.blog-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s;
}

.blog-card:hover .blog-card-image img {
    transform: scale(1.08);
}

.category-badge {
    position: absolute;
    top: 16px;
    right: 16px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    color: var(--primary-700);
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.blog-card-content {
    padding: 1.75rem;
}

.blog-card-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    color: var(--gray-900);
    line-height: 1.4;
    font-family: var(--font-primary);
}

.blog-card-description {
    color: var(--gray-700);
    margin-bottom: 1rem;
    line-height: 1.7;
    font-size: 0.95rem;
}

.blog-card-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.85rem;
    color: var(--gray-700);
    font-weight: 500;
}

.no-posts {
    text-align: center;
    font-size: 1.2rem;
    color: var(--gray-700);
    padding: 4rem 0;
}

/* ============================================
   BLOG POST PAGE - ENHANCED
   ============================================ */

.blog-post-page {
    background: var(--gray-50);
    min-height: 100vh;
    font-family: var(--font-primary);
}

/* Reading Progress Bar */
.reading-progress {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--gray-200);
    z-index: 9999;
}

.reading-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-500), var(--accent-500));
    width: 0%;
    transition: width 0.1s ease-out;
}

/* Breadcrumbs */
.breadcrumbs {
    max-width: var(--reading-width);
    margin: 0 auto;
    padding: 24px 20px 16px;
    font-size: 0.9rem;
    font-weight: 500;
}

.breadcrumbs a {
    color: var(--primary-500);
    text-decoration: none;
    transition: color 0.2s;
}

.breadcrumbs a:hover {
    color: var(--primary-700);
    text-decoration: underline;
}

.breadcrumbs span {
    color: var(--gray-700);
    margin: 0 8px;
}

/* Blog Post Article */
.blog-post {
    max-width: var(--reading-width);
    margin: 0 auto;
    padding: 20px;
}

.blog-post header {
    text-align: center;
    margin-bottom: 3rem;
}

#post-title {
    font-size: 2.75rem;
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 1.5rem;
    color: var(--gray-900);
    font-family: var(--font-primary);
    letter-spacing: -0.02em;
}

.post-meta {
    display: flex;
    gap: 1.5rem;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    color: var(--gray-700);
    font-size: 0.95rem;
    font-weight: 500;
}

.post-meta span {
    display: flex;
    align-items: center;
    gap: 6px;
}

#post-category {
    background: linear-gradient(135deg, var(--primary-500), var(--primary-700));
    color: white;
    padding: 6px 16px;
    border-radius: 20px;
    font-weight: 700;
}

/* Featured Image */
#featured-image {
    width: 100%;
    max-height: 500px;
    object-fit: cover;
    border-radius: 16px;
    margin-bottom: 3rem;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

/* ============================================
   MODERN MARKDOWN CONTENT STYLES
   ============================================ */

.markdown-content {
    background: white;
    padding: 3.5rem;
    border-radius: 16px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.04);
    line-height: 1.8;
    color: var(--gray-800);
    font-family: var(--font-primary);
    font-size: 18px;
}

/* Drop Cap - First Paragraph */
.markdown-content>p:first-of-type::first-letter {
    float: left;
    font-size: 4.5em;
    line-height: 0.9;
    margin: 0.05em 0.15em 0 0;
    color: var(--primary-500);
    font-weight: 800;
}

/* Headings with Modern Style */
.markdown-content h1,
.markdown-content h2,
.markdown-content h3,
.markdown-content h4 {
    color: var(--gray-900);
    font-weight: 800;
    margin-top: 2.5rem;
    margin-bottom: 1.25rem;
    line-height: 1.3;
    font-family: var(--font-primary);
    letter-spacing: -0.01em;
}

.markdown-content h1 {
    font-size: 2.5rem;
    border-bottom: 3px solid var(--primary-500);
    padding-bottom: 0.75rem;
    margin-bottom: 1.5rem;
}

.markdown-content h2 {
    font-size: 2rem;
    border-bottom: 2px solid var(--gray-200);
    padding-bottom: 0.5rem;
    position: relative;
}

.markdown-content h2::before {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 60px;
    height: 2px;
    background: var(--primary-500);
}

.markdown-content h3 {
    font-size: 1.6rem;
    color: var(--primary-700);
}

.markdown-content h4 {
    font-size: 1.3rem;
}

.markdown-content p {
    margin-bottom: 1.5rem;
    font-size: 1.05rem;
}

/* Links with Modern Hover */
.markdown-content a {
    color: var(--primary-500);
    text-decoration: none;
    font-weight: 600;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
    position: relative;
}

.markdown-content a:hover {
    color: var(--primary-700);
    border-bottom-color: var(--primary-500);
}

/* Lists */
.markdown-content ul,
.markdown-content ol {
    margin-bottom: 1.75rem;
    padding-left: 2rem;
}

.markdown-content li {
    margin-bottom: 0.75rem;
    line-height: 1.8;
}

.markdown-content ul li {
    list-style-type: none;
    position: relative;
    padding-left: 1.5rem;
}

.markdown-content ul li::before {
    content: '→';
    position: absolute;
    left: 0;
    color: var(--primary-500);
    font-weight: 700;
}

/* ============================================
   ENHANCED CODE BLOCKS
   ============================================ */

.markdown-content code {
    background: rgba(99, 102, 241, 0.08);
    padding: 3px 8px;
    border-radius: 6px;
    font-family: var(--font-mono);
    font-size: 0.9em;
    color: var(--primary-700);
    font-weight: 500;
    border: 1px solid rgba(99, 102, 241, 0.15);
}

.markdown-content pre {
    background: var(--gray-900);
    color: #e2e8f0;
    padding: 1.75rem;
    border-radius: 12px;
    overflow-x: auto;
    margin-bottom: 2rem;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.markdown-content pre code {
    background: none;
    padding: 0;
    color: inherit;
    font-size: 0.95rem;
    border: none;
    line-height: 1.6;
}

/* Code Copy Button */
.code-copy-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(255, 255, 255, 0.9);
    color: var(--gray-900);
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: var(--font-primary);
    backdrop-filter: blur(10px);
}

.code-copy-btn:hover {
    background: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.code-copy-btn.copied {
    background: var(--success-500);
    color: white;
}

/* ============================================
   MODERN TABLES
   ============================================ */

.markdown-content table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-bottom: 2rem;
    overflow: hidden;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.markdown-content table thead {
    background: linear-gradient(135deg, var(--primary-500), var(--primary-700));
    color: white;
}

.markdown-content table th {
    padding: 16px 20px;
    text-align: left;
    font-weight: 700;
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.markdown-content table td {
    padding: 14px 20px;
    border-bottom: 1px solid var(--gray-200);
}

.markdown-content table tbody tr {
    background: white;
    transition: all 0.2s;
}

.markdown-content table tbody tr:nth-child(even) {
    background: var(--gray-50);
}

.markdown-content table tbody tr:hover {
    background: rgba(99, 102, 241, 0.05);
    transform: scale(1.01);
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.1);
}

/* ============================================
   CALLOUT BOXES / ALERTS
   ============================================ */

.markdown-content blockquote {
    margin: 2rem 0;
    padding: 1.25rem 1.5rem;
    border-left: 4px solid var(--primary-500);
    background: rgba(99, 102, 241, 0.05);
    border-radius: 8px;
    font-style: normal;
}

/* Callout Types */
.callout {
    margin: 2rem 0;
    padding: 1.25rem 1.5rem;
    border-radius: 12px;
    border-left: 4px solid;
    font-size: 1rem;
    position: relative;
    backdrop-filter: blur(10px);
}

.callout-tip {
    background: rgba(59, 130, 246, 0.08);
    border-color: var(--info-500);
    color: #1e40af;
}

.callout-warning {
    background: rgba(234, 179, 8, 0.08);
    border-color: var(--warning-500);
    color: #92400e;
}

.callout-danger {
    background: rgba(239, 68, 68, 0.08);
    border-color: var(--danger-500);
    color: #991b1b;
}

.callout-success {
    background: rgba(16, 185, 129, 0.08);
    border-color: var(--success-500);
    color: #065f46;
}

.callout::before {
    content: attr(data-type);
    display: block;
    font-weight: 800;
    text-transform: uppercase;
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
    letter-spacing: 0.05em;
}

/* ============================================
   IMAGES
   ============================================ */

.markdown-content img {
    max-width: 100%;
    height: auto;
    border-radius: 12px;
    margin: 2rem 0;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s;
}

.markdown-content img:hover {
    transform: scale(1.02);
    cursor: zoom-in;
}

/* Horizontal Rule */
.markdown-content hr {
    border: none;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--gray-300), transparent);
    margin: 3rem 0;
}

/* Strong and Em */
.markdown-content strong {
    font-weight: 700;
    color: var(--gray-900);
}

.markdown-content em {
    font-style: italic;
    color: var(--gray-700);
}

/* ============================================
   PHASE 2: TABLE OF CONTENTS
   ============================================ */

/* Content wrapper for markdown + TOC layout */
.post-content-wrapper {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

@media (min-width: 1024px) {
    .post-content-wrapper {
        flex-direction: row;
        align-items: flex-start;
        gap: 2rem;
    }

    .markdown-content {
        flex: 1;
        min-width: 0;
    }

    .toc-sidebar {
        flex-shrink: 0;
        width: 280px;
    }
}

.toc-sidebar {
    position: sticky;
    top: 100px;
    width: 250px;
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    border: 1px solid var(--gray-200);
    max-height: calc(100vh - 150px);
    overflow-y: auto;
}

.toc-header {
    font-weight: 800;
    font-size: 0.95rem;
    color: var(--gray-900);
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.toc-header::before {
    content: '📑';
}

.toc-nav {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toc-link {
    display: block;
    padding: 0.5rem 0.75rem;
    color: var(--gray-700);
    text-decoration: none;
    font-size: 0.9rem;
    border-left: 2px solid transparent;
    transition: all 0.2s;
    line-height: 1.4;
}

.toc-link:hover {
    color: var(--primary-500);
    border-left-color: var(--primary-500);
    background: rgba(99, 102, 241, 0.05);
    border-radius: 4px;
}

.toc-link.active {
    color: var(--primary-700);
    font-weight: 700;
    border-left-color: var(--primary-500);
    background: rgba(99, 102, 241, 0.08);
    border-radius: 4px;
}

.toc-h3 {
    padding-left: 1.5rem;
    font-size: 0.85rem;
}

/* ============================================
   PHASE 2: SOCIAL SHARE BUTTONS
   ============================================ */

.share-sidebar {
    position: fixed;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    z-index: 1000;
}

.share-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    border: 1px solid var(--gray-200);
    font-size: 1.3rem;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    position: relative;
}

.share-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.share-btn.twitter:hover {
    background: #1DA1F2;
    border-color: #1DA1F2;
}

.share-btn.facebook:hover {
    background: #1877F2;
    border-color: #1877F2;
}

.share-btn.linkedin:hover {
    background: #0A66C2;
    border-color: #0A66C2;
}

.share-btn.whatsapp:hover {
    background: #25D366;
    border-color: #25D366;
}

.share-btn.copy:hover {
    background: var(--primary-500);
    border-color: var(--primary-500);
}

/* Tooltip for share buttons */
.share-btn::after {
    content: attr(data-tooltip);
    position: absolute;
    left: 60px;
    background: var(--gray-900);
    color: white;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.85rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}

.share-btn:hover::after {
    opacity: 1;
}

/* ============================================
   PHASE 2: READING STATISTICS BAR
   ============================================ */

.reading-stats {
    display: flex;
    gap: 2rem;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    padding: 1rem 1.5rem;
    background: white;
    border-radius: 12px;
    margin-bottom: 2rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    border: 1px solid var(--gray-200);
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: var(--gray-700);
    font-weight: 500;
}

.stat-icon {
    font-size: 1.1rem;
}

.stat-value {
    font-weight: 700;
    color: var(--gray-900);
}

/* ============================================
   LOADING & ERROR STATES
   ============================================ */

.loading {
    text-align: center;
    padding: 4rem;
    font-size: 1.2rem;
    color: var(--gray-700);
    font-family: var(--font-primary);
}

.error-message {
    text-align: center;
    padding: 4rem 2rem;
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.error-message h2 {
    color: var(--danger-500);
    margin-bottom: 1rem;
}

.error-message .btn {
    display: inline-block;
    margin-top: 1.5rem;
    padding: 14px 28px;
    background: var(--primary-500);
    color: white;
    text-decoration: none;
    border-radius: 10px;
    font-weight: 700;
    transition: all 0.3s;
    font-family: var(--font-primary);
}

.error-message .btn:hover {
    background: var(--primary-700);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

@media (max-width: 1024px) {
    .toc-sidebar {
        display: none;
    }

    .share-sidebar {
        display: none;
    }
}

@media (max-width: 768px) {
    .blog-listing h1 {
        font-size: 2rem;
    }

    #blog-posts-container {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .blog-controls {
        flex-direction: column;
    }

    #blog-search {
        max-width: 100%;
    }

    #post-title {
        font-size: 2rem;
    }

    .markdown-content {
        padding: 2rem 1.5rem;
        font-size: 17px;
    }

    .markdown-content>p:first-of-type::first-letter {
        font-size: 3.5em;
    }

    .markdown-content h1 {
        font-size: 2rem;
    }

    .markdown-content h2 {
        font-size: 1.6rem;
    }

    .markdown-content h3 {
        font-size: 1.3rem;
    }

    .markdown-content table {
        font-size: 0.85rem;
        display: block;
        overflow-x: auto;
    }

    .post-meta {
        font-size: 0.85rem;
        gap: 1rem;
    }

    .reading-stats {
        gap: 1rem;
        font-size: 0.85rem;
    }
}

@media (max-width: 480px) {
    .blog-listing {
        padding: 20px 15px;
    }

    .blog-post {
        padding: 10px;
    }

    .markdown-content {
        padding: 1.5rem 1rem;
    }

    .blog-card-content {
        padding: 1.25rem;
    }

    .blog-card-title {
        font-size: 1.3rem;
    }
}

/* ============================================
   SMOOTH SCROLLING
   ============================================ */

html {
    scroll-behavior: smooth;
}

/* Selection Color */
::selection {
    background: var(--primary-500);
    color: white;
}

::-moz-selection {
    background: var(--primary-500);
    color: white;
}

/* ============================================
   PHASE 3: DARK MODE SUPPORT
   ============================================ */

/* Dark Mode Variables */
[data-theme="dark"] {
    /* Background colors */
    --gray-50: #1f2937;
    --gray-100: #374151;
    --gray-200: #4b5563;
    --gray-300: #6b7280;
    --gray-700: #d1d5db;
    --gray-800: #e5e7eb;
    --gray-900: #f9fafb;

    /* Component backgrounds */
    --bg-primary: #111827;
    --bg-secondary: #1f2937;
    --bg-tertiary: #374151;
    --text-primary: #f9fafb;
    --text-secondary: #d1d5db;
    --border-color: #374151;
}

[data-theme="dark"] .blog-post-page {
    background: #0f172a;
}

[data-theme="dark"] .markdown-content,
[data-theme="dark"] .blog-card,
[data-theme="dark"] .toc-sidebar,
[data-theme="dark"] .reading-stats,
[data-theme="dark"] .related-posts-container {
    background: #1f2937;
    color: #e5e7eb;
}

[data-theme="dark"] .markdown-content code {
    background: rgba(99, 102, 241, 0.2);
    color: #a5b4fc;
}

[data-theme="dark"] .markdown-content table tbody tr:nth-child(even) {
    background: #111827;
}

[data-theme="dark"] .newsletter-form input {
    background: #374151;
    border-color: #4b5563;
    color: #f9fafb;
}

/* Dark Mode Toggle Button - Improved */
.dark-mode-toggle {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    border: 3px solid rgba(255, 255, 255, 0.4);
    box-shadow:
        0 8px 16px rgba(0, 0, 0, 0.15),
        0 0 0 0 rgba(251, 191, 36, 0.4);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 99999;
    animation: pulse 2s infinite;
}

@keyframes pulse {

    0%,
    100% {
        box-shadow:
            0 8px 16px rgba(0, 0, 0, 0.15),
            0 0 0 0 rgba(251, 191, 36, 0.4);
    }

    50% {
        box-shadow:
            0 8px 16px rgba(0, 0, 0, 0.15),
            0 0 0 10px rgba(251, 191, 36, 0);
    }
}

.dark-mode-toggle:hover {
    transform: scale(1.15) rotate(15deg);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.25);
    animation: none;
}

[data-theme="dark"] .dark-mode-toggle {
    background: linear-gradient(135deg, #6366f1 0%, #4338ca 100%);
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow:
        0 8px 16px rgba(0, 0, 0, 0.3),
        0 0 0 0 rgba(99, 102, 241, 0.4);
}

.dark-mode-toggle .icon-sun,
.dark-mode-toggle .icon-moon {
    transition: opacity 0.3s;
}

[data-theme="light"] .icon-moon {
    display: none;
}

[data-theme="dark"] .icon-sun {
    display: none;
}

/* ============================================
   PHASE 3: RELATED POSTS WIDGET
   ============================================ */

.related-posts-container {
    margin-top: 4rem;
    padding: 3rem;
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.04);
}

.related-posts-heading {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 2rem;
    text-align: center;
    color: var(--gray-900);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
}

.related-posts-heading::before {
    content: '📚';
    font-size: 2.5rem;
}

.related-posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
}

.related-post-card {
    background: var(--gray-50);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    transition: all 0.3s;
    border: 1px solid var(--gray-200);
    text-decoration: none;
    color: inherit;
    display: block;
}

.related-post-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.12);
}

.related-post-image {
    width: 100%;
    height: 180px;
    overflow: hidden;
    background: linear-gradient(135deg, var(--primary-500), var(--primary-700));
    position: relative;
}

.related-post-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s;
}

.related-post-card:hover .related-post-image img {
    transform: scale(1.08);
}

.related-post-category {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(255, 255, 255, 0.95);
    color: var(--primary-700);
    padding: 4px 12px;
    border-radius: 16px;
    font-size: 0.8rem;
    font-weight: 700;
}

.related-post-content {
    padding: 1.5rem;
}

.related-post-title {
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    color: var(--gray-900);
    line-height: 1.4;
}

.related-post-excerpt {
    font-size: 0.9rem;
    color: var(--gray-700);
    line-height: 1.6;
    margin-bottom: 1rem;
}

.related-post-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.85rem;
    color: var(--gray-700);
}

/* ============================================
   PHASE 3: NEWSLETTER SIGNUP
   ============================================ */

.newsletter-container {
    margin-top: 4rem;
    padding: 3rem;
    background: linear-gradient(135deg, var(--primary-500) 0%, var(--primary-700) 100%);
    border-radius: 16px;
    color: white;
    text-align: center;
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.2);
}

.newsletter-heading {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
}

.newsletter-heading::before {
    content: '📧';
    font-size: 2.5rem;
}

.newsletter-subheading {
    font-size: 1.1rem;
    margin-bottom: 2rem;
    opacity: 0.95;
}

.newsletter-form {
    display: flex;
    gap: 1rem;
    max-width: 500px;
    margin: 0 auto 1rem;
    flex-wrap: wrap;
    justify-content: center;
}

.newsletter-form input {
    flex: 1;
    min-width: 250px;
    padding: 14px 20px;
    font-size: 1rem;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 10px;
    font-family: var(--font-primary);
    background: rgba(255, 255, 255, 0.15);
    color: white;
    backdrop-filter: blur(10px);
    transition: all 0.3s;
}

.newsletter-form input::placeholder {
    color: rgba(255, 255, 255, 0.7);
}

.newsletter-form input:focus {
    outline: none;
    border-color: white;
    background: rgba(255, 255, 255, 0.25);
}

.newsletter-form button {
    padding: 14px 32px;
    background: white;
    color: var(--primary-700);
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
    font-family: var(--font-primary);
}

.newsletter-form button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.newsletter-disclaimer {
    font-size: 0.85rem;
    opacity: 0.85;
}

.newsletter-success {
    background: var(--success-500);
    padding: 1rem;
    border-radius: 8px;
    margin-top: 1rem;
    font-weight: 600;
}

/* ============================================
   PHASE 3: RESPONSIVE UPDATES
   ============================================ */

/* Tablet Range (768px - 1023px) */
@media (min-width: 768px) and (max-width: 1023px) {
    .toc-sidebar {
        display: none;
        /* Hide TOC on tablets to avoid clutter */
    }

    .share-sidebar {
        display: none;
        /* Hide share buttons on tablets */
    }

    .dark-mode-toggle {
        bottom: 25px;
        right: 25px;
        width: 60px;
        height: 60px;
    }
}

/* Laptop/Desktop (1024px+) */
@media (min-width: 1024px) {
    .blog-post {
        max-width: 1200px;
        margin: 0 auto;
    }

    .toc-sidebar {
        width: 280px;
        top: 120px;
    }

    .share-sidebar {
        left: 50px;
    }

    .dark-mode-toggle {
        bottom: 30px;
        right: 30px;
    }
}

/* Large Laptop (1440px+) */
@media (min-width: 1440px) {
    .blog-post {
        max-width: 1400px;
    }

    .markdown-content {
        max-width: 850px;
        padding: 4rem;
        font-size: 19px;
    }

    .toc-sidebar {
        width: 300px;
    }

    .share-sidebar {
        left: calc((100vw - 1400px) / 2 - 90px);
    }
}

/* Ultra-wide screens (1920px+) */
@media (min-width: 1920px) {
    .blog-post {
        max-width: 1600px;
    }

    .markdown-content {
        max-width: 900px;
    }

    .share-sidebar {
        left: calc((100vw - 1600px) / 2 - 100px);
    }
}

/* Mobile breakpoints */
@media (max-width: 768px) {
    .related-posts-grid {
        grid-template-columns: 1fr;
    }

    .newsletter-form {
        flex-direction: column;
        align-items: stretch;
    }

    .newsletter-form input {
        min-width: 100%;
    }

    .dark-mode-toggle {
        bottom: 20px;
        right: 20px;
        width: 56px;
        height: 56px;
        font-size: 1.5rem;
    }
}

@media (max-width: 480px) {

    .related-posts-container,
    .newsletter-container {
        padding: 2rem 1.5rem;
    }

    .related-posts-heading,
    .newsletter-heading {
        font-size: 1.5rem;
    }

    .dark-mode-toggle {
        bottom: 15px;
        right: 15px;
        width: 52px;
        height: 52px;
        font-size: 1.3rem;
    }
}