/* --- Global & Layout --- */
.blog-main-container { max-width: 1400px; margin: 40px auto; padding: 0 20px; font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; }
.blog-flex-layout { display: flex; gap: 50px; }
.blog-content-left { flex: 3; min-width: 0; }
/* --- HERO SECTION --- */
.blog-hero { background: linear-gradient(135deg, #0d47a1 0%, #1976d2 100%); color: white; padding: 80px 20px; text-align: center; }
.blog-hero-inner { max-width: 900px; margin: 0 auto; }
.blog-hero h1 { font-size: 2.8rem; font-weight: 800; margin-bottom: 20px; line-height: 1.2; }
.blog-hero p { font-size: 1.15rem; line-height: 1.7; opacity: 0.95; font-weight: 300; }

/* --- MAIN LAYOUT & TYPOGRAPHY --- */
.blog-container { max-width: 1400px; margin: 0 auto; padding: 60px 20px; }
.section-title { color: #0d47a1; font-size: 2.5rem; font-weight: 700; margin-bottom: 40px; text-align: center; }

/* --- WHAT YOU WILL FIND HERE (FEATURES) --- */
.features-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 30px; text-align: left; margin-bottom: 50px; }
.feature-card { background: #f8fafc; padding: 30px; border-radius: 12px; box-shadow: 0 4px 6px rgba(0,0,0,0.05); }
.feature-card.blue { border-top: 4px solid #3b82f6; }
.feature-card.green { border-top: 4px solid #10b981; }
.feature-card.orange { border-top: 4px solid #f59e0b; }
.feature-card.purple { border-top: 4px solid #8b5cf6; }
.feature-card h3 { font-size: 1.25rem; margin-bottom: 15px; }
.feature-card p { color: #4b5563; font-size: 0.95rem; line-height: 1.6; margin: 0; }
.feature-card .fa-lightbulb-o { color: #1e40af; }
.feature-card .fa-laptop { color: #047857; }
.feature-card .fa-globe { color: #b45309; }
.feature-card .fa-line-chart { color: #5b21b6; }

/* --- CATEGORY FILTER BAR --- */
.filter-section { text-align: center; margin-bottom: 70px; }
.filter-title { color: #6b7280; font-size: 1.5rem; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 20px; }
.filter-group { display: flex; flex-wrap: wrap; justify-content: center; gap: 15px; }
.filter-btn { background: #e0f2fe; color: #1e3a8a; padding: 10px 20px; border-radius: 50px; font-weight: 600; font-size: 0.9rem; cursor: pointer; border: 2px solid transparent; transition: all 0.3s ease; }
.filter-btn:hover { background: #bfdbfe; }
.filter-btn.active-filter { background: #1e3a8a; color: white; box-shadow: 0 4px 6px rgba(0,0,0,0.1); }

/* --- BLOG GRID & CARDS --- */
.blog-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 30px; }
.blog-card { border: 1px solid #e5e7eb; border-radius: 12px; overflow: hidden; background: white; box-shadow: 0 4px 6px rgba(0,0,0,0.05); display: flex; flex-direction: column; text-decoration: none; color: inherit; transition: transform 0.3s ease; height: 100%; }
.blog-card:hover { transform: translateY(-5px); }
.card-img-box { height: 220px; background: #f3f4f6; overflow: hidden; position: relative; }
.card-img-box img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.5s ease; }
/* .category-badge { position: absolute; top: 15px; left: 15px; background: rgba(13, 71, 161, 0.9); color: white; padding: 4px 12px; border-radius: 4px; font-size: 0.8rem; font-weight: 600; z-index: 10; } */
.no-img-placeholder { display: flex; align-items: center; justify-content: center; height: 100%; color: #9ca3af; }

/* --- CARD CONTENT --- */
.card-content { padding: 25px; flex-grow: 1; display: flex; flex-direction: column; }
.card-title { margin: 0 0 10px 0; font-size: 1.3rem; color: #111827; font-weight: 700; line-height: 1.4; }
.card-meta { font-size: 0.95rem; color: #6b7280; margin-bottom: 12px; display: flex; justify-content: space-between; }
.card-excerpt { color: #4b5563; font-size: 0.95rem; line-height: 1.6; margin-bottom: 15px; flex-grow: 1; }
.card-read-more { color: #2563eb; font-weight: 600; font-size: 0.95rem; display: flex; align-items: center; margin-top: auto; }
.card-read-more span { margin-left: 5px; }

/* --- CTA SECTION & EMPTY STATE --- */
.cta-section { background: #f8fafc; padding: 50px 20px; text-align: center; border-radius: 16px; margin-top: 80px; border: 1px solid #e2e8f0; }
.cta-section h2 { color: #0d47a1; font-size: 2.5rem; font-weight: 700; margin-bottom: 15px; }
.cta-section p { color: #4b5563; font-size: 1.1rem; max-width: 600px; margin: 0 auto 30px; }
.cta-btn { display: inline-block; background: #0d47a1; color: white; padding: 14px 35px; border-radius: 50px; font-weight: 600; text-decoration: none; font-size: 1.05rem; transition: background 0.3s; }
.cta-btn:hover { background: #1e3a8a; color: white; }
.empty-state { text-align: center; padding: 40px; border: 2px dashed #d9534f; border-radius: 10px; background: #fff5f5; }
.empty-state h3 { color: #d9534f; }
/* --- ENHANCED SIDEBAR (Distinct Block) --- */
/* Styles for images converted from [image] tags */
.blog-inner-image {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 25px auto;
    border-radius: 12px;
    box-shadow: 0 10px 20px rgba(0,0,0,0.1);
}

.img-container {
    text-align: center;
    width: 100%;
}
.blog-sidebar-right { 
    flex: 1; 
    min-width: 320px; 
    background-color: #f8fafc; /* Distinct light background */
    padding: 30px; 
    border-radius: 16px; 
    border: 1px solid #e2e8f0;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05); /* Soft shadow */
    height: fit-content; 
    position: sticky; 
    top: 30px; /* Sticks nicely when scrolling */
}
.sidebar-title { 
    font-size: 1.15rem; 
    font-weight: 800; 
    color: #0d47a1; 
    border-bottom: 3px solid #0d47a1; 
    padding-bottom: 12px; 
    margin-bottom: 25px; 
    text-transform: uppercase; 
    letter-spacing: 0.5px;
}
.sidebar-item { 
    display: flex; 
    gap: 15px; 
    margin-bottom: 20px; 
    text-decoration: none; 
    color: inherit; 
    align-items: center;
    padding: 10px;
    border-radius: 8px;
     background: #fff;
    border: 1px solid #e2e8f0;
    transition: background-color 0.3s ease;
}
.sidebar-item:hover {
    background-color: #e0f2fe; /* Highlight on hover */
}
.sidebar-item img { 
    width: 10rem; 
    height: 8rem; 
    border-radius: 8px; 
    object-fit: cover; /* Fixed image distortion! */
    box-shadow: 0 2px 4px rgba(0,0,0,0.1); 
}
.sidebar-item h4 { margin: 0; font-size: 0.95rem; line-height: 1.4; color: #1e293b; font-weight: 700; transition: color 0.2s; }
.sidebar-item:hover h4 { color: #0d47a1; }

/* --- Index Cards --- */
.blog-card { border: 1px solid #e2e8f0; border-radius: 16px; overflow: hidden; background: #fff; transition: all 0.3s ease; height: 100%; display: flex; flex-direction: column; text-decoration: none; color: inherit; box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05); }
.blog-card:hover { transform: translateY(-8px); box-shadow: 0 20px 25px -5px rgba(0,0,0,0.1); border-color: #bfdbfe; }
.card-img-box { height: 220px; background: #f3f4f6; position: relative; overflow: hidden; }
.card-img-box img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.5s ease; }
.blog-card:hover .card-img-box img { transform: scale(1.05); }
/* .category-badge { position: absolute; top: 15px; left: 15px; background: rgba(13, 71, 161, 0.95); color: #fff; padding: 6px 12px; border-radius: 6px; font-size: 0.75rem; font-weight: 700; z-index: 5; text-transform: uppercase; letter-spacing: 0.5px; box-shadow: 0 2px 4px rgba(0,0,0,0.2); } */
.tag-pill { display: inline-block; background: #f1f5f9; color: #475569; padding: 6px 14px; border-radius: 50px; font-size: 0.85rem; font-weight: 600; margin-right: 8px; margin-bottom: 8px; border: 1px solid #cbd5e1; transition: all 0.2s ease; }
.tag-pill:hover { background: #e2e8f0; color: #0f172a; }

/* --- Detail Page Header & Banner --- */
.detail-header { text-align: left; margin-bottom: 30px; }
.detail-meta { font-size: 0.95rem; color: #64748b; margin-bottom: 15px; font-weight: 500; }
.detail-banner { width: 100%; max-height: 480px; object-fit: cover; border-radius: 16px; margin-bottom: 40px; box-shadow: 0 10px 25px -5px rgba(0,0,0,0.1); }

/* --- Top Author Box (Brief) --- */
.top-author-box { display: flex; align-items: center; gap: 15px; padding: 20px 0; border-top: 1px solid #e2e8f0; border-bottom: 1px solid #e2e8f0; margin: 30px 0; }
.top-author-photo { width: 65px; height: 65px; border-radius: 50%; object-fit: cover; border: 2px solid #e0f2fe; box-shadow: 0 2px 4px rgba(0,0,0,0.05); }
.top-author-info h4 { margin: 0; font-size: 1.15rem; color: #0f172a; font-weight: 700; }
.top-author-info p { margin: 4px 0 0; color: #64748b; font-size: 0.95rem; }

/* --- Bottom Author Box (Detailed) --- */
.author-box { display: flex; gap: 25px; align-items: flex-start; background: #ffffff; padding: 35px; border-radius: 16px; margin-top: 60px; border: 1px solid #e2e8f0; box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05); }
.author-photo { width: 100px; height: 100px; border-radius: 50%; object-fit: cover; border: 3px solid #0d47a1; box-shadow: 0 4px 6px rgba(0,0,0,0.1); }

/* --- Table of Contents --- */
.toc-container { background: #eff6ff; padding: 25px; border-radius: 12px; margin-bottom: 40px; border-left: 5px solid #1d4ed8; box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05); }
.toc-container h3 { margin-top: 0; font-size: 1.3rem; color: #1e3a8a; margin-bottom: 15px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.5px; }
.toc-list { list-style: none; padding: 0; margin: 0; }
.toc-list li { margin-bottom: 12px; }
.toc-list a { color: #334155; text-decoration: none; font-size: 1rem; font-weight: 500; transition: all 0.2s; display: inline-block; }
.toc-list a:hover { color: #1d4ed8; transform: translateX(5px); font-weight: 700; }
.toc-list .toc-h3 { padding-left: 25px; font-size: 0.95rem; color: #64748b; }
/* ==========================================================================
   Responsive Media Queries
   ========================================================================== */

/* --- Tablets & Smaller Laptops (Max Width: 1024px) --- */
@media (max-width: 1024px) {
    /* Adjust Main Layout */
    .blog-flex-layout {
        gap: 30px;
    }
    
    .blog-sidebar-right {
        min-width: 280px; /* Slightly narrower sidebar */
        padding: 20px;
    }
    
    .sidebar-item img {
        width: 8rem; /* Smaller images in sidebar */
        height: 6rem;
    }
    
    /* Hero Section */
    .blog-hero h1 {
        font-size: 2.4rem;
    }
}

/* --- Large Tablets & Small Desktops (Max Width: 868px) --- */
@media (max-width: 868px) {
    /* Collapse the 2-column layout into 1 column */
    .blog-flex-layout {
        flex-direction: column;
    }

    .blog-content-left {
        flex: none;
        width: 100%;
    }

    .blog-sidebar-right {
        flex: none;
        position: relative; /* Remove sticky behavior on mobile */
        top: 0;
        margin-top: 40px;
        border-radius: 12px;
    }

    /* Make sidebar items flow horizontally if possible, or stack neatly */
    .sidebar-item {
        background: #fff;
        border: 1px solid #e2e8f0;
        padding: 15px;
    }
    
    .detail-banner {
        max-height: 400px;
    }
}

/* --- Mobile Devices (Max Width: 600px) --- */
@media (max-width: 600px) {
    /* Hero Section */
    .blog-hero {
        padding: 50px 15px;
    }
    
    .blog-hero h1 {
        font-size: 1.8rem;
    }
    
    .blog-hero p {
        font-size: 1rem;
    }

    /* Container padding */
    .blog-main-container, .container {
        padding: 40px 15px;
    }

    /* Typography */
    .section-title {
        font-size: 1.6rem;
    }
    
    .detail-header h1 {
        font-size: 2rem !important; /* Force override inline styles if necessary */
    }
    
    .detail-header p {
        font-size: 1.1rem !important;
    }

    /* Blog Grid (Index Page) */
    .blog-grid {
        grid-template-columns: 1fr; /* Force single column on mobile */
        gap: 20px;
    }
    
    .card-img-box {
        height: 180px;
    }

    /* Filter Buttons */
    .filter-group {
        gap: 10px;
    }
    
    .filter-btn {
        padding: 8px 15px;
        font-size: 0.8rem;
        flex: 1 1 auto; /* Allow buttons to grow and fill space */
        text-align: center;
    }

    /* Detail Page Author Boxes */
    .author-box {
        flex-direction: column; /* Stack photo above text */
        align-items: center;
        text-align: center;
        padding: 20px;
    }
    
    .author-photo {
        margin-bottom: 15px;
    }

    .top-author-box {
        flex-direction: column;
        align-items: flex-start; /* Or center, depending on preference */
        padding: 15px 0;
    }
    
    .top-author-info p {
        font-size: 0.85rem;
    }

    /* Table of Contents */
    .toc-container {
        padding: 15px;
    }
    
    .toc-container h3 {
        font-size: 1.1rem;
    }

    /* Sidebar Items */
    .sidebar-item img {
        width: 100px; /* Fixed size for mobile sidebar */
        height: 75px;
    }
    
    .sidebar-item h4 {
        font-size: 0.9rem;
    }

    /* CTA Section */
    .cta-section {
        padding: 30px 15px;
        margin-top: 50px;
    }
    
    .cta-section h2 {
        font-size: 1.6rem;
    }
    
    .cta-btn {
        padding: 12px 25px;
        font-size: 1rem;
        width: 100%; /* Full width button on mobile */
        box-sizing: border-box;
    }
}

/* --- Very Small Devices (Max Width: 380px) --- */
@media (max-width: 380px) {
    .sidebar-item {
        flex-direction: column; /* Stack sidebar image and text */
        text-align: center;
    }
    
    .sidebar-item img {
        width: 100%;
        height: 140px;
        margin-bottom: 10px;
    }
    
    .tag-pill {
        font-size: 0.75rem;
        padding: 4px 10px;
    }
}