<!DOCTYPE html>
<html>
<head>
    <title>Login - Sistem Administrasi Guru Madrasah Istiqlal</title>
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/admin-lte@3.2/dist/css/adminlte.min.css">
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css">
    <link href="https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700;800&display=swap" rel="stylesheet">
    <link rel="stylesheet" href="assets/css/theme-istiqlal-green.css">
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }
        
        body {
            background: linear-gradient(135deg, #0f2715 0%, #49b134 50%, #2c5364 100%);
            min-height: 100vh;
            display: flex;
            align-items: center;
            justify-content: center;
            font-family: 'Poppins', sans-serif;
            position: relative;
            overflow-x: hidden;
        }
        
        /* Animated Background */
        .bg-animation {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            z-index: 0;
            overflow: hidden;
        }
        
        .bg-animation .circle {
            position: absolute;
            border-radius: 50%;
            background: rgba(255, 255, 255, 0.05);
            animation: float 20s infinite;
        }
        
        .circle-1 { width: 300px; height: 300px; top: -100px; left: -100px; animation-delay: 0s; }
        .circle-2 { width: 500px; height: 500px; bottom: -200px; right: -200px; animation-delay: 5s; }
        .circle-3 { width: 200px; height: 200px; top: 50%; left: 50%; animation-delay: 10s; }
        .circle-4 { width: 150px; height: 150px; bottom: 20%; right: 10%; animation-delay: 2s; }
        .circle-5 { width: 250px; height: 250px; top: 20%; right: 15%; animation-delay: 7s; }
        
        @keyframes float {
            0%, 100% { transform: translate(0, 0) rotate(0deg); }
            25% { transform: translate(50px, -50px) rotate(45deg); }
            50% { transform: translate(100px, 0) rotate(90deg); }
            75% { transform: translate(50px, 50px) rotate(135deg); }
        }
        
        /* Login Container */
        .login-container {
            width: 100%;
            max-width: 500px;
            padding: 20px;
            z-index: 1;
            position: relative;
            animation: fadeInUp 0.8s ease-out;
        }
        
        @keyframes fadeInUp {
            from {
                opacity: 0;
                transform: translateY(30px);
            }
            to {
                opacity: 1;
                transform: translateY(0);
            }
        }
        
        /* Card Login Premium */
        .login-card {
            background: rgba(255, 255, 255, 0.98);
            border-radius: 30px;
            box-shadow: 0 35px 68px rgba(0, 0, 0, 0.55), 0 15px 20px rgba(0, 0, 0, 0.2);
            overflow: hidden;
            transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
            backdrop-filter: blur(10px);
            border: 1px solid rgba(255, 255, 255, 0.3);
        }
        
        .login-card:hover {
            transform: translateY(-10px);
            box-shadow: 0 45px 80px rgba(0, 0, 0, 0.65);
        }
        
        /* Header dengan Logo */
        .login-header {
            background: linear-gradient(135deg, #1b4e2a 0%, #0bdd74 100%);
            padding: 45px 35px;
            text-align: center;
            color: white;
            position: relative;
            overflow: hidden;
        }
        
        .login-header::before {
            content: '';
            position: absolute;
            top: -50%;
            left: -50%;
            width: 200%;
            height: 200%;
            background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
            animation: shine 8s infinite;
        }
        
        @keyframes shine {
            0% { transform: rotate(0deg); }
            100% { transform: rotate(360deg); }
        }
        
        /* Logo Container */
        .logo-container {
            position: relative;
            z-index: 1;
            margin-bottom: 20px;
        }
        
        .logo-image {
            width: 90px;
            height: 90px;
            margin: 0 auto;
            background: white;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
            animation: logoPulse 2s infinite;
            overflow: hidden;
        }
        
        @keyframes logoPulse {
            0%, 100% { transform: scale(1); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3); }
            50% { transform: scale(1.05); box-shadow: 0 15px 40px rgba(0, 0, 0, 0.4); }
        }
        
        .logo-image img {
            width: 100%;
            height: 100%;
            object-fit: cover;
            border-radius: 50%;
        }
        
        .logo-image i {
            font-size: 50px;
            color: #073f0f;
        }
        
        .institution-name {
            font-size: 22px;
            font-weight: 700;
            letter-spacing: 1px;
            margin-top: 15px;
            text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
        }
        
        .institution-tagline {
            font-size: 12px;
            opacity: 0.9;
            margin-top: 5px;
            letter-spacing: 1px;
        }
        
        .login-title {
            font-size: 26px;
            font-weight: 700;
            margin-top: 20px;
            position: relative;
            display: inline-block;
        }
        
        .login-title::after {
            content: '';
            position: absolute;
            bottom: -10px;
            left: 50%;
            transform: translateX(-50%);
            width: 50px;
            height: 3px;
            background: white;
            border-radius: 3px;
        }
        
        .login-subtitle {
            font-size: 13px;
            opacity: 0.85;
            margin-top: 20px;
        }
        
        /* Body Card */
        .login-body {
            padding: 45px 35px;
            background: white;
        }
        
        /* Input Group Premium */
        .input-group-custom {
            margin-bottom: 28px;
            position: relative;
        }
        
        .input-group-custom label {
            display: block;
            margin-bottom: 8px;
            font-size: 13px;
            font-weight: 500;
            color: #333;
            letter-spacing: 0.5px;
        }
        
        .input-group-custom input {
            width: 100%;
            padding: 14px 15px 14px 50px;
            border: 2px solid #e8eef2;
            border-radius: 16px;
            font-size: 14px;
            font-family: 'Poppins', sans-serif;
            transition: all 0.3s ease;
            background: #f8fafc;
            color: #1a2a3a;
        }
        
        .input-group-custom input:focus {
            outline: none;
            border-color: #047c2c;
            background: white;
            box-shadow: 0 0 0 4px rgba(16, 240, 128, 0.1);
        }
        
        .input-group-custom i {
            position: absolute;
            left: 18px;
            bottom: 16px;
            color: #94a3b8;
            font-size: 18px;
            transition: all 0.3s ease;
        }
        
        .input-group-custom input:focus + i {
            color: #09881e;
            transform: scale(1.1);
        }
        
        /* Button Login Premium */
        .btn-login {
            width: 100%;
            padding: 14px;
            background: linear-gradient(135deg, #056e25 0%, #4fc98c 100%);
            border: none;
            border-radius: 16px;
            color: white;
            font-size: 16px;
            font-weight: 600;
            font-family: 'Poppins', sans-serif;
            cursor: pointer;
            transition: all 0.3s ease;
            margin-top: 15px;
            position: relative;
            overflow: hidden;
            letter-spacing: 1px;
        }
        
        .btn-login::before {
            content: '';
            position: absolute;
            top: 0;
            left: -100%;
            width: 100%;
            height: 100%;
            background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
            transition: left 0.5s ease;
        }
        
        .btn-login:hover::before {
            left: 100%;
        }
        
        .btn-login:hover {
            transform: translateY(-2px);
            box-shadow: 0 10px 25px rgba(6, 116, 65, 0.3);
        }
        
        .btn-login:active {
            transform: translateY(0);
        }
        
        .btn-login i {
            margin-right: 10px;
        }
        
        /* Alert Premium */
        .alert-custom {
            background: linear-gradient(135deg, #fef3f2 0%, #fee2e2 100%);
            border-left: 4px solid #dc2626;
            padding: 14px 18px;
            border-radius: 16px;
            margin-bottom: 30px;
            color: #991b1b;
            font-size: 13px;
            display: flex;
            align-items: center;
            gap: 12px;
            animation: slideIn 0.5s ease-out;
            font-weight: 500;
        }
        
        .alert-custom i {
            font-size: 20px;
        }
        
        @keyframes slideIn {
            from {
                opacity: 0;
                transform: translateX(-20px);
            }
            to {
                opacity: 1;
                transform: translateX(0);
            }
        }
        
        .alert-success {
            background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
            border-left-color: #22c55e;
            color: #166534;
        }
        
        /* Footer */
        .login-footer {
            text-align: center;
            padding: 20px 35px;
            background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
            border-top: 1px solid #e2e8f0;
        }
        
        .login-footer p {
            margin: 0;
            font-size: 12px;
            color: #64748b;
            font-weight: 500;
        }
        
        .login-footer .version {
            margin-top: 5px;
            font-size: 11px;
            color: #94a3b8;
        }
        
        /* Responsive */
        @media (max-width: 768px) {
            .login-container {
                padding: 15px;
            }
            
            .login-header {
                padding: 30px 20px;
            }
            
            .login-body {
                padding: 30px 20px;
            }
            
            .logo-image {
                width: 70px;
                height: 70px;
            }
            
            .institution-name {
                font-size: 18px;
            }
            
            .login-title {
                font-size: 22px;
            }
        }
        
        /* Loading Animation */
        .loading {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: #189196;
            display: flex;
            align-items: center;
            justify-content: center;
            z-index: 9999;
            transition: opacity 0.5s ease;
        }
        
        .loading.hide {
            opacity: 0;
            visibility: hidden;
        }
        
        .spinner {
            width: 50px;
            height: 50px;
            border: 3px solid rgba(255,255,255,0.3);
            border-top-color: white;
            border-radius: 50%;
            animation: spin 1s linear infinite;
        }
        
        @keyframes spin {
            to { transform: rotate(360deg); }
        }
    </style>
</head>
<body>
    <!-- Loading Screen -->
    <div class="loading" id="loading">
        <div class="spinner"></div>
    </div>
    
    <!-- Animated Background -->
    <div class="bg-animation">
        <div class="circle circle-1"></div>
        <div class="circle circle-2"></div>
        <div class="circle circle-3"></div>
        <div class="circle circle-4"></div>
        <div class="circle circle-5"></div>
    </div>
    
    <div class="login-container">
        <div class="login-card">
            <div class="login-header">
                <div class="logo-container">
                    <div class="logo-image">
    <img src="assets/images/logo_madrasah.png" alt="Logo Madrasah Istiqlal">
</div>
                    <div class="institution-name">
                        MADRASAH ISTIQLAL JAKARTA
                    </div>
                    <div class="institution-tagline">
                        TRULY INTEGRATED ISLAMIC SCHOOL
                    </div>
                </div>
                <div class="login-title">
                    Sistem Administrasi Guru
                </div>
                <div class="login-subtitle">
                    Platform Manajemen Sekolah Terpadu
                </div>
            </div>
            
            <div class="login-body">
                <?php if(isset($_GET['error'])): ?>
                <div class="alert-custom">
                    <i class="fas fa-exclamation-triangle"></i>
                    <span>Login gagal! Periksa kembali username dan password Anda.</span>
                </div>
                <?php endif; ?>
                
                <?php if(isset($_GET['logout'])): ?>
                <div class="alert-custom alert-success">
                    <i class="fas fa-check-circle"></i>
                    <span>Anda berhasil keluar dari sistem. Sampai jumpa kembali!</span>
                </div>
                <?php endif; ?>
                
                <form action="proses_login.php" method="post" id="loginForm">
                    <div class="input-group-custom">
                        <label>USERNAME</label>
                        <input type="text" name="username" id="username" placeholder="Masukkan username Anda" required autocomplete="off" autofocus>
                        <i class="fas fa-user"></i>
                    </div>
                    
                    <div class="input-group-custom">
                        <label>PASSWORD</label>
                        <input type="password" name="password" id="password" placeholder="Masukkan password Anda" required>
                        <i class="fas fa-lock"></i>
                    </div>
                    
                    <button type="submit" class="btn-login">
                        <i class="fas fa-sign-in-alt"></i> MASUK SISTEM
                    </button>
                </form>
            </div>
            
            <div class="login-footer">
                <p>&copy; <?= date('Y') ?> Madrasah Istiqlal. All rights reserved.</p>
            </div>
        </div>
    </div>
    
    <script>
        // Hide loading screen
        window.addEventListener('load', function() {
            setTimeout(function() {
                document.getElementById('loading').classList.add('hide');
            }, 500);
        });
        
        // Add floating animation for shapes
        document.addEventListener('DOMContentLoaded', function() {
            const circles = document.querySelectorAll('.circle');
            circles.forEach((circle, index) => {
                circle.style.animation = `float ${20 + index * 3}s infinite`;
            });
            
            // Add focus effect
            const inputs = document.querySelectorAll('.input-group-custom input');
            inputs.forEach(input => {
                input.addEventListener('focus', function() {
                    this.parentElement.style.transform = 'scale(1.02)';
                });
                input.addEventListener('blur', function() {
                    this.parentElement.style.transform = 'scale(1)';
                });
            });
            
            // Form submit loading effect
            const form = document.getElementById('loginForm');
            form.addEventListener('submit', function() {
                const btn = document.querySelector('.btn-login');
                btn.innerHTML = '<i class="fas fa-spinner fa-spin"></i> PROSES...';
                btn.disabled = true;
            });
        });
    </script>
</body>
</html>