<?php 
require_once 'config.php';
require_once 'admin/blog-functions.php';

// Get the blog ID from URL parameter
$blog_id = isset($_GET['id']) ? (int)$_GET['id'] : 0;

if ($blog_id <= 0) {
    header("Location: blogs.php");
    exit;
}

// Get blog from database
$blog = getBlogById($link, $blog_id);

if (!$blog) {
    header("Location: blogs.php");
    exit;
}

// Update view count using the incrementViews function
incrementViews($link, $blog_id);

// Refresh blog data to get updated view count
$blog = getBlogById($link, $blog_id);

// SEO Meta Variables
$page_title = htmlspecialchars($blog['meta_title'] ?: $blog['title'] . " - Expert Satta Matka Tips | Shubank");
$page_description = htmlspecialchars($blog['meta_description'] ?: substr(strip_tags($blog['content']), 0, 160) . "...");
$page_keywords = "satta matka, " . strtolower($blog['category']) . ", " . htmlspecialchars($blog['tags']) . ", matka tips, satta king, disawar, delhi bazaar";
$canonical_url = "https://shubank.co/blog-details.php?id=" . $blog['id'];
$published_date = date('c', strtotime($blog['created_at']));
$modified_date = date('c', strtotime($blog['updated_at'] ?: $blog['created_at']));

// Get related blogs
$related_blogs = getRelatedBlogs($link, $blog_id, $blog['category']);

// Calculate reading time
function calculateReadTime($content) {
    $word_count = str_word_count(strip_tags($content));
    $minutes = ceil($word_count / 200);
    return max(1, $minutes);
}

$reading_time = calculateReadTime($blog['content']);

