<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>easyenglishtranslator</title>
    <meta name="description" content="Translate text on images and PDF scans easily. Upload your document, choose languages, and let AI provide you with an accurate translation.">
    <meta name="keywords" content="document translator, pdf translator, image translator, ocr translation, ai translation, language tool, easy english translator, Built with Flatlogic Generator">
    <meta property="og:title" content="easyenglishtranslator">
    <meta property="og:description" content="Translate text on images and PDF scans easily.">
    <meta property="og:image" content="">
    <meta name="twitter:card" content="summary_large_image">
    <meta name="twitter:image" content="">

    <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">
    <link rel="preconnect" href="https://fonts.googleapis.com">
    <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
    <link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet">
    <link rel="stylesheet" href="assets/css/custom.css?v=<?php echo time(); ?>">
</head>
<body>

    <nav class="navbar navbar-expand-lg navbar-light bg-white shadow-sm">
        <div class="container">
            <a class="navbar-brand" href="#">
                <i class="bi bi-translate text-primary"></i>
                easyenglishtranslator
            </a>
        </div>
    </nav>

    <header class="hero">
        <div class="container">
            <h1>Document Translation Made Simple</h1>
            <p class="lead">Upload a PDF or image, select your languages, and let our AI do the rest.</p>
        </div>
    </header>

    <main class="container my-5">
        
        
        <div class="row justify-content-center">
            <div class="col-lg-8">
                <div class="translation-box">
                    <form id="translation-form">
                        <div class="mb-4">
                            <label for="document-upload" class="form-label">1. Upload Your Document</label>
                            <div class="custom-file-upload">
                                <i class="bi bi-cloud-arrow-up-fill fs-1 text-primary"></i>
                                <p class="mt-2 mb-0">Click to browse or drag & drop your file here</p>
                                <p class="text-muted small">(PDF, JPG, PNG, TIFF)</p>
                            </div>
                            <input type="file" id="document-upload" class="d-none" accept=".pdf,.jpg,.jpeg,.png,.tiff">
                            <div id="file-upload-filename" class="text-center"></div>
                        </div>

                        <div class="row mb-4">
                            <div class="col-md-6">
                                <label for="source-lang" class="form-label">2. Source Language</label>
                                <select class="form-select" id="source-lang" required>
                                    <option selected disabled value="">Choose...</option>
                                    <option value="auto">Auto-detect</option>
                                    <option value="en">English</option>
                                    <option value="es">Spanish</option>
                                    <option value="fr">French</option>
                                    <option value="de">German</option>
                                    <option value="it">Italian</option>
                                    <option value="pt">Portuguese</option>
                                    <option value="nl">Dutch</option>
                                    <option value="ru">Russian</option>
                                    <option value="ja">Japanese</option>
                                    <option value="ko">Korean</option>
                                    <option value="zh">Chinese (Simplified)</option>
                                    <option value="ar">Arabic</option>
                                    <option value="hi">Hindi</option>
                                </select>
                            </div>
                            <div class="col-md-6">
                                <label for="target-lang" class="form-label">3. Target Language</label>
                                <select class="form-select" id="target-lang" required>
                                    <option selected disabled value="">Choose...</option>
                                    <option value="en">English</option>
                                    <option value="es">Spanish</option>
                                    <option value="fr">French</option>
                                    <option value="de">German</option>
                                    <option value="it">Italian</option>
                                    <option value="pt">Portuguese</option>
                                    <option value="nl">Dutch</option>
                                    <option value="ru">Russian</option>
                                    <option value="ja">Japanese</option>
                                    <option value="ko">Korean</option>
                                    <option value="zh">Chinese (Simplified)</option>
                                    <option value="ar">Arabic</option>
                                    <option value="hi">Hindi</option>
                                </select>
                            </div>
                        </div>

                        <div id="preview-container" class="text-center" style="display: none;">
                            <h5 class="mt-4">Document Preview</h5>
                            
                            <img id="image-preview" src="#" alt="Image Preview" class="img-fluid rounded border" style="max-height: 400px; display: none;"/>

                            <div id="pdf-preview" class="py-5" style="display: none;">
                                <i class="bi bi-file-earmark-pdf-fill text-danger" style="font-size: 4rem;"></i>
                                <p id="pdf-filename" class="mt-2 mb-0"></p>
                            </div>

                            <div class="d-grid mt-3">
                                <button type="button" id="start-translation-btn" class="btn btn-primary btn-lg" style="display: none;">
                                    <i class="bi bi-stars"></i> Translate
                                </button>
                            </div>
                        </div>
                    </form>
                    <div id="response-message" class="mt-4"></div>
                    <div id="processing-message" class="alert alert-info mt-4" role="alert" style="display: none;">
                        <div class="d-flex align-items-center">
                            <div class="spinner-border text-primary me-3" role="status">
                                <span class="visually-hidden">Loading...</span>
                            </div>
                            <span>Processing your document... This may take a moment.</span>
                        </div>
                    </div>

                    <div id="translation-output-container" class="card mt-4" style="display: none;">
                        <div class="card-header fw-bold">
                            <i class="bi bi-check-circle-fill text-success me-2"></i>Translation Result
                        </div>
                        <div class="card-body">
                            <pre id="translation-output" class="mb-0" style="white-space: pre-wrap; font-family: inherit; font-size: 1rem;"></pre>
                        </div>
                        <div class="card-footer bg-light text-end">
                            <button id="copy-btn" class="btn btn-secondary btn-sm"><i class="bi bi-clipboard me-1"></i> Copy Text</button>
                            <button id="download-btn" class="btn btn-primary btn-sm"><i class="bi bi-download me-1"></i> Download PDF</button>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </main>

    <footer class="text-center py-4 text-muted">
        <div class="container">
            <p>&copy; <?php echo date("Y"); ?> easyenglishtranslator. All Rights Reserved. Built with Flatlogic.</p>
        </div>
    </footer>

    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/2.5.1/jspdf.umd.min.js"></script>
    <script src="assets/js/main.js?v=<?php echo time(); ?>"></script>
</body>
</html>