<?php
/* FILE: tag/bihar-home-guard-*.php 
   UPDATED: High Performance, Dynamic Schema, Google Discover Ready
*/

// --- 1. YOUR CUSTOM LINKS (UPDATE THESE WITH YOUR REAL POST LINKS) ---
$custom_links = [
    "apply_target"  => "https://sarkarimocktest.com/news/?category=Govt%20Job", 
    "admit_target"  => "https://sarkarimocktest.com/news/?category=Admit%20Card", 
    "result_target" => "https://sarkarimocktest.com/news/?category=Result",
    "syllabus_pdf"  => "https://sarkarimocktest.com/news/" // Main Mock Page
];

// --- 2. GLOBAL CONFIGURATION ---
$exam_name_base = "Bihar Home Guard 2026";
$site_url = "https://sarkarimocktest.com";
$official_website = "https://csbc.bih.nic.in/"; // CSBC conducts this mostly

// Logos & Images (As per your request)
$common_logo = "https://sarkarimocktest.com/images/logo/bihar-police-logo.webp";
$publisher_logo = "https://sarkarimocktest.com/images/logo/publisher-logo-600x60.png";
$hero_image = "https://sarkarimocktest.com/uploads/bihar-home-guard-2026-mock-test.webp";

// Author Details (E-E-A-T)
$author_name = "Shubham Kumar Sah";
$author_url = "https://sarkarimocktest.com/author/shubham-kumar-sah.php";
$author_img = "https://sarkarimocktest.com/images/author/shubham-kumar-sah.webp";

// --- 3. SMART LOGIC & SCHEMA GENERATOR ---
$current_file = basename(__FILE__, '.php');
$current_url = $site_url . "/tag/" . basename(__FILE__);

// Date Logic (Simulated for Demo - Use DB in Production)
$published_date = "2025-11-10T09:00:00+05:30"; 
$modified_date  = date("c"); 

// Variables Init
$page_title = ""; $page_desc = ""; $hero_badge = ""; $active_tab = "";
$schema_type = "Article"; 
$faq_items = [];

// A. ADMIT CARD (NewsArticle - Fast Indexing)
if (strpos($current_file, 'admit-card') !== false) {
    $page_title = "Bihar Home Guard Admit Card 2026: Download Hall Ticket Link";
    $page_desc = "Breaking: Bihar Home Guard Admit Card 2026 released. Download Hall Ticket for PET/PST. Check Exam Date, Center List and Reporting Time.";
    $hero_badge = "Admit Card Released";
    $active_tab = "admit";
    $schema_type = "NewsArticle";
    
    $faq_items = [
        ["q" => "When will Bihar Home Guard Admit Card 2026 come?", "a" => "The admit card is likely to be released 15 days before the exam on the CSBC website."],
        ["q" => "How to download the Hall Ticket?", "a" => "Use your Registration ID and Date of Birth to login and download the PDF."]
    ];
} 
// B. RESULT PAGE (NewsArticle - Fast Indexing)
elseif (strpos($current_file, 'result') !== false) {
    $page_title = "Bihar Home Guard Result 2026 Declared: Merit List PDF";
    $page_desc = "Live Updates: Check Bihar Home Guard Result 2026. Download District-wise Merit List PDF, Cut Off Marks for General/OBC/SC/ST and Selection List.";
    $hero_badge = "Result Update";
    $active_tab = "result";
    $schema_type = "NewsArticle";

    $faq_items = [
        ["q" => "How to check Bihar Home Guard Merit List?", "a" => "Visit the official website, click on the Result tab, and search for your Roll Number in the PDF."],
        ["q" => "What is the expected Cut Off?", "a" => "The expected cut-off for General category is around 70-75 marks out of 100."]
    ];
}
// C. APPLY ONLINE (NewsArticle - Fast Indexing)
elseif (strpos($current_file, 'apply') !== false) {
    $page_title = "Bihar Home Guard Apply Online 2026: Registration Link & Fees";
    $page_desc = "Bihar Home Guard Vacancy 2026 Application Form. Check 12th Pass eligibility, Age Limit (18-25), Fees, and direct apply online link.";
    $hero_badge = "New Vacancy";
    $active_tab = "apply";
    $schema_type = "NewsArticle";

    $faq_items = [
        ["q" => "What is the qualification for Bihar Home Guard?", "a" => "Candidates must have passed Intermediate (10+2) from a recognized board."],
        ["q" => "What is the age limit?", "a" => "18 to 25 years for General. Relaxation applicable for OBC/EBC/SC/ST."]
    ];
}
// D. GUIDE/SYLLABUS (Article - Stable Ranking)
else {
    $page_title = "Bihar Home Guard 2026 Complete Guide: Syllabus & Pattern";
    $page_desc = "Complete details about Bihar Home Guard 2026. Check Detailed Syllabus, Exam Pattern (100 Questions), Physical Efficiency Test (PET) and Salary.";
    $hero_badge = "Complete Guide";
    $active_tab = "syllabus";
    $schema_type = "Article"; 

    $faq_items = [
        ["q" => "What is the exam pattern for Bihar Home Guard?", "a" => "The written exam consists of 100 objective questions (Hindi, English, Maths, GK) for 100 marks."],
        ["q" => "Is there negative marking?", "a" => "Usually, there is no negative marking in CSBC Home Guard exams, but check the latest notification."]
    ];
}

