/**
 * Blog Stylesheet
 * File: assets/css/blog.css
 * Styles for blog listing, single post, and category pages
 */

/* ============================================
   Header & Navigation
   ============================================ */
/* .blog-header {
    background: white;
    border-bottom: 1px solid #e2e8f0;
    padding: 20px 0;
    position: sticky;
    top: 0;
    z-index: 100;
} */

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.site-title {
    font-size: 24px;
    font-weight: 700;
    margin: 0;
}

.site-title a {
    color: #2d3748;
    text-decoration: none;
}

.site-title a:hover {
    color: #667eea;
}

.main-nav {
    display: flex;
    gap: 30px;
}

.main-nav a {
    color: #2d3748;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.main-nav a:hover,
.main-nav a.active {
    color: #667eea;
}

/* ============================================
   Blog Hero Section
   ============================================ */
.blog-hero {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 60px 20px;
    text-align: center;
    margin-bottom: 60px;
}

.blog-hero h1 {
    padding-top: 60px;
    font-size: 48px;
    margin-bottom: 15px;
}

.blog-hero p {
    font-size: 18px;
    opacity: 0.95;
}

.category-post-count {
    margin-top: 15px;
    font-size: 16px;
    opacity: 0.9;
}

/* ============================================
   Blog Layout (3-column for main pages)
   ============================================ */
.blog-container {
    background: #f7fafc;
    padding: 40px 0;
    min-height: 60vh;
}

.blog-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 40px;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

@media (max-width: 1024px) {
    .blog-layout {
        grid-template-columns: 1fr;
        gap: 30px;
    }
}

/* ============================================
   Blog Main Content Area
   ============================================ */
.blog-main {
    grid-column: 1;
}

.blog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 30px;
    margin-bottom: 50px;
}

@media (max-width: 768px) {
    .blog-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
}

/* ============================================
   Blog Card
   ============================================ */
.blog-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s, box-shadow 0.3s;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.blog-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.15);
}

.blog-card-image {
    display: block;
    width: 100%;
    height: 200px;
    overflow: hidden;
    background: #e2e8f0;
}

.blog-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.blog-card:hover .blog-card-image img {
    transform: scale(1.05);
}

