{% load static %}
<!DOCTYPE html>
<html lang="id">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Login - Telkomsel IndiHome</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            margin: 0;
            height: 100vh;
            background: linear-gradient(to right, #D50000, #A50000);
        }

        /* Splash Screen Styles */
        .splash-screen {
            position: fixed;
            top: 0; left: 0;
            width: 100%;
            height: 100%;
            background-color: white;
            display: flex;
            justify-content: center;
            align-items: center;
            z-index: 9999;
        }

        .splash-screen img {
            width: 150px;
            animation: pulseZoom 1.5s infinite;
        }

        @keyframes pulseZoom {
            0% { transform: scale(1); opacity: 1; }
            50% { transform: scale(1.2); opacity: 0.7; }
            100% { transform: scale(1); opacity: 1; }
        }

        /* Login Container Styles */
        .container {
            display: none; /* hidden by default for splash */
            justify-content: center;
            align-items: center;
            height: 100vh;
        }

        .content-box {
            display: flex;
            background: white;
            border-radius: 10px;
            box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
            overflow: hidden;
            width: 700px;
            max-width: 90%;
        }

        .login-container {
            padding: 30px;
            width: 50%;
            text-align: center;
        }

        .login-container h2 {
            color: #D50000;
            margin-bottom: 20px;
        }

        .login-container input {
            width: 100%;
            padding: 12px;
            margin: 8px 0;
            border: 1px solid #ccc;
            border-radius: 5px;
            font-size: 16px;
        }

        .login-container button {
            width: 108%;
            padding: 12px;
            background-color: #D50000;
            color: white;
            border: none;
            border-radius: 5px;
            font-size: 16px;
            cursor: pointer;
            transition: 0.3s;
        }

        .login-container button:hover {
            background-color: #A50000;
            box-shadow: 0 3px 8px rgba(0, 0, 0, 0.2);
        }

        .error {
            color: red;
            font-size: 14px;
            margin-top: 10px;
        }

        label {
            display: block;
            text-align: left;
            font-weight: bold;
            margin-top: 10px;
        }

        .image-container {
            width: 50%;
            display: flex;
            justify-content: center;
            align-items: center;
            background: white;
        }

        .image-container img {
            max-width: 80%;
            height: auto;
        }

        @media (max-width: 700px) {
            .content-box {
                flex-direction: column;
                width: 90%;
            }

            .login-container,
            .image-container {
                width: 100%;
            }

            .image-container img {
                max-width: 50%;
            }
        }
    </style>
</head>
<body>
    <!-- Splash Screen -->
    <div class="splash-screen" id="splash">
        <img src="{% static 'admincss/img/logocwn/Logo_CWN.png' %}" alt="Logo CWN">
    </div>

    <!-- Main Login Content -->
    <div class="container" id="main-content">
        <div class="content-box">
            <div class="login-container">
                <h2>Login</h2>
                {% if error %}
                    <p class="error">{{ error }}</p>
                {% endif %}
                <form method="POST">
                    {% csrf_token %}
                    <label for="uname">Username</label>
                    <input type="text" id="uname" name="uname" required>
                    
                    <label for="password">Password</label>
                    <input type="password" id="password" name="password" required>
                    
                    <button type="submit">Login</button>
                </form>
            </div>
            <div class="image-container">
                <img src="{% static 'admincss/img/logocwn/Logo_CWN.png' %}" alt="Logo CWN">
            </div>
        </div>
    </div>

    <script>
        // Splash screen timeout
        window.addEventListener('load', function () {
            setTimeout(function () {
                document.getElementById('splash').style.display = 'none';
                document.getElementById('main-content').style.display = 'flex';
            }, 2000); // 2 seconds
        });
    </script>
</body>
</html>