// Format publish date
$formatted_date = date('F j, Y', strtotime($blog['created_at']));
?>
<!DOCTYPE html>
<html lang="en-IN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    
    <!-- Primary SEO Meta Tags -->
    <title><?php echo $page_title; ?></title>
    <meta name="description" content="<?php echo $page_description; ?>">
    <meta name="keywords" content="<?php echo $page_keywords; ?>">
    <link rel="canonical" href="<?php echo $canonical_url; ?>">
    
    <!-- Open Graph Meta Tags -->
    <meta property="og:title" content="<?php echo $page_title; ?>">
    <meta property="og:description" content="<?php echo $page_description; ?>">
    <meta property="og:type" content="article">
    <meta property="og:url" content="<?php echo $canonical_url; ?>">
    <?php if (!empty($blog['featured_image'])): ?>
    <meta property="og:image" content="https://shubank.co/uploads/blog/<?php echo htmlspecialchars($blog['featured_image']); ?>">
    <?php else: ?>
    <meta property="og:image" content="https://shubank.co/images/shubank-blog-default.jpg">
    <?php endif; ?>
    <meta property="og:image:width" content="1200">
    <meta property="og:image:height" content="630">
    <meta property="og:site_name" content="Shubank">
    <meta property="og:locale" content="en_IN">
    <meta property="article:published_time" content="<?php echo $published_date; ?>">
    <meta property="article:modified_time" content="<?php echo $modified_date; ?>">
    <meta property="article:author" content="<?php echo htmlspecialchars($blog['author']); ?>">
    <meta property="article:section" content="<?php echo htmlspecialchars($blog['category']); ?>">
    <?php if (!empty($blog['tags'])): ?>
        <?php $tags = explode(',', $blog['tags']); ?>
        <?php foreach($tags as $tag): ?>
        <meta property="article:tag" content="<?php echo htmlspecialchars(trim($tag)); ?>">
        <?php endforeach; ?>
    <?php endif; ?>
    
    <!-- Twitter Card Meta Tags -->
    <meta name="twitter:card" content="summary_large_image">
    <meta name="twitter:title" content="<?php echo $page_title; ?>">
    <meta name="twitter:description" content="<?php echo $page_description; ?>">
    <?php if (!empty($blog['featured_image'])): ?>
    <meta name="twitter:image" content="https://shubank.co/uploads/blog/<?php echo htmlspecialchars($blog['featured_image']); ?>">
    <?php else: ?>
    <meta name="twitter:image" content="https://shubank.co/images/shubank-blog-default.jpg">
    <?php endif; ?>
    <meta name="twitter:site" content="@shubank">
    <meta name="twitter:creator" content="@shubank">
    
    <!-- Additional SEO Meta Tags -->
    <meta name="robots" content="index, follow, max-snippet:-1, max-image-preview:large">
    <meta name="author" content="<?php echo htmlspecialchars($blog['author']); ?>">
    <meta name="geo.region" content="IN">
    <meta name="geo.country" content="India">
    <meta name="revisit-after" content="7 days">
    
    <!-- JSON-LD Structured Data -->
    <script type="application/ld+json">
    {
        "@context": "https://schema.org",
        "@type": "BlogPosting",
        "headline": "<?php echo htmlspecialchars($blog['title']); ?>",
        "description": "<?php echo $page_description; ?>",
        "image": {
            "@type": "ImageObject",
            "url": "<?php echo !empty($blog['featured_image']) ? 'https://shubank.co/uploads/blog/' . htmlspecialchars($blog['featured_image']) : 'https://shubank.co/images/shubank-blog-default.jpg'; ?>",
            "width": 1200,
            "height": 630
        },
        "author": {
            "@type": "Person",
            "name": "<?php echo htmlspecialchars($blog['author']); ?>",
            "url": "https://shubank.co/about.php"
        },
        "publisher": {
            "@type": "Organization",
            "name": "Shubank",
            "logo": {
                "@type": "ImageObject",
                "url": "https://shubank.co/images/shubank-logo.png",
                "width": 200,
                "height": 60
            }
        },
        "datePublished": "<?php echo $published_date; ?>",
        "dateModified": "<?php echo $modified_date; ?>",
        "mainEntityOfPage": {
            "@type": "WebPage",
            "@id": "<?php echo $canonical_url; ?>"
        },
        "articleSection": "<?php echo htmlspecialchars($blog['category']); ?>",
        "keywords": "<?php echo $page_keywords; ?>",
        "wordCount": <?php echo str_word_count(strip_tags($blog['content'])); ?>,
        "timeRequired": "PT<?php echo $reading_time; ?>M",
        "inLanguage": "en-IN",
        "isPartOf": {
            "@type": "Blog",
            "name": "Shubank Matka Blog",
            "url": "https://shubank.co/blogs.php"
        }
    }
    </script>
    
    <script type="application/ld+json">
    {
        "@context": "https://schema.org",
        "@type": "WebPage",
        "name": "<?php echo htmlspecialchars($blog['title']); ?>",
        "description": "<?php echo $page_description; ?>",
        "url": "<?php echo $canonical_url; ?>",
        "inLanguage": "en-IN",
        "isPartOf": {
            "@type": "WebSite",
            "name": "Shubank",
            "url": "https://shubank.co/"
        },
        "breadcrumb": {
            "@type": "BreadcrumbList",
            "itemListElement": [
                {
                    "@type": "ListItem",
                    "position": 1,
                    "name": "Home",
                    "item": "https://shubank.co/"
                },
                {
                    "@type": "ListItem",
                    "position": 2,
                    "name": "Blog",
                    "item": "https://shubank.co/blogs.php"
                },
                {
                    "@type": "ListItem",
                    "position": 3,
                    "name": "<?php echo htmlspecialchars($blog['title']); ?>",
                    "item": "<?php echo $canonical_url; ?>"
                }
            ]
        }
    }
    </script>
    
    <link rel="stylesheet" href="style.css">
</head>
<body>

<?php include 'header.php'; ?>

<!-- Breadcrumb Navigation -->
<nav class="breadcrumb-nav" aria-label="Breadcrumb">
    <div class="container">
        <ol class="breadcrumb">
            <li><a href="index.php">Home</a></li>
            <li><a href="blogs.php">Blog</a></li>
            <li aria-current="page"><?php echo htmlspecialchars($blog['title']); ?></li>
        </ol>
    </div>
</nav>

