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

// SEO Meta Variables
$page_title = "Satta Matka Blog - Expert Tips, Strategies & Market Analysis | Shubank";
$page_description = "Read expert satta matka blogs with winning strategies, market analysis, and insider tips. Latest matka news, prediction techniques, and exclusive insights from Shubank experts.";
$page_keywords = "satta matka blog, matka tips and tricks, satta king strategies, matka market analysis, disawar tips, delhi bazaar strategies, matka prediction blog, satta matka news, matka expert tips, winning strategies";
$canonical_url = "https://shubank.co/blogs.php";

// Get all published blogs from database
try {
    $all_blogs = getAllBlogs($link, 50, 0); // Get more blogs for proper pagination
    
    // Since getAllBlogs already filters for published blogs, no need to filter again
    // But let's add safety check for status field
    $published_blogs = [];
    foreach ($all_blogs as $blog) {
        // Ensure blog has all required fields with defaults
        $blog = array_merge([
            'id' => 0,
            'title' => 'Untitled',
            'slug' => '',
            'excerpt' => '',
            'content' => '',
            'featured_image' => '',
            'category' => 'general',
            'tags' => '',
            'status' => 'published',
            'views' => 0,
            'likes' => 0,
            'created_at' => date('Y-m-d H:i:s')
        ], $blog);
        
        // Only add if status is published (redundant but safe)
        if ($blog['status'] === 'published') {
            $published_blogs[] = $blog;
        }
    }
} catch (Exception $e) {
    error_log("Error getting blogs: " . $e->getMessage());
    $published_blogs = [];
}

// Get blog statistics for hero section
try {
    $blog_stats = getBlogStats($link);
    // Ensure required keys exist
    $blog_stats = array_merge([
        'total_blogs' => 0,
        'total_published' => 0,
        'total_views' => 0,
        'total_likes' => 0
    ], $blog_stats);
} catch (Exception $e) {
    error_log("Error getting blog stats: " . $e->getMessage());
    $blog_stats = [
        'total_blogs' => 0,
        'total_published' => 0,
        'total_views' => 0,
        'total_likes' => 0
    ];
}

// Pagination settings
$posts_per_page = 6;
$current_page = isset($_GET['page']) ? max(1, intval($_GET['page'])) : 1;
$total_posts = count($published_blogs);
$total_pages = ceil($total_posts / $posts_per_page);

// Calculate offset for current page
$offset = ($current_page - 1) * $posts_per_page;
$current_page_blogs = array_slice($published_blogs, $offset, $posts_per_page);

// Helper function to get category icon
function getCategoryIcon($category) {
    $icons = [
        'Strategies' => '📊',
        'Market Analysis' => '📈',
        'Tips & Tricks' => '💡',
        'Latest News' => '📰',
        'Tutorials' => '🎓',
        'Tips' => '💡',
        'News' => '📰'
    ];
    return $icons[$category] ?? '📄';
}

// Helper function to generate category slug
function getCategorySlug($category) {
    return strtolower(str_replace([' ', '&'], ['-', ''], $category));
}

