<!DOCTYPE html>
<html lang="ur" dir="rtl">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Installation Wizard | Madrasa Management System</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
    <link href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.1/font/bootstrap-icons.css" rel="stylesheet">
    <link
        href="https://fonts.googleapis.com/css2?family=Noto+Nastaliq+Urdu:wght@400;700&family=Inter:wght@400;600;700&display=swap"
        rel="stylesheet">
    <style>
        :root {
            --primary-color: #0d6efd;
            --bg-light: #f8f9fa;
        }

        body {
            font-family: 'Inter', 'Noto Nastaliq Urdu', sans-serif;
            background-color: var(--bg-light);
            min-height: 100vh;
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 20px;
        }

        .urdu-font {
            font-family: 'Noto Nastaliq Urdu', serif;
        }

        .wizard-card {
            max-width: 900px;
            width: 100%;
            background: white;
            border-radius: 20px;
            box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
            overflow: hidden;
            display: flex;
            flex-direction: column;
        }

        .wizard-header {
            background: linear-gradient(135deg, #0d6efd 0%, #0043a8 100%);
            color: white;
            padding: 30px;
            text-align: center;
            line-height: 6;
        }

        .wizard-steps {
            display: flex;
            justify-content: space-between;
            padding: 20px 40px;
            background: #fff;
            border-bottom: 1px solid #eee;
        }

        .step-item {
            text-align: center;
            flex: 1;
            position: relative;
        }

        .step-item:not(:last-child):after {
            content: '';
            position: absolute;
            top: 15px;
            right: 50%;
            width: 100%;
            height: 2px;
            background: #eee;
            z-index: 1;
        }

        .step-circle {
            width: 35px;
            height: 35px;
            border-radius: 50%;
            background: #eee;
            color: #666;
            display: flex;
            align-items: center;
            justify-content: center;
            margin: 0 auto 10px;
            position: relative;
            z-index: 2;
            font-weight: bold;
            transition: all 0.3s ease;
        }

        .step-item.active .step-circle {
            background: var(--primary-color);
            color: white;
            box-shadow: 0 0 0 5px rgba(13, 110, 253, 0.2);
        }

        .step-item.completed .step-circle {
            background: #198754;
            color: white;
        }

        .step-label {
            font-size: 12px;
            color: #666;
            font-weight: 600;
        }

        .wizard-body {
            display: flex;
            flex: 1;
        }

        .wizard-content {
            flex: 1;
            padding: 40px;
        }

        .wizard-help {
            width: 250px;
            background: #f1f3f5;
            padding: 40px 25px;
            border-right: 1px solid #eee;
            font-size: 14px;
            color: #495057;
        }

        .help-title {
            font-weight: 700;
            margin-bottom: 15px;
            color: var(--primary-color);
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .step-pane {
            display: none;
        }

        .step-pane.active {
            display: block;
            animation: fadeIn 0.5s ease;
        }

        @keyframes fadeIn {
            from {
                opacity: 0;
                transform: translateY(10px);
            }

            to {
                opacity: 1;
                transform: translateY(0);
            }
        }

        .check-item {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 12px;
            border-bottom: 1px solid #f1f1f1;
        }
    </style>
</head>

<body>

    <div class="wizard-card">
        <div class="wizard-header">
            <h2 class="urdu-font mb-2">سیٹ اپ مددگار (Setup Wizard)</h2>
            <p class="mb-0 opacity-75">مدارسہ مینجمنٹ سسٹم کی ابتدائی کنفیگریشن</p>
        </div>

        <div class="wizard-steps">
            <div class="step-item active" id="step1-indicator">
                <div class="step-circle">1</div>
                <div class="step-label">سسٹم چیک</div>
            </div>
            <div class="step-item" id="step2-indicator">
                <div class="step-circle">2</div>
                <div class="step-label">ڈیٹا بیس</div>
            </div>
            <div class="step-item" id="step3-indicator">
                <div class="step-circle">3</div>
                <div class="step-label">ایڈمن اکاؤنٹ</div>
            </div>
            <div class="step-item" id="step4-indicator">
                <div class="step-circle">4</div>
                <div class="step-label">ای میل</div>
            </div>
            <div class="step-item" id="step5-indicator">
                <div class="step-circle">5</div>
                <div class="step-label">سیٹنگز</div>
            </div>
        </div>

        <div class="wizard-body">
            <!-- Sidebar Help -->
            <div class="wizard-help">
                <div id="help-content">
                    <h6 class="help-title"><i class="bi bi-info-circle"></i> مدد (Help)</h6>
                    <p id="help-text">خوش آمدید! یہ مددگار آپ کو سسٹم انسٹال کرنے میں مدد کرے گا۔</p>
                </div>
            </div>

            <!-- Content -->
            <div class="wizard-content">
                <form id="installForm">

                    <!-- Step 1: System Check -->
                    <div class="step-pane active" id="step1">
                        <h4 class="mb-4 urdu-font">سسٹم کی ضروریات (System Check)</h4>
                        <div id="system-checks">
                            <div class="text-center p-4">
                                <div class="spinner-border text-primary" role="status"></div>
                                <p class="mt-2">سسٹم چیک کیا جا رہا ہے...</p>
                            </div>
                        </div>
                        <div class="mt-4 text-start">
                            <button type="button" class="btn btn-primary px-4" id="btnNext1" disabled>اگلا مرحلہ
                                (Next)</button>
                        </div>
                    </div>

                    <!-- Step 2: Database -->
                    <div class="step-pane" id="step2">
                        <h4 class="mb-4 urdu-font">ڈیٹا بیس کنفیگریشن</h4>
                        <div class="mb-3 text-end">
                            <label class="form-label">ڈیٹا بیس ہوسٹ (Host)</label>
                            <input type="text" class="form-control dir-ltr" name="db_host" value="localhost"
                                placeholder="localhost">
                        </div>
                        <div class="mb-3 text-end">
                            <label class="form-label">ڈیٹا بیس کا نام (Database Name)</label>
                            <input type="text" class="form-control dir-ltr" name="db_name" value="madrasa_db_new"
                                placeholder="madrasa_db">
                        </div>
                        <div class="mb-3 text-end">
                            <label class="form-label">یوزر نیم (Username)</label>
                            <input type="text" class="form-control dir-ltr" name="db_user" placeholder="root">
                        </div>
                        <div class="mb-3 text-end">
                            <label class="form-label">پاس ورڈ (Password)</label>
                            <input type="password" class="form-control dir-ltr" name="db_pass">
                        </div>
                        <div class="d-flex justify-content-between mt-4">
                            <button type="button" class="btn btn-outline-secondary px-4 btn-prev">پیچھے (Back)</button>
                            <div>
                                <button type="button" class="btn btn-info text-white px-3 me-2" id="btnTestDb">ٹیسٹ
                                    کنکشن</button>
                                <button type="button" class="btn btn-primary px-4" id="btnNext2" disabled>اگلا
                                    مرحلہ</button>
                            </div>
                        </div>
                    </div>

                    <!-- Step 3: Admin Account -->
                    <div class="step-pane" id="step3">
                        <h4 class="mb-4 urdu-font">ایڈمن اکاؤنٹ کی معلومات</h4>
                        <div class="mb-3 text-end">
                            <label class="form-label">مکمل نام (Full Name)</label>
                            <input type="text" class="form-control" name="admin_name" placeholder="ایڈمنسٹریٹر">
                        </div>
                        <div class="mb-3 text-end">
                            <label class="form-label">ای میل ایڈریس</label>
                            <input type="email" class="form-control dir-ltr" name="admin_email"
                                placeholder="admin@example.com">
                        </div>
                        <div class="mb-3 text-end">
                            <label class="form-label">پاس ورڈ</label>
                            <input type="password" class="form-control dir-ltr" name="admin_pass">
                        </div>
                        <div class="mb-3 text-end">
                            <label class="form-label">پاس ورڈ کی تصدیق</label>
                            <input type="password" class="form-control dir-ltr" name="admin_confirm">
                        </div>
                        <div class="d-flex justify-content-between mt-4">
                            <button type="button" class="btn btn-outline-secondary px-4 btn-prev">پیچھے</button>
                            <button type="button" class="btn btn-primary px-4" id="btnNext3">اگلا مرحلہ</button>
                        </div>
                    </div>

                    <!-- Step 4: Email Config (Optional) -->
                    <div class="step-pane" id="step4">
                        <div class="d-flex justify-content-between align-items-center mb-4">
                            <h4 class="mb-0 urdu-font">ای میل کنفیگریشن (اختیاری)</h4>
                            <span class="badge bg-secondary">Optional</span>
                        </div>
                        <div class="mb-3 text-end">
                            <label class="form-label">SMTP Host</label>
                            <input type="text" class="form-control dir-ltr" name="mail_host"
                                placeholder="smtp.gmail.com">
                        </div>
                        <div class="row g-3 mb-3">
                            <div class="col-6 text-end">
                                <label class="form-label">پورٹ (Port)</label>
                                <input type="number" class="form-control dir-ltr" name="mail_port" placeholder="465">
                            </div>
                            <div class="col-6 text-end">
                                <label class="form-label">Encryption</label>
                                <select class="form-select dir-ltr" name="mail_enc">
                                    <option value="ssl">SSL</option>
                                    <option value="tls">TLS</option>
                                </select>
                            </div>
                        </div>
                        <div class="mb-3 text-end">
                            <label class="form-label">ای میل یوزر نیم</label>
                            <input type="text" class="form-control dir-ltr" name="mail_user">
                        </div>
                        <div class="mb-3 text-end">
                            <label class="form-label">ای میل پاس ورڈ</label>
                            <input type="password" class="form-control dir-ltr" name="mail_pass">
                        </div>
                        <div class="d-flex justify-content-between mt-4">
                            <button type="button" class="btn btn-outline-secondary px-4 btn-prev">پیچھے</button>
                            <div>
                                <button type="button" class="btn btn-link text-decoration-none me-3"
                                    id="btnSkipEmail">بعد میں کریں (Skip)</button>
                                <button type="button" class="btn btn-primary px-4" id="btnNext4">اگلا مرحلہ</button>
                            </div>
                        </div>
                    </div>

                    <!-- Step 5: App Settings -->
                    <div class="step-pane" id="step5">
                        <h4 class="mb-4 urdu-font">ایپلی کیشن سیٹنگز</h4>
                        <div class="mb-3 text-end">
                            <label class="form-label">سائٹ کا نام</label>
                            <input type="text" class="form-control" name="app_name" value="Madrasa Management System">
                        </div>
                        <div class="mb-3 text-end">
                            <label class="form-label">بیس یو آر ایل (Base URL)</label>
                            <input type="text" class="form-control dir-ltr" name="app_url" value="http://madrasa.com">
                        </div>
                        <div class="mb-3 text-end">
                            <label class="form-label">ٹائم زون</label>
                            <select class="form-select dir-ltr" name="app_timezone">
                                <option value="Asia/Karachi">Asia/Karachi</option>
                                <option value="UTC">UTC</option>
                            </select>
                        </div>
                        <div class="d-flex justify-content-between mt-4">
                            <button type="button" class="btn btn-outline-secondary px-4 btn-prev">پیچھے</button>
                            <button type="button" class="btn btn-success px-5" id="btnFinish">انسٹالیشن مکمل
                                کریں!</button>
                        </div>
                    </div>

                </form>
            </div>
        </div>
    </div>

    <script src="https://code.jquery.com/jquery-3.7.1.min.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
    <script src="install.js"></script>
</body>

</html>