.blog-card-content {
    padding: 24px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.blog-meta {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.blog-category {
    display: inline-block;
    background: #edf2f7;
    color: #667eea;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.2s;
}

.blog-category:hover {
    background: #667eea;
    color: white;
}

.blog-category-active {
    display: inline-block;
    background: #667eea;
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.blog-date {
    color: #718096;
    font-size: 14px;
}

.blog-title {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 12px;
    flex-grow: 1;
}

.blog-title a {
    color: #2d3748;
    text-decoration: none;
    transition: color 0.2s;
}

.blog-title a:hover {
    color: #667eea;
}

.blog-excerpt {
    color: #718096;
    font-size: 15px;
    line-height: 1.6;
    margin-bottom: 15px;
}

.blog-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 15px;
    border-top: 1px solid #e2e8f0;
    margin-bottom: 15px;
}

.blog-author {
    font-size: 13px;
    color: #718096;
    font-weight: 500;
}

.blog-reading-time {
    font-size: 13px;
    color: #a0aec0;
}

.blog-read-more {
    color: #667eea;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    transition: color 0.2s;
}

.blog-read-more:hover {
    color: #764ba2;
}

/* ============================================
   No Posts Message
   ============================================ */
.no-posts {
    background: white;
    padding: 60px 40px;
    text-align: center;
    border-radius: 12px;
}

.no-posts p {
    color: #718096;
    font-size: 18px;
    margin-bottom: 20px;
}

.btn-secondary {
    display: inline-block;
    padding: 12px 24px;
    background: #667eea;
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    transition: background 0.2s;
}

.btn-secondary:hover {
    background: #764ba2;
}

/* ============================================
   Pagination
   ============================================ */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 40px;
    padding: 30px;
    background: white;
    border-radius: 12px;
}

.pagination-link {
    padding: 8px 12px;
    border: 1px solid #e2e8f0;
    color: #667eea;
    text-decoration: none;
    border-radius: 6px;
    transition: all 0.2s;
}

.pagination-link:hover {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.pagination-current {
    padding: 8px 12px;
    background: #667eea;
    color: white;
    border-radius: 6px;
    font-weight: 600;
}

.pagination-ellipsis {
    color: #a0aec0;
    padding: 8px 4px;
}

/* ============================================
   Blog Sidebars
   ============================================ */
.blog-sidebar {
    display: none;
}

.blog-sidebar-right {
    display: block;
}

/* Show sidebar on larger screens (make grid responsive) */
@media (min-width: 1025px) {
    .blog-layout {
        grid-template-columns: 1fr 280px;
    }
    
    .blog-sidebar-right {
        grid-column: 2;
        grid-row: 1;
    }
}

.sidebar-card {
    background: white;
    padding: 24px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.sidebar-card.sticky {
    position: sticky;
    top: 100px;
}

.sidebar-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 16px;
    color: #2d3748;
}

.category-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.category-list li {
    margin-bottom: 12px;
}

.category-list a {
    display: block;
    padding: 10px 12px;
    color: #2d3748;
    text-decoration: none;
    border-radius: 6px;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.category-list a:hover,
.category-list a.active {
    background: #edf2f7;
    color: #667eea;
    border-left-color: #667eea;
}

.sidebar-empty {
    color: #a0aec0;
    font-size: 14px;
    text-align: center;
    padding: 20px 0;
}

/* ============================================
   Container Fluid
   ============================================ */
.container-fluid {
    width: 100%;
    padding: 0 20px;
    margin: 0 auto;
}

/* ============================================
   Post Hero Two Column Layout
   ============================================ */
.post-hero {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 60px 20px;
    margin-bottom: 40px;
}

.post-hero-wrapper {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    align-items: center;
    max-width: 1400px;
    margin: 0 auto;
    padding-top: 60px;  
}

.post-hero-left {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.post-hero-right {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.post-hero-featured-image {
    width: 100%;
    height: auto;
    max-height: 400px;
    object-fit: cover;
    border-radius: 12px;
}

.post-hero-author {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.post-hero-author-avatar {
    width: 50px;
    height: 50px;
    min-width: 50px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid white;
}

.post-hero-author-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.post-hero-author-name {
    font-weight: 600;
    font-size: 16px;
    display: block;
    margin-bottom: 4px;
}

.post-hero-author-info .post-meta {
    margin-top: 4px;
}

/* ============================================
   Post Hero Content
   ============================================ */
.post-hero-content {
    /* Full width within grid column */
}

.post-hero h1 {
    font-size: 48px;
    margin: 20px 0;
    line-height: 1.2;
}

.post-category {
    display: inline-block;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.2s;
}

.post-category:hover {
    background: rgba(255, 255, 255, 0.3);
}

.post-meta {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    font-size: 15px;
    opacity: 0.95;
    margin-top: 20px;
}

.post-date,
.post-reading-time,
.post-updated {
    display: flex;
    align-items: center;
}

/* ============================================
   Post Container (3-column layout)
   ============================================ */
.post-container {
    padding: 40px 0;
    background: white;
}

.post-layout {
    display: grid;
    grid-template-columns: 250px 1fr 250px;
    gap: 40px;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

@media (max-width: 1400px) {
    .post-layout {
        grid-template-columns: 220px 1fr 220px;
        gap: 30px;
    }
}

@media (max-width: 1200px) {
    .post-hero-wrapper {
        grid-template-columns: 1fr;
        gap: 30px;
    }
    
    .post-hero-featured-image {
        max-height: 300px;
    }
    
    .post-layout {
        grid-template-columns: 1fr;
        gap: 30px;
    }
    
    /* Hide TOC and Category sidebars on mobile */
    .post-sidebar-left {
        display: none;
    }
    
    .post-sidebar-right {
        display: none;
    }
}

.post-sidebar-left {
    grid-column: 1;
    grid-row: 1;
    order: 1;
}

.post-main {
    grid-column: 2;
    grid-row: 1;
    order: 2;
}

.post-sidebar-right {
    grid-column: 3;
    grid-row: 1;
    order: 3;
}

/* ============================================
   Table of Contents (TOC)
   ============================================ */
.toc-card {
    background: white;
    padding: 24px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border-left: 4px solid #667eea;
}

.toc-card.sticky {
    position: sticky;
    top: 100px;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
}

.toc-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
    color: #2d3748;
}

.toc {
    font-size: 14px;
}

.toc-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.toc-list li {
    margin-bottom: 8px;
}

.toc-link {
    color: #718096;
    text-decoration: none;
    padding: 4px 8px;
    display: block;
    border-radius: 4px;
    transition: all 0.2s;
}

.toc-link:hover {
    color: #667eea;
    background: #edf2f7;
    padding-left: 12px;
}

.toc-nested {
    padding-left: 16px;
    margin-top: 4px;
}

.toc-nested .toc-link {
    font-size: 13px;
}

/* ============================================
   Post Content
   ============================================ */
.post-content {
    font-size: 16px;
    line-height: 1.8;
    color: #2d3748;
}

.post-content h2 {
    font-size: 32px;
    margin-top: 40px;
    margin-bottom: 20px;
    color: #2d3748;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 15px;
    scroll-margin-top: 100px;
}

.post-content h3 {
    font-size: 24px;
    margin-top: 30px;
    margin-bottom: 15px;
    color: #2d3748;
    scroll-margin-top: 100px;
}

.post-content p {
    margin-bottom: 20px;
}

.post-content a {
    color: #667eea;
    text-decoration: underline;
}

.post-content a:hover {
    color: #764ba2;
}

.post-content ul,
.post-content ol {
    margin: 20px 0;
    padding-left: 30px;
}

.post-content li {
    margin-bottom: 10px;
}

.post-content blockquote {
    border-left: 4px solid #667eea;
    padding: 15px 20px;
    margin: 20px 0;
    background: #f7fafc;
    border-radius: 4px;
    font-style: italic;
    color: #718096;
}

.post-content code {
    background: #f7fafc;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Monaco', 'Courier New', monospace;
    color: #d63384;
}

.post-content pre {
    background: #2d3748;
    color: #cbd5e0;
    padding: 20px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 20px 0;
}

.post-content pre code {
    background: none;
    padding: 0;
    color: inherit;
}

.post-content img {
    max-width: 100%;
    height: auto;
    margin: 20px 0;
    border-radius: 8px;
}

.post-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
}

.post-content th,
.post-content td {
    border: 1px solid #e2e8f0;
    padding: 12px;
    text-align: left;
}

.post-content th {
    background: #f7fafc;
    font-weight: 600;
}

/* ============================================
   Quick Answer Section
   ============================================ */
.quick-answer {
    background: linear-gradient(135deg, #edf2f7 0%, #f7fafc 100%);
    padding: 24px;
    border-radius: 12px;
    border-left: 4px solid #667eea;
    margin-bottom: 40px;
}

.quick-answer h2 {
    margin-top: 0;
    font-size: 18px;
    color: #667eea;
}

.quick-answer p {
    margin-bottom: 0;
    color: #2d3748;
}

/* ============================================
   Author Section
   ============================================ */
.post-author-section {
    margin-top: 50px;
    padding-top: 30px;
    border-top: 2px solid #e2e8f0;
}

.author-card {
    display: flex;
    gap: 20px;
    background: #f7fafc;
    padding: 24px;
    border-radius: 12px;
}

.author-image {
    width: 80px;
    height: 80px;
    min-width: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid white;
}

.author-info h3 {
    margin: 0 0 8px 0;
    color: #2d3748;
    font-size: 18px;
}

.author-info p {
    margin: 0;
    color: #718096;
    font-size: 14px;
}

/* ============================================
   Related Posts
   ============================================ */
.related-posts {
    margin-top: 60px;
    padding-top: 40px;
    border-top: 2px solid #e2e8f0;
}

.related-posts h2 {
    margin-top: 0;
    border-bottom: none;
    padding-bottom: 0;
}

.related-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
    margin-top: 30px;
}

.related-card {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s;
}

.related-card:hover {
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
}

.related-image {
    display: block;
    width: 100%;
    height: 180px;
    overflow: hidden;
    background: #e2e8f0;
}

.related-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.related-card:hover .related-image img {
    transform: scale(1.05);
}

.related-content {
    padding: 20px;
}

.related-card h3 {
    margin: 0 0 12px 0;
    font-size: 16px;
}

.related-card a {
    text-decoration: none;
    color: #2d3748;
}

.related-card a:hover {
    color: #667eea;
}

.related-meta {
    display: flex;
    gap: 15px;
    font-size: 13px;
    color: #a0aec0;
}


/* ============================================
   Responsive Design - Mobile
   ============================================ */
@media (max-width: 768px) {
    /* Prevent horizontal overflow */
    html,
    body {
        overflow-x: hidden;
        width: 100%;
        position: relative;
        margin: 0;
        padding: 0;
    }
    
    /* Fix all container widths */
    .container-fluid,
    .post-layout,
    .blog-layout,
    .post-hero-wrapper {
        width: 100%;
        max-width: 100vw;
        overflow-x: hidden;
        padding: 0 15px;
    }
    
    /* Fix post content overflow */
    .post-content {
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
        word-wrap: break-word;
        overflow-wrap: break-word;
        font-size: 17px;
    }
    
    .post-content p {
        font-size: 1.0625rem;
    }
    
    /* Ensure content elements don't overflow */
    .post-content img,
    .post-content table,
    .post-content pre,
    .post-content iframe,
    .post-content video {
        max-width: 100% !important;
        width: 100% !important;
        height: auto !important;
    }
    
    /* Header adjustments */
    .blog-header {
        padding: 16px 0;
    }
    
    .header-content {
        flex-direction: column;
        gap: 16px;
    }
    
    .site-title {
        font-size: 20px;
    }
    
    .main-nav {
        gap: 16px;
        font-size: 14px;
    }
    
    /* Blog hero section */
    .blog-hero {
        padding: 80px 15px 40px 15px;
        margin-top: -35 !important;
    }
    
    .blog-hero h1 {
        padding-top: 0;
        margin-top: 0;
        font-size: 32px;
    }
    
    .blog-hero p {
        font-size: 16px;
    }
    
    /* Post hero section */
    .post-hero {
        padding: 80px 15px 40px 15px;
        margin-top: -35 !important;
        margin-bottom: 40px;
    }
    
    .post-hero-wrapper {
        gap: 20px;
        padding-top: 0;
    }
    
    .post-hero h1 {
        font-size: 28px;
        padding-top: 0;
        margin-top: 0;
    }
    
    .post-hero-author {
        margin-top: 16px;
        padding-top: 16px;
    }
    
    .post-hero-featured-image {
        max-height: 250px;
        width: 100%;
    }
    
    /* Post meta */
    .post-meta {
        gap: 12px;
        font-size: 13px;
    }
    
    /* Post content headings */
    .post-content h2 {
        font-size: 26px;
    }
    
    .post-content h3 {
        font-size: 20px;
    }
    
    /* Table of contents */
    .toc-card {
        border-left-width: 3px;
    }
    
    /* Author card */
    .author-card {
        flex-direction: column;
        text-align: center;
    }
    
    .author-image {
        margin: 0 auto;
    }
    
    /* Related posts grid */
    .related-grid {
        grid-template-columns: 1fr;
    }
}

