/* ============================================
   Blog Styles
   ============================================ */

.blog {
    background: var(--bg);
}

.blog-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
    margin-bottom: 40px;
}

.blog-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.blog-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-xl);
}

.blog-card-image {
    position: relative;
    height: 200px;
    overflow: hidden;
    background: var(--bg-light);
}

.blog-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition);
}

.blog-card:hover .blog-card-image img {
    transform: scale(1.05);
}

.blog-card-category {
    position: absolute;
    top: 16px;
    left: 16px;
    padding: 6px 14px;
    background: var(--gold);
    color: var(--primary);
    font-size: 0.8rem;
    font-weight: 600;
    border-radius: 20px;
}

.blog-card-content {
    padding: 24px;
}

.blog-card-meta {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 12px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.blog-card-title {
    font-size: 1.15rem;
    margin-bottom: 12px;
    line-height: 1.4;
}

.blog-card-title a {
    color: var(--primary);
}

.blog-card-title a:hover {
    color: var(--gold-dark);
}

.blog-card-excerpt {
    color: var(--text-light);
    font-size: 0.9rem;
    line-height: 1.7;
    margin-bottom: 16px;
}

.blog-card-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--gold-dark);
    font-weight: 600;
    font-size: 0.9rem;
}

.blog-card-link:hover {
    color: var(--gold);
    gap: 10px;
}

.blog-more {
    text-align: center;
    margin-top: 20px;
}

.loading-posts {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    color: var(--text-light);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--gold);
    border-radius: 50%;
    margin: 0 auto 16px;
    animation: spin 0.8s linear infinite;
}

/* Single Post */
.post-header {
    padding: 80px 0 60px;
    background: var(--bg-dark);
    color: var(--white);
    margin-top: 80px;
}

.post-header .container {
    max-width: 800px;
}

.post-category {
    display: inline-block;
    padding: 6px 16px;
    background: var(--gold);
    color: var(--primary);
    font-size: 0.85rem;
    font-weight: 600;
    border-radius: 20px;
    margin-bottom: 20px;
}

.post-title {
    font-size: 2.2rem;
    color: var(--white);
    margin-bottom: 20px;
    line-height: 1.3;
}

.post-meta {
    display: flex;
    align-items: center;
    gap: 24px;
    color: rgba(255,255,255,0.7);
    font-size: 0.95rem;
}

.post-content {
    max-width: 800px;
    margin: 0 auto;
    padding: 60px 20px;
}

.post-content img {
    max-width: 100%;
    width: auto !important;
    height: auto !important;
    border-radius: 12px;
    margin: 30px 0;
    display: block;
}

/* Article images with fixed width attribute */
.post-content img.article-image,
.post-content figure img {
    max-width: 100%;
    width: 100% !important;
    height: auto !important;
    object-fit: cover;
    border-radius: 12px;
}

.post-content h2, .post-content h3 {
    margin: 40px 0 20px;
}

.post-content p {
    margin-bottom: 20px;
    line-height: 1.9;
}

.post-content ul, .post-content ol {
    margin: 20px 0;
    padding-left: 30px;
}

.post-content li {
    margin-bottom: 10px;
    list-style: disc;
}

/* Blog Layout with Sidebar */
.blog-layout {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 40px;
    align-items: start;
}

.blog-main {
    min-width: 0;
}

/* Blog Grid - 2 columns in main area */
.blog-layout .blog-grid {
    grid-template-columns: repeat(2, 1fr);
}

/* Sidebar */
.blog-sidebar {
    position: sticky;
    top: 100px;
}

.sidebar-widget {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow);
}

.sidebar-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.1rem;
    color: var(--primary);
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--gold);
}

.sidebar-title svg {
    width: 20px;
    height: 20px;
    color: var(--gold);
}

.article-list {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 500px;
    overflow-y: auto;
}

.article-list li {
    margin-bottom: 0;
    border-bottom: 1px solid var(--border);
}

.article-list li:last-child {
    border-bottom: none;
}

.article-list a {
    display: flex;
    gap: 8px;
    padding: 12px 8px;
    color: var(--text);
    font-size: 0.9rem;
    line-height: 1.4;
    transition: var(--transition);
}

.article-list a:hover {
    background: var(--bg);
    color: var(--gold-dark);
}

.article-num {
    color: var(--gold);
    font-weight: 600;
    flex-shrink: 0;
}

.article-title {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Pagination */
.pagination {
    margin-top: 40px;
    text-align: center;
}

.pagination-info {
    display: block;
    color: var(--text-light);
    font-size: 0.9rem;
    margin-bottom: 16px;
}

.pagination-buttons {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.pagination-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--transition);
}

.pagination-btn:hover {
    background: var(--bg);
    border-color: var(--gold);
    color: var(--gold-dark);
}

