<!DOCTYPE html>
<html lang="en">
<head>
    
    
    <!-- Google AdSense -->
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-3882393371567164"
 crossorigin="anonymous"></script>
 
 
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <title>Job Details | JobsAlertIndia</title>
    
    <base href="/">
    
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.0/css/all.min.css">
    <link href="https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap" rel="stylesheet">
    <link rel="icon" href="assets/imagebrowser.jpg" type="image/jpg">
    <link rel="apple-touch-icon" href="assets/imagebrowser.jpg">

    <style>
        :root { --primary: #6366f1; --accent: #f59e0b; --bg-deep: #020617; --card-bg: rgba(30, 41, 59, 0.7); --text-main: #f1f5f9; --text-muted: #94a3b8; --border: rgba(255, 255, 255, 0.1); }
        * { box-sizing: border-box; max-width: 100%; }
        body { margin: 0; padding: 0; font-family: 'Plus Jakarta Sans', sans-serif; background-color: var(--bg-deep); background-image: radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.12) 0px, transparent 50%), radial-gradient(at 100% 100%, rgba(168, 85, 247, 0.12) 0px, transparent 50%); color: var(--text-main); overflow-x: hidden; width: 100vw; line-height: 1.6; }
        .site-header { background: rgba(15, 23, 42, 0.85); backdrop-filter: blur(12px); padding: 15px 25px; border-bottom: 1px solid var(--border); }
        .site-header h1 { margin: 0; color: #fff; font-size: 22px; font-weight: 800; letter-spacing: -0.5px; }
        .site-header span { color: var(--accent); }
        .nav-bar { padding: 12px 25px; display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 1000; background: rgba(2, 6, 23, 0.6); backdrop-filter: blur(10px); }
        .nav-bar a { color: var(--text-muted); text-decoration: none; font-weight: 600; font-size: 14px; transition: 0.3s; }
        .nav-bar a:hover { color: var(--primary); }
        .main-wrapper { max-width: 1150px; margin: 15px auto 50px; padding: 0 15px; display: flex; flex-direction: row; gap: 25px; }
        .content-area { flex: 1; min-width: 0; }
        .sidebar { width: 340px; }
        .card { background: var(--card-bg); backdrop-filter: blur(20px); border: 1px solid var(--border); border-radius: 24px; padding: 25px; box-shadow: 0 20px 50px rgba(0,0,0,0.4); margin-bottom: 25px; }
        .job-banner { width: 100%; border-radius: 16px; margin-bottom: 20px; border: 1px solid var(--border); display: block; }
        .job-title { font-size: 28px; font-weight: 800; margin: 0; background: linear-gradient(to right, #fff, #94a3b8); -webkit-background-clip: text; -webkit-text-fill-color: transparent; line-height: 1.3; }
        .stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 15px; margin: 30px 0; }
        .stat-box { background: rgba(255, 255, 255, 0.03); padding: 18px 10px; border-radius: 20px; text-align: center; border: 1px solid var(--border); display: flex; flex-direction: column; align-items: center; transition: 0.3s ease; }
        .stat-box:hover { background: rgba(255, 255, 255, 0.08); transform: translateY(-5px); border-color: var(--primary); }
        .stat-icon { width: 44px; height: 44px; border-radius: 12px; display: flex; align-items: center; justify-content: center; margin-bottom: 10px; font-size: 18px; }
        .icon-qual { background: rgba(99, 102, 241, 0.15); color: #818cf8; }
        .icon-posts { background: rgba(16, 185, 129, 0.15); color: #34d399; }
        .icon-date { background: rgba(244, 63, 94, 0.15); color: #fb7185; }
        .stat-box span { font-size: 10px; text-transform: uppercase; color: var(--text-muted); font-weight: 700; letter-spacing: 0.5px; }
        .stat-box b { font-size: 14px; color: #fff; margin-top: 5px; }
        .details-text { line-height: 1.8; font-size: 15px; color: #cbd5e1; }
        .details-text h3 { color: #fff; margin-top: 30px; border-left: 4px solid var(--primary); padding-left: 12px; }
        .details-text table { width: 100% !important; display: block; overflow-x: auto; border-collapse: separate; border-spacing: 0; margin: 20px 0; border-radius: 12px; border: 1px solid var(--border); -webkit-overflow-scrolling: touch; }
        .details-text td, .details-text th { padding: 12px; border-bottom: 1px solid var(--border); border-right: 1px solid var(--border); min-width: 110px; }
        .details-text th { background: rgba(99, 102, 241, 0.1); color: var(--primary); font-weight: 700; }
        .btn { background: linear-gradient(135deg, var(--primary), #818cf8); color: white; padding: 16px; text-align: center; text-decoration: none; display: flex; align-items: center; justify-content: center; gap: 10px; border-radius: 14px; font-weight: 700; box-shadow: 0 10px 20px rgba(99, 102, 241, 0.3); transition: 0.3s; }
        .btn:hover { transform: translateY(-2px); box-shadow: 0 15px 30px rgba(99, 102, 241, 0.4); }
        @media (max-width: 900px) { .main-wrapper { flex-direction: column; padding: 0 12px; } .sidebar { width: 100%; } .stats { grid-template-columns: 1fr; gap: 10px; } .job-title { font-size: 24px; } .card { padding: 20px; } aside { position: static !important; } }
        #loading { position: fixed; inset: 0; background: var(--bg-deep); z-index: 2000; display: flex; flex-direction: column; align-items: center; justify-content: center; color: white; font-weight: 600; }
        .spinner { width: 40px; height: 40px; border: 3px solid rgba(255,255,255,0.1); border-top: 3px solid var(--primary); border-radius: 50%; animation: spin 1s linear infinite; margin-bottom: 15px; }
        @keyframes spin { to { transform: rotate(360deg); } }
        ::selection { background: rgba(99, 102, 241, 0.4); color: #fff; }
    </style>
</head>
<body>

<div id="loading">
    <div class="spinner"></div>
    Fetching Latest Data...
</div>

<header class="site-header">
    <h1>JobsAlert<span>India</span></h1>
</header>

<nav class="nav-bar">
    <a href="/"><i class="fa-solid fa-chevron-left"></i> Back to Jobs</a>
    <a href="/" title="Home"><i class="fa-solid fa-house"></i></a>
</nav>

<div class="main-wrapper" id="mainContent" style="display:none;">
    <div class="content-area">
        <div class="card">
            <img id="banner" class="job-banner" src="" alt="Recruitment Banner">
            <h1 id="title" class="job-title"></h1>
            <p id="org" style="color:var(--primary); font-weight:700; margin:15px 0; font-size: 18px;"></p>

            <div class="stats">
                <div class="stat-box">
                    <div class="stat-icon icon-qual"><i class="fa-solid fa-graduation-cap"></i></div>
                    <span>Qualification</span>
                    <b id="qual"></b>
                </div>
                <div class="stat-box">
                    <div class="stat-icon icon-posts"><i class="fa-solid fa-users-viewfinder"></i></div>
                    <span>Total Vacancy</span>
                    <b id="posts"></b>
                </div>
                <div class="stat-box" style="border-bottom: 2px solid rgba(244, 63, 94, 0.3);">
                    <div class="stat-icon icon-date"><i class="fa-solid fa-calendar-check"></i></div>
                    <span>Last Date</span>
                    <b id="date" style="color:#f87171;"></b>
                </div>
            </div>

<div class="details-text">
                <h3>Recruitment Details</h3>
                <div id="details"></div>
            </div>
        </div>

<div class="card" style="margin-top: 25px;">
    <h3 style="color: #fff; border-left: 4px solid var(--primary); padding-left: 12px; margin-bottom: 15px; margin-top: 0; font-size: 18px;">How to Apply for this Recruitment</h3>
    <p style="color: #cbd5e1; font-size: 14px; line-height: 1.8; margin-bottom: 10px;">Applying for government and private sector jobs requires careful attention to detail. Before proceeding with your application, ensure you have read the official notification thoroughly. Check the eligibility criteria, including educational qualifications, age limits, and required experience. Gather all necessary documents such as your Aadhar card, educational certificates, scanned passport-size photograph, and digital signature.</p>
    <p style="color: #cbd5e1; font-size: 14px; line-height: 1.8; margin-bottom: 0;">To submit your application, click on the application links provided on this page. This will redirect you to the official recruitment portal. Register yourself using a valid email ID and mobile number. Fill out the online application form with accurate details, upload the required documents in the specified format, and pay the application fee if applicable. Always save a copy or print the final submitted application form for your future reference and exam preparation.</p>
</div>
</div>

    <aside class="sidebar">
        <div class="card" style="text-align: center; position: sticky; top: 100px;">
            <div style="background: rgba(99, 102, 241, 0.1); width: 55px; height: 55px; border-radius: 50%; display: flex; align-items: center; justify-content: center; margin: 0 auto 15px; color: var(--primary); font-size: 22px;">
                <i class="fa-solid fa-paper-plane"></i>
            </div>
            <h3 style="margin: 0 0 10px 0; color: #fff;">Instant Apply</h3>
            <p style="font-size: 13px; color: var(--text-muted); margin-bottom: 20px;">Get directed to the official portal to submit your application.</p>
            <div id="btnArea"></div>
        </div>
    </aside>
</div>

<script>
    function decodeHtml(html) {
        const txt = document.createElement("textarea");
        txt.innerHTML = html;
        return txt.value;
    }

    // 🔴 THIS GRABS THE CLEAN URL (e.g. 'wipro-recruitment')
    let slug = new URLSearchParams(window.location.search).get('slug');
    if (!slug) {
        let pathArray = window.location.pathname.split('/').filter(Boolean);
        slug = pathArray[0]; // Gets the first part of the URL path
    }

    if(slug) {
        fetch(`/api/get-job.php?slug=${slug}`)
        .then(res => res.json())
        .then(data => {
            if(data.error) {
                document.body.innerHTML = `
                <div style='height:100vh; display:flex; flex-direction:column; align-items:center; justify-content:center; background:#020617; text-align:center;'>
                    <h2 style='color:white;'>Notification Not Found</h2>
                    <p style='color:#f87171; margin-top: 10px; font-size: 18px;'><b>Error:</b> ${data.error}</p>
                    <a href="/" style="margin-top:20px; color: white; background: #6366f1; padding: 10px 20px; border-radius: 8px; text-decoration: none;">Go Back Home</a>
                </div>`;
                return;
            }

            let banner = "/uploads/banner.jpg"; 
            if(data.job_image && data.job_image.trim() !== ""){
                if(data.job_image.startsWith("http")){
                    banner = data.job_image;
                }else{
                    banner = "/uploads/" + data.job_image;
                }
            }
            document.getElementById("banner").src = banner;

            document.getElementById("title").innerText = data.job_title;
            document.getElementById("org").innerText = data.organization;
            document.getElementById("qual").innerText = data.qualification || "As per notification";
            document.getElementById("posts").innerText = data.total_posts || "Multiple";
            document.getElementById("date").innerText = data.last_date || "N/A";
            document.getElementById("details").innerHTML = decodeHtml(data.more_info || "");

            let btnHtml = ""; 
            const secType = (data.section_type || "").toLowerCase();
            let mainLabel = "Apply Now";
            let mainIcon = "fa-rocket";
            
            if (secType.includes("result")) { mainLabel = "View Result"; mainIcon = "fa-square-check"; }
            else if (secType.includes("admit")) { mainLabel = "Download Admit"; mainIcon = "fa-id-card"; }

            if (data.apply_link && data.apply_link.trim() !== "") {
                btnHtml += `<a href="${data.apply_link}" class="btn" target="_blank" style="margin-bottom: 12px;">${mainLabel} <i class="fa-solid ${mainIcon}"></i></a>`;
            }
            if (data.pdf_link && data.pdf_link.trim() !== "") {
                btnHtml += `<a href="${data.pdf_link}" class="btn" target="_blank" style="background: linear-gradient(135deg, #e11d48, #fb7185); margin-bottom: 12px;">Download PDF <i class="fa-solid fa-file-pdf"></i></a>`;
            }
            if (data.official_website && data.official_website.trim() !== "") {
                btnHtml += `<a href="${data.official_website}" class="btn" target="_blank" style="background: linear-gradient(135deg, #059669, #34d399); margin-bottom: 12px;">Official Website <i class="fa-solid fa-globe"></i></a>`;
            }
            if (data.extra_link && data.extra_link.trim() !== "") {
                let checkUrl = data.extra_link.toLowerCase();
                if (checkUrl.includes("youtube.com") || checkUrl.includes("youtu.be")) {
                    btnHtml += `<a href="${data.extra_link}" class="btn" target="_blank" style="background: linear-gradient(135deg, #ff0000, #dc2626); margin-bottom: 12px;">Watch on YouTube <i class="fa-brands fa-youtube"></i></a>`;
                } else {
                    btnHtml += `<a href="${data.extra_link}" class="btn" target="_blank" style="background: linear-gradient(135deg, #d97706, #fbbf24); margin-bottom: 12px;">More Info <i class="fa-solid fa-link"></i></a>`;
                }
            }
            if (data.Youtube && data.Youtube.trim() !== "") {
                btnHtml += `<a href="${data.Youtube}" class="btn" target="_blank" style="background: linear-gradient(135deg, #ff0000, #dc2626); margin-bottom: 12px;">Watch on YouTube <i class="fa-brands fa-youtube"></i></a>`;
            }

            if (btnHtml === "") {
                btnHtml = `<p style="color: var(--text-muted); font-size: 13px; text-align: center;">Links will be updated soon.</p>`;
            }

            document.getElementById("btnArea").innerHTML = btnHtml;
            document.getElementById("loading").style.display = "none";
            document.getElementById("mainContent").style.display = "flex";
        })
        .catch(() => {
            document.getElementById("loading").innerHTML = "<p style='color:white;'>Error loading data. Please refresh.</p>";
        });
    } else {
        window.location.href = "/";
    }
</script>

</body>
</html>