// --- 4. CARDS DATA ---
$cards = [
    "apply" => ["title" => "Apply Online", "icon" => "bi-pencil-square", "status" => "Registration", "link" => $custom_links['apply_target'], "btn" => "Apply Now"],
    "admit" => ["title" => "Admit Card", "icon" => "bi-person-badge", "status" => "Download", "link" => $custom_links['admit_target'], "btn" => "Download"],
    "result" => ["title" => "Result / Merit", "icon" => "bi-trophy", "status" => "Check Status", "link" => $custom_links['result_target'], "btn" => "View Result"],
    "syllabus" => ["title" => "Mock & Syllabus", "icon" => "bi-book", "status" => "Preparation", "link" => $custom_links['syllabus_pdf'], "btn" => "Start Test"]
];
?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title><?php echo $page_title; ?></title>
    <meta name="description" content="<?php echo $page_desc; ?>">
    <meta name="author" content="<?php echo $author_name; ?>">
    <meta name="robots" content="index, follow, max-image-preview:large">
    <link rel="canonical" href="<?php echo $current_url; ?>">
    
    <link rel="preconnect" href="https://fonts.googleapis.com">
    <link rel="preconnect" href="https://cdn.jsdelivr.net" crossorigin>
    <link rel="preload" as="image" href="<?php echo $author_img; ?>">
    
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css">

    <script type="application/ld+json">
    [
      {
        "@context": "https://schema.org",
        "@type": "<?php echo $schema_type; ?>",
        "headline": "<?php echo $page_title; ?>",
        "description": "<?php echo $page_desc; ?>",
        "image": [ "<?php echo $hero_image; ?>" ],
        "datePublished": "<?php echo $published_date; ?>",
        "dateModified": "<?php echo $modified_date; ?>",
        "author": { "@type": "Person", "name": "<?php echo $author_name; ?>", "url": "<?php echo $author_url; ?>" },
        "publisher": { 
            "@type": "Organization", 
            "name": "Sarkari Mock Test", 
            "logo": { "@type": "ImageObject", "url": "<?php echo $publisher_logo; ?>", "width": 600, "height": 60 } 
        },
        "mainEntityOfPage": { "@type": "WebPage", "@id": "<?php echo $current_url; ?>" },
        "isAccessibleForFree": true
      },
      {
        "@context": "https://schema.org",
        "@type": "BreadcrumbList",
        "itemListElement": [
          { "@type": "ListItem", "position": 1, "name": "Home", "item": "<?php echo $site_url; ?>" },
          { "@type": "ListItem", "position": 2, "name": "Bihar Home Guard", "item": "<?php echo $custom_links['syllabus_pdf']; ?>" },
          { "@type": "ListItem", "position": 3, "name": "<?php echo $hero_badge; ?>", "item": "<?php echo $current_url; ?>" }
        ]
      },
      {
        "@context": "https://schema.org",
        "@type": "FAQPage",
        "mainEntity": [
          <?php 
          $schema_faqs = [];
          foreach($faq_items as $faq) {
              $schema_faqs[] = '{ "@type": "Question", "name": "'.$faq['q'].'", "acceptedAnswer": { "@type": "Answer", "text": "'.$faq['a'].'" } }';
          }
          echo implode(",", $schema_faqs);
          ?>
        ]
      }
    ]
    </script>
    
    <style>
        :root { --primary-gradient: linear-gradient(135deg, #002D62 0%, #0052cc 100%); --accent: #ffc107; --dark: #1f2937; --bg-light: #f8f9fa; }
        body { font-family: 'Segoe UI', sans-serif; background-color: var(--bg-light); color: var(--dark); }
        
        .hero { background: var(--primary-gradient); color: white; padding: 60px 20px 80px 20px; text-align: center; border-radius: 0 0 40px 40px; position: relative; }
        .hero-meta { font-size: 0.85rem; opacity: 0.9; margin-bottom: 15px; }
        .badge-hero { background: rgba(255,255,255,0.2); border: 1px solid rgba(255,255,255,0.3); padding: 6px 16px; border-radius: 30px; font-size: 0.85rem; letter-spacing: 0.5px; }
        
        .nav-cards-container { margin-top: -50px; position: relative; z-index: 10; }
        .nav-card { background: white; border-radius: 16px; padding: 25px 20px; box-shadow: 0 10px 30px rgba(0,0,0,0.08); border: 1px solid #e5e7eb; transition: transform 0.3s ease; text-align: center; height: 100%; }
        .nav-card:hover { transform: translateY(-5px); border-color: #0052cc; }
        .nav-card.active { border: 2px solid #C41E3A; background: #fff5f5; }
        .card-icon { font-size: 2.5rem; margin-bottom: 10px; color: #0052cc; }
        
        .content-box { background: white; border-radius: 16px; padding: 30px; margin-top: 40px; box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05); border-left: 5px solid #0052cc; }
        
        .author-strip { display: inline-flex; align-items: center; background: rgba(255,255,255,0.1); padding: 5px 15px; border-radius: 50px; margin-top: 20px; border: 1px solid rgba(255,255,255,0.2); }
        .author-thumb { width: 30px; height: 30px; border-radius: 50%; margin-right: 10px; border: 1px solid white; }
        
        /* Social Share Buttons */
        .share-btn { width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; color: white; text-decoration: none; transition: 0.3s; margin: 0 5px; }
        .share-btn:hover { transform: scale(1.1); color: white; }
        .bg-wa { background: #25D366; } .bg-fb { background: #1877F2; } .bg-x { background: #000; } .bg-tg { background: #0088cc; }
        
        /* Mobile Responsive Tweaks */
        @media (max-width: 768px) { .hero { padding-bottom: 60px; } .nav-cards-container { margin-top: -40px; } }
    </style>
</head>
<body>

    <header class="hero">
        <div class="container">
            <span class="badge-hero mb-3 text-uppercase">🚀 <?php echo $hero_badge; ?></span>
            <h1 class="display-5 fw-bold mb-3"><?php echo $page_title; ?></h1>
            
            <div class="hero-meta">
                <span class="me-3"><i class="bi bi-calendar-check me-1"></i> Published: <?php echo date("d M Y", strtotime($published_date)); ?></span>
                <span><i class="bi bi-arrow-repeat me-1"></i> Updated: <?php echo date("d M Y"); ?></span>
            </div>
            
            <p class="opacity-75 mb-4" style="max-width: 700px; margin: 0 auto;"><?php echo $page_desc; ?></p>
            
            <div class="author-strip">
                <img src="<?php echo $author_img; ?>" alt="<?php echo $author_name; ?>" class="author-thumb">
                <span class="small text-white opacity-90 me-1">By</span>
                <a href="<?php echo $author_url; ?>" class="fw-bold text-warning text-decoration-none small"><?php echo $author_name; ?> <i class="bi bi-patch-check-fill"></i></a>
            </div>
        </div>
    </header>

    <div class="container pb-5">
        <div class="row g-4 nav-cards-container justify-content-center">
            <?php foreach($cards as $key => $card): ?>
            <div class="col-md-6 col-lg-3">
                <div class="nav-card <?php echo ($active_tab == $key) ? 'active' : ''; ?>">
                    <div class="card-icon"><i class="bi <?php echo $card['icon']; ?>"></i></div>
                    <h5 class="fw-bold text-dark mb-1"><?php echo $card['title']; ?></h5>
                    <p class="small text-muted mb-0 text-uppercase fw-bold"><?php echo $card['status']; ?></p>
                    <a href="<?php echo $card['link']; ?>" class="btn btn-outline-primary w-100 rounded-pill mt-3 fw-bold">
                        <?php echo $card['btn']; ?> <i class="bi bi-box-arrow-up-right ms-1"></i>
                    </a>
                </div>
            </div>
            <?php endforeach; ?>
        </div>

        <div class="row">
            <div class="col-lg-10 mx-auto">
                
                <div class="text-center my-4">
                    <p class="small text-muted mb-2 fw-bold text-uppercase">Share this update</p>
                    <a href="whatsapp://send?text=<?php echo urlencode($page_title . ' - ' . $current_url); ?>" class="share-btn bg-wa"><i class="bi bi-whatsapp"></i></a>
                    <a href="https://www.facebook.com/sharer/sharer.php?u=<?php echo urlencode($current_url); ?>" target="_blank" class="share-btn bg-fb"><i class="bi bi-facebook"></i></a>
                    <a href="https://twitter.com/intent/tweet?text=<?php echo urlencode($page_title); ?>&url=<?php echo urlencode($current_url); ?>" target="_blank" class="share-btn bg-x"><i class="bi bi-twitter-x"></i></a>
                    <a href="https://t.me/share/url?url=<?php echo urlencode($current_url); ?>&text=<?php echo urlencode($page_title); ?>" target="_blank" class="share-btn bg-tg"><i class="bi bi-telegram"></i></a>
                </div>

                <div class="content-box">
                    <h2 class="h4 fw-bold mb-4">ℹ️ Detailed Information</h2>
                    
                    <?php if($active_tab == 'admit'): ?>
                        <p>Download your <strong>Bihar Home Guard Admit Card 2026</strong> directly from the official CSBC portal. Ensure you carry a valid ID proof (Aadhar/Voter ID) along with the hall ticket to the exam center.</p>
                        <p><strong>Important:</strong> Check your Exam Shift and Reporting Time carefully.</p>
                    <?php elseif($active_tab == 'result'): ?>
                        <p>The <strong>Bihar Home Guard Result 2026</strong> will be published in PDF format containing Roll Numbers of selected candidates for PET. Marks will be released later.</p>
                    <?php elseif($active_tab == 'apply'): ?>
                        <p><strong>Documents Required:</strong> Aadhar Card, 10th/12th Marksheet, Domicile Certificate (Bihar), Caste Certificate (if applicable), Scanned Photo & Signature.</p>
                    <?php else: ?>
                        <p><strong>Preparation Strategy:</strong> Focus on Hindi Grammar and General Knowledge (Bihar Special) as they are high-scoring subjects. Practice daily mock tests on Sarkari Mock Test.</p>
                    <?php endif; ?>

                    <hr class="my-4">
                    
                    <h3 class="h5 fw-bold mb-3">Frequently Asked Questions</h3>
                    <div class="accordion" id="faqSchema">
                        <?php foreach($faq_items as $index => $faq): ?>
                        <div class="accordion-item">
                            <h2 class="accordion-header">
                                <button class="accordion-button <?php echo $index > 0 ? 'collapsed' : ''; ?>" type="button" data-bs-toggle="collapse" data-bs-target="#faq<?php echo $index; ?>">
                                    <?php echo $faq['q']; ?>
                                </button>
                            </h2>
                            <div id="faq<?php echo $index; ?>" class="accordion-collapse collapse <?php echo $index === 0 ? 'show' : ''; ?>" data-bs-parent="#faqSchema">
                                <div class="accordion-body text-muted small"><?php echo $faq['a']; ?></div>
                            </div>
                        </div>
                        <?php endforeach; ?>
                    </div>
                </div>

                <div class="text-center mt-5">
                    <div class="p-4 bg-white border rounded-4 d-inline-block shadow-sm">
                        <h4 class="fw-bold mb-2">🔥 More Govt Jobs?</h4>
                        <p class="text-muted small mb-3">Check latest Railway, SSC & Banking notifications.</p>
                        <a href="https://sarkarimocktest.com/news" class="btn btn-dark rounded-pill px-4"><i class="bi bi-bell me-2"></i>View All Vacancies</a>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <footer class="text-center py-4 border-top bg-white mt-auto small text-muted">
        &copy; 2026 Sarkari Mock Test. Information Source: <a href="<?php echo $official_website; ?>" rel="nofollow" class="text-decoration-none">CSBC Official</a>.
    </footer>
    
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>