.pagination-btn.active {
    background: var(--gold);
    border-color: var(--gold);
    color: var(--primary);
    font-weight: 600;
}

.pagination-dots {
    color: var(--text-light);
    padding: 0 8px;
}

/* Responsive */
@media (max-width: 1024px) {
    .blog-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .blog-layout {
        grid-template-columns: 1fr;
    }
    
    .blog-sidebar {
        position: static;
        order: -1;
    }
    
    .article-list {
        max-height: 200px;
    }
}

@media (max-width: 768px) {
    .blog-grid {
        grid-template-columns: 1fr;
    }
    
    .blog-layout .blog-grid {
        grid-template-columns: 1fr;
    }
    
    .post-title {
        font-size: 1.8rem;
    }
    
    .post-content {
        padding: 40px 16px;
    }
    
    /* Ensure images display properly on mobile */
    .post-content img,
    .post-content img.article-image,
    .post-content figure img {
        max-width: 100% !important;
        width: 100% !important;
        height: auto !important;
        margin: 20px 0;
    }
    
    .post-content figure {
        margin: 20px 0;
        width: 100%;
    }
    
    .pagination-btn {
        padding: 8px 12px;
        font-size: 0.85rem;
    }
    
    .blog-filters {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .filter-btn {
        font-size: 0.8rem;
        padding: 6px 12px;
    }
}

/* ============================================
   Table of Contents (TOC) - Article Styles
   ============================================ */
   
.article-toc,
.toc {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border: 1px solid #e2e8f0;
    border-left: 4px solid var(--gold);
    border-radius: 12px;
    padding: 20px 24px;
    margin: 24px 0 32px 0;
}

.article-toc h4,
.toc h4 {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.1rem;
    color: var(--primary);
    margin: 0 0 16px 0;
    padding-bottom: 12px;
    border-bottom: 1px solid #e2e8f0;
}

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

.article-toc li,
.toc li {
    padding: 8px 0;
    border-bottom: 1px dotted #e2e8f0;
}

.article-toc li:last-child,
.toc li:last-child {
    border-bottom: none;
}

.article-toc a,
.toc a {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text);
    text-decoration: none;
    transition: all 0.2s;
    font-size: 0.95rem;
}

.article-toc a::before,
.toc a::before {
    content: "→";
    color: var(--gold);
    font-weight: bold;
}

.article-toc a:hover,
.toc a:hover {
    color: var(--gold-dark);
    padding-left: 8px;
}

/* Article Content Styling */
.post-content h2 {
    scroll-margin-top: 100px;
    color: var(--primary);
    font-size: 1.5rem;
    margin: 32px 0 16px 0;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--gold);
}

.post-content h3 {
    scroll-margin-top: 100px;
    color: var(--text);
    font-size: 1.2rem;
    margin: 24px 0 12px 0;
}

.post-content ul,
.post-content ol {
    margin: 16px 0;
    padding-left: 24px;
}

.post-content li {
    margin-bottom: 8px;
    line-height: 1.7;
}