<!-- Blog Article -->
<article class="blog-article">
    <div class="blog-container">
        <!-- Article Header -->
        <header class="article-header">
            <div class="article-meta-top">
                <div class="article-category">
                    📊 <?php echo htmlspecialchars($blog['category']); ?>
                </div>
                <div class="article-reading-time">
                    ⏱️ <?php echo $reading_time; ?> min read
                </div>
            </div>
            
            <h1 class="article-title"><?php echo htmlspecialchars($blog['title']); ?></h1>
            
            <div class="article-excerpt">
                <p><?php echo htmlspecialchars($blog['excerpt']); ?></p>
            </div>
            
            <div class="article-meta">
                <div class="article-author">
                    <div class="author-avatar">
                        <span><?php echo strtoupper(substr($blog['author'], 0, 1)); ?></span>
                    </div>
                    <div class="author-info">
                        <div class="author-name">By <?php echo htmlspecialchars($blog['author']); ?></div>
                        <div class="publish-date">📅 Published on <?php echo $formatted_date; ?></div>
                    </div>
                </div>
                
                <div class="article-stats">
                    <span class="views-count">👁️ <?php echo number_format($blog['views']); ?> views</span>
                    <span class="likes-count">❤️ <?php echo number_format($blog['likes']); ?> likes</span>
                </div>
            </div>
        </header>
        
        <!-- Featured Image -->
        <?php if (!empty($blog['featured_image'])): ?>
        <div class="article-featured-image">
            <img src="uploads/blog/<?php echo htmlspecialchars($blog['featured_image']); ?>" 
                 alt="<?php echo htmlspecialchars($blog['title']); ?>"
                 loading="lazy">
        </div>
        <?php endif; ?>
        
        <!-- Article Content -->
        <div class="article-content">
            <?php echo $blog['content']; ?>
        </div>
        
        <!-- Article Tags -->
        <?php if (!empty($blog['tags'])): ?>
        <div class="article-tags">
            <h3>🏷️ Tags</h3>
            <div class="tags-list">
                <?php 
                $tags = explode(',', $blog['tags']);
                foreach($tags as $tag): 
                    $tag = trim($tag);
                    if (!empty($tag)):
                ?>
                <span class="tag"><?php echo htmlspecialchars($tag); ?></span>
                <?php 
                    endif;
                endforeach; 
                ?>
            </div>
        </div>
        <?php endif; ?>
        
        <!-- Social Share -->
        <div class="article-share">
            <h3>📢 Share This Article</h3>
            <div class="share-buttons">
                <a href="https://wa.me/?text=<?php echo urlencode($blog['title'] . ' - ' . $canonical_url); ?>" 
                   target="_blank" 
                   class="share-btn whatsapp"
                   aria-label="Share on WhatsApp">
                    📱 WhatsApp
                </a>
                <a href="https://t.me/share/url?url=<?php echo urlencode($canonical_url); ?>&text=<?php echo urlencode($blog['title']); ?>" 
                   target="_blank" 
                   class="share-btn telegram"
                   aria-label="Share on Telegram">
                    ✈️ Telegram
                </a>
                <a href="https://twitter.com/intent/tweet?url=<?php echo urlencode($canonical_url); ?>&text=<?php echo urlencode($blog['title']); ?>" 
                   target="_blank" 
                   class="share-btn twitter"
                   aria-label="Share on Twitter">
                    🐦 Twitter
                </a>
                <button onclick="copyToClipboard('<?php echo $canonical_url; ?>')" 
                        class="share-btn copy"
                        aria-label="Copy Link">
                    🔗 Copy Link
                </button>
            </div>
        </div>
        
        <!-- Author Bio -->
        <div class="author-bio">
            <div class="author-avatar-large">
                <span><?php echo strtoupper(substr($blog['author'], 0, 2)); ?></span>
            </div>
            <div class="author-details">
                <h3>About <?php echo htmlspecialchars($blog['author']); ?></h3>
                <p><?php echo htmlspecialchars($blog['author']); ?> is an expert satta matka analyst and writer at Shubank, specializing in market trends, strategy development, and providing actionable insights for serious matka players.</p>
                <div class="author-expertise">
                    <span class="expertise-tag">Matka Expert</span>
                    <span class="expertise-tag">Market Analyst</span>
                    <span class="expertise-tag">Strategy Developer</span>
                </div>
            </div>
        </div>
    </div>
</article>