// Helper function to estimate read time
function estimateReadTime($content) {
    $word_count = str_word_count(strip_tags($content));
    $minutes = ceil($word_count / 200);
    return $minutes . ' min read';
}
?>
<!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="Satta Matka Blog - Expert Tips & Strategies | Shubank">
    <meta property="og:description" content="<?php echo $page_description; ?>">
    <meta property="og:type" content="website">
    <meta property="og:url" content="<?php echo $canonical_url; ?>">
    <meta property="og:image" content="https://shubank.co/images/shubank-blog-og.jpg">
    <meta property="og:image:width" content="1200">
    <meta property="og:image:height" content="630">
    <meta property="og:image:alt" content="Satta Matka Blog - Expert Tips and Strategies">
    <meta property="og:site_name" content="Shubank">
    <meta property="og:locale" content="en_IN">
    
    <!-- Twitter Card Meta Tags -->
    <meta name="twitter:card" content="summary_large_image">
    <meta name="twitter:title" content="Satta Matka Blog - Expert Tips & Strategies | Shubank">
    <meta name="twitter:description" content="<?php echo $page_description; ?>">
    <meta name="twitter:image" content="https://shubank.co/images/shubank-blog-twitter.jpg">
    <meta name="twitter:image:alt" content="Satta Matka Blog">
    
    <!-- Additional SEO Meta Tags -->
    <meta name="robots" content="index, follow, max-snippet:-1, max-image-preview:large">
    <meta name="author" content="Shubank">
    <meta name="geo.region" content="IN">
    <meta name="geo.country" content="India">
    <meta name="revisit-after" content="3 days">
    
    <!-- Structured Data -->
    <script type="application/ld+json">
    {
        "@context": "https://schema.org",
        "@type": "Blog",
        "name": "Shubank Matka Blog",
        "description": "<?php echo $page_description; ?>",
        "url": "<?php echo $canonical_url; ?>",
        "inLanguage": "en-IN",
        "publisher": {
            "@type": "Organization",
            "name": "Shubank",
            "logo": {
                "@type": "ImageObject",
                "url": "https://shubank.co/images/shubank-logo.png"
            }
        },
        "mainEntity": {
            "@type": "ItemList",
            "itemListElement": [
                <?php 
                $blog_items = [];
                foreach(array_slice($published_blogs, 0, 5) as $index => $blog) {
                    $blog_items[] = '{
                                    "@type": "ListItem",
                                    "position": ' . ($index + 1) . ',
                                    "url": "https://shubank.co/blog/' . $blog['slug'] . '"
                                }';
                }
                echo implode(',', $blog_items);
                ?>
            ]
        }
    }
    </script>
    
    <script type="application/ld+json">
    {
        "@context": "https://schema.org",
        "@type": "WebPage",
        "name": "Satta Matka Blog - Expert Tips & Strategies",
        "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": "<?php echo $canonical_url; ?>"
                }
            ]
        }
    }
    </script>
    
    <script type="application/ld+json">
    {
        "@context": "https://schema.org",
        "@type": "FAQPage",
        "mainEntity": [
            {
                "@type": "Question",
                "name": "What topics are covered in Shubank matka blog?",
                "acceptedAnswer": {
                    "@type": "Answer",
                    "text": "Shubank blog covers expert satta matka strategies, market analysis, winning tips, Disawar and Delhi Bazaar insights, prediction techniques, and latest matka news for serious players."
                }
            },
            {
                "@type": "Question",
                "name": "How often is the Shubank blog updated?",
                "acceptedAnswer": {
                    "@type": "Answer",
                    "text": "Our expert team publishes new matka blog articles regularly with fresh strategies, market updates, and insider tips to help players improve their game."
                }
            },
            {
                "@type": "Question",
                "name": "Are the matka tips in the blog reliable?",
                "acceptedAnswer": {
                    "@type": "Answer",
                    "text": "Yes, all tips and strategies are written by experienced matka players and analysts with years of market knowledge and proven track records."
                }
            }
        ]
    }
    </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 aria-current="page">Matka Blog</li>
        </ol>
    </div>
</nav>

<!-- Hero Section -->
<section class="blogs-hero">
    <div class="container">
        <div class="blogs-hero-content">
            <div class="eyebrow">
                <span>📚</span>
                Expert Satta Matka Blog
            </div>
            <h1>Master Matka with Expert Tips & Winning Strategies</h1>
            <p>Discover proven <strong>satta matka strategies</strong>, expert <strong>market analysis</strong>, and insider tips from India's top <strong>matka experts</strong>. Get the edge you need to succeed with <strong>Disawar, Delhi Bazaar</strong>, and other major markets.</p>
            
            <div class="blog-stats">
                <div class="stat-item">
                    <span class="stat-number"><?php echo count($published_blogs); ?>+</span>
                    <span class="stat-label">Expert Articles</span>
                </div>
                <div class="stat-item">
                    <span class="stat-number"><?php echo $blog_stats['total_views'] ?? '10K'; ?>+</span>
                    <span class="stat-label">Total Reads</span>
                </div>
                <div class="stat-item">
                    <span class="stat-number">Weekly</span>
                    <span class="stat-label">New Content</span>
                </div>
            </div>
        </div>
    </div>
</section>

<!-- Featured Categories Section -->
<section class="blog-categories-section">
    <div class="container">
        <h2>🎯 Explore Matka Blog Categories</h2>
        <div class="categories-grid">
            <div class="category-card">
                <div class="category-icon">📊</div>
                <h3>Winning Strategies</h3>
                <p>Proven <strong>satta matka strategies</strong> and techniques used by successful players</p>
                <span class="post-count">12+ Articles</span>
            </div>
            <div class="category-card">
                <div class="category-icon">📈</div>
                <h3>Market Analysis</h3>
                <p>Deep dive into <strong>Disawar, Delhi Bazaar</strong> market trends and patterns</p>
                <span class="post-count">8+ Articles</span>
            </div>
            <div class="category-card">
                <div class="category-icon">💡</div>
                <h3>Tips & Tricks</h3>
                <p>Expert <strong>matka tips</strong> and insider secrets for better predictions</p>
                <span class="post-count">15+ Articles</span>
            </div>
            <div class="category-card">
                <div class="category-icon">📰</div>
                <h3>Latest News</h3>
                <p>Breaking <strong>matka news</strong> and important market updates</p>
                <span class="post-count">6+ Articles</span>
            </div>
        </div>
    </div>
