<!DOCTYPE html>
<html lang="fa" dir="rtl">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>CDN Health Check</title>
    <style>
        body { font-family: system-ui, -apple-system, sans-serif; background: #0f172a; color: #f8fafc; display: flex; justify-content: center; align-items: center; min-height: 100vh; margin: 0; }
        .card { background: #1e293b; padding: 2.5rem; border-radius: 16px; box-shadow: 0 10px 30px rgba(0,0,0,0.5); text-align: center; border: 1px solid #334155; max-width: 450px; width: 90%; }
        .status { color: #22c55e; font-size: 1.25rem; font-weight: bold; margin-bottom: 1.2rem; }
        .clock-box { background: #0b1329; border: 1px solid #1e293b; border-radius: 10px; padding: 1rem; margin-bottom: 1.5rem; }
        .clock-label { font-size: 0.85rem; color: #94a3b8; margin-bottom: 0.3rem; }
        .clock { font-size: 2rem; font-weight: 700; color: #38bdf8; font-family: monospace; letter-spacing: 2px; direction: ltr; }
        .date { font-size: 0.9rem; color: #cbd5e1; margin-top: 0.3rem; }
        .meta { font-size: 0.85rem; color: #94a3b8; line-height: 1.8; text-align: left; direction: ltr; background: #0b1329; padding: 1rem; border-radius: 8px; border-left: 3px solid #38bdf8; }
    </style>
</head>
<body>
    <div class="card">
        <div class="status">✓ ارتباط CDN و HAProxy برقرار است</div>
        
        <div class="clock-box">
            <div class="clock-label">ساعت لحظه‌ای تهران (IRDT / IRST)</div>
            <div id="tehran-time" class="clock">--:--:--</div>
            <div id="tehran-date" class="date">--</div>
        </div>

        <div class="meta">
            <strong>Edge/HAProxy IP:</strong> 127.0.0.1<br>
            <strong>Host Header:</strong> test2.behdashttejaratkaveh.ir<br>
            <strong>Protocol:</strong> HTTP/1.1
        </div>
    </div>

    <script>
        function updateClock() {
            const now = new Date();
            
            // زمان لحظه‌ای تهران
            const timeOptions = { timeZone: "Asia/Tehran", hour12: false, hour: "2-digit", minute: "2-digit", second: "2-digit" };
            document.getElementById("tehran-time").textContent = new Intl.DateTimeFormat("en-US", timeOptions).format(now);

            // تاریخ شمسی لحظه‌ای
            const dateOptions = { timeZone: "Asia/Tehran", year: "numeric", month: "long", day: "numeric", weekday: "long" };
            document.getElementById("tehran-date").textContent = new Intl.DateTimeFormat("fa-IR", dateOptions).format(now);
        }
        setInterval(updateClock, 1000);
        updateClock();
    </script>
</body>
</html>