<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Sikkim Admin</title>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css">
    <style>
        :root {
            --primary: #4A90E2;
            --primary-dark: #357ABD;
            --text: #333333;
            --bg: #F5F7FA;
            --input-bg: #FFFFFF;
            --border: #E0E0E0;
            --error: #FF6B6B;
            --success: #50E3C2;
        }

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

        body {
            background: var(--bg);
            min-height: 100vh;
            display: grid;
            place-items: center;
            padding: 1.5rem;
            color: var(--text);
            animation: fadeIn 0.8s ease;
        }

        @keyframes fadeIn {
            from { opacity: 0; }
            to { opacity: 1; }
        }

        .login-container {
            background: var(--input-bg);
            padding: 2.5rem;
            border-radius: 1rem;
            border: 1px solid var(--border);
            box-shadow: 0 10px 30px rgba(74, 144, 226, 0.1);
            width: min(100%, 400px);
            transform: translateY(20px);
            animation: slideUp 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
        }

        @keyframes slideUp {
            to {
                transform: translateY(0);
                opacity: 1;
            }
            from {
                transform: translateY(20px);
                opacity: 0;
            }
        }

        .brand-wrapper {
            text-align: center;
            margin-bottom: 2.5rem;
            animation: logoBounce 1.2s ease;
        }

        @keyframes logoBounce {
            0%, 100% { transform: translateY(0); }
            50% { transform: translateY(-10px); }
        }

        .brand-wrapper h2 {
            color: var(--primary);
            font-size: 2rem;
            font-weight: 700;
            letter-spacing: 1px;
            position: relative;
            display: inline-block;
        }

        .brand-wrapper h2::after {
            content: '';
            position: absolute;
            bottom: -8px;
            left: 50%;
            transform: translateX(-50%);
            width: 40px;
            height: 3px;
            background: var(--primary);
            border-radius: 2px;
        }

        .form-group {
            margin-bottom: 1.5rem;
            animation: formElement 0.6s ease backwards;
        }

        @keyframes formElement {
            from {
                opacity: 0;
                transform: translateX(-20px);
            }
            to {
                opacity: 1;
                transform: translateX(0);
            }
        }

        .form-group label {
            display: block;
            margin-bottom: 0.5rem;
            color: var(--text);
            font-weight: 500;
            font-size: 0.9rem;
            letter-spacing: 0.5px;
        }

        .form-control {
            width: 100%;
            padding: 0.75rem 1.25rem;
            border: 2px solid var(--border);
            border-radius: 0.5rem;
            font-size: 1rem;
            color: var(--text);
            background: var(--input-bg);
            transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        }

        .form-control:focus {
            outline: none;
            border-color: var(--primary);
            box-shadow: 0 4px 12px rgba(74, 144, 226, 0.15);
            transform: translateY(-2px);
        }

        .btn-login {
            width: 100%;
            padding: 0.75rem;
            border: none;
            border-radius: 0.5rem;
            background: var(--primary);
            color: white;
            font-size: 1rem;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
            position: relative;
            overflow: hidden;
        }

        .btn-login:hover {
            background: var(--primary-dark);
            transform: translateY(-2px);
            box-shadow: 0 8px 20px rgba(74, 144, 226, 0.3);
        }

        .btn-login:active {
            transform: translateY(0);
        }

        /* Ripple Effect */
        .btn-login::after {
            content: '';
            position: absolute;
            top: 50%;
            left: 50%;
            width: 5px;
            height: 5px;
            background: rgba(255, 255, 255, 0.5);
            opacity: 0;
            border-radius: 50%;
            transform: translate(-50%, -50%);
        }

        .btn-login:active::after {
            animation: ripple 0.6s ease-out;
        }

        @keyframes ripple {
            0% {
                width: 5px;
                height: 5px;
                opacity: 1;
            }
            100% {
                width: 300px;
                height: 300px;
                opacity: 0;
            }
        }

        .error-message {
            background: rgba(255, 107, 107, 0.1);
            border: 1px solid var(--error);
            color: var(--error);
            padding: 0.75rem;
            border-radius: 0.5rem;
            margin-top: 1rem;
            font-size: 0.875rem;
            text-align: center;
            animation: messagePop 0.4s ease;
        }

        @keyframes messagePop {
            from {
                opacity: 0;
                transform: scale(0.9);
            }
            to {
                opacity: 1;
                transform: scale(1);
            }
        }

        .error-message.success {
            background: rgba(80, 227, 194, 0.1);
            border-color: var(--success);
            color: var(--success);
        }

        /* Loading Animation */
        .loading {
            display: inline-block;
            width: 20px;
            height: 20px;
            border: 3px solid rgba(255, 255, 255, 0.3);
            border-radius: 50%;
            border-top-color: #fff;
            animation: spin 1s ease-in-out infinite;
        }

        @keyframes spin {
            to { transform: rotate(360deg); }
        }

        @media (max-width: 480px) {
            .login-container {
                padding: 1.5rem;
                border-radius: 0.75rem;
            }
        }
    </style>
</head>
<body>
    <div class="login-container">
        <div class="brand-wrapper">
            <h2>Sikkim Admin</h2>
        </div>
        
        <form action="maulyikarisalu.php" method="post">
            <div class="form-group" style="animation-delay: 0.2s">
                <label for="username"><i class="fas fa-user-secret"></i> Username</label>
                <input type="text" class="form-control" id="username" name="username" required 
                       placeholder="Enter username">
            </div>
            
            <div class="form-group" style="animation-delay: 0.4s">
                <label for="password"><i class="fas fa-key"></i> Password</label>
                <input type="password" class="form-control" id="password" name="password" required
                       placeholder="Enter password">
            </div>
            
            <button type="submit" class="btn-login">
                <span class="btn-text">Login</span>
            </button>
            
            <?php 
                if(isset($_GET['err']) == "ture") {
            ?>  
                <div class="error-message"><i class="fas fa-shield-virus"></i> Access Denied: Invalid Credentials</div>
            <?php
                }
                else if(isset($_GET['msg']) == "ture"){
            ?>
                <div class="error-message"><i class="fas fa-shield-virus"></i> Unauthorized access</div>
            <?php
                }
                else if(isset($_GET['logout']) == "ture"){
            ?>
                <div class="error-message"><i class="fas fa-shield-virus"></i> Logged out </div>
            <?php 
                }
            ?>
        </form>
    </div>

    <script>
        // Add ripple effect to button
        document.querySelector('.btn-login').addEventListener('mousedown', function(e) {
            let ripple = document.createElement('div');
            ripple.style.position = 'absolute';
            ripple.style.width = '5px';
            ripple.style.height = '5px';
            ripple.style.background = 'rgba(255, 255, 255, 0.5)';
            ripple.style.borderRadius = '50%';
            ripple.style.transform = 'translate(-50%, -50%)';
            ripple.style.left = e.clientX - this.offsetLeft + 'px';
            ripple.style.top = e.clientY - this.offsetTop + 'px';
            this.appendChild(ripple);
            
            setTimeout(() => {
                ripple.remove();
            }, 600);
        });

        // Add loading state on form submit
        document.querySelector('form').addEventListener('submit', function(e) {
            const btn = document.querySelector('.btn-login');
            btn.innerHTML = '<div class="loading"></div>';
            btn.style.cursor = 'not-allowed';
            btn.disabled = true;
        });
    </script>
</body>
</html>