.elementor-3133 .elementor-element.elementor-element-0421d30{--display:flex;--min-height:1440px;--flex-direction:column;--container-widget-width:100%;--container-widget-height:initial;--container-widget-flex-grow:0;--container-widget-align-self:initial;--flex-wrap-mobile:wrap;}/* Start custom CSS for html, class: .elementor-element-0615867 */body {
    font-family: Arial, sans-serif;
    background-color: #f4f4f4;
    margin: 0;
    padding: 20px;
}

/* Search Container (matching your design) */
.search-container {
    background-color: #1a3c5e;
    color: white;
    padding: 20px;
    border-radius: 10px;
    text-align: center;
    margin-bottom: 20px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.search-container h2 {
    margin: 0 0 15px;
    font-size: 24px;
}

.search-bar {
    display: flex;
    justify-content: center;
    align-items: center;
}

.search-bar input {
    padding: 10px;
    width: 300px;
    border: 1px solid #ccc;
    border-radius: 5px 0 0 5px;
    outline: none;
}

.search-bar button {
    padding: 10px 20px;
    background-color: #f5a623;
    color: white;
    border: none;
    border-radius: 0 5px 5px 0;
    cursor: pointer;
    transition: background-color 0.3s;
}

.search-bar button:hover {
    background-color: #e69520;
}

/* Results Container */
.results-container {
    background-color: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.results-container h3 {
    margin: 0 0 15px;
    color: #1a3c5e;
}

/* Results Display */
.results-display {
    border: 1px solid #ccc;
    border-radius: 5px;
    padding: 15px;
    min-height: 200px;
    overflow-y: auto;
    background-color: #f9f9f9;
    font-size: 16px;
    line-height: 1.5;
}
<style>
    /* CSS code (as provided above) */
    .search-container {
        background-color: #1a3c5e;
        color: white;
        padding: 20px;
        border-radius: 10px;
        text-align: center;
        margin-bottom: 20px;
        box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    }

    .search-container h2 {
        margin: 0 0 15px;
        font-size: 24px;
    }

    .search-bar {
        display: flex;
        justify-content: center;
        align-items: center;
    }

    .search-bar input {
        padding: 10px;
        width: 300px;
        border: 1px solid #ccc;
        border-radius: 5px 0 0 5px;
        outline: none;
    }

    .search-bar button {
        padding: 10px 20px;
        background-color: #f5a623;
        color: white;
        border: none;
        border-radius: 0 5px 5px 0;
        cursor: pointer;
        transition: background-color 0.3s;
    }

    .search-bar button:hover {
        background-color: #e69520;
    }

    .results-container {
        background-color: white;
        padding: 20px;
        border-radius: 10px;
        box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    }

    .results-container h3 {
        margin: 0 0 15px;
        color: #1a3c5e;
    }

    .results-display {
        border: 1px solid #ccc;
        border-radius: 5px;
        padding: 15px;
        min-height: 100px;
        overflow-x: auto;
        background-color: #f9f9f9;
        font-size: 16px;
        line-height: 1.5;
    }

    .results-display table {
        width: 100%;
        border-collapse: collapse;
        margin-top: 10px;
    }

    .results-display table th,
    .results-display table td {
        border: 1px solid #ddd;
        padding: 8px;
        text-align: left;
    }

    .results-display table th {
        background-color: #1a3c5e;
        color: white;
    }

    .results-display table td {
        background-color: #fff;
    }

    .results-display table tr:nth-child(even) td {
        background-color: #f9f9f9;
    }
</style>

<!-- Search Bar (matching your design) -->
<div class="search-container">
    <h2>AUTHORIZED CENTER</h2>
    <div class="search-bar">
        <input type="text" id="centerInput" placeholder="Enter Center Name or Code">
        <button onclick="searchCenter()">Search</button>
    </div>
</div>

<!-- Results Container -->
<div class="results-container">
    <h3>Search Results</h3>
    <div id="results" class="results-display">
        <!-- Results will be displayed here -->
    </div>
</div>

<!-- Include pdf.js and the JavaScript code -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdf.js/2.9.359/pdf.min.js"></script>
<script>
    // Load PDF.js worker
    pdfjsLib.GlobalWorkerOptions.workerSrc = 'https://cdnjs.cloudflare.com/ajax/libs/pdf.js/2.9.359/pdf.worker.min.js';

    let centers = [];

    // Function to load and parse the PDF
    async function loadPDF() {
        try {
            const pdfUrl = 'https://virtualcouncil.in/wp-content/uploads/2025/04/Notes.pdf';
            const pdf = await pdfjsLib.getDocument(pdfUrl).promise;
            let textContent = '';

            // Loop through each page of the PDF
            for (let pageNum = 1; pageNum <= pdf.numPages; pageNum++) {
                const page = await pdf.getPage(pageNum);
                const text = await page.getTextContent();
                textContent += text.items.map(item => item.str).join(' ') + '\n';
            }

            // Parse the text into a structured format
            centers = parsePDFText(textContent);
        } catch (error) {
            console.error('Error loading PDF:', error);
            document.getElementById('results').innerHTML = 'Error loading PDF. Please try again later.';
        }
    }

    // Function to parse PDF text into a structured format
    function parsePDFText(text) {
        const lines = text.split('\n');
        const centersArray = [];
        
        // Skip the header row (S.NO BOARD CENTRE NAME PLACE STARTING DATE VALIDITY PERIOD)
        for (let i = 1; i < lines.length; i++) {
            const line = lines[i].trim();
            if (line) {
                // Split the line into columns based on spaces (this is a simple approach; adjust if needed)
                const columns = line.split(/\s+/);
                
                // Ensure we have enough columns (sometimes spaces in names can cause issues)
                if (columns.length >= 6) {
                    const center = {
                        sno: columns[0], // S.NO
                        board: columns[1], // BOARD (TAMILNADU)
                        centreName: '', // We'll build this by combining columns until we hit the place
                        place: '',
                        startingDate: '',
                        validityPeriod: ''
                    };

                    // Extract CENTRE NAME (which may span multiple columns)
                    let placeIndex = -1;
                    for (let j = 2; j < columns.length; j++) {
                        if (columns[j].includes(',')) { // Look for the comma in the PLACE column (e.g., THENI,)
                            placeIndex = j;
                            break;
                        }
                        center.centreName += columns[j] + ' ';
                    }
                    center.centreName = center.centreName.trim();

                    // Extract PLACE (e.g., THENI, TAMILNADU)
                    center.place = columns[placeIndex] + ' ' + columns[placeIndex + 1];

                    // Extract STARTING DATE (e.g., 10-06-2024)
                    center.startingDate = columns[placeIndex + 2];

                    // Extract VALIDITY PERIOD (e.g., 2 YEARS)
                    center.validityPeriod = columns[placeIndex + 3] + (columns[placeIndex + 4] ? ' ' + columns[placeIndex + 4] : '');

                    centersArray.push(center);
                }
            }
        }

        return centersArray;
    }

    // Function to search for a center and display results
    function searchCenter() {
        const input = document.getElementById('centerInput').value.trim().toLowerCase();
        const resultsDiv = document.getElementById('results');

        // Clear previous results
        resultsDiv.innerHTML = '';

        if (!input) {
            resultsDiv.innerHTML = 'Please enter a center name.';
            return;
        }

        // Search for matching center
        const result = centers.find(center => 
            center.centreName.toLowerCase().includes(input)
        );

        // Display results in a table
        if (result) {
            resultsDiv.innerHTML = `
                <table>
                    <thead>
                        <tr>
                            <th>S.NO</th>
                            <th>BOARD</th>
                            <th>CENTRE NAME</th>
                            <th>PLACE</th>
                            <th>STARTING DATE</th>
                            <th>VALIDITY PERIOD</th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr>
                            <td>${result.sno}</td>
                            <td>${result.board}</td>
                            <td>${result.centreName}</td>
                            <td>${result.place}</td>
                            <td>${result.startingDate}</td>
                            <td>${result.validityPeriod}</td>
                        </tr>
                    </tbody>
                </table>
            `;
        } else {
            resultsDiv.innerHTML = 'No matching center found.';
        }
    }

    // Load the PDF when the page loads
    window.onload = loadPDF;
</script>/* End custom CSS */