</section>

<!-- Main Content -->
<section class="blogs-main">
    <div class="blogs-container">
        
        <!-- Search and Filters -->
        <div class="blogs-filters">
            <h2>🔍 Find the Perfect Matka Strategy Article</h2>
            <div class="search-bar">
                <input type="text" id="searchInput" class="search-input" placeholder="Search for matka tips, strategies, market analysis..." aria-label="Search blog posts">
                <button class="search-btn" onclick="searchBlogs()">🔍 Search Articles</button>
            </div>
            <div class="category-filters">
                <button class="category-btn active" data-category="all">All Categories</button>
                <button class="category-btn" data-category="strategies">📊 Strategies</button>
                <button class="category-btn" data-category="market-analysis">📈 Market Analysis</button>
                <button class="category-btn" data-category="tips-tricks">💡 Tips & Tricks</button>
                <button class="category-btn" data-category="latest-news">📰 Latest News</button>
            </div>
        </div>
        
        <?php if (empty($current_page_blogs)): ?>
            <div class="no-blogs-message">
                <div class="no-blogs-icon">📝</div>
                <h3>No Blog Posts Available</h3>
                <p>We're working on creating amazing <strong>matka strategy content</strong> for you. Check back soon for expert tips and winning strategies!</p>
            </div>
        <?php else: ?>
            
            <!-- Featured Post (First Post) -->
            <?php if ($current_page == 1 && !empty($current_page_blogs)): 
                $featured_post = $current_page_blogs[0];
            ?>
            <div class="featured-post">
                <h2>🌟 Featured Article</h2>
                <div class="featured-post-card">
                    <div class="featured-image">
                        <div class="featured-category"><?php echo getCategoryIcon($featured_post['category']); ?> <?php echo htmlspecialchars($featured_post['category']); ?></div>
                        <div class="featured-icon">📚</div>
                    </div>
                    <div class="featured-content">
                        <h3><a href="/A+/01/blog/<?php echo $featured_post['slug']; ?>" class="featured-title"><?php echo htmlspecialchars($featured_post['title']); ?></a></h3>
                        <p class="featured-excerpt"><?php echo htmlspecialchars(substr(strip_tags($featured_post['content']), 0, 200)) . '...'; ?></p>
                        <div class="featured-meta">
                            <span class="featured-date">📅 <?php echo date('M d, Y', strtotime($featured_post['created_at'])); ?></span>
                            <span class="featured-views">👁️ <?php echo number_format($featured_post['views']); ?> views</span>
                            <span class="featured-read-time">⏱️ <?php echo estimateReadTime($featured_post['content']); ?></span>
                        </div>
                        <a href="/A+/01/blog/<?php echo $featured_post['slug']; ?>" class="featured-read-btn">Read Full Strategy Guide →</a>
                    </div>
                </div>
            </div>
            <?php endif; ?>
            
            <!-- Blog Grid -->
            <div class="blogs-section">
                <h2>📖 Latest Matka Strategy Articles</h2>
                <div class="blogs-grid">
                    <?php 
                    $start_index = ($current_page == 1) ? 1 : 0; // Skip first post on page 1 (featured)
                    for ($i = $start_index; $i < count($current_page_blogs); $i++): 
                        $blog = $current_page_blogs[$i];
                    ?>
                    <article class="blog-card" data-category="<?php echo getCategorySlug($blog['category']); ?>">
                        <div class="blog-image">
                            <div class="blog-category"><?php echo getCategoryIcon($blog['category']); ?> <?php echo htmlspecialchars($blog['category']); ?></div>
                            <div class="blog-icon">📄</div>
                        </div>
                        <div class="blog-content">
                            <div class="blog-meta">
                                <span class="blog-date">📅 <?php echo date('M d, Y', strtotime($blog['created_at'])); ?></span>
                                <span class="blog-views">👁️ <?php echo number_format($blog['views']); ?></span>
                            </div>
                            <h3 class="blog-title">
                                <a href="/A+/01/blog/<?php echo $blog['slug']; ?>"><?php echo htmlspecialchars($blog['title']); ?></a>
                            </h3>
                            <p class="blog-excerpt"><?php echo htmlspecialchars(substr(strip_tags($blog['content']), 0, 150)) . '...'; ?></p>
                            <div class="blog-footer">
                                <span class="read-time">⏱️ <?php echo estimateReadTime($blog['content']); ?></span>
                                <span class="blog-likes">❤️ <?php echo number_format($blog['likes']); ?></span>
                            </div>
                            <a href="/A+/01/blog/<?php echo $blog['slug']; ?>" class="read-more-btn">Read Strategy →</a>
                        </div>
                    </article>
                    <?php endfor; ?>
                </div>
            </div>
            
            <!-- Pagination -->
            <?php if ($total_pages > 1): ?>
            <div class="pagination-section">
                <div class="pagination">
                    <?php if ($current_page > 1): ?>
                        <a href="?page=<?php echo $current_page - 1; ?>" class="pagination-btn">← Previous</a>
                    <?php endif; ?>
                    
                    <?php for ($i = 1; $i <= $total_pages; $i++): ?>
                        <?php if ($i == $current_page): ?>
                            <span class="pagination-btn active"><?php echo $i; ?></span>
                        <?php else: ?>
                            <a href="?page=<?php echo $i; ?>" class="pagination-btn"><?php echo $i; ?></a>
                        <?php endif; ?>
                    <?php endfor; ?>
                    
                    <?php if ($current_page < $total_pages): ?>
                        <a href="?page=<?php echo $current_page + 1; ?>" class="pagination-btn">Next →</a>
                    <?php endif; ?>
                </div>
                <div class="pagination-info">
                    <p>Showing page <?php echo $current_page; ?> of <?php echo $total_pages; ?> • Total: <?php echo $total_posts; ?> expert <strong>matka articles</strong></p>
                </div>
            </div>
            <?php endif; ?>
            
        <?php endif; ?>
        
    </div>