<!-- Related Articles -->
<?php if (!empty($related_blogs)): ?>
<section class="related-articles">
    <div class="container">
        <h2>📖 Related Matka Strategy Articles</h2>
        <div class="related-grid">
            <?php foreach(array_slice($related_blogs, 0, 3) as $related): ?>
            <article class="related-card">
                <div class="related-image">
                    <div class="related-category">
                        📊 <?php echo htmlspecialchars($related['category']); ?>
                    </div>
                    <div class="related-icon">📄</div>
                </div>
                <div class="related-content">
                    <h3>
                        <a href="blog-details.php?id=<?php echo $related['id']; ?>">
                            <?php echo htmlspecialchars($related['title']); ?>
                        </a>
                    </h3>
                    <p><?php echo htmlspecialchars(substr(strip_tags($related['content']), 0, 100)) . '...'; ?></p>
                    <div class="related-meta">
                        <span>📅 <?php echo date('M d, Y', strtotime($related['created_at'])); ?></span>
                        <span>⏱️ <?php echo ceil(str_word_count(strip_tags($related['content'])) / 200); ?> min read</span>
                    </div>
                </div>
            </article>
            <?php endforeach; ?>
        </div>
        <div class="view-all-articles">
            <a href="blogs.php" class="view-all-btn">📚 View All Articles</a>
        </div>
    </div>
</section>
<?php endif; ?>

<!-- Blog CTA Section -->
<section class="blog-cta-section">
    <div class="container">
        <div class="blog-cta-content">
            <h2>🎯 Ready to Apply These Matka Strategies?</h2>
            <p>Join thousands of successful players who use Shubank for <strong>professional satta matka gaming</strong> with <strong>highest rates</strong> and <strong>instant withdrawals</strong>.</p>
            <div class="cta-buttons">
                <a href="login.php" class="cta-btn primary">🚀 Start Playing Now</a>
                <a href="blogs.php" class="cta-btn secondary">📖 Read More Tips</a>
            </div>
            <div class="cta-features">
                <span>✅ Highest Market Rates</span>
                <span>✅ Same Day Withdrawal</span>
                <span>✅ 24/7 Support</span>
            </div>
        </div>
    </div>
</section>