/* CTA Box in Article */
.cta-box,
.article-cta {
    background: linear-gradient(135deg, var(--primary) 0%, #1e3a5f 100%);
    color: white;
    padding: 32px;
    border-radius: 16px;
    margin: 32px 0;
    text-align: center;
}

.cta-box h3,
.article-cta h3 {
    color: var(--gold);
    margin-bottom: 12px;
}

.cta-box a,
.article-cta a,
.content-section .cta-box a,
.content-section .article-cta a,
.cta-box ul li a,
.cta-box li a,
.content-section .cta-box ul li a,
.content-section .cta-box li a {
    display: inline-block;
    background: var(--gold) !important;
    color: #0f172a !important;
    padding: 12px 24px;
    border-radius: 8px;
    text-decoration: none !important;
    font-weight: 600;
    margin: 8px;
    transition: all 0.2s;
}

.cta-box a:hover,
.article-cta a:hover,
.content-section .cta-box a:hover {
    background: var(--gold-light);
    transform: translateY(-2px);
}

/* CTA box text colors */
.cta-box,
.content-section .cta-box {
    background: linear-gradient(135deg, #1e3a5f 0%, #0f172a 100%) !important;
    color: white !important;
}

.cta-box h3,
.content-section .cta-box h3 {
    color: var(--gold) !important;
}

.cta-box p,
.cta-box li,
.content-section .cta-box p,
.content-section .cta-box li {
    color: white !important;
}

.blog-post-page .content-section div[style*="background-color:#f0f0f0"],
.blog-post-page .content-section div[style*="background-color: #f0f0f0"],
.blog-post-page .content-section div[style*="background-color:#f2f2f2"],
.blog-post-page .content-section div[style*="background-color: #f2f2f2"],
.blog-post-page .content-section div[style*="background-color:#f0f8ff"],
.blog-post-page .content-section div[style*="background-color: #f0f8ff"],
.blog-post-page .content-section div[style*="background-color:#fff"],
.blog-post-page .content-section div[style*="background-color: #fff"],
.blog-post-page .content-section div[style*="background-color:#ffffff"],
.blog-post-page .content-section div[style*="background-color: #ffffff"] {
    color: var(--text);
}

.blog-post-page .content-section div[style*="background-color:#f0f0f0"] *,
.blog-post-page .content-section div[style*="background-color: #f0f0f0"] *,
.blog-post-page .content-section div[style*="background-color:#f2f2f2"] *,
.blog-post-page .content-section div[style*="background-color: #f2f2f2"] *,
.blog-post-page .content-section div[style*="background-color:#f0f8ff"] *,
.blog-post-page .content-section div[style*="background-color: #f0f8ff"] *,
.blog-post-page .content-section div[style*="background-color:#fff"] *,
.blog-post-page .content-section div[style*="background-color: #fff"] *,
.blog-post-page .content-section div[style*="background-color:#ffffff"] *,
.blog-post-page .content-section div[style*="background-color: #ffffff"] * {
    color: inherit;
}

.blog-post-page .content-section div[style*="background-color:#f0f0f0"] a,
.blog-post-page .content-section div[style*="background-color: #f0f0f0"] a,
.blog-post-page .content-section div[style*="background-color:#f2f2f2"] a,
.blog-post-page .content-section div[style*="background-color: #f2f2f2"] a,
.blog-post-page .content-section div[style*="background-color:#f0f8ff"] a,
.blog-post-page .content-section div[style*="background-color: #f0f8ff"] a,
.blog-post-page .content-section div[style*="background-color:#fff"] a,
.blog-post-page .content-section div[style*="background-color: #fff"] a,
.blog-post-page .content-section div[style*="background-color:#ffffff"] a,
.blog-post-page .content-section div[style*="background-color: #ffffff"] a {
    color: var(--primary);
    text-decoration: underline;
}

.blog-post-page .content-section div[style*="background-color:#f0f0f0"] strong,
.blog-post-page .content-section div[style*="background-color: #f0f0f0"] strong,
.blog-post-page .content-section div[style*="background-color:#f2f2f2"] strong,
.blog-post-page .content-section div[style*="background-color: #f2f2f2"] strong,
.blog-post-page .content-section div[style*="background-color:#f0f8ff"] strong,
.blog-post-page .content-section div[style*="background-color: #f0f8ff"] strong,
.blog-post-page .content-section div[style*="background-color:#fff"] strong,
.blog-post-page .content-section div[style*="background-color: #fff"] strong,
.blog-post-page .content-section div[style*="background-color:#ffffff"] strong,
.blog-post-page .content-section div[style*="background-color: #ffffff"] strong {
    color: var(--primary);
}

/* Fix text colors for highlights and bold text in articles */
.post-content strong,
.post-content b {
    color: var(--primary);
    font-weight: 700;
}

.post-content mark,
.post-content span[style*="background"],
.post-content span[style*="highlight"] {
    background: linear-gradient(135deg, rgba(212, 168, 83, 0.3) 0%, rgba(212, 168, 83, 0.15) 100%) !important;
    color: var(--primary) !important;
    padding: 2px 6px;
    border-radius: 4px;
}

.post-content em,
.post-content i:not([data-lucide]) {
    color: var(--text);
    font-style: italic;
}

/* Fix inline styles that may have light colors */
.post-content span[style*="color:#f"],
.post-content span[style*="color: #f"],
.post-content span[style*="color:#e"],
.post-content span[style*="color: #e"],
.post-content span[style*="color:#d"],
.post-content span[style*="color: #d"],
.post-content span[style*="color:#c"],
.post-content span[style*="color: #c"],
.post-content span[style*="color:white"],
.post-content span[style*="color: white"],
.post-content span[style*="color:#fff"],
.post-content span[style*="color: #fff"] {
    color: var(--primary) !important;
}

/* Fix bold/strong with light colors */
.post-content strong[style*="color:#f"],
.post-content strong[style*="color: #f"],
.post-content strong[style*="color:#e"],
.post-content strong[style*="color: #e"],
.post-content strong[style*="color:#d"],
.post-content strong[style*="color: #d"],
.post-content strong[style*="color:#c"],
.post-content strong[style*="color: #c"],
.post-content b[style*="color:#f"],
.post-content b[style*="color: #f"],
.post-content b[style*="color:#e"],
.post-content b[style*="color: #e"] {
    color: var(--primary) !important;
}

/* Ensure headings in content are visible */
.post-content h2[style*="color"],
.post-content h3[style*="color"],
.post-content h4[style*="color"] {
    color: var(--primary) !important;
}

/* Fix links in article content */
.post-content a {
    color: var(--gold-dark);
    text-decoration: underline;
}

.post-content a:hover {
    color: var(--gold);
}