</section>

<!-- Blog Newsletter Section -->
<section class="blog-newsletter-section">
    <div class="container">
        <div class="newsletter-content">
            <h2>📧 Never Miss a Winning Strategy</h2>
            <p>Get the latest <strong>matka tips</strong>, <strong>expert strategies</strong>, and <strong>market insights</strong> delivered to your inbox. Join 10,000+ players who rely on our expert analysis.</p>
            <div class="newsletter-form">
                <input type="email" placeholder="Enter your email for exclusive matka tips..." class="newsletter-input">
                <button class="newsletter-btn">🎯 Get Expert Tips</button>
            </div>
            <div class="newsletter-benefits">
                <span>✅ Weekly Strategy Updates</span>
                <span>✅ Exclusive Market Analysis</span>
                <span>✅ Early Access to New Tips</span>
            </div>
        </div>
    </div>
</section>

<!-- FAQ Section -->
<section class="blog-faq-section">
    <div class="container">
        <h2>❓ Frequently Asked Questions - Matka Blog</h2>
        <div class="faq-grid">
            <div class="faq-item">
                <h3>What topics are covered in Shubank matka blog?</h3>
                <p>Our expert blog covers comprehensive <strong>satta matka strategies</strong>, detailed <strong>market analysis</strong>, winning tips for <strong>Disawar and Delhi Bazaar</strong>, prediction techniques, and latest <strong>matka news</strong> to help serious players succeed.</p>
            </div>
            <div class="faq-item">
                <h3>How often is the Shubank blog updated?</h3>
                <p>Our expert team publishes new <strong>matka strategy articles</strong> weekly with fresh insights, market updates, and insider tips to keep you ahead of the competition.</p>
            </div>
            <div class="faq-item">
                <h3>Are the matka tips in the blog reliable?</h3>
                <p>Yes, all tips and <strong>satta matka strategies</strong> are written by experienced players and analysts with years of market knowledge and proven track records in <strong>matka gaming</strong>.</p>
            </div>
            <div class="faq-item">
                <h3>Can I get personalized matka advice?</h3>
                <p>While our blog provides general <strong>matka strategies</strong>, you can join our community for discussions and connect with other experienced players for personalized insights.</p>
            </div>
            <div class="faq-item">
                <h3>Do you cover prediction techniques in your blog?</h3>
                <p>Yes, our blog features detailed articles on <strong>matka prediction methods</strong>, chart analysis, number pattern recognition, and proven techniques used by successful players in <strong>Kalyan and Mumbai markets</strong>.</p>
            </div>
            <div class="faq-item">
                <h3>Are beginner guides available in the blog?</h3>
                <p>Absolutely! We provide comprehensive <strong>beginner tutorials</strong> covering matka basics, game rules, betting types, and step-by-step guides to help new players understand <strong>satta matka fundamentals</strong> safely.</p>
            </div>
        </div>
    </div>
</section>