<style>
    /* Blog Details Page Styles */
    
    /* Breadcrumb Navigation */
    .breadcrumb-nav {
        background: rgba(0, 92, 151, 0.05);
        padding: 1rem 0;
        border-bottom: 1px solid rgba(0, 92, 151, 0.1);
    }
    
    .breadcrumb {
        list-style: none;
        display: flex;
        align-items: center;
        gap: 0.5rem;
        margin: 0;
        padding: 0;
        font-size: 0.9rem;
    }
    
    .breadcrumb li {
        color: #6c757d;
        max-width: 200px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    
    .breadcrumb li:not(:last-child)::after {
        content: "›";
        margin-left: 0.5rem;
        color: #adb5bd;
    }
    
    .breadcrumb a {
        color: #005c97;
        text-decoration: none;
        transition: color 0.3s ease;
    }
    
    .breadcrumb a:hover {
        color: #17a2b8;
    }
    
    /* Blog Article */
    .blog-article {
        padding: 3rem 0;
        background: white;
    }
    
    .blog-container {
        max-width: 800px;
        margin: 0 auto;
        padding: 0 20px;
    }
    
    /* Article Header */
    .article-header {
        margin-bottom: 3rem;
        text-align: center;
    }
    
    .article-meta-top {
        display: flex;
        justify-content: center;
        gap: 2rem;
        margin-bottom: 1.5rem;
        flex-wrap: wrap;
    }
    
    .article-category {
        background: linear-gradient(135deg, #667eea, #764ba2);
        color: white;
        padding: 0.5rem 1rem;
        border-radius: 1.5rem;
        font-size: 0.85rem;
        font-weight: 600;
    }
    
    .article-reading-time {
        background: rgba(108, 117, 125, 0.1);
        color: #6c757d;
        padding: 0.5rem 1rem;
        border-radius: 1.5rem;
        font-size: 0.85rem;
        font-weight: 600;
    }
    
    .article-title {
        font-size: clamp(2rem, 4vw, 3rem);
        font-weight: 800;
        color: #2c3e50;
        margin-bottom: 1.5rem;
        line-height: 1.2;
    }
    
    .article-excerpt {
        margin-bottom: 2rem;
    }
    
    .article-excerpt p {
        font-size: 1.2rem;
        color: #6c757d;
        line-height: 1.6;
        font-style: italic;
    }
    
    .article-meta {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 1.5rem;
        background: #f8f9fa;
        border-radius: 1rem;
        flex-wrap: wrap;
        gap: 1rem;
    }
    
    .article-author {
        display: flex;
        align-items: center;
        gap: 1rem;
    }
    
    .author-avatar {
        width: 50px;
        height: 50px;
        background: linear-gradient(135deg, #667eea, #764ba2);
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        color: white;
        font-weight: 700;
        font-size: 1.2rem;
    }
    
    .author-info {
        display: flex;
        flex-direction: column;
        gap: 0.25rem;
    }
    
    .author-name {
        font-weight: 600;
        color: #2c3e50;
        font-size: 1rem;
    }
    
    .publish-date {
        color: #6c757d;
        font-size: 0.9rem;
    }
    
    .article-stats {
        display: flex;
        gap: 1rem;
        font-size: 0.9rem;
        color: #6c757d;
        flex-wrap: wrap;
    }
    
    /* Featured Image */
    .article-featured-image {
        margin-bottom: 3rem;
        border-radius: 1rem;
        overflow: hidden;
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    }
    
    .article-featured-image img {
        width: 100%;
        height: auto;
        display: block;
    }
    
    /* Article Content */
    .article-content {
        margin-bottom: 3rem;
        line-height: 1.8;
        font-size: 1.1rem;
        color: #2c3e50;
    }
    
    .article-content h2 {
        font-size: 1.8rem;
        color: #2c3e50;
        margin: 2rem 0 1rem 0;
        font-weight: 700;
    }
    
    .article-content h3 {
        font-size: 1.5rem;
        color: #2c3e50;
        margin: 1.5rem 0 1rem 0;
        font-weight: 600;
    }
    
    .article-content p {
        margin-bottom: 1.5rem;
    }
    
    .article-content ul,
    .article-content ol {
        margin-bottom: 1.5rem;
        padding-left: 2rem;
    }
    
    .article-content li {
        margin-bottom: 0.5rem;
    }
    
    .article-content strong {
        color: #005c97;
        font-weight: 700;
    }
    
    .article-content blockquote {
        background: #f8f9fa;
        border-left: 4px solid #667eea;
        padding: 1rem 1.5rem;
        margin: 2rem 0;
        font-style: italic;
        border-radius: 0 0.5rem 0.5rem 0;
    }
    
    /* Article Tags */
    .article-tags {
        margin-bottom: 3rem;
        padding: 1.5rem;
        background: #f8f9fa;
        border-radius: 1rem;
    }
    
    .article-tags h3 {
        margin-bottom: 1rem;
        color: #2c3e50;
        font-size: 1.2rem;
        font-weight: 600;
    }
    
    .tags-list {
        display: flex;
        gap: 0.5rem;
        flex-wrap: wrap;
    }
    
    .tag {
        background: #667eea;
        color: white;
        padding: 0.25rem 0.75rem;
        border-radius: 1rem;
        font-size: 0.85rem;
        font-weight: 500;
    }
    
    /* Social Share */
    .article-share {
        margin-bottom: 3rem;
        padding: 1.5rem;
        background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
        border-radius: 1rem;
        text-align: center;
    }
    
    .article-share h3 {
        margin-bottom: 1rem;
        color: #2c3e50;
        font-size: 1.2rem;
        font-weight: 600;
    }
    
    .share-buttons {
        display: flex;
        gap: 1rem;
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .share-btn {
        display: inline-flex;
        align-items: center;
        gap: 0.5rem;
        padding: 0.75rem 1rem;
        border: none;
        border-radius: 0.5rem;
        text-decoration: none;
        font-weight: 600;
        font-size: 0.9rem;
        cursor: pointer;
        transition: all 0.3s ease;
    }
    
    .share-btn.whatsapp {
        background: #25d366;
        color: white;
    }
    
    .share-btn.telegram {
        background: #0088cc;
        color: white;
    }
    
    .share-btn.twitter {
        background: #1da1f2;
        color: white;
    }
    
    .share-btn.copy {
        background: #6c757d;
        color: white;
    }
    
    .share-btn:hover {
        transform: translateY(-2px);
        box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    }
    
    /* Author Bio */
    .author-bio {
        display: flex;
        gap: 1.5rem;
        padding: 2rem;
        background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
        border-radius: 1rem;
        margin-bottom: 3rem;
    }
    
    .author-avatar-large {
        width: 80px;
        height: 80px;
        background: linear-gradient(135deg, #667eea, #764ba2);
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        color: white;
        font-weight: 700;
        font-size: 1.5rem;
        flex-shrink: 0;
    }
    
    .author-details h3 {
        margin-bottom: 0.5rem;
        color: #2c3e50;
        font-size: 1.3rem;
        font-weight: 700;
    }
    
    .author-details p {
        color: #6c757d;
        line-height: 1.6;
        margin-bottom: 1rem;
    }
    
    .author-expertise {
        display: flex;
        gap: 0.5rem;
        flex-wrap: wrap;
    }
    
    .expertise-tag {
        background: #667eea;
        color: white;
        padding: 0.25rem 0.75rem;
        border-radius: 1rem;
        font-size: 0.8rem;
        font-weight: 500;
    }
    
    /* Related Articles */
    .related-articles {
        padding: 4rem 0;
        background: #f8f9fa;
    }
    
    .related-articles h2 {
        text-align: center;
        font-size: 2rem;
        color: #2c3e50;
        margin-bottom: 3rem;
        font-weight: 700;
    }
    
    .related-grid {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
        gap: 2rem;
        margin-bottom: 2rem;
    }
    
    .related-card {
        background: white;
        border-radius: 1rem;
        overflow: hidden;
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
        transition: all 0.3s ease;
    }
    
    .related-card:hover {
        transform: translateY(-5px);
        box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    }
    
    .related-image {
        width: 100%;
        height: 150px;
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        position: relative;
        display: flex;
        align-items: center;
        justify-content: center;
        color: white;
    }
    
    .related-category {
        position: absolute;
        top: 1rem;
        left: 1rem;
        background: rgba(255, 215, 0, 0.9);
        color: #2c3e50;
        padding: 0.25rem 0.75rem;
        border-radius: 1rem;
        font-size: 0.75rem;
        font-weight: 700;
    }
    
    .related-icon {
        font-size: 2.5rem;
    }
    
    .related-content {
        padding: 1.5rem;
    }
    
    .related-content h3 {
        margin-bottom: 1rem;
    }
    
    .related-content h3 a {
        color: #2c3e50;
        text-decoration: none;
        font-size: 1.1rem;
        font-weight: 600;
        line-height: 1.4;
    }
    
    .related-content h3 a:hover {
        color: #667eea;
    }
    
    .related-content p {
        color: #6c757d;
        line-height: 1.6;
        margin-bottom: 1rem;
        font-size: 0.95rem;
    }
    
    .related-meta {
        display: flex;
        gap: 1rem;
        font-size: 0.8rem;
        color: #6c757d;
        flex-wrap: wrap;
    }
    
    .view-all-articles {
        text-align: center;
    }
    
    .view-all-btn {
        display: inline-block;
        background: linear-gradient(135deg, #667eea, #764ba2);
        color: white;
        padding: 1rem 2rem;
        border-radius: 0.5rem;
        text-decoration: none;
        font-weight: 600;
        transition: all 0.3s ease;
    }
    
    .view-all-btn:hover {
        transform: translateY(-2px);
        box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
        color: white;
    }
    
    /* Blog CTA Section */
    .blog-cta-section {
        padding: 4rem 0;
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        color: white;
        text-align: center;
    }
    
    .blog-cta-content h2 {
        font-size: clamp(1.8rem, 4vw, 2.5rem);
        font-weight: 700;
        margin-bottom: 1rem;
    }
    
    .blog-cta-content p {
        font-size: 1.1rem;
        margin-bottom: 2rem;
        opacity: 0.95;
        max-width: 600px;
        margin-left: auto;
        margin-right: auto;
    }
    
    .cta-buttons {
        display: flex;
        gap: 1rem;
        justify-content: center;
        margin-bottom: 2rem;
        flex-wrap: wrap;
    }
    
    .cta-btn {
        display: inline-block;
        padding: 0.75rem 1.5rem;
        border-radius: 0.5rem;
        text-decoration: none;
        font-weight: 600;
        transition: all 0.3s ease;
    }
    
    .cta-btn.primary {
        background: #ffd700;
        color: #2c3e50;
    }
    
    .cta-btn.secondary {
        background: rgba(255, 255, 255, 0.2);
        color: white;
        border: 2px solid rgba(255, 255, 255, 0.3);
    }
    
    .cta-btn:hover {
        transform: translateY(-2px);
        box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
    }
    
    .cta-btn.primary:hover {
        color: #2c3e50;
    }
    
    .cta-btn.secondary:hover {
        color: white;
    }
    
    .cta-features {
        display: flex;
        gap: 2rem;
        justify-content: center;
        font-size: 0.9rem;
        opacity: 0.9;
        flex-wrap: wrap;
    }
    
    /* Mobile Responsiveness */
    @media (max-width: 768px) {
        .blog-article {
            padding: 2rem 0;
        }
        
        .blog-container {
            padding: 0 15px;
        }
        
        .article-meta {
            flex-direction: column;
            text-align: center;
            gap: 1rem;
        }
        
        .article-meta-top {
            flex-direction: column;
            gap: 1rem;
        }
        
        .share-buttons {
            flex-direction: column;
            align-items: center;
        }
        
        .share-btn {
            width: 200px;
            justify-content: center;
        }
        
        .author-bio {
            flex-direction: column;
            text-align: center;
        }
        
        .author-avatar-large {
            align-self: center;
        }
        
        .related-grid {
            grid-template-columns: 1fr;
        }
        
        .cta-buttons {
            flex-direction: column;
            align-items: center;
        }
        
        .cta-btn {
            width: 250px;
        }
        
        .cta-features {
            flex-direction: column;
            gap: 1rem;
        }
    }
    
    @media (max-width: 480px) {
        .breadcrumb li {
            max-width: 100px;
        }
        
        .article-header {
            margin-bottom: 2rem;
        }
        
        .article-content {
            font-size: 1rem;
        }
        
        .article-tags,
        .article-share,
        .author-bio {
            padding: 1rem;
        }
        
        .related-articles {
            padding: 3rem 0;
        }
        
        .blog-cta-section {
            padding: 3rem 0;
        }
    }
</style>

<script>
// Copy to clipboard function
function copyToClipboard(text) {
    navigator.clipboard.writeText(text).then(function() {
        // Show success message
        const btn = event.target;
        const originalText = btn.textContent;
        btn.textContent = '✅ Copied!';
        btn.style.background = '#22c55e';
        
        setTimeout(() => {
            btn.textContent = originalText;
            btn.style.background = '#6c757d';
        }, 2000);
    }).catch(function(err) {
        // Fallback for older browsers
        const textArea = document.createElement('textarea');
        textArea.value = text;
        document.body.appendChild(textArea);
        textArea.select();
        document.execCommand('copy');
        document.body.removeChild(textArea);
        
        const btn = event.target;
        const originalText = btn.textContent;
        btn.textContent = '✅ Copied!';
        btn.style.background = '#22c55e';
        
        setTimeout(() => {
            btn.textContent = originalText;
            btn.style.background = '#6c757d';
        }, 2000);
    });
}

// Smooth scroll for anchor links
document.addEventListener('DOMContentLoaded', function() {
    const anchorLinks = document.querySelectorAll('a[href^="#"]');
    
    anchorLinks.forEach(link => {
        link.addEventListener('click', function(e) {
            e.preventDefault();
            const target = document.querySelector(this.getAttribute('href'));
            if (target) {
                target.scrollIntoView({
                    behavior: 'smooth',
                    block: 'start'
                });
            }
        });
    });
    
    // Add loading indicator for images
    const images = document.querySelectorAll('.article-featured-image img');
    images.forEach(img => {
        img.addEventListener('load', function() {
            this.style.opacity = '1';
        });
        img.style.opacity = '0';
        img.style.transition = 'opacity 0.3s ease';
    });
});
</script>

<?php include 'footer.php'; ?>
</body>
</html>