@php
    $maintenanceEndsAt = now()->addMinutes(15);
    $maintenanceEndsAtMs = $maintenanceEndsAt->timestamp * 1000;
    $maintenanceEndsAtLabel = $maintenanceEndsAt->format('d M Y H:i');
@endphp
<!DOCTYPE html>
<html lang="id">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Sedang Maintenance</title>
    <meta name="robots" content="noindex,nofollow">
    <style>
        :root {
            --bg: #f5f7fb;
            --card: #ffffff;
            --text: #111827;
            --muted: #6b7280;
            --border: #e5e7eb;
            --primary: #2563eb;
        }

        @media (prefers-color-scheme: dark) {
            :root {
                --bg: #0f172a;
                --card: #111827;
                --text: #f9fafb;
                --muted: #94a3b8;
                --border: #1f2937;
                --primary: #3b82f6;
            }
        }

        * {
            box-sizing: border-box;
        }

        body {
            margin: 0;
            min-height: 100vh;
            font-family: Inter, Arial, Helvetica, sans-serif;
            background: var(--bg);
            color: var(--text);
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 24px;
        }

        .wrapper {
            width: 100%;
            max-width: 480px;
        }

        .card {
            background: var(--card);
            border: 1px solid var(--border);
            border-radius: 16px;
            padding: 32px;
            box-shadow: 0 8px 30px rgba(0, 0, 0, 0.06);
            text-align: center;
        }

        .status {
            display: inline-block;
            margin-bottom: 16px;
            padding: 6px 10px;
            border-radius: 999px;
            background: rgba(37, 99, 235, 0.08);
            color: var(--primary);
            font-size: 12px;
            font-weight: 600;
        }

        h1 {
            margin: 0 0 12px;
            font-size: 28px;
            line-height: 1.3;
            font-weight: 700;
        }

        p {
            margin: 0;
            color: var(--muted);
            line-height: 1.7;
            font-size: 14px;
        }

        .countdown-box {
            margin-top: 24px;
            padding: 18px;
            border: 1px solid var(--border);
            border-radius: 12px;
            background: rgba(37, 99, 235, 0.04);
        }

        .countdown-label {
            font-size: 12px;
            color: var(--muted);
            margin-bottom: 8px;
        }

        .countdown-time {
            font-size: 32px;
            font-weight: 700;
            letter-spacing: 0.04em;
            color: var(--text);
        }

        .countdown-note {
            margin-top: 8px;
            font-size: 13px;
            color: var(--muted);
        }

        .footer {
            margin-top: 18px;
            font-size: 12px;
            color: var(--muted);
            text-align: center;
        }

        @media (max-width: 520px) {
            .card {
                padding: 24px;
            }

            h1 {
                font-size: 24px;
            }

            .countdown-time {
                font-size: 28px;
            }
        }
    </style>
</head>
<body>
    <div class="wrapper">
        <div class="card">
            <div class="status">Maintenance</div>

            <h1>Sistem sedang dalam perawatan</h1>

            <p>
                Kami sedang melakukan maintenance untuk penghapusan inject JUDOL  .
            </p>

            <div class="countdown-box">
                <div class="countdown-label">Estimasi selesai</div>
                <div class="countdown-time" id="countdown">01:00:00</div>
                <div class="countdown-note" id="statusText">
                    Sekitar {{ $maintenanceEndsAtLabel }}
                </div>
            </div>
        </div>

        <div class="footer">
            © {{ date('Y') }} {{ config('app.name', 'Application') }}
        </div>
    </div>

    <script>
        const endAt = {{ $maintenanceEndsAtMs }};
        const countdownEl = document.getElementById('countdown');
        const statusTextEl = document.getElementById('statusText');

        function pad(value) {
            return String(value).padStart(2, '0');
        }

        function updateCountdown() {
            const now = Date.now();
            const distance = endAt - now;

            if (distance <= 0) {
                countdownEl.textContent = '00:00:00';
                statusTextEl.textContent = 'Silakan muat ulang halaman.';
                return;
            }

            const totalSeconds = Math.floor(distance / 1000);
            const hours = Math.floor(totalSeconds / 3600);
            const minutes = Math.floor((totalSeconds % 3600) / 60);
            const seconds = totalSeconds % 60;

            countdownEl.textContent = `${pad(hours)}:${pad(minutes)}:${pad(seconds)}`;
        }

        updateCountdown();
        setInterval(updateCountdown, 1000);
    </script>
</body>
</html>