<style>
    /* Blogs Page Professional Styling */
    
    /* 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;
    }
    
    .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;
    }
    
    /* Hero Section */
    .blogs-hero {
        background: linear-gradient(135deg, #005c97 0%, #17a2b8 50%, #667eea 100%);
        padding: 4rem 0;
        color: white;
        text-align: center;
        position: relative;
        overflow: hidden;
    }
    
    .blogs-hero::before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.1);
        z-index: 1;
    }
    
    .blogs-hero-content {
        position: relative;
        z-index: 2;
        max-width: 800px;
        margin: 0 auto;
        padding: 0 20px;
    }
    
    .blogs-hero .eyebrow {
        display: inline-flex;
        align-items: center;
        gap: 0.5rem;
        background: rgba(255, 255, 255, 0.15);
        padding: 0.5rem 1rem;
        border-radius: 2rem;
        font-size: 0.9rem;
        font-weight: 600;
        margin-bottom: 1.5rem;
        backdrop-filter: blur(10px);
    }
    
    .blogs-hero h1 {
        font-size: clamp(2.5rem, 5vw, 4rem);
        font-weight: 800;
        margin-bottom: 1.5rem;
        background: linear-gradient(45deg, #fff, #ffd700);
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
        background-clip: text;
        line-height: 1.2;
    }
    
    .blogs-hero p {
        font-size: 1.1rem;
        color: rgba(255, 255, 255, 0.95);
        margin-bottom: 2rem;
        line-height: 1.6;
        max-width: 700px;
        margin-left: auto;
        margin-right: auto;
    }
    
    .blog-stats {
        display: flex;
        justify-content: center;
        gap: 3rem;
        margin-top: 2rem;
    }
    
    .stat-item {
        text-align: center;
        padding: 1rem;
        background: rgba(255, 255, 255, 0.1);
        border-radius: 1rem;
        backdrop-filter: blur(10px);
        border: 1px solid rgba(255, 255, 255, 0.2);
    }
    
    .stat-number {
        font-size: 2rem;
        font-weight: 800;
        color: #ffd700;
        display: block;
        margin-bottom: 0.25rem;
    }
    
    .stat-label {
        font-size: 0.9rem;
        color: rgba(255, 255, 255, 0.9);
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }
    
    /* Categories Section */
    .blog-categories-section {
        padding: 4rem 0;
        background: #f8f9fa;
    }
    
    .blog-categories-section h2 {
        text-align: center;
        font-size: clamp(2rem, 4vw, 2.5rem);
        color: #2c3e50;
        margin-bottom: 3rem;
        font-weight: 700;
    }
    
    .categories-grid {
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        gap: 2rem;
        max-width: 1200px;
        margin: 0 auto;
    }
    
    .category-card {
        background: white;
        padding: 2rem;
        border-radius: 1rem;
        text-align: center;
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
        transition: all 0.3s ease;
        border: 1px solid #e9ecef;
        height: 280px;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
    }
    
    .category-card:hover {
        transform: translateY(-5px);
        box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    }
    
    .category-card .category-icon {
        font-size: 3rem;
        margin-bottom: 1rem;
    }
    
    .category-card h3 {
        font-size: 1.3rem;
        font-weight: 600;
        color: #2c3e50;
        margin-bottom: 1rem;
    }
    
    .category-card p {
        line-height: 1.6;
        color: #6c757d;
        margin-bottom: 1rem;
    }
    
    .post-count {
        display: inline-block;
        background: #667eea;
        color: white;
        padding: 0.25rem 0.75rem;
        border-radius: 1rem;
        font-size: 0.8rem;
        font-weight: 600;
    }
    
    /* Main Content */
    .blogs-main {
        padding: 4rem 0;
        background: white;
    }
    
    .blogs-container {
        max-width: 1200px;
        margin: 0 auto;
        padding: 0 20px;
    }
    
    /* Search and Filters */
    .blogs-filters {
        background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
        padding: 2rem;
        border-radius: 1rem;
        margin-bottom: 3rem;
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
        border: 1px solid #e9ecef;
    }
    
    .blogs-filters h2 {
        color: #2c3e50;
        margin-bottom: 1.5rem;
        font-size: 1.5rem;
        font-weight: 600;
    }
    
    .search-bar {
        display: flex;
        gap: 1rem;
        margin-bottom: 1.5rem;
        flex-wrap: wrap;
    }
    
    .search-input {
        flex: 1;
        min-width: 300px;
        padding: 0.75rem 1rem;
        border: 2px solid #e9ecef;
        border-radius: 0.5rem;
        font-size: 1rem;
        transition: all 0.3s ease;
        background: white;
    }
    
    .search-input:focus {
        outline: none;
        border-color: #667eea;
        box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    }
    
    .search-btn {
        padding: 0.75rem 1.5rem;
        background: linear-gradient(135deg, #667eea, #764ba2);
        color: white;
        border: none;
        border-radius: 0.5rem;
        font-weight: 600;
        cursor: pointer;
        transition: all 0.3s ease;
        white-space: nowrap;
    }
    
    .search-btn:hover {
        transform: translateY(-2px);
        box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
    }
    
    .category-filters {
        display: flex;
        gap: 0.75rem;
        flex-wrap: wrap;
    }
    
    .category-btn {
        padding: 0.5rem 1rem;
        background: white;
        border: 2px solid #e9ecef;
        border-radius: 1.5rem;
        font-size: 0.9rem;
        font-weight: 600;
        cursor: pointer;
        transition: all 0.3s ease;
        white-space: nowrap;
    }
    
    .category-btn:hover,
    .category-btn.active {
        background: #667eea;
        border-color: #667eea;
        color: white;
        transform: translateY(-1px);
    }
    
    /* Featured Post */
    .featured-post {
        margin-bottom: 3rem;
    }
    
    .featured-post h2 {
        color: #2c3e50;
        margin-bottom: 1.5rem;
        font-size: 1.8rem;
        font-weight: 700;
    }
    
    .featured-post-card {
        display: grid;
        grid-template-columns: 1fr 2fr;
        gap: 2rem;
        background: white;
        border-radius: 1rem;
        overflow: hidden;
        box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
        border: 1px solid #e9ecef;
    }
    
    .featured-image {
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        position: relative;
        display: flex;
        align-items: center;
        justify-content: center;
        min-height: 300px;
    }
    
    .featured-category {
        position: absolute;
        top: 1rem;
        left: 1rem;
        background: rgba(255, 215, 0, 0.9);
        color: #2c3e50;
        padding: 0.5rem 1rem;
        border-radius: 1rem;
        font-size: 0.8rem;
        font-weight: 700;
        backdrop-filter: blur(10px);
    }
    
    .featured-icon {
        font-size: 4rem;
        color: white;
    }
    
    .featured-content {
        padding: 2rem;
        display: flex;
        flex-direction: column;
        justify-content: center;
    }
    
    .featured-title {
        color: #2c3e50;
        text-decoration: none;
        font-size: 1.8rem;
        font-weight: 700;
        line-height: 1.3;
        margin-bottom: 1rem;
    }
    
    .featured-title:hover {
        color: #667eea;
    }
    
    .featured-excerpt {
        color: #6c757d;
        line-height: 1.6;
        margin-bottom: 1.5rem;
        font-size: 1.1rem;
    }
    
    .featured-meta {
        display: flex;
        gap: 1rem;
        margin-bottom: 1.5rem;
        font-size: 0.9rem;
        color: #6c757d;
        flex-wrap: wrap;
    }
    
    .featured-read-btn {
        display: inline-block;
        background: linear-gradient(135deg, #667eea, #764ba2);
        color: white;
        padding: 0.75rem 1.5rem;
        border-radius: 0.5rem;
        text-decoration: none;
        font-weight: 600;
        transition: all 0.3s ease;
        align-self: flex-start;
    }
    
    .featured-read-btn:hover {
        transform: translateY(-2px);
        box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
        color: white;
    }
    
    /* Blog Grid */
    .blogs-section h2 {
        color: #2c3e50;
        margin-bottom: 2rem;
        font-size: 1.8rem;
        font-weight: 700;
    }
    
    .blogs-grid {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
        gap: 2rem;
        margin-bottom: 3rem;
    }
    
    .blog-card {
        background: white;
        border-radius: 1rem;
        overflow: hidden;
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
        transition: all 0.3s ease;
        border: 1px solid #e9ecef;
    }
    
    .blog-card:hover {
        transform: translateY(-5px);
        box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    }
    
    .blog-image {
        width: 100%;
        height: 200px;
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        position: relative;
        display: flex;
        align-items: center;
        justify-content: center;
        color: white;
    }
    
    .blog-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;
        backdrop-filter: blur(10px);
    }
    
    .blog-icon {
        font-size: 3rem;
    }
    
    .blog-content {
        padding: 1.5rem;
    }
    
    .blog-meta {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 1rem;
        font-size: 0.8rem;
        color: #6c757d;
    }
    
    .blog-title {
        margin-bottom: 1rem;
    }
    
    .blog-title a {
        color: #2c3e50;
        text-decoration: none;
        font-size: 1.2rem;
        font-weight: 600;
        line-height: 1.4;
    }
    
    .blog-title a:hover {
        color: #667eea;
    }
    
    .blog-excerpt {
        color: #6c757d;
        line-height: 1.6;
        margin-bottom: 1rem;
        font-size: 0.95rem;
    }
    
    .blog-footer {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 1rem;
        font-size: 0.8rem;
        color: #6c757d;
    }
    
    .read-more-btn {
        display: inline-block;
        background: #667eea;
        color: white;
        padding: 0.5rem 1rem;
        border-radius: 0.5rem;
        text-decoration: none;
        font-weight: 600;
        font-size: 0.9rem;
        transition: all 0.3s ease;
    }
    
    .read-more-btn:hover {
        background: #5a67d8;
        transform: translateY(-1px);
        color: white;
    }
    
    /* No Blogs Message */
    .no-blogs-message {
        text-align: center;
        padding: 4rem 2rem;
        background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
        border-radius: 1rem;
        border: 2px dashed #dee2e6;
    }
    
    .no-blogs-icon {
        font-size: 4rem;
        margin-bottom: 1rem;
    }
    
    .no-blogs-message h3 {
        color: #2c3e50;
        margin-bottom: 1rem;
        font-size: 1.5rem;
        font-weight: 600;
    }
    
    .no-blogs-message p {
        color: #6c757d;
        line-height: 1.6;
    }
    
    /* Pagination */
    .pagination-section {
        text-align: center;
        margin-top: 3rem;
    }
    
    .pagination {
        display: flex;
        justify-content: center;
        gap: 0.5rem;
        margin-bottom: 1rem;
        flex-wrap: wrap;
    }
    
    .pagination-btn {
        display: inline-block;
        padding: 0.5rem 1rem;
        background: white;
        color: #2c3e50;
        text-decoration: none;
        border: 2px solid #e9ecef;
        border-radius: 0.5rem;
        font-weight: 600;
        transition: all 0.3s ease;
    }
    
    .pagination-btn:hover,
    .pagination-btn.active {
        background: #667eea;
        color: white;
        border-color: #667eea;
    }
    
    .pagination-info {
        color: #6c757d;
        font-size: 0.9rem;
    }
    
    /* Newsletter Section */
    .blog-newsletter-section {
        padding: 4rem 0;
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        color: white;
        text-align: center;
    }
    
    .newsletter-content h2 {
        font-size: clamp(1.8rem, 4vw, 2.5rem);
        font-weight: 700;
        margin-bottom: 1rem;
    }
    
    .newsletter-content p {
        font-size: 1.1rem;
        margin-bottom: 2rem;
        opacity: 0.95;
        max-width: 600px;
        margin-left: auto;
        margin-right: auto;
    }
    
    .newsletter-form {
        display: flex;
        gap: 1rem;
        max-width: 500px;
        margin: 0 auto 2rem;
        flex-wrap: wrap;
    }
    
    .newsletter-input {
        flex: 1;
        min-width: 250px;
        padding: 0.75rem 1rem;
        border: none;
        border-radius: 0.5rem;
        font-size: 1rem;
    }
    
    .newsletter-btn {
        padding: 0.75rem 1.5rem;
        background: #ffd700;
        color: #2c3e50;
        border: none;
        border-radius: 0.5rem;
        font-weight: 600;
        cursor: pointer;
        transition: all 0.3s ease;
        white-space: nowrap;
    }
    
    .newsletter-btn:hover {
        transform: translateY(-2px);
        box-shadow: 0 10px 20px rgba(255, 215, 0, 0.3);
    }
    
    .newsletter-benefits {
        display: flex;
        gap: 2rem;
        justify-content: center;
        font-size: 0.9rem;
        opacity: 0.9;
        flex-wrap: wrap;
    }
    
    /* FAQ Section */
    .blog-faq-section {
        padding: 4rem 0;
        background: #f8f9fa;
    }
    
    .blog-faq-section h2 {
        text-align: center;
        font-size: clamp(1.8rem, 4vw, 2.5rem);
        color: #2c3e50;
        margin-bottom: 3rem;
        font-weight: 700;
    }
    
    .faq-grid {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
        gap: 2rem;
        max-width: 1200px;
        margin: 0 auto;
    }
    
    .faq-item {
        background: white;
        padding: 2rem;
        border-radius: 1rem;
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
        border: 1px solid #e9ecef;
        transition: all 0.3s ease;
    }
    
    .faq-item:hover {
        transform: translateY(-5px);
        box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    }
    
    .faq-item h3 {
        color: #667eea;
        margin-bottom: 1rem;
        font-size: 1.1rem;
        font-weight: 600;
        line-height: 1.4;
    }
    
    .faq-item p {
        line-height: 1.6;
        color: #6c757d;
    }
    
    /* Mobile Responsiveness */
    @media (max-width: 1024px) {
        .categories-grid {
            grid-template-columns: repeat(2, 1fr);
            gap: 1.5rem;
        }
        
        .category-card {
            height: 260px;
            padding: 1.5rem;
        }
    }
    
    @media (max-width: 768px) {
        .blogs-hero {
            padding: 3rem 0;
        }
        
        .blog-stats {
            gap: 1.5rem;
            flex-wrap: wrap;
        }
        
        .stat-item {
            padding: 0.75rem;
        }
        
        .blog-categories-section,
        .blogs-main,
        .blog-newsletter-section,
        .blog-faq-section {
            padding: 3rem 0;
        }
        
        .categories-grid {
            grid-template-columns: repeat(2, 1fr);
            gap: 1.5rem;
        }
        
        .category-card {
            height: 240px;
            padding: 1.25rem;
        }
        
        .search-bar {
            flex-direction: column;
        }
        
        .search-input {
            min-width: 100%;
        }
        
        .featured-post-card {
            grid-template-columns: 1fr;
        }
        
        .featured-image {
            min-height: 200px;
        }
        
        .blogs-grid {
            grid-template-columns: 1fr;
        }
        
        .newsletter-form {
            flex-direction: column;
        }
        
        .newsletter-input {
            min-width: 100%;
        }
        
        .newsletter-benefits {
            flex-direction: column;
            gap: 1rem;
        }
        
        .faq-grid {
            grid-template-columns: 1fr;
        }
    }
    
    @media (max-width: 480px) {
        .blogs-hero,
        .blog-categories-section,
        .blogs-main,
        .blog-newsletter-section,
        .blog-faq-section {
            padding: 2rem 0;
        }
        
        .blog-stats {
            flex-direction: column;
            gap: 1rem;
        }
        
        .stat-item {
            padding: 0.5rem;
        }
        
        .categories-grid {
            grid-template-columns: 1fr;
            gap: 1rem;
        }
        
        .category-card {
            height: auto;
            min-height: 200px;
            padding: 1rem;
        }
        
        .featured-content,
        .blog-content,
        .faq-item {
            padding: 1rem;
        }
        
        .featured-meta,
        .blog-footer {
            flex-direction: column;
            gap: 0.5rem;
            align-items: flex-start;
        }
    }
</style>

<!-- Enhanced JavaScript -->
<script>
document.addEventListener('DOMContentLoaded', function() {
    // Category filter functionality
    const categoryBtns = document.querySelectorAll('.category-btn');
    const blogCards = document.querySelectorAll('.blog-card');
    
    categoryBtns.forEach(btn => {
        btn.addEventListener('click', function() {
            // Remove active class from all buttons
            categoryBtns.forEach(b => b.classList.remove('active'));
            this.classList.add('active');
            
            const category = this.dataset.category;
            
            blogCards.forEach(card => {
                if (category === 'all' || card.dataset.category === category) {
                    card.style.display = '';
                } else {
                    card.style.display = 'none';
                }
            });
        });
    });
    
    // Search functionality
    window.searchBlogs = function() {
        const searchTerm = document.getElementById('searchInput').value.toLowerCase();
        
        blogCards.forEach(card => {
            const title = card.querySelector('.blog-title a').textContent.toLowerCase();
            const excerpt = card.querySelector('.blog-excerpt').textContent.toLowerCase();
            const category = card.querySelector('.blog-category').textContent.toLowerCase();
            
            if (title.includes(searchTerm) || excerpt.includes(searchTerm) || category.includes(searchTerm)) {
                card.style.display = '';
            } else {
                card.style.display = 'none';
            }
        });
        
        // Reset category filters when searching
        if (searchTerm) {
            categoryBtns.forEach(btn => btn.classList.remove('active'));
            document.querySelector('.category-btn[data-category="all"]').classList.add('active');
        }
    };
    
    // Search on Enter key
    document.getElementById('searchInput').addEventListener('keypress', function(e) {
        if (e.key === 'Enter') {
            searchBlogs();
        }
    });
    
    // Newsletter subscription
    const newsletterBtn = document.querySelector('.newsletter-btn');
    const newsletterInput = document.querySelector('.newsletter-input');
    
    if (newsletterBtn) {
        newsletterBtn.addEventListener('click', function() {
            const email = newsletterInput.value.trim();
            if (email && isValidEmail(email)) {
                this.textContent = '✅ Subscribed!';
                this.style.background = '#22c55e';
                newsletterInput.value = '';
                setTimeout(() => {
                    this.textContent = '🎯 Get Expert Tips';
                    this.style.background = '#ffd700';
                }, 3000);
            } else {
                alert('Please enter a valid email address');
            }
        });
    }
    
    function isValidEmail(email) {
        return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email);
    }
    
    // Smooth scroll for pagination
    const paginationBtns = document.querySelectorAll('.pagination-btn');
    paginationBtns.forEach(btn => {
        btn.addEventListener('click', function() {
            setTimeout(() => {
                document.querySelector('.blogs-main').scrollIntoView({
                    behavior: 'smooth'
                });
            }, 100);
        });
    });
});
